Exemple #1
0
    def load_domain0(self):
        """ load domain-0 running state """
        log.log_d("%s: loading domain0 infos" % (self.srv_ip))

        domustate_list = self.xenapi.xmlist_bydomu_raw('Domain-0')

        domustate_dict = scc.list2dict(eval(domustate_list))['domain']
        scc.dict2struct(self.infos.domain0, domustate_dict)
        return True
Exemple #2
0
    def load_state(self):
        """ import domU running state """
        log.log_d("%s: loading domU running state" % (self.srv_ip))

        domustate_list = self.dom0.xenapi.xmlist_bydomu_raw(self.name)
        e_domustate_list = eval(domustate_list)
        if len(e_domustate_list):
            domustate_dict = scc.list2dict(e_domustate_list)['domain']
            self.state = scc.dict2struct(scc.AttStr("state structure"),
                                         domustate_dict)
        return True
Exemple #3
0
    def list_running_domus(self):
        """ running domus listing """
        log.log_d("%s: listing running domUs" % (self.srv_ip))

        running_domus = []
        self.infos.used_cpus = 0
        # retrieve xm list output and convert each domU in dict
        out = self.xenapi.xmlist_bytype_raw()
        for domu in eval(out):
            domu_dict = scc.list2dict(domu)['domain']
            if domu_dict['name'] != "Domain-0":
                running_domus.append(domu_dict['name'])
                self.infos.used_cpus += int(domu_dict['vcpus'])

        # return list of domU dicts
        if hasattr(self.infos, 'nr_cpus'):
            self.infos.free_cpus = (
                int(self.infos.nr_cpus) - self.infos.used_cpus
                )

        return running_domus