Beispiel #1
0
 def registerVMs(self, xenapi, session, host):
     hostRef = xenapi.session.get_this_host(session["Value"], session["Value"])["Value"]
     domURef = xenapi.host.get_resident_VMs(session["Value"], hostRef)["Value"]
     vmsList = []
     for vmRef in domURef:
         # dom0 will not be shown
         if vmRef != "00000000-0000-0000-0000-000000000000":
             vmInfoRef = xenapi.VM.get_record(session["Value"], vmRef)
             vmInfo = vmInfoRef["Value"]
             if vmInfo["HVM_boot_policy"] == "":
                 vmType = "Para-Virt"
             else:
                 vmType = "Full-Virt"
             vmMaxMemory = (int(vmInfo["memory_dynamic_max"]) / 1024) / 1024
             vmMetricRef = vmInfo["metrics"]
             vmMetric = xenapi.VM_metrics.get_record(session["Value"], vmMetricRef)
             domU = DomU(vmInfo["name_label"], vmType, vmMaxMemory, vmInfo["power_state"], host)
             vmsList.append(domU)
     db = DBManager()
     db.updateDomU(host, vmsList)