VMware Cloud Community
daijowen
Contributor
Contributor
Jump to solution

Relocate VM Harddisk


Good afternoon,

I'm relatively new to VCO and have only recently setup in our enviroment. I've managed to get a vm being built up from a template working and it joins our domain with a couple of other nice modifications. The last part of the puzzle is, Once a new VM's been deployed from a template, at the end of the orchestrator task I would like it to automatically change "HARDDISK2" (the second harddisk of the new VM) to a different datastore. The "Relocate virtual machine disks" workflow under "Library/vCenter/Virtual Machine Mangement/Move and Migrate/" folder does move the VM's hard disks but it moves both Hard Disk 1 and Hard disk 2 of the VM. I only want it to do "Hard Disk 2". Does anyone know how i can modify this workflow just to do the second hard disk?

Kind regards,

Dai

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

Disks are 0 indexed... are you trying to move the disk labeled disk 2? If so, this would be disk 3... If you only have two disks, they are Disk 0 and Disk 1 so you would want to specify disk 1 as the one to move to new datastore. In my test, my running VM had 6 disks and I successfully moved disks 0, 1, and 2.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
8 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

Moderator or Dai, please move this post to the Orchestrator Community. This original post is in the community for building vCO Plug-ins Smiley Happy Thanks.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Yessir 🙂 Moved to Orchestrator forums

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Thanks Joerg!

Here's hopefully a solution: Relocate virtual machine disks to custom datastores

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
daijowen
Contributor
Contributor
Jump to solution

Thanks ever so much for the quick reply.

I've just tryed the workflow and the when selecting the VM and then the Datastore for Hard Disk 2, it failed the first time saying "To Migrate both the disks and the VM at the same time, the VM must be powered off".

I then modified the workflow to remove the check about the VM state and tryed the same thing again. This time the workflow said it successfully completed although nothing seemed to happen with the VM? It did not relocate the second hard disk to a different datastore?

Any Ideas?

The only time it will migrate the disks is if I set target Datastore to a datastore, but then it migrates all disks to this one not just the second hard disk.

Thanks again,

Kind regards,

Dai

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Here you go, I had a chance to test today... I suspected that the last workflow had too much info in it - too many properties of the relocate spec were defined. I have duplicated that workflow and stripped out anything not related to ONLY disk relocation. I then tested this workflow successfully against a running VM Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
daijowen
Contributor
Contributor
Jump to solution

Thanks again for the help. It successfully run's but does not migrate the harddisk 2.

All i'm doing is selecting the VM and then the target Datastore for Harddisk 2 only - Am i doing something incorrect?

The workflow completes with a green tick but does not move the disk Smiley Sad

Thanks Again,

Dai.

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Disks are 0 indexed... are you trying to move the disk labeled disk 2? If so, this would be disk 3... If you only have two disks, they are Disk 0 and Disk 1 so you would want to specify disk 1 as the one to move to new datastore. In my test, my running VM had 6 disks and I successfully moved disks 0, 1, and 2.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
daijowen
Contributor
Contributor
Jump to solution

Excellent stuff!! Its now working Smiley Happy

Yeah i was using disk 2 as the one to move, and I should have been choosing disk 1 in the workflow!

It was a bit confusing as it said "system disk" for disk 0 in the workflow and i presumed this would have been the VMX files themselfs. So 0 would have been the vmx, hard disk 1 would be hard disk 1, then hard disk 2 would have been the one I wanted. As you rightly pointed out, harddisk 0 in the workflow is not actually the vmx file, it is actually hard disk 1, then hard disk 1 in the workflow was the one i wanted.

Thanks again for all your help.

0 Kudos