VMware Cloud Community
itma10
Contributor
Contributor
Jump to solution

Cloning vm using vmclone.pl "How to get vmhost name from vmname"

Hi, I'm now trying to crate cloning script running on vMA. I have 3 ESX4 U1 host managed by vCenter server.

Every weekend I want to create vm clone. So I'm planning to use vmclone.pl. But I think vmclone.pl need to specify

vcenter server and vmhost.I configured HA and DRS(automatic) so vmhost may change.

I want to get vmhost anme before runnning vmclone script.

using command example:

./vmclone.pl --username uname --password pass --server vcenter01 --vmhost vmesx02 --vmname adm_cl --vmname_destination adm_cl_bk --datastore iSCSI_test

Are there any script to get vmhost name from vmname?

./guestinfo.pl --username uname --password pass --server vcenter01 --vmname adm_cl --operation display

Guest Info for the Virtual Machine 'adm_cl' under host vmesx02

I know guestinfo.pl returns vmhost at the part of guest Info. but If there is any script that returns only vmhost name I would like to use it

to get a parameter value for ./vmclone.

thanks

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Is there a specific reason you need to get the particular ESX/ESXi host from the VM you're trying to clone? One of the benefits of using vCenter is that you can query for a particular VM and it'll know exactly which ESX/ESXi host is managing the VM. In the case of vmclone.pl the requirements of "vmname" is the source VM you would like to clone and "vmname_destination" is simple enough, the destination VM you want to clone to. The "vmhost" parameter is actually the destination ESX/ESXi host you're going to create the new clone on and from what I call tell from your input you're going to deploy this clone on an iSCSI volume? If this iSCSI volume is presented to all 3 of your ESX/ESXi cluster, then it doesn't really matter which host it goes to, since they can all see the same storage. Once the VM is up and running, DRS will automatically move it to the most optimal host that can support the VM.

Even if you specify a specific host, DRS may still move it, so I'm trying to understand why you need to get the exact host that is running your source VM as it's not really necessary.

=========================================================================

William Lam

VMware vExpert 2009

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

Reply
0 Kudos
3 Replies
lamw
Community Manager
Community Manager
Jump to solution

Is there a specific reason you need to get the particular ESX/ESXi host from the VM you're trying to clone? One of the benefits of using vCenter is that you can query for a particular VM and it'll know exactly which ESX/ESXi host is managing the VM. In the case of vmclone.pl the requirements of "vmname" is the source VM you would like to clone and "vmname_destination" is simple enough, the destination VM you want to clone to. The "vmhost" parameter is actually the destination ESX/ESXi host you're going to create the new clone on and from what I call tell from your input you're going to deploy this clone on an iSCSI volume? If this iSCSI volume is presented to all 3 of your ESX/ESXi cluster, then it doesn't really matter which host it goes to, since they can all see the same storage. Once the VM is up and running, DRS will automatically move it to the most optimal host that can support the VM.

Even if you specify a specific host, DRS may still move it, so I'm trying to understand why you need to get the exact host that is running your source VM as it's not really necessary.

=========================================================================

William Lam

VMware vExpert 2009

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
itma10
Contributor
Contributor
Jump to solution

Hi,lamw.

Thanks for your quick reply.

I got it. I thought --vmhost parametr is about clone source ESX host.

That's why I asked about to get ESX host.

Thanks.

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

np.

Technically you can even edit the script so that when you connect to vCenter, it'll query for the available host ... the problem with that is there's lots of things you need to check for in terms of connectivity and that the host has access to the volume you're trying to clone from.

=========================================================================

William Lam

VMware vExpert 2009

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos