Skip to content

Instantly share code, notes, and snippets.

@codegold79
Created October 2, 2020 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codegold79/1bf596a407b9312960168de85674f901 to your computer and use it in GitHub Desktop.
Save codegold79/1bf596a407b9312960168de85674f901 to your computer and use it in GitHub Desktop.
func generateRelocSpec() types.VirtualMachineRelocateSpec {
// Resource pool managed object reference
poolMOR := types.ManagedObjectReference{
Type: "ResourcePool",
Value: "resgroup-1030",
}
// Host managed object reference
hostMOR := types.ManagedObjectReference{
Type: "HostSystem",
Value: "host-1031",
}
// Datastore managed object reference
dsMOR := types.ManagedObjectReference{
Type: "Datastore",
Value: "datastore-1032",
}
spec := types.VirtualMachineRelocateSpec{
Host: &hostMOR,
Pool: &poolMOR,
Datastore: &dsMOR,
DiskMoveType: "moveAllDiskBackingsAndConsolidate",
}
return spec
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment