def __init__(self, virsh_instance=base.virsh): accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=['set', 'del'], parent_xpath='/host', tag_name='uuid') # This will skip self.get_os_arch_machine_map() defined below accessors.AllForbidden(property_name="os_arch_machine_map", libvirtxml=self) # This will skip self.get_cpu_count() defined below accessors.AllForbidden(property_name="cpu_count", libvirtxml=self) # The set action is for test. accessors.XMLElementText(property_name="arch", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='arch') accessors.XMLElementText(property_name="model", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='model') accessors.XMLElementText(property_name="vendor", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='vendor') # This will skip self.get_feature_list() defined below accessors.AllForbidden(property_name="feature_list", libvirtxml=self) super(CapabilityXML, self).__init__(virsh_instance) # calls set_xml accessor method self['xml'] = self.dict_get('virsh').capabilities()
def __init__(self, virsh_instance=base.virsh): accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=['set', 'del'], parent_xpath='/host', tag_name='uuid') # This will skip self.get_guest_capabilities() defined below accessors.AllForbidden(property_name="guest_capabilities", libvirtxml=self) # This will skip self.get_cpu_count() defined below accessors.AllForbidden(property_name="cpu_count", libvirtxml=self) # The set action is for test. accessors.XMLElementText(property_name="arch", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='arch') accessors.XMLElementText(property_name="model", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='model') accessors.XMLElementText(property_name="vendor", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='vendor') accessors.XMLElementDict(property_name="cpu_topology", libvirtxml=self, forbidden=['del'], parent_xpath='/host/cpu', tag_name='topology') accessors.XMLElementDict(property_name="iommu", libvirtxml=self, forbidden=['del'], parent_xpath='/host', tag_name='iommu') accessors.XMLElementNest( property_name='cells_topology', libvirtxml=self, parent_xpath='/host', tag_name='topology', subclass=TopologyXML, subclass_dargs={'virsh_instance': virsh_instance}) # This will skip self.get_feature_list() defined below accessors.AllForbidden(property_name="feature_list", libvirtxml=self) # This will skip self.get_power_management_list() defined below accessors.AllForbidden(property_name="power_management_list", libvirtxml=self) super(CapabilityXML, self).__init__(virsh_instance) # calls set_xml accessor method self['xml'] = self.__dict_get__('virsh').capabilities()
def __init__(self, virsh_instance=base.virsh, vm_name='', mode='host-model'): """ Create new VMCPU XML instance """ # The set action is for test. accessors.XMLElementText(property_name="model", libvirtxml=self, forbidden=['del'], parent_xpath='/cpu', tag_name='model') accessors.XMLElementText(property_name="vendor", libvirtxml=self, forbidden=['del'], parent_xpath='/cpu', tag_name='vendor') # This will skip self.get_feature_list() defined below accessors.AllForbidden(property_name="feature_list", libvirtxml=self) super(VMCPUXML, self).__init__(virsh_instance=virsh_instance) # Setup some bare-bones XML to build upon self.set_cpu_mode(vm_name, mode) self['xml'] = self.__dict_get__('virsh').dumpxml( vm_name, extra="--update-cpu").stdout.strip()
def __init__(self, virsh_instance=base.virsh): accessors.XMLAttribute(property_name='gic_supported', libvirtxml=self, parent_xpath='/', tag_name='gic', attribute='supported') accessors.AllForbidden(property_name='gic_enums', libvirtxml=self) super(DomCapFeaturesXML, self).__init__(virsh_instance)
def __init__(self, virsh_instance=base.base.virsh): for slot in ('sha1', 'sha256', 'sha384', 'sha512'): accessors.XMLElementBool(slot, self, parent_xpath='/', tag_name=slot) accessors.AllForbidden(property_name="pcrbank_list", libvirtxml=self) super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<active_pcr_banks/>'
def test_AllForbidden(self): class FooBar(base.LibvirtXMLBase): __slots__ = ('test',) lvx = FooBar(self.dummy_virsh) accessors.AllForbidden('test', lvx) self.assertRaises(xcepts.LibvirtXMLForbiddenError, lvx.__getitem__, 'test') self.assertRaises(xcepts.LibvirtXMLForbiddenError, lvx.__setitem__, 'test', 'foobar') self.assertRaises(xcepts.LibvirtXMLForbiddenError, lvx.__delitem__, 'test')
def __init__(self, virsh_instance=virsh): accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=['set', 'del'], parent_xpath='/host', tag_name='uuid') # This will skip self.get_os_arch_machine_map() defined below accessors.AllForbidden(property_name="os_arch_machine_map", libvirtxml=self) super(LibvirtXML, self).__init__(virsh_instance) # calls set_xml accessor method self['xml'] = self.dict_get('virsh').capabilities()
def __init__(self, virsh_instance=base.virsh): """ Create new cells topology XML instance """ accessors.XMLAttribute(property_name="num", libvirtxml=self, parent_xpath='/', tag_name='cells', attribute='num') accessors.AllForbidden(property_name="cell", libvirtxml=self) super(TopologyXML, self).__init__(virsh_instance) self.xml = self.__dict_get__('virsh').capabilities() self.xmltreefile.reroot("/host/topology") self.xmltreefile.write()
def __init__(self, virsh_instance=base.base.virsh): accessors.AllForbidden(property_name="pcrbank_list", libvirtxml=self) super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<active_pcr_banks/>'