VMware Cloud Community
jauling
Enthusiast
Enthusiast
Jump to solution

full VM rename via Orchestrator 7?

Hi,

I'm running Orchestrator 7.2, and also actively testing a new Orchestrator 7.5 instance.

I know it's possible to change the VM display name using Orchestrator, using the simple Rename virtual machine workflow. But is there a way to fully rename the VM including the files and directory on the datastore using Orchestrator?

I'm planning on doing a "rip and replace" of RHEL6 VMs with RHEL7. We do cfg mgmt of these VMs in Chef, so the idea is that I would do something like this:

  1. Copy RHEL6 VM Chef files (like the client.pem) and whatever else we might need that isn't Chef controlled
  2. Shutdown RHEL6 VM
  3. Rename RHEL6 VM, to something like vm-name-rhel6
  4. Deploy RHEL7 via template into a VM with the original VM name
  5. Boot up VM, then shimmy in the files I saved from Step #1
  6. Run chef-client

I guess I'm not 100% sure if this is the best method, but it's what I've come up thus far. I could just destroy the VM and create a RHEL7 equivalent with the same name, but I'd prefer a method where I had some kind of rollback.

Reply
0 Kudos
1 Solution

Accepted Solutions
ThePortLion
Contributor
Contributor
Jump to solution

Hi,

Yes this is possible in Orchestrator but as you already mentioned there is no out of the box workflow available.

We have just created a workflow to satisfy this exact requirement due to being constrained by a single VSAN datastore. Storage vMotion is not an option in this instance.

Our workflow was VSAN specific and the steps were:

- Power down VM (if powered on)

- Remove VM from vCenter inventory (No need to rename VM object in advance as it will have new name when it is re-imported)

- Access a host in the cluster via SSH to gain access to datastore

- (VSAN Specific rename task using object UUID) Rename VM folder using "/usr/lib/vmware/osfs/bin/objtool setAttr -u UUID -n newVMname

- Rename VM files using mv command (.nvram .vmsd .vmx .vmxf)

- Rename all VMDK files using "vmkfstools -E " command

- Replace all entries in the .vmx file using "sed -i"

- Import VM into vCenter inventory (VM will import as new name read from .vmx file)

There is some code required to implement each of the steps above and as mentioned, our use case is VSAN specific but if you are familiar with vRO and the vCenter plugin it will be pretty straight forward to implement for standard VMFS datastores also. The only task above that would differ for standard datastores is the VM folder rename. 

One major benefit using this method for rename is speed. The workflow end to end completes in less than 30 seconds.

A drawback to this method is having to remove the VM from the inventory to complete. This may have an impact on any third party products (backup etc.) that use the VM's ID for reference as this would change.

Hope this helps!

View solution in original post

Reply
0 Kudos
3 Replies
sbeaver
Leadership
Leadership
Jump to solution

So as far as I know the only way to rename the files of the VM's as part of that process is to perform a storage migration one the display name has been changed. Also to fully rename the VM in vRA you need to rename the entity name as well as the DNS name of the entity

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
Reply
0 Kudos
ThePortLion
Contributor
Contributor
Jump to solution

Hi,

Yes this is possible in Orchestrator but as you already mentioned there is no out of the box workflow available.

We have just created a workflow to satisfy this exact requirement due to being constrained by a single VSAN datastore. Storage vMotion is not an option in this instance.

Our workflow was VSAN specific and the steps were:

- Power down VM (if powered on)

- Remove VM from vCenter inventory (No need to rename VM object in advance as it will have new name when it is re-imported)

- Access a host in the cluster via SSH to gain access to datastore

- (VSAN Specific rename task using object UUID) Rename VM folder using "/usr/lib/vmware/osfs/bin/objtool setAttr -u UUID -n newVMname

- Rename VM files using mv command (.nvram .vmsd .vmx .vmxf)

- Rename all VMDK files using "vmkfstools -E " command

- Replace all entries in the .vmx file using "sed -i"

- Import VM into vCenter inventory (VM will import as new name read from .vmx file)

There is some code required to implement each of the steps above and as mentioned, our use case is VSAN specific but if you are familiar with vRO and the vCenter plugin it will be pretty straight forward to implement for standard VMFS datastores also. The only task above that would differ for standard datastores is the VM folder rename. 

One major benefit using this method for rename is speed. The workflow end to end completes in less than 30 seconds.

A drawback to this method is having to remove the VM from the inventory to complete. This may have an impact on any third party products (backup etc.) that use the VM's ID for reference as this would change.

Hope this helps!

Reply
0 Kudos
jauling
Enthusiast
Enthusiast
Jump to solution

Your solution does sound nice, albeit with a bunch of moving components. It is much faster than waiting for an svMotion! Thanks.

Reply
0 Kudos