Solved

is there an api equivalent of "create vm client"?


Userlevel 3
Badge +10

What this does is a discovery on a hypervisor sub client and creates a vm pseudo client for any discovered virtual machines.

The functionality is outlined here:

https://documentation.commvault.com/11.26/expert/104558_creating_vm_clients_before_performing_backup_operations.html

 

In practice it looks like this.

 

 

 

Thanks!

Chris

icon

Best answer by Jos Meijer 11 August 2022, 19:31

View original

11 replies

Userlevel 7
Badge +16

Looked in https://api.commvault.com/ but I can't find any command here representing this action.

I am afraid you will have to wait for future releases, but you might be able to speed this up by requesting a CMR for this specific function.

Userlevel 3
Badge +10

Looked in https://api.commvault.com/ but I can't find any command here representing this action.

I am afraid you will have to wait for future releases, but you might be able to speed this up by requesting a CMR for this specific function.

I was hoping someone internal to CommVault would let me know if it was in the works or undocumented. 

Userlevel 7
Badge +19

Also checked the PS SDK for you as I was writing some code and also couldn't find an argument in the cmdlets for it so I thing this is a CommCell console only feature which first needs to be ported to the REST API before it can be used from Command Center and be consumed via the REST API through the SDKs or directly. 

Userlevel 3
Badge +10

Thanks for checking. 

 

Badge +1

I was wondering if there by now was a solution to this? Also looking for an API equivalent for this action.

Userlevel 5
Badge +16

@Harm 

I actually found two ways to do it! but neither are trivial. I will post it tomorrow or Monday.

Badge +1

Hi @christopherlecky  let me know if you’ve found some time to give me your experiences on how to accomplish this ;-) 

Userlevel 5
Badge +16

Oh!

I do gave it somewhere in my notes but I planned to update you once I implemented myself.

 

here is the issue. I couldn’t implement it without rearchitecting my subclient layout which should happen sometime next week.

 

Badge +1

Hi Christopher,

 

I’ve checked the logging when doing the “Create VM Client” from the Virtual Server subclient and noticed that there is some XML requests/responses going on in CvInstallMgr.log on the Commserver. 

I’ve broken the request XML down to this, notice the “var_” which needs to be replaced off course case by case. To test it, you can ad-hoc create a static XML file eg. create_vm.xml in your Base directory, then you can run “SIMCallWrapper.exe -input .\create_vm.xml to see the magic happen :-)

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CVInstallManager_ClientSetup Focus="Instance001" Operationtype="20" RemoteClient="1"
requestType="0" vsaSubClientId="var_subclient_id">
<User _type_="13" userId="0" userName="admin" />
<CommServeInfo>
<CommserveHostInfo _type_="3" clientName="var_commserve_client_name"
hostName="var_commserve_host_name" />
</CommServeInfo>
<clientComposition activateClient="1" packageDeliveryOption="0">
<clientInfo>
<client cvdPort="0" evmgrcPort="0" installDirectory="N/A">
<clientEntity _type_="3" clientName="var_vm_name"
displayName="var_vm_name" hostName="var_ip" />
<osInfo Type="var_os" />
</client>
<clientProps BinarySetID="0" ConsumeLicense="0" iSCSIPort="3260"
virtualDiscoveredClient="1" virtualServerIPAddress="" vmInstanceId="var_vm_instance_id"
vmReferenceTime="0"
vmguid="var_bios_uuid,var_instance_uuid"
vmhostname="var_vm_name" vmname="var_vm_name" />
</clientInfo>
</clientComposition>
</CVInstallManager_ClientSetup>

In my scripting, I’m going to generate this XML file like I said case by case and remote execute SIMCallWrapper.exe with this input file.

I’ll let you know if I managed to do it like this, but for now it seems like it’s already working via command line.

For “var_os” I’ve tested with the string “Windows” which is working.
For “var_bios_uuid” and “var_instance_uuid” you should check via VCenter API:
https://{{url}}/api/vcenter/vm/vm-49341/ (where vm-49341 is the vCenter MoRef ID for the virtual machine)


As long as the client gets created it’s OK, that way we should be able to run a back-up via API POST using only the vm_uuid. (Edit: this was not sufficient to be able to run a backup)

Other client properties are not relevant at this point as they will get populated as soon as the VM Client gets merged with a Commvault client.

Kind regards,

Harm

Badge +1

Hi Christopher,

I tried and it worked creating the Commvault ‘Virtual Machine’ Client the way I described it in my previous post, however I was not able to start a backup (POST VM Backup) via the V2 VM API endpoint using the vm uuid.

"errorMessage": "Not able to fetch Vm status Information" 500 Internal Server Error

I can also see some important information is missing from the Client Properties “Virtual Machine Properties” tab, such as:

  • Virtualization Client Name
  • Backupset Name
  • Subclient Name

I’m continuing my investigation and I think I have a new lead :-)
On the VSA proxy in vsdiscovery.log I can see this log line: (filtered out and changed values between < >)

vsdiscovery has started vsdisc.exe -vm Instance001 -cn <vsa_proxy_client_name> -ClientId <vsa_proxy_client_id> -InstanceId <vmpseudoclient_instance_id> -BackupSetId <ilb_backupset_id> -a 2:2388 -collectfilepath "C:\Program Files\Commvault\ContentStore\Base\Temp\vmcollect_1696338112_18796.cvf" -createVMClients 

I’m still unsure about the “-a” parameter and also how we should name the .cvf files
I’m guessing the 1696338112 is the epoch timestamp and the 18796 is the ilb_subclient_id.

Edit: 1696338112 is epoch timestamp / 18796 is the subclient id

If I have some news I’ll update here ;-)

Kind regards,

Harm

Badge +1

Hi Christopher,

This vdisc.exe method is working for me.

 

# Create vm client
vdisc_path =f'{cv_path}\\VSDisc.exe'
command = (f'& "{vdisc_path}" -vm Instance001 '
f'-cn {vsa_client_name} -ClientId {vsa_client_id} '
f'-InstanceId {instance_id} -BackupSetId {ilb_backupset.backupset_id} '
f'-a 2:{ilb_subclient.subclient_id} '
f'-collectfilepath "C:\\Program Files\\Commvault\\ContentStore\\Base\\Temp\\vmcollect_{time.time()}_{rfc}.cvf" -createVMClients')
_ = remote_cmds.run_secure_powershell(credentials, vsa_hostname, command)

 

Reply