Skip to content

Commit

Permalink
virt-who-vsphere - script for simulating virt-who vsphere response
Browse files Browse the repository at this point in the history
  • Loading branch information
iNecas committed Jan 4, 2012
1 parent 1717714 commit 36ac26d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/system-test/vsphere-virt-who-simulator.py
@@ -0,0 +1,23 @@
#!/usr/bin/env python
# usage:
# vsphere-virt-who-simulator.py -o ACME_Corporation -e Dev host1:guest1,guest2 host3:guest3,guest4

from rhsm.connection import UEPConnection
from optparse import OptionParser

parser = OptionParser()

parser.add_option("-o", "--org", default="ACME_Corporation")
parser.add_option("-e", "--env", default="Dev")

[options, args] = parser.parse_args()

conn = UEPConnection(cert_file="/etc/pki/consumer/cert.pem",key_file="/etc/pki/consumer/key.pem", insecure=True)

# takes array in format ["host1:guest1,guest2","host2:guest3,guest4"]
# returns dict {"host1": ["guest1","guest2"], "host2": ["guest3","guest4"]}
mapping = dict([[host, guests.split(",")] for
[host, guests] in [arg.split(":")
for arg in args]])

print conn.hypervisorCheckIn(options.org, options.env, mapping)

0 comments on commit 36ac26d

Please sign in to comment.