Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

ainfo satprep_wa_vcvms

Christian Stankowic edited this page Mar 20, 2015 · 4 revisions

satprep_wa_vcvms.py is a script that implements a workaround for the poor libvirt support for VMware vCenter.

#Implementation To run the script you need to specify a Satellite and VMware vCenter server. Afterwards vCenter is queried to get the current compute ressource (datacenter, cluster and ESXi host) of all systems managed with Satellite. Unfortunately this takes some time (~20 minutes for my vCenter managing ~300 VMs). After that the Satellite custominfo key SYSTEM_VIRT_HOST is updated for each affected system.

#Parameters

##Generic Options

Parameter Description
-d / --debug enable debugging outputs (default: no)
-n / --dry-run only simulates updating custom keys (default: no)

##Satellite Options

Parameter Description
-a / --satellite-authfile defines an auth file to use for Satellite
-s / --satellite-server defines the Satellite server to use (default: localhost)

##vCenter Options

Parameter Description
-A / --vcenter-authfile defines an auth file to use for VMware vCenter
-S / --vcenter-server defines the VMware vCenter server to use
-v / --verify-ssl forces using verified SSL connections (removes libvirt ?no_verify=1 flag, default: no)

#Example Simulate updating the custom keys for managed systems:

$ ./satprep_wa_vcvms.py -s mysat -S myvc -n
INFO:satprep_wa_vcvms:Connected to myvc (VMware vCenter Server), version 5.5.
INFO:satprep_wa_vcvms:Searching for ESXi hosts by datacenter...
INFO:satprep_wa_vcvms:Digging through list of systems managed by Satellite...
INFO:satprep_wa_vcvms:Getting list of all VMs and assign them to host arrays - grab some coffee.
INFO:satprep_wa_vcvms:Checked 10 of 21 VMs so far...
INFO:satprep_wa_vcvms:Checked 20 of 21 VMs so far...
INFO:satprep_wa_vcvms:Updating relevant system custom info keys...
INFO:satprep_wa_vcvms:I'd like to set SYSTEM_VIRT_HOST='vpx://myvc/testdc/mycluster/myesxi1?no_verify=1' for system 'mysrv1.localdomain.loc' (ID 1000013370).
INFO:satprep_wa_vcvms:I'd like to set SYSTEM_VIRT_HOST='vpx://myvc/devdc/mycluster/myesxi2?no_verify=1' for system 'mysrv2.localdomain.loc' (ID 1000013371).
...

Updating custom keys for all VMs managed by Satellite, using auth files for Satellite (mysat) and VMware vCenter Server (myvc):

$ ./satprep_wa_vcvms.py -s mysat -S myvc -a mysat.auth -A myvc.auth
INFO:satprep_wa_vcvms:Connected to myvc (VMware vCenter Server), version 5.5.
INFO:satprep_wa_vcvms:Searching for ESXi hosts by datacenter...
INFO:satprep_wa_vcvms:Digging through list of systems managed by Satellite...
INFO:satprep_wa_vcvms:Getting list of all VMs and assign them to host arrays - grab some coffee.
INFO:satprep_wa_vcvms:Checked 10 of 21 VMs so far...
INFO:satprep_wa_vcvms:Checked 20 of 21 VMs so far...
INFO:satprep_wa_vcvms:Updating relevant system custom info keys...
INFO:satprep_wa_vcvms:Updated virtual host entry for system 'mysrv1.localdomain.loc' (ID 1000013370).
INFO:satprep_wa_vcvms:Updated virtual host entry for system 'mysrv2.localdomain.loc' (ID 1000013371).
...
Clone this wiki locally