VMware Cloud Community
michael_stefani
Enthusiast
Enthusiast
Jump to solution

CloudClient and changing reservations

We're in the process of migrating VMs from ClusterA to ClusterB and part of that migration is going back into vRA and changing the reservation and storage post migration.  I started looking into CloudClient a few days ago thinking maybe we could use it to script the changing of the reservation.  It definitely seems doable, but I'm not finding a lot of documentation or help around CloundClient.  It looks like a lot of the commands you would use revolve around IDs and not VM names.  I think I've got an idea of the command I would run to change them.  Just not sure about the ID or if there's a command in the tool that can translate a VM name to the ID.  Can anyone give me a nudge in the right direction?  Thanks,

"vra provisioneditem change reservation --ids <not sure which one or how to retrieve in mass> --reservationName <resname> --storagPath <storage>"

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

You are correct. I'm using CC 4.0. Unfortunately in CC 3.4.1. the --ids option takes only UUIDs. What you can do is to take all VM of the given user by using the "vra provisioneditem list" command and then change the reservation. For example something like the following shell script may work:

for VMID in $(./cloudclient.sh vra provisioneditem list --format CSV|cut -d, -f1);

do

  ./cloudclient.sh vra provisioneditem change reservation --ids "$VMID" --reservationName <resname> --storagePath <storage>

done

This should change the reservation of the VMs one by one. You should be able also first to extract the VM IDs and pass them with one call to the "change reservation" option.

View solution in original post

Reply
0 Kudos
6 Replies
GrantOrchardVMw
Commander
Commander
Jump to solution

I'll just reply to this so that it's in my feed. I'll test this for you but it's the weekend for now!

Grant

Grant http://grantorchard.com
Reply
0 Kudos
michael_stefani
Enthusiast
Enthusiast
Jump to solution

The command itself works.  Although I did notice errors in the vRA log if the owner of the VM is no longer in AD.  Despite the errors the changer reservation completed successfully.  The thing I'm really looking for is some ability to pass VM names as opposed to the vCAC ID for the VMs.  I was hoping there was some other command you could run in cloudclient to translate VM names to IDs.  That way in a script we could execute that first to get the ID and then run the command to change the reservation.

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi Michael,

The --id option takes either a VM ID or a name, so you can directly pass the VM names to change the resrvations.

For example: vra machines change reservation --ids <your-machine-name> --reservationName <new-reservation-name>

Also if you want you can extract all VMs with their names and IDs in a CSV file:

vra machines list --format CSV --export machines-list.txt

Hope this helps,

Stefan

Reply
0 Kudos
michael_stefani
Enthusiast
Enthusiast
Jump to solution

Thanks, I wonder if it's a version thing.  I'm running 3.4.1 but when I try to pass a name it says invalid UUID sting.  Seems like it only wants to accept the ID at least on this version.  Just out of curiosity can you confirm it's working for you and if so what version are you running?

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

You are correct. I'm using CC 4.0. Unfortunately in CC 3.4.1. the --ids option takes only UUIDs. What you can do is to take all VM of the given user by using the "vra provisioneditem list" command and then change the reservation. For example something like the following shell script may work:

for VMID in $(./cloudclient.sh vra provisioneditem list --format CSV|cut -d, -f1);

do

  ./cloudclient.sh vra provisioneditem change reservation --ids "$VMID" --reservationName <resname> --storagePath <storage>

done

This should change the reservation of the VMs one by one. You should be able also first to extract the VM IDs and pass them with one call to the "change reservation" option.

Reply
0 Kudos
ep4ps
Contributor
Contributor
Jump to solution

We are having an issue with this command when specifying the storagePath. See command bellow:

vra machines change reservation --ids TestServer --reservationName "Test_Reservation" --storagePath "Test_Storage02"

com.vmware.cloudclient.exception.CloudClientException: Failed to convert 'Test_Storage02' to type StorageInputModel for option 'storagePath'

Error: Unable to find a StorageInputModel by the name or id 'Test_Storage02'.

The reservation in the example has two storage resources Test_Storage01 and Test_Storage02 and if I make this change in the GUI all works fine.

Anyone had this error before? Is there a different way to specify the storagePath option?

I would really appreciate any suggestions.

Reply
0 Kudos