HPE Morpheus Enterprise
1832856 Members
3048 Online
110047 Solutions
New Discussion

VM creation on hyper-v using golden image fails

 
Not applicable

VM creation on hyper-v using golden image fails

Hi Team,

We’ve a hyper-v node added as hyper-v cloud in the Morpheus, Able to deploy VM into it using images from Morpheus marketplace.

We created a golden image for windows server 2022 in the same hyper-v node, Created 1 2022 VM and followed steps provided in Morpheus documentation for golden image creation. Imported VHDx of that VM to Morpheus and created node type,instance types and layout. When we try provision the VM using that golden image to hyper-v node, Provisioning fails with generic message “Your Instance Test-006 had a failure occur during provisioning”.

On Hyper-v node I do see a VM getting created which is unable to find a boot media/source


eba2fee2a3f6ba6f6ab42aa9dff16b4e2013826f.png

Any input is greatly appreciated !

Regards
Suresh Thakur

9 REPLIES 9
Not applicable

Re: VM creation on hyper-v using golden image fails

Yes, I imported it manually by uploading it to local storage bucket from library > virtual images.

Not applicable

Re: VM creation on hyper-v using golden image fails

Did you figure anything out on this? I’ve ran into the same issue.

What I’ve found in my case is that if I “manually” put the .vhd or .vhdx into the “working path” on the hyper-v server itself then it will actually finish provisioning.

For example:
My working path is G:\Morpheus
If I download the .vhd of the image I called Windows_Server_2022 from the library on the morpheus app and upload it to the hyper-v server under G:\Morpheus\images\Windows_Server_2022 the provisioning will complete fine.

This goes for any image I try to provision to hyper-v, be it one I uploaded or one of the default Ubuntu ones, ect.

rbmorph
HPE Pro

Re: VM creation on hyper-v using golden image fails

This is probably related to the fact you are trying to create a gen 2 VM with the hyper-v integration. From testing it looks like for the hyper-v integration we only send the request as gen 1 regardless of the selection. It does look like our SCVMM integration supports both gen 1 and gen 2 so that may be an option. The other option would be to create a gen 1 image and use that.

I would recommend creating an idea to add support for gen 2 with the hyper-v integration.

Not applicable

Re: VM creation on hyper-v using golden image fails

Our process is to use packer, with use_fixed_vhd_format = "true" and skip_compaction = "true" with a Gen1 vhd file. That’s what I know works.

Can you DM me a log of you trying to deploy this? There might be a clue in there for me, but I haven’t dug into using Gen2 vhdx disk images in Hyper-V, myself.

Not applicable

Re: VM creation on hyper-v using golden image fails

I’m not sure if any of this is different with Windows.

I only have a process for building images with packer and the config is pretty simple:

source "hyperv-iso" "ubuntu" {
    iso_url = "${var.iso_url}"
    iso_checksum = "${var.iso_checksum}"
    shutdown_command = "${var.shutdown_command}"
    disk_size = "${var.disk_size}"
    use_fixed_vhd_format = "true"
    skip_compaction = "true"
    headless = "true"
    memory = "${var.memory}"
    http_directory = "${var.http_directory}"
    ssh_username = "${var.ssh_username}"
    ssh_password = "${var.ssh_password}"
    ssh_timeout = "${var.ssh_wait_timeout}"
    vm_name = "${local.vm_name}"
    boot_command = ["c<wait>linux /casper/vmlinuz --- autoinstall ds=\"nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/u22_cloudinit_hyperv/\"<enter><wait>initrd /casper/initrd<enter><wait>boot<enter>"]
    output_directory = "${var.output_directory}"
}

build {
    sources = [
        "source.hyperv-iso.ubuntu"
    ]
  provisioner "file" {
    source = "../supportfiles/os_detect.sh"
    destination = "/tmp/os_detect.sh"
  }
  provisioner "shell" {
    script = "../supportfiles/ubuntu_setup.sh"
  }
  provisioner "shell" {
    script = "../supportfiles/ubuntu_cleanup.sh"
  }
  post-processor "shell-local" {
    tempfile_extension = ".ps1"
    execute_command = ["powershell.exe", "{{.Vars}}  {{.Script}}"]
    env_var_format = "$env:%s=\"%s\"; "
    inline = [
        "cd '${var.output_directory}\\Virtual Hard Disks'",
        "tar cvzf ..\\${local.vm_name}.vhd.tar.gz ${local.vm_name}.vhd",
        "cd ..",
        "del -Recurse 'Virtual Hard Disks'",
        "del -Recurse 'Virtual Machines'"
    ]
  }
}
Not applicable

Re: VM creation on hyper-v using golden image fails

Are you using packer, or are you modifying the VM in hyper-v, shutting down and exporting the vhdx?

cbunge
HPE Pro

Re: VM creation on hyper-v using golden image fails

Are you stating you imported the vhdx manually? Or are you saying on a sync, you found it under Library > Virtual Images?

Not applicable

Re: VM creation on hyper-v using golden image fails

I tried same steps with Gen1 VM’s as well but facing the same challenge, If convenient please share steps to use Packer for this process.

Not applicable

Re: VM creation on hyper-v using golden image fails

After following steps in VM i’m using sysprep ( sysprep\sysprep.exe /generalize /shutdown /oobe) to generalize and shurdown the VM, Once VM is off then i upload the VHDx file to Morpheus.