def __init__(self, virsh_instance=base.virsh): accessors.XMLElementInt('domain', self, parent_xpath='/', tag_name='domain') accessors.XMLElementInt('bus', self, parent_xpath='/', tag_name='bus') accessors.XMLElementInt('slot', self, parent_xpath='/', tag_name='slot') accessors.XMLElementInt('function', self, parent_xpath='/', tag_name='function') accessors.XMLAttribute('product_id', self, parent_xpath='/', tag_name='product', attribute='id') accessors.XMLAttribute('vendor_id', self, parent_xpath='/', tag_name='vendor', attribute='id') super(PCIXML, self).__init__(virsh_instance=virsh_instance) self.xml = (' <capability type=\'pci\'></capability>')
def __init__(self, virsh_instance=base.virsh): accessors.XMLAttribute(property_name='pool_type', libvirtxml=self, parent_xpath='/', tag_name='pool', attribute='type') accessors.XMLElementText(property_name='name', libvirtxml=self, parent_xpath='/', tag_name='name') accessors.XMLElementText(property_name='uuid', libvirtxml=self, parent_xpath='/', tag_name='uuid') accessors.XMLElementInt(property_name='capacity', libvirtxml=self, parent_xpath='/', tag_name='capacity') accessors.XMLElementInt(property_name='allocation', libvirtxml=self, parent_xpath='/', tag_name='allocation') accessors.XMLElementInt(property_name='available', libvirtxml=self, parent_xpath='/', tag_name='available') accessors.XMLElementText(property_name='target_path', libvirtxml=self, parent_xpath='/target', tag_name='path') super(PoolXMLBase, self).__init__(virsh_instance=virsh_instance)
def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementInt('pagesize', self, parent_xpath='/', tag_name='pagesize') accessors.XMLAttribute(property_name="pagesize_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='pagesize', attribute='unit') accessors.XMLElementText('nodemask', self, parent_xpath='/', tag_name='nodemask') accessors.XMLElementText('path', self, parent_xpath='/', tag_name='path') accessors.XMLElementInt('alignsize', self, parent_xpath='/', tag_name='alignsize') accessors.XMLAttribute(property_name="alignsize_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='alignsize', attribute='unit') accessors.XMLElementBool('pmem', self, parent_xpath='/', tag_name='pmem') super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<source/>'
def __init__(self, virsh_instance=virsh): accessors.XMLAttribute(property_name="hypervisor_type", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='domain', attribute='type') accessors.XMLElementText(property_name="vm_name", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='name') accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='uuid') accessors.XMLElementInt(property_name="vcpu", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu') accessors.XMLElementInt(property_name="max_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='memory') accessors.XMLElementInt(property_name="current_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='currentMemory') super(VMXMLBase, self).__init__(virsh_instance)
def __init__(self, virsh_instance=base.virsh): accessors.XMLElementText('name', self, parent_xpath='/', tag_name='name') accessors.XMLElementText('key', self, parent_xpath='/', tag_name='key') accessors.XMLElementInt('capacity', self, parent_xpath='/', tag_name='capacity') accessors.XMLElementInt('allocation', self, parent_xpath='/', tag_name='allocation') accessors.XMLAttribute('format', self, parent_xpath='/target', tag_name='format', attribute='type') accessors.XMLAttribute('capacity_unit', self, parent_xpath='/', tag_name='capacity', attribute='unit') accessors.XMLElementNest( 'encryption', self, parent_xpath='/target', tag_name='encryption', subclass=self.Encryption, subclass_dargs={'virsh_instance': virsh_instance}) accessors.XMLElementText('path', self, parent_xpath='/target', tag_name='path') accessors.XMLElementInt('owner', self, parent_xpath='/target/permissions', tag_name='owner') accessors.XMLElementInt('group', self, parent_xpath='/target/permissions', tag_name='group') accessors.XMLElementText('mode', self, parent_xpath='/target/permissions', tag_name='mode') accessors.XMLElementText('label', self, parent_xpath='/target/permissions', tag_name='label') accessors.XMLElementText('compat', self, parent_xpath='/target', tag_name='compat') accessors.XMLElementBool('lazy_refcounts', self, parent_xpath='/target/features', tag_name='lazy_refcounts') super(VolXMLBase, self).__init__(virsh_instance=virsh_instance)
def __init__(self, virsh_instance=base.virsh): accessors.XMLElementInt('domain', self, parent_xpath='/', tag_name='domain') accessors.XMLElementInt('bus', self, parent_xpath='/', tag_name='bus') accessors.XMLElementInt('slot', self, parent_xpath='/', tag_name='slot') accessors.XMLElementInt('function', self, parent_xpath='/', tag_name='function') accessors.XMLAttribute('product_id', self, parent_xpath='/', tag_name='product', attribute='id') accessors.XMLAttribute('vendor_id', self, parent_xpath='/', tag_name='vendor', attribute='id') accessors.XMLAttribute('numa_node', self, parent_xpath='/', tag_name='numa', attribute='node') accessors.XMLAttribute('iommuGroup_number', self, parent_xpath='/', tag_name='iommuGroup', attribute='number') accessors.XMLElementList('iommuGroup_address', self, parent_xpath='/iommuGroup', marshal_from=self.marshal_from_address, marshal_to=self.marshal_to_address) accessors.XMLElementList('virt_functions', self, parent_xpath='/capability', marshal_from=self.marshal_from_address, marshal_to=self.marshal_to_address) accessors.XMLElementText('product_info', self, parent_xpath='/', tag_name='product') super(PCIXML, self).__init__(virsh_instance=virsh_instance) self.xml = (' <capability type=\'pci\'></capability>')
def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementInt('size', self, parent_xpath='/', tag_name='size') accessors.XMLAttribute(property_name="size_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='size', attribute='unit') accessors.XMLElementInt('requested_size', self, parent_xpath='/', tag_name='requested') accessors.XMLAttribute(property_name="requested_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='requested', attribute='unit') accessors.XMLElementInt('current_size', self, parent_xpath='/', tag_name='current') accessors.XMLAttribute(property_name="current_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='current', attribute='unit') accessors.XMLElementInt('block_size', self, parent_xpath='/', tag_name='block') accessors.XMLAttribute(property_name="block_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='block', attribute='unit') accessors.XMLElementInt('node', self, parent_xpath='/', tag_name='node') accessors.XMLElementNest( 'label', self, parent_xpath='/', tag_name='label', subclass=self.Label, subclass_dargs={'virsh_instance': virsh_instance}) accessors.XMLElementBool('readonly', self, parent_xpath='/', tag_name='readonly') super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<target/>'
def __init__(self, virsh_instance=base.virsh): accessors.XMLAttribute(property_name="hypervisor_type", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='domain', attribute='type') accessors.XMLElementText(property_name="vm_name", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='name') accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='uuid') accessors.XMLElementInt(property_name="vcpu", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu') accessors.XMLAttribute(property_name="placement", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu', attribute='placement') accessors.XMLElementInt(property_name="max_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='memory') accessors.XMLElementInt(property_name="current_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='currentMemory') accessors.XMLElementDict(property_name="numa", libvirtxml=self, forbidden=None, parent_xpath='numatune', tag_name='memory') accessors.XMLElementText(property_name="cputune", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='cputune') accessors.XMLAttribute(property_name="emulatorpin", libvirtxml=self, forbidden=None, parent_xpath='/cputune', tag_name='emulatorpin', attribute='cpuset') super(VMXMLBase, self).__init__(virsh_instance=virsh_instance)
def __init__(self, virsh_instance=base.virsh): accessors.XMLElementText('name', self, parent_xpath='/', tag_name='name') accessors.XMLElementText('key', self, parent_xpath='/', tag_name='key') accessors.XMLElementInt('capacity', self, parent_xpath='/', tag_name='capacity') accessors.XMLElementInt('allocation', self, parent_xpath='/', tag_name='allocation') accessors.XMLAttribute('format', self, parent_xpath='/target', tag_name='format', attribute='type') accessors.XMLElementText('path', self, parent_xpath='/target', tag_name='path') super(VolXMLBase, self).__init__(virsh_instance=virsh_instance)
def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementInt('size', self, parent_xpath='/', tag_name='size') accessors.XMLAttribute(property_name="size_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='size', attribute='unit') accessors.XMLElementInt('node', self, parent_xpath='/', tag_name='node') super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<target/>'
def test_XMLElementInt(self): class FooBar(base.LibvirtXMLBase): __slots__ = ('auto_test', 'bin_test', 'oct_test', 'dec_test', 'hex_test') lvx = FooBar(self.dummy_virsh) lvx.xml = ('<integer>' ' <auto>00</auto>' ' <bin>10</bin>' ' <oct>10</oct>' ' <dec>10</dec>' ' <hex>10</hex>' '</integer>') name_radix = {'auto': 0, 'bin': 2, 'oct': 8, 'dec': 10, 'hex': 16} for name, radix in name_radix.items(): accessors.XMLElementInt(name + '_test', lvx, parent_xpath='/', tag_name=name, radix=radix) self.assertEqual(lvx[name + '_test'], radix) self.assertRaises(ValueError, lvx.__setitem__, 'bin_test', 'text')
def __init__(self, virsh_instance=base.base.virsh): for slot in self.__all_slots__: if slot in base.base.LibvirtXMLBase.__all_slots__: continue # don't add these else: accessors.XMLElementInt(slot, self, parent_xpath='/', tag_name=slot) super(Disk.IOTune, self).__init__(virsh_instance=virsh_instance) self.xml = '<iotune/>'
def __init__(self, virsh_instance=base.base.virsh): # pylint: disable=E1133,E1135 for slot in self.__all_slots__: if slot in base.base.LibvirtXMLBase.__all_slots__: continue # don't add these else: accessors.XMLElementInt(slot, self, parent_xpath='/', tag_name=slot) super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<iotune/>'
def __init__(self, virsh_instance=base.virsh): accessors.XMLElementList('vcpupins', self, parent_xpath='/', marshal_from=self.marshal_from_vcpupins, marshal_to=self.marshal_to_vcpupins) accessors.XMLAttribute('emulatorpin', self, parent_xpath='/', tag_name='emulatorpin', attribute='cpuset') for slot in self.__all_slots__: if slot in ('shares', 'period', 'quota', 'emulator_period', 'emulator_quota'): accessors.XMLElementInt(slot, self, parent_xpath='/', tag_name=slot) super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '<cputune/>'
def __init__(self, virsh_instance=base.virsh): """ Create new cpus XML instance """ accessors.XMLAttribute(property_name="cell_id", libvirtxml=self, parent_xpath='/', tag_name='cell', attribute='id') accessors.XMLElementInt(property_name="memory", libvirtxml=self, parent_xpath='/', tag_name='memory') accessors.XMLAttribute(property_name="mem_unit", libvirtxml=self, parent_xpath='/', tag_name='memory', attribute='unit') accessors.XMLElementList(property_name="pages", libvirtxml=self, parent_xpath='/', marshal_from=self.marshal_from_pages, marshal_to=self.marshal_to_pages) accessors.XMLElementList(property_name="sibling", libvirtxml=self, parent_xpath='/distances', marshal_from=self.marshal_from_sibling, marshal_to=self.marshal_to_sibling) accessors.XMLAttribute(property_name="cpus_num", libvirtxml=self, parent_xpath='/', tag_name='cpus', attribute='num') accessors.XMLElementList(property_name="cpu", libvirtxml=self, parent_xpath='/cpus', marshal_from=self.marshal_from_cpu, marshal_to=self.marshal_to_cpu) super(CellXML, self).__init__(virsh_instance) self.xml = u"<cell></cell>"
def __init__(self, virsh_instance=base.base.virsh): accessors.XMLAttribute('name', self, parent_xpath='/', tag_name='shmem', attribute='name') accessors.XMLAttribute('role', self, parent_xpath='/', tag_name='shmem', attribute='role') accessors.XMLElementDict('model_attrs', self, parent_xpath='/', tag_name='model') accessors.XMLElementInt('size', self, parent_xpath='/', tag_name='size') accessors.XMLAttribute(property_name="size_unit", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='size', attribute='unit') accessors.XMLElementDict('pci_addr_attrs', self, parent_xpath='/', tag_name='address') accessors.XMLElementDict('server_attrs', self, parent_xpath='/', tag_name='server') accessors.XMLElementDict('msi_attrs', self, parent_xpath='/output', tag_name='msi') super(Shmem, self).__init__(device_tag='shmem', virsh_instance=virsh_instance)
def __init__(self, virsh_instance=base.virsh): accessors.XMLAttribute(property_name="hypervisor_type", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='domain', attribute='type') accessors.XMLElementText(property_name="vm_name", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='name') accessors.XMLElementText(property_name="uuid", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='uuid') accessors.XMLElementInt(property_name="vcpu", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu') accessors.XMLAttribute(property_name="current_vcpu", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu', attribute='current') accessors.XMLAttribute(property_name="placement", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='vcpu', attribute='placement') accessors.XMLElementInt(property_name="max_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='memory') accessors.XMLElementInt(property_name="current_mem", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='currentMemory') accessors.XMLElementText(property_name="os", libvirtxml=self, forbidden=None, parent_xpath='/', tag_name='os') accessors.XMLElementText(property_name="os_type", libvirtxml=self, forbidden=None, parent_xpath='/os', tag_name='type') accessors.XMLAttribute(property_name="os_arch", libvirtxml=self, forbidden=None, parent_xpath='/os', tag_name='type', attribute='arch') accessors.XMLElementText(property_name="os_init", libvirtxml=self, forbidden=None, parent_xpath='/os', tag_name='init') accessors.XMLElementDict(property_name="numa", libvirtxml=self, forbidden=None, parent_xpath='numatune', tag_name='memory') accessors.XMLElementNest( property_name='cputune', libvirtxml=self, parent_xpath='/', tag_name='cputune', subclass=VMCPUTune, subclass_dargs={'virsh_instance': virsh_instance}) super(VMXMLBase, self).__init__(virsh_instance=virsh_instance)