VMware Cloud Community
JseMc
Contributor
Contributor
Jump to solution

Unable to Move-VM to a VVOL datastore, however Web UI works

While trying to migrate a VM from a LUN to a VVOL I encountered an odd error, so I set up a number of test VMs to try the various programmatic ways to move the VM from the LUN to the VVOL but all were unsuccessful. To confirm I this was possible, I attempted a migration through the Web UI which was successful. Afterwards I used the successful VM to migrate to/from the LUN/VVOL without an issue.

This implies the Web UI is adjusting some configuration that I'm unable to identify/replicate.


Attempt 1 - Basic Move-VM

$cluster = Get-Cluster -Name "Test Cluster"
$vvol_datastore = Get-Datastore -Name "VVOL Datastore"
$lun_datastore = Get-Datastore -Name "LUN Datastore"

New-VM -Name "test1" -ResourcePool $cluster -Datastore $lun_datastore -NumCPU 1 -MemoryGB 1 -DiskGB 1

Move-VM -VM "test1" -Datastore $vvol_datastore


Move-VM : 5/25/2018 3:46:35 PM  Move-VM         The operation for the entity "test1" failed with the following message: "Error caused by file /vmfs/volumes/58af3eaf-dbba4e18-2e5e-10604b996f60/test1/test1.vmdk"

Attempt 2 - Use a RelocateSpec to set the profile during relocation

$cluster = Get-Cluster -Name "Test Cluster"
$vvol_datastore = Get-Datastore -Name "VVOL Datastore"
$lun_datastore = Get-Datastore -Name "LUN Datastore"

New-VM -Name "test2" -ResourcePool $cluster -Datastore $lun_datastore -NumCPU 1 -MemoryGB 1 -DiskGB 1
$vm = Get-VM -Name "test2"

$policy = Get-SpbmStoragePolicy -Name "VVOL Policy"

$profile_spec = New-Object VMware.Vim.VirtualMachineDefinedProfileSpec

$profile_spec.ProfileId = $policy.Id

$relocate_spec = New-Object VMware.Vim.VirtualMachineRelocateSpec

$relocate_spec.Datastore = $vvol_datastore.ExtensionData.MoRef

$relocate_spec.Profile = $profile_spec

$relocate_spec.Disk = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator

$relocate_spec.Disk[0].DiskId = $vm.ExtensionData.LayoutEx.Disk.Key[0]

$relocate_spec.Disk[0].Datastore = $vvol_datastore.ExtensionData.MoRef

$relocate_spec.Disk[0].Profile = $profile_spec

$vm.ExtensionData.RelocateVM_Task($relocate_spec, "defaultPriority")

^ Fails with the same error as Move-VM

Worth noting:

  • At any point, if I use the Web UI to migrate the VM to the VVOL, the above variations will work to move it to/from the LUN/VVOL
  • If I create the VM directly on the VVOL, the above variations will work to move it to/from the LUN/VVOL
  • There is a default storage policy set (same policy that I'm testing with), and the datastore is compatible with the test policy (Get-SpbmCompatibleStorage returns it)
  • Using PowerCLI 10.1.0

Any ideas?

Tags (2)
1 Solution

Accepted Solutions
JseMc
Contributor
Contributor
Jump to solution

Found the difference!

TLDR; The VVOL required the disk storage format to be Thin

Migrating through the WebUI or creating directly on the VVOL will set the harddisk storage format to thin. As I wasn't specifying the storage format in New-VM, it was defaulting to Thick on the test LUN and when migrating from the LUN to the VVOL failing as the VVOL did/does not support Thick.

Adding "-DiskStorageFormat Thin" to the Move-VM command addresses the issue in testing.

View solution in original post

2 Replies
JseMc
Contributor
Contributor
Jump to solution

Forgot to include some additional observations/tests

There appears to be a storage policy set at the VM/HardDisk level once the VM was moved through the Web UI or created directly on the VVOL

If I try to replicate that configuration to another test VM and then attempt a Move-VM, it doesn't have an affect and still fails (same error referenced earlier)

Example

$cluster = Get-Cluster -Name "Test Cluster"
$vvol_datastore = Get-Datastore -Name "VVOL Datastore"
$lun_datastore = Get-Datastore -Name "LUN Datastore"

New-VM -Name "test1" -ResourcePool $cluster -Datastore $vvol_datastore -NumCPU 1 -MemoryGB 1 -DiskGB 1

Move-VM -VM "test1" -Datastore $lun_datastore

New-VM -Name "test2" -ResourcePool $cluster -Datastore $lun_datastore -NumCPU 1 -MemoryGB 1 -DiskGB 1

Get-VM -Name "test[12]" | Get-SpbmEntityConfiguration

Entity                         Storage Policy                 Status          Time Of Check

------                         --------------                 ------          -------------

test2                                                  none

test1                   VVOL Policy    compliant       5/25/2018 7:55:55 PM

Get-VM -Name "test[12]" | Get-HardDisk | Get-SpbmEntityConfiguration

Entity                         Storage Policy                 Status          Time Of Check

------                         --------------                 ------          -------------

Hard disk 1                                                   none

Hard disk 1                    VVOL Policy    compliant       5/25/2018 7:55:55 PM

If I set the storage policy on test2 and run a Move-VM, it fails


$policy = Get-SpbmStoragePolicy -Name "VVOL Policy"

Get-VM -Name "test2" | Set-SpbmEntityConfiguration -StoragePolicy $policy

Entity                         Storage Policy                 Status          Time Of Check

------                         --------------                 ------          -------------

test2                   VVOL Policy    notApplicable   5/25/2018 8:27:34 PM

Get-VM -Name "test2" | Get-HardDisk | Set-SpbmEntityConfiguration -StoragePolicy $policy

Entity                         Storage Policy                 Status          Time Of Check

------                         --------------                 ------          -------------

Hard disk 1                    VVOL Policy    notApplicable   5/25/2018 8:27:43 PM


Move-VM -VM "test2" -Datastore $vvol_datastore
^ Fails with the same error referenced earlier

There is a difference in status, but I'm not sure what that means and if it's related to the failure (still reading about it).

0 Kudos
JseMc
Contributor
Contributor
Jump to solution

Found the difference!

TLDR; The VVOL required the disk storage format to be Thin

Migrating through the WebUI or creating directly on the VVOL will set the harddisk storage format to thin. As I wasn't specifying the storage format in New-VM, it was defaulting to Thick on the test LUN and when migrating from the LUN to the VVOL failing as the VVOL did/does not support Thick.

Adding "-DiskStorageFormat Thin" to the Move-VM command addresses the issue in testing.