2

I am having issues attaching an existing disk (vmdk) to a vSphere VM without an initial harddisk via govc.

I uploaded a vmdk which was tested with VMWare Player to the datastore on the ESXi datacenter without any errors. The command used for this task is:

govc datastore.upload

Later on I created a VM without any disks and tried to attach the vmdk I uploaded previously via the following command:

govc vm.disk.attach -vm testvm -disk test_img/myimage.vmdk

and this error-message occures once I try to power on the VM with the govc vm.power -on=true testvm command:

Powering on VirtualMachine:vm-389044... govc: File /vmfs/volumes/5ce7e498-26699e67-0545-3ca82a1204a0/testvm/testvm.vmdk was not found

When checking the settings of the VM, the disk is shown as testvm/testvm.vmdk instead of test_img/myimage.vmdk.

When creating a VM via the GUI and attaching the previously uploaded vmdk manually, the VM boots up and works as intended. It is just the govc CLI tool which causes troubles.

Checking the datastore after creating the VM, the directory in which I uploaded the vmdk as well as the directory created for the VM are present.

When I remove/destroy the VM with the govc vm.destroy testvm, the uploaded disk gets deleted as well, even though it wasn't shown as attached in the VM settings.

gknHost
  • 21
  • 2

0 Answers0