-
Notifications
You must be signed in to change notification settings - Fork 1
virttest.libvirt_xml
virttest.libvirt_xml package¶
Subpackages¶
-
virttest.libvirt_xml.devices package
- Submodules
- virttest.libvirt_xml.devices.address module
- virttest.libvirt_xml.devices.base module
- virttest.libvirt_xml.devices.channel module
- virttest.libvirt_xml.devices.character module
- virttest.libvirt_xml.devices.console module
- virttest.libvirt_xml.devices.controller module
- virttest.libvirt_xml.devices.disk module
- virttest.libvirt_xml.devices.emulator module
- virttest.libvirt_xml.devices.filesystem module
- virttest.libvirt_xml.devices.graphics module
- virttest.libvirt_xml.devices.hostdev module
- virttest.libvirt_xml.devices.hub module
- virttest.libvirt_xml.devices.input module
- virttest.libvirt_xml.devices.interface module
- virttest.libvirt_xml.devices.lease module
- virttest.libvirt_xml.devices.librarian module
- virttest.libvirt_xml.devices.memballoon module
- virttest.libvirt_xml.devices.memory module
- virttest.libvirt_xml.devices.panic module
- virttest.libvirt_xml.devices.parallel module
- virttest.libvirt_xml.devices.redirdev module
- virttest.libvirt_xml.devices.rng module
- virttest.libvirt_xml.devices.seclabel module
- virttest.libvirt_xml.devices.serial module
- virttest.libvirt_xml.devices.smartcard module
- virttest.libvirt_xml.devices.sound module
- virttest.libvirt_xml.devices.video module
- virttest.libvirt_xml.devices.watchdog module
- Module contents
-
virttest.libvirt_xml.nwfilter_protocols package
- Submodules
- virttest.libvirt_xml.nwfilter_protocols.ah module
- virttest.libvirt_xml.nwfilter_protocols.ah_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.all module
- virttest.libvirt_xml.nwfilter_protocols.all_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.arp module
- virttest.libvirt_xml.nwfilter_protocols.base module
- virttest.libvirt_xml.nwfilter_protocols.esp module
- virttest.libvirt_xml.nwfilter_protocols.esp_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.icmp module
- virttest.libvirt_xml.nwfilter_protocols.icmpv6 module
- virttest.libvirt_xml.nwfilter_protocols.igmp module
- virttest.libvirt_xml.nwfilter_protocols.ip module
- virttest.libvirt_xml.nwfilter_protocols.ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.librarian module
- virttest.libvirt_xml.nwfilter_protocols.mac module
- virttest.libvirt_xml.nwfilter_protocols.rarp module
- virttest.libvirt_xml.nwfilter_protocols.sctp module
- virttest.libvirt_xml.nwfilter_protocols.sctp_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.stp module
- virttest.libvirt_xml.nwfilter_protocols.tcp module
- virttest.libvirt_xml.nwfilter_protocols.tcp_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.udp module
- virttest.libvirt_xml.nwfilter_protocols.udp_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.udplite module
- virttest.libvirt_xml.nwfilter_protocols.udplite_ipv6 module
- virttest.libvirt_xml.nwfilter_protocols.vlan module
- Module contents
Submodules¶
virttest.libvirt_xml.accessors module¶
Specializations of base.AccessorBase for particular XML manipulation types
classvirttest.libvirt_xml.accessors.``AccessorBase
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.propcan.PropCanBase
Base class for a callable operating on a LibvirtXMLBase subclass instance
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
element_by_parent
(parent_xpath, tag_name, create=True)¶
Retrieve/create an element instance at parent_xpath/tag_name
Parameters:
- parent_xpath – xpath of parent element
- tag_name – name of element under parent to retrieve/create
- create – True to create new element if not exist
Returns:
ElementTree.Element instance
Raise:
LibvirtXMLError: If element not exist & create=False
libvirtxml
¶
operation
¶
property_name
¶
xmltreefile
()¶
Retrieve xmltreefile instance from libvirtxml instance
classvirttest.libvirt_xml.accessors.``AccessorGeneratorBase
(property_name, libvirtxml, forbidden=None, **dargs)¶
Bases: object
Accessor method/class generator for specific property name
Initialize accessor methods, marking operations in forbidden as such
Parameters:
- property_name – Name of the property
- libvirtxml – Instance reference to LibvirtXMLBase subclass
- forbidden – Optional string list of ‘get’, ‘set’, and/or ‘del’
- dargs – Specific AccessorGeneratorBase subclass info.
accessor_name
(operation)¶
Return instance name for operation, defined by subclass (i.e. ‘get_foo’)
assign_callable
(operation, callable_inst)¶
Set reference on objectified libvirtxml instance to callable_inst
staticcallable_name
(operation)¶
Return class name for operation (i.e. ‘Getter’), defined by subclass.
make_callable
(operation)¶
Return an callable instance for operation
make_forbidden
(operation)¶
Return a forbidden callable instance for operation
set_if_not_defined
(operation)¶
Setup a callable instance for operation only if not already defined
classvirttest.libvirt_xml.accessors.``AllForbidden
(property_name, libvirtxml)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of forbidden accessor classes for those undefined on libvirtxml
Create exception raising accessors for those undefined on libvirtxml
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
classvirttest.libvirt_xml.accessors.``ForbiddenBase
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Raise LibvirtXMLAccessorError when called w/ or w/o a value arg.
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
classvirttest.libvirt_xml.accessors.``XMLAttribute
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None, attribute=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating on an attribute of an element
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘Getter’, ‘Setter’, ‘Delter’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
- attribute – Attribute name to manupulate
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove attribute
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
attribute
¶
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLAttribute.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Get attribute value
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
attribute
¶
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLAttribute.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set attribute value
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
attribute
¶
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classvirttest.libvirt_xml.accessors.``XMLElementBool
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating purely element existence
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘get’, ‘set’, ‘del’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove element and ignore if it doesn’t exist (same as False)
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementBool.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve text on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementBool.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Create element when True, delete when false
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
XMLElementBool.``required_dargs
= ('parent_xpath', 'tag_name')¶
classvirttest.libvirt_xml.accessors.``XMLElementDict
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating as a dictionary of attributes
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘Getter’, ‘Setter’, ‘Delter’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove element and ignore if it doesn’t exist (same as False)
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementDict.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve attributes on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementDict.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set attributes to value on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classvirttest.libvirt_xml.accessors.``XMLElementInt
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None, radix=10)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating on element.text as an integer
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘Getter’, ‘Setter’, ‘Delter’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove element and ignore if it doesn’t exist (same as False)
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementInt.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve text on element and convert to int
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
radix
¶
tag_name
¶
classXMLElementInt.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set text on element after converting to int then to str
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
radix
¶
tag_name
¶
XMLElementInt.``required_dargs
= ('parent_xpath', 'tag_name', 'radix')¶
classvirttest.libvirt_xml.accessors.``XMLElementList
(property_name, libvirtxml, forbidden=None, parent_xpath=None, marshal_from=None, marshal_to=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating on a list of child elements
Other generators here have a hard-time dealing with XML that has multiple child-elements with the same tag. This class allows treating these structures as lists of arbitrary user-defined objects. User-defined marshal functions are called to perform the conversion to/from the format described in __init__.
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘Getter’, ‘Setter’, ‘Delter’
- parent_xpath – XPath string of parent element
- marshal_from – Callable, passed the item, index, and libvirtxml instance. Must return tuple of tag-name, an attribute-dict, and an optional text or raise ValueError exception.
- marshal_to – Callable. Passed a the item tag, attribute-dict, index, libvirtxml, and optional text instance. Returns item value accepted by marshal_from or None to skip
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove ALL child elements for which marshal_to does NOT return None
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
marshal_to
¶
operation
¶
parent_xpath
¶
property_name
¶
classXMLElementList.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve list of values as returned by the marshal_to callable
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
marshal_to
¶
operation
¶
parent_xpath
¶
property_name
¶
classXMLElementList.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set child elements as returned by the marshal_to callable
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
marshal_from
¶
operation
¶
parent_xpath
¶
property_name
¶
XMLElementList.``required_dargs
= ('parent_xpath', 'tag_name', 'marshal_from', 'marshal_to')¶
classvirttest.libvirt_xml.accessors.``XMLElementNest
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None, subclass=None, subclass_dargs=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating on a LibvirtXMLBase subclass
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘Getter’, ‘Setter’, ‘Delter’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
- subclass – A LibvirtXMLBase subclass with root tag == tag_name
- subclass_dargs – dict. to pass as kw args to subclass.__init__
N/B: Works ONLY if tag_name is unique within parent element
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove element and ignore if it doesn’t exist (same as False)
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementNest.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve instance of subclass with it’s xml set to rerooted xpath/tag
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
subclass
¶
subclass_dargs
¶
tag_name
¶
classXMLElementNest.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set attributes to value on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
subclass
¶
tag_name
¶
XMLElementNest.``required_dargs
= ('parent_xpath', 'tag_name', 'subclass', 'subclass_dargs')¶
classvirttest.libvirt_xml.accessors.``XMLElementText
(property_name, libvirtxml, forbidden=None, parent_xpath=None, tag_name=None)¶
Bases: virttest.libvirt_xml.accessors.AccessorGeneratorBase
Class of accessor classes operating on element.text
Create undefined accessors on libvirt instance
Parameters:
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- forbidden – Optional list of ‘get’, ‘set’, ‘del’
- parent_xpath – XPath string of parent element
- tag_name – element tag name to manipulate text attribute on.
classDelter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Remove element and ignore if it doesn’t exist (same as False)
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementText.``Getter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Retrieve text on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
classXMLElementText.``Setter
(operation, property_name, libvirtxml, **dargs)¶
Bases: virttest.libvirt_xml.accessors.AccessorBase
Set text to value on element
Initialize accessor to operate on lvxml with accessor_data for property
Parameters:
- operation – Debug String for ‘Getter’, ‘Setter’, or ‘Delter’
- property_name – String name of property (for exception detail)
- libvirtxml – An instance of a LibvirtXMLBase subclass
- dargs – Necessary for subclasses to extend required parameters
libvirtxml
¶
operation
¶
parent_xpath
¶
property_name
¶
tag_name
¶
XMLElementText.``required_dargs
= ('parent_xpath', 'tag_name')¶
virttest.libvirt_xml.accessors.``add_to_slots
(*args)¶
Return list of AccessorBase.__all_slots__ + args
virttest.libvirt_xml.accessors.``type_check
(name, thing, expected)¶
Check that thing is expected subclass or instance, raise ValueError if not
virttest.libvirt_xml.base module¶
classvirttest.libvirt_xml.base.``LibvirtXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.propcan.PropCanBase
Base class for common attributes/methods applying to all sub-classes
Properties:
xml:
virtual XMLTreeFile instance
get:
xml filename string
set:
create new XMLTreeFile instance from string or filename
del:
deletes property, closes & unlinks any temp. files
xmltreefile:
XMLTreeFile instance
virsh:
virsh module or Virsh class instance
set:
validates and sets value
get:
returns value
del:
removes value
validates:
virtual boolean, read-only, True/False from virt-xml-validate
Initialize instance with connection to virsh
Parameters:
virsh_instance – virsh module or instance to use
copy
()¶
Returns a copy of instance not sharing any references or modifications
del_validates
()¶
Raises LibvirtXMLError
del_xmltreefile
()¶
Remove all backing XML
get_section_string
(xpath)¶
Returns the content of section in xml.
get_validates
()¶
Accessor method for ‘validates’ property returns virt-xml-validate T/F
get_xml
()¶
Accessor method for ‘xml’ property returns xmlTreeFile backup filename
get_xmltreefile
()¶
Return the xmltreefile object backing this instance
restore
()¶
Restore current xml content to original source content
set_validates
(value)¶
Raises LibvirtXMLError
set_virsh
(value)¶
Accessor method for virsh property, make sure it’s right type
set_xml
(value)¶
Accessor method for ‘xml’ property to load using xml_utils.XMLTreeFile
set_xmltreefile
(value)¶
Point instance directly at an already initialized XMLTreeFile instance
validates
¶
virsh
¶
staticvirt_xml_validate
(filename, schema_name=None)¶
Return CmdResult from running virt-xml-validate on backing XML
xml
¶
xmltreefile
¶
virttest.libvirt_xml.base.``load_xml_module
(path, name, type_list)¶
Returns named xml element’s handler class
Parameters:
- path – the xml module path
- name – the xml module name
- type_list – the supported type list of xml module names
Returns:
the named xml element’s handler class
virttest.libvirt_xml.capability_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatcaps.html
classvirttest.libvirt_xml.capability_xml.``CapabilityXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Handler of libvirt capabilities and nonspecific item operations.
Properties:
uuid:
string of host uuid
guest_capabilities:
dict, read-only
get:
dict map from os type names to dict map from arch names
add_feature
(value)¶
Add a feature Element to xml
Parameters:
value – The added feature name
arch
¶
cells_topology
¶
check_feature_name
(name)¶
Check feature name valid or not.
Parameters:
name – The checked feature name
Returns:
True if check pass
cpu_count
¶
cpu_topology
¶
feature_list
¶
get_cpu_count
()¶
Accessor method for cpu_count property (in __slots__)
get_feature
(num)¶
Get a feature element from feature list by number
Returns:
Feature element
get_feature_list
()¶
Accessor method for feature_list property (in __slots__)
get_feature_name
(num)¶
Get assigned feature name
Parameters:
num – Assigned feature number
Returns:
Assigned feature name
get_guest_capabilities
()¶
Accessor method for guest_capabilities property (in __slots__). Return a guest capabilities dict in following schema: {<os_type>: {<arch name>: {‘wordsize’: ‘’, ‘emulator’: ‘’, ‘machine’: [<machine name>, ...], ‘domaini_<type>’: {‘emulator’: ‘’}}}}
get_power_management_list
()¶
Accessor method for power_management_list property (in __slots__)
guest_capabilities
¶
model
¶
power_management_list
¶
remove_feature
(num)¶
Remove a assigned feature from xml
Parameters:
num – Assigned feature number
set_feature
(num, value)¶
Set a assigned feature value to xml
Parameters:
- num – Assigned feature number
- value – The feature name modified to
uuid
¶
vendor
¶
classvirttest.libvirt_xml.capability_xml.``CellXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Handler of cell element in libvirt capabilities.
Properties:
cell_id:
string of node cell number id
memory:
int, memory size
mem_unit:
string of memory unit
pages:
list of pages dict
sibling:
list of sibling dict
cpus_num:
string of cpus number
cpu:
list of cpu dict
Create new cpus XML instance
cell_id
¶
cpu
¶
cpus_num
¶
staticmarshal_from_cpu
(item, index, libvirtxml)¶
Convert a dict to cpu tag and attributes.
staticmarshal_from_pages
(item, index, libvirtxml)¶
Convert a dict to pages tag and attributes.
staticmarshal_from_sibling
(item, index, libvirtxml)¶
Convert a dict to sibling tag and attributes.
staticmarshal_to_cpu
(tag, attr_dict, index, libvirtxml)¶
Convert a cpu tag and attributes to a dict.
staticmarshal_to_pages
(tag, attr_dict, index, libvirtxml, text)¶
Convert a pages tag and attributes to a dict.
staticmarshal_to_sibling
(tag, attr_dict, index, libvirtxml)¶
Convert a sibling tag and attributes to a dict.
mem_unit
¶
memory
¶
pages
¶
sibling
¶
classvirttest.libvirt_xml.capability_xml.``TopologyXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Handler of cells topology element in libvirt capabilities.
Properties:
num:
string of node cell numbers
cell:
list of cpu dict
Create new cells topology XML instance
cell
¶
get_cell
()¶
Return CellXML instances list
num
¶
virttest.libvirt_xml.network_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatnetwork.html
classvirttest.libvirt_xml.network_xml.``DNSXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
IP address block, optionally containing DHCP range information
Properties:
txt:
Dict. keys: name, value
forwarder:
List
srv:
Dict. keys: service, protocol, domain, tartget, port, priority, weight
hosts:
List of host name
Create new IPXML instance based on address/mask
classHostXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Hostname element of dns
Create new TimerXML instance
host_ip
¶
hostnames
¶
staticmarshal_from_hostname
(item, index, libvirtxml)¶
Convert a HostnameXML instance into a tag + attributes
staticmarshal_to_hostname
(tag, attr, index, libvirtxml, text)¶
Convert a tag + attributes into a HostnameXML instance
classDNSXML.``HostnameXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Hostname element of dns
Create new HostnameXML instance
hostname
¶
DNSXML.``dns_forward
¶
DNSXML.``forwarders
¶
DNSXML.``host
¶
staticDNSXML.``marshal_from_forwarder
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticDNSXML.``marshal_to_forwarder
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
DNSXML.``new_host
(**dargs)¶
Return a new disk IOTune instance and set properties from dargs
DNSXML.``srv
¶
DNSXML.``txt
¶
classvirttest.libvirt_xml.network_xml.``IPXML
(address='192.168.122.1', netmask='255.255.255.0', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
IP address block, optionally containing DHCP range information
Properties:
dhcp_ranges: Dict. keys: start, end host_attr: host mac, name and ip information address: string IP address netmask: string IP’s netmask
Create new IPXML instance based on address/mask
address
¶
dhcp_bootp
¶
dhcp_ranges
¶
family
¶
hosts
¶
staticmarshal_from_host
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticmarshal_to_host
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
netmask
¶
prefix
¶
tftp_root
¶
classvirttest.libvirt_xml.network_xml.``NetworkXML
(network_name='default', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.network_xml.NetworkXMLBase
Manipulators of a Virtual Network through it’s XML definition.
Initialize new instance with empty XML
create
()¶
Adds non-persistant / transient network to libvirt with net-create
debug_xml
()¶
Dump contents of XML file for debugging
define
()¶
Define network from self.xml.
exists
()¶
Return True if network already exists.
staticget_uuid_by_name
(network_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return Network’s uuid by Network’s name.
Parameters:
network_name – Network’s name
Returns:
Network’s uuid
staticnew_all_networks_dict
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return a dictionary of names to NetworkXML instances for all networks
Parameters:
virsh – virsh module or instance to use
Returns:
Dictionary of network name to NetworkXML instance
staticnew_from_net_dumpxml
(network_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>, extra='')¶
Return new NetworkXML instance from virsh net-dumpxml command
Parameters:
- network_name – Name of network to net-dumpxml
- virsh_instance – virsh module or instance to use
Returns:
New initialized NetworkXML instance
orbital_nuclear_strike
()¶
It’s the only way to really be sure. Remove all libvirt state
start
()¶
Start network with self.virsh.
state_dict
()¶
Return a dict containing states of active/autostart/persistent
Returns:
A dict contains active/autostart/persistent as keys and boolean as values or None if network doesn’t exist.
sync
(state=None)¶
Make the change of “self” take effect on network. Recover network to designated state if option state is set.
Parameters:
state – a boolean dict contains active/persistent/autostart as keys
undefine
()¶
Undefine network witch name is self.name.
classvirttest.libvirt_xml.network_xml.``NetworkXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for NetworkXML class.
Properties:
name:
string, operates on XML name tag
uuid:
string, operates on uuid tag
mac:
string, operates on address attribute of mac tag
ip:
string operate on ip/dhcp ranges as IPXML instances
forward:
dict, operates on forward tag
forward_interface:
list, operates on forward/interface tag
nat_port:
dict, operates on nat tag
bridge:
dict, operates on bridge attributes
routes:
list, operates on route tag.
virtualport_type:
string, operates on ‘type’ attribute of virtualport tag.
bandwidth_inbound:
dict, operates on inbound under bandwidth.
bandwidth_outbound:
dict, operates on outbound under bandwidth.
portgroup:
PortgroupXML instance to access portgroup tag.
domain_name:
string, operates on name attribute of domain tag
dns:
DNSXML instance to access dns tag.
defined:
virtual boolean, callout to virsh methods
get:
True if libvirt knows network name
set:
True defines network, False undefines to libvirt
del:
Undefines network to libvirt
active:
virtual boolean, callout to virsh methods
get:
True if network is active to libvirt
set:
True activates network, False deactivates to libvirt
del:
Deactivates network to libvirt
autostart:
virtual boolean, callout to virsh methods
get:
True if libvirt autostarts network with same name
set:
True to set autostart, False to unset to libvirt
del:
Unset autostart to libvirt
persistent:
virtual boolean, callout to virsh methods
get:
True if network was defined, False if only created.
set:
Same as defined property
del:
Same as defined property
active
¶
autostart
¶
bandwidth_inbound
¶
bandwidth_outbound
¶
bridge
¶
defined
¶
del_active
()¶
Accessor method for ‘active’ property, stops network
del_autostart
()¶
Accessor method for ‘autostart’ property, unsets autostart
del_defined
()¶
Accessor method for ‘define’ property, undefines network
del_ip
()¶
del_persistent
()¶
Accessor method for ‘define’ property, undefines network
del_portgroup
()¶
dns
¶
domain_name
¶
forward
¶
forward_interface
¶
get_active
()¶
Accessor method for ‘active’ property (True/False)
get_autostart
()¶
Accessor method for ‘autostart’ property, True if set
get_defined
()¶
Accessor for ‘define’ property - does this name exist in network list
get_ip
()¶
get_persistent
()¶
Accessor method for ‘persistent’ property
get_portgroup
()¶
ip
¶
mac
¶
staticmarshal_from_forward_iface
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticmarshal_from_route
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticmarshal_to_forward_iface
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
staticmarshal_to_route
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
name
¶
nat_port
¶
new_dns
(**dargs)¶
Return a new dns instance and set properties from dargs
persistent
¶
portgroup
¶
routes
¶
set_active
(value)¶
Accessor method for ‘active’ property, sets network active
set_autostart
(value)¶
Accessor method for ‘autostart’ property, sets/unsets autostart
set_defined
(value)¶
Accessor method for ‘define’ property, set True to define.
set_ip
(value)¶
set_persistent
(value)¶
Accessor method for ‘define’ property, set True to define.
set_portgroup
(value)¶
uuid
¶
virtualport_type
¶
classvirttest.libvirt_xml.network_xml.``PortgroupXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for PortgroupXML class in NetworkXML.
Properties:
name:
string, operates on ‘name’ attribute of portgroup tag
default:
string of yes or no, operates on ‘default’ attribute of portgroup tag
virtualport_type:
string, operates on ‘type’ attribute of virtualport tag in portgroup.
bandwidth_inbound:
dict, operates on inbound tag in bandwidth which is child of portgroup.
bandwidth_outbound:
dict, operates on outbound tag in bandwidth which is child of portgroup.
vlan_tag:
dict, operates on vlan tag of portgroup
Create new PortgroupXML instance.
bandwidth_inbound
¶
bandwidth_outbound
¶
default
¶
name
¶
virtualport_type
¶
vlan_tag
¶
classvirttest.libvirt_xml.network_xml.``RangeList
(iterable=None)¶
Bases: list
A list of start & end address tuples
Initialize from list/tuple of two-item tuple start/end address strings
append_to_element
(element)¶
Adds range described by instance to ElementTree.element
virttest.libvirt_xml.nodedev_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatnode.html
classvirttest.libvirt_xml.nodedev_xml.``CAPXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
The base class for capability.
Initialize instance with connection to virsh
Parameters:
virsh_instance – virsh module or instance to use
staticget_key2filename_dict
()¶
Return a dict which contain the key and the name of info file.
get_key2value_dict
()¶
Reutn a dict which contain the key and the value in capability xml.
get_sysfs_sub_path
()¶
return the sub path store the info of capibility.
classvirttest.libvirt_xml.nodedev_xml.``NetXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nodedev_xml.CAPXML
class for capability whose type is net.
address
¶
interface
¶
classvirttest.libvirt_xml.nodedev_xml.``NodedevXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nodedev_xml.NodedevXMLBase
class for Node device XML.
Initialize new instance.
get_key2syspath_dict
()¶
Get the dict which contains key and path. key: keys in nodedev xml need to check. syspath: the abs path for the file stores info for the key.
get_key2value_dict
()¶
Get the dict which contain key and value in xml. key: keys in nodedev xml need to check. value: value in xml for the key.
staticnew_from_dumpxml
(dev_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get a instance of NodedevXML by dumpxml dev_name.
classvirttest.libvirt_xml.nodedev_xml.``NodedevXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for NodedevXML class.
cap
¶
cap_type
¶
del_cap
()¶
Delete the capability from nodedev xml.
fabric_wwn
¶
fc_type
¶
get_cap
()¶
Return the capability of nodedev_xml.
staticget_cap_by_type
(cap_type)¶
Init a cap class for a specific type.
Parameters:
cap_type – the type of capability.
Returns:
instanse of the cap.
get_sysfs_path
()¶
Get the abs path of the capability info.
get_sysfs_sub_path
()¶
Get the sub sysfs path of the capability.
host
¶
name
¶
parent
¶
set_cap
(value)¶
Set the capability by value.
sysfs_main_path
¶
wwnn
¶
wwpn
¶
classvirttest.libvirt_xml.nodedev_xml.``PCIXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nodedev_xml.CAPXML
class for capability whose type is pci.
classAddress
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Address of Virtual Function device.
bus
¶
domain
¶
function
¶
slot
¶
PCIXML.``bus
¶
PCIXML.``domain
¶
PCIXML.``function
¶
PCIXML.``get_address_dict
()¶
Return a dict contain the address.
staticPCIXML.``get_key2filename_dict
()¶
return the dict key2filename. key: the keys in pcixml need to check. filename: the name of file stored info for this key.
PCIXML.``get_key2value_dict
()¶
return the dict key2value
key: the key in xml need to check. value: value in xml for this key.
PCIXML.``get_sysfs_sub_path
()¶
Return the sysfs_subdir in .
Example:
pci_bus/0000:00/device/0000:00:00.0/
staticPCIXML.``make_sysfs_sub_path
(domain, bus, slot, function)¶
Make sysfs_sub_path for pci by domain,bus,slot and function.
staticPCIXML.``marshal_from_address
(item, index, libvirtxml)¶
Convert an Address instance into tag + attributes
staticPCIXML.``marshal_to_address
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into an Address instance
PCIXML.``numa_node
¶
PCIXML.``product_id
¶
PCIXML.``slot
¶
PCIXML.``vendor_id
¶
PCIXML.``virt_functions
¶
classvirttest.libvirt_xml.nodedev_xml.``StorageXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nodedev_xml.CAPXML
class for capability whose type is storage.
block
¶
bus
¶
driver_type
¶
classvirttest.libvirt_xml.nodedev_xml.``SystemXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nodedev_xml.CAPXML
class for capability which type is system.
Initialize instance with connection to virsh
Parameters:
virsh_instance – virsh module or instance to use
firm_release_date
¶
firmversion
¶
firmware_vendor
¶
staticget_key2filename_dict
()¶
Return a dict which contain the key and the name of info file for System node device.
get_key2value_dict
()¶
return the dict key2value
key: the key in xml need to check. value: value in xml for this key.
get_sysfs_sub_path
()¶
Return the sysfs_subdir.
hdware_serial
¶
hdware_uuid
¶
hdware_vendor
¶
staticmake_sysfs_sub_path
()¶
return __sysfs_sub_path__ immediately.
product
¶
virttest.libvirt_xml.nwfilter_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatnwfilter.html
classvirttest.libvirt_xml.nwfilter_xml.``NwfilterRulesProtocol
¶
Bases: list
List of protocol instances from classes handed out by librarian.get
append
(value)¶
by_device_tag
(tag)¶
extend
(iterable)¶
classvirttest.libvirt_xml.nwfilter_xml.``NwfilterXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.nwfilter_xml.NwfilterXMLBase
Manipulators of a nwfilter through it’s XML definition.
Initialize new instance with empty XML
filter_chain
¶
filter_name
¶
filter_priority
¶
filterrefs
¶
get_all_protocols
(protocol=None)¶
Put all type of protocol into a NwfilterRulesProtocol instance. Return all protocols class list if protocol as None, else return specific protocol type class list.
Parameters:
protocol – specific protocol type in rules
Returns:
NwfilterRulesProtocol instance list
get_all_rules
()¶
Return all rules dict with protocol attribute.
Returns:
all rules dict with key as rule index number
get_rules_dict
(filter_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return all rules dict with protocol attribute for given filter
Parameters:
- filter_name – name or uuid of filter
- options – extra options
Returns:
all rules dictionary with index as key
staticnew_from_filter_dumpxml
(uuid, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new NwfilterXML instance from virsh filter-dumpxml command
Parameters:
- uuid – filter’s uuid
- virsh_instance – virsh module or instance to use
Returns:
New initialized NwfilterXML instance
uuid
¶
validates
¶
virsh
¶
xml
¶
xmltreefile
¶
classvirttest.libvirt_xml.nwfilter_xml.``NwfilterXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for NwfilterXML class.
Properties:
filter_name: string, filter name filter_chain: string, filter name filter_priority: string, filter priority uuid: string, operates on uuid tag filterrefs: list, list of dictionaries describing filterref properties
add_rule
(value)¶
Add new rule into filter
Parameters:
value – NwfilterXMLRules instance
del_rule
(rule_index=0)¶
Delete rule with specific index
Parameters:
rule_index – rule’s index number
filter_chain
¶
filter_name
¶
filter_priority
¶
filterrefs
¶
get_protocol_attr
(rule_index=0, protocol=None)¶
Return protocol dict of specific rule index and protocol type
Parameters:
- rule_index – rule’s index number
- protocol – the specific protocol type in rules
Returns:
protocol attribute dict
get_rule
(rule_index=0, rule_protocol=None)¶
Return NwfilterXMLRules instance for specific protocol and index
Parameters:
- rule_index – rule’s index number
- rule_protocol – the specific protocol type in rules
Returns:
New initialized NwfilterXMLRules instance
get_rule_index
(rule_protocol=None)¶
Return rule index list for specific protocol
Parameters:
rule_protocol – the specific protocol type in rules
Returns:
rule index list
staticmarshal_from_filterref
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticmarshal_to_filterref
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
set_rule
(value, rule_index=0)¶
Delete rule with specific index and add new given value
Parameters:
- rule_index – rule’s index number
- value – NwfilterXMLRules instance
uuid
¶
validates
¶
virsh
¶
xml
¶
xmltreefile
¶
classvirttest.libvirt_xml.nwfilter_xml.``NwfilterXMLRules
(protocol=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Create new NwfilterXMLRules instance.
Properties:
rule_action: string, rule action rule_direction: string, rule direction priority: string, rule priority statematch: string, rule statematch
backup_rule
()¶
Return backup rule instance
Returns:
the backup of rule instance
del_protocol
()¶
Delete protocol in rule xml
get_protocol
(protocol=None)¶
Return None if protocol is None, else return specific class instance
Parameters:
protocol – specific protocol type in rules
Returns:
specific protocol class instance from librarian.get
new_protocol
(**dargs)¶
Return a new rule protocol instance and set properties from dargs
rule_action
¶
rule_direction
¶
rule_priority
¶
rule_statematch
¶
virttest.libvirt_xml.pool_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatstorage.html#StoragePool
classvirttest.libvirt_xml.pool_xml.``PoolXML
(pool_type='dir', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.pool_xml.PoolXMLBase
Manipulators of a libvirt Pool through it’s XML definition.
Initialize new instance with empty XML
staticbackup_xml
(name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Backup the pool xml file.
debug_xml
()¶
Dump contents of XML file for debugging
staticget_pool_details
(name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return pool details by pool name.
Parameters:
name – pool name
Returns:
a dict which include a series of pool details
staticget_type
(name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return pool type by pool name
Parameters:
name – pool name
Returns:
pool type
staticnew_from_dumpxml
(name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new PoolXML instance from virsh pool-dumpxml command
Parameters:
- name – Name of pool to pool-dumpxml
- virsh_instance – Virsh module or instance to use
Returns:
new initialized PoolXML instance
pool_define
()¶
Define pool with virsh from this instance
staticpool_rename
(name, new_name, uuid=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Rename a pool from pool XML. :param name: Original pool name. :param new_name: new name of pool. :param uuid: new pool uuid, if None libvirt will generate automatically. :return: True/False or raise LibvirtXMLError
pool_undefine
()¶
Undefine pool with libvirt retaining XML in instance
classvirttest.libvirt_xml.pool_xml.``PoolXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for PoolXML class.
Properties:
pool_type:
string, pool type
name:
string, pool name
uuid:
string, pool uuid
capacity:
integer, pool total capacity
allocation:
integer, pool allocated capacity
available:
integer, pool available capacity
source:
PoolSourceXML instanc
target:
string, target path of pool
allocation
¶
available
¶
capacity
¶
del_source
()¶
get_source
()¶
group
¶
mode
¶
name
¶
owner
¶
pool_type
¶
set_source
(value)¶
source
¶
target_path
¶
uuid
¶
classvirttest.libvirt_xml.pool_xml.``SourceXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Source block in pool xml, optionally containing different elements and attributes which dependent on pool type.
Create new SourceXML instance.
adp_name
¶
adp_parent
¶
adp_type
¶
adp_wwnn
¶
adp_wwpn
¶
auth_type
¶
auth_username
¶
device_path
¶
dir_path
¶
format_type
¶
host_name
¶
hosts
¶
staticmarshal_from_host
(item, index, libvirtxml)¶
Convert a dictionary into a tag + attributes
staticmarshal_to_host
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes into a dictionary
secret_usage
¶
secret_uuid
¶
vg_name
¶
virttest.libvirt_xml.secret_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatsecret.html
classvirttest.libvirt_xml.secret_xml.``SecretXML
(ephemeral='yes', private='no', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.secret_xml.SecretXMLBase
Manipulators of a secret through it’s XML definition.
Initialize new instance with empty XML
staticget_secret_details_by_uuid
(uuid, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return secret XML by secret’s uuid
Parameters:
uuid – secret’s uuid
Returns:
secret XML dictionary
staticnew_from_secret_dumpxml
(uuid, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new SecretXML instance from virsh secret-dumpxml command
Parameters:
- uuid – secret’s uuid
- virsh_instance – virsh module or instance to use
Returns:
New initialized SecretXML instance
classvirttest.libvirt_xml.secret_xml.``SecretXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for SecretXML class.
Properties:
secret_ephemeral:
yes or no, operates on XML secret tag
secret_private:
yes or no, operates on XML secret tag
description:
string, operates on description tag
uuid:
string, operates on uuid tag
auth_type:
string, sercet authentication type, operates on auth tag
auth_username:
string, secret authentication username, operates on auth tag
usage:
string, operates on usage tag
target:
string, sub-tag of the usage tag, operates on target tag
volume:
the volume file path, sub-tag of the usage tag, operates on volume tag
auth_type
¶
auth_username
¶
description
¶
secret_ephemeral
¶
secret_private
¶
target
¶
usage
¶
usage_name
¶
uuid
¶
volume
¶
virttest.libvirt_xml.snapshot_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatsnapshot.html
classvirttest.libvirt_xml.snapshot_xml.``SnapshotXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.snapshot_xml.SnapshotXMLBase
Manipulators of a snapshot through it’s XML definition.
Initialize new instance with empty XML
classSnapDiskXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.devices.disk.Disk
Manipulators disk xml in snapshot xml definition. Most properties are inherit from parent class Disk.
Properties:
disk_name:
string, operates on disk name under disk tag
Initialize new instance with empty XML
address
¶
auth
¶
blockio
¶
boot
¶
device
¶
disk_name
¶
driver
¶
encryption
¶
geometry
¶
iotune
¶
mirror
¶
product
¶
rawio
¶
readonly
¶
ready
¶
serial
¶
sgio
¶
share
¶
snapshot
¶
source
¶
target
¶
transient
¶
vendor
¶
wwn
¶
SnapshotXML.``del_disks
()¶
Remove all disks
staticSnapshotXML.``new_from_snapshot_dumpxml
(name, snap_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new SnapshotXML instance from virsh snapshot-dumpxml command
Parameters:
- name – vm’s name
- snap_name – snapshot name
- uuid – snapshot’s uuid
- virsh_instance – virsh module or instance to use
Returns:
New initialized SnapshotXML instance
SnapshotXML.``set_disks
(value_list)¶
Define disks based on contents of SnapDiskXML instance list
Parameters:
value_list – SnapDiskXML instance list
classvirttest.libvirt_xml.snapshot_xml.``SnapshotXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for SnapshotXML class.
Properties:
snap_name:
string, operates on snapshot name tag
description:
string, operates on snapshot description tag
mem_snap_type:
string, operates snapshot type under memory tag, ‘internal’, ‘external’ or ‘no’
mem_file:
string, operates snapshot file path under memory tag
creation_time:
string, operates on creationTime tag
state:
string, operates snapshot state tag
parent_name:
string, parent snapshot name tag under parent tag
creation_time
¶
description
¶
mem_file
¶
mem_snap_type
¶
parent_name
¶
snap_name
¶
state
¶
virttest.libvirt_xml.sysinfo_xml module¶
Module simplifying manipulation of sysinfo XML
classvirttest.libvirt_xml.sysinfo_xml.``SysinfoXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Handler of libvirt sysinfo xml.
Initialize new instance with empty XML
get_all_processors
()¶
Get all processors dict with entry name as key.
Returns:
all processors dict with entry name as key
virttest.libvirt_xml.vm_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatdomain.html
classvirttest.libvirt_xml.vm_xml.``VMCPUTuneXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
CPU tuning tag XML class
Elements:
vcpupins: list of dict - vcpu, cpuset emulatorpin: attribute - cpuset shares: int period: int quota: int emulator_period: int emulator_quota: int
emulator_period
¶
emulator_quota
¶
emulatorpin
¶
iothreadpins
¶
staticmarshal_from_iothreadpins
(item, index, libvirtxml)¶
Convert a dict to iothreadpin tag and attributes.
staticmarshal_from_vcpupins
(item, index, libvirtxml)¶
Convert a dict to vcpupin tag and attributes.
staticmarshal_to_iothreadpins
(tag, attr_dict, index, libvirtxml)¶
Convert a iothreadpin tag and attributes to a dict.
staticmarshal_to_vcpupins
(tag, attr_dict, index, libvirtxml)¶
Convert a vcpupin tag and attributes to a dict.
period
¶
quota
¶
shares
¶
vcpupins
¶
classvirttest.libvirt_xml.vm_xml.``VMCPUXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Higher-level manipulations related to VM’s XML(CPU)
Create new VMCPU XML instance
add_feature
(name, policy='')¶
Add a feature element to xml
Parameters:
- name – New feature name
- policy – New feature policy
staticcheck_feature_name
(value)¶
Check feature name valid or not.
Parameters:
value – Feature name
Returns:
True if check pass
fallback
¶
feature_list
¶
get_feature
(num)¶
Get a feature element from feature list by number
Returns:
Feature element
get_feature_list
()¶
Accessor method for feature_list property (in __slots__)
get_feature_name
(num)¶
Get feature name
Parameters:
num – Number in feature list
Returns:
Feature name
get_feature_policy
(num)¶
Get feature policy
Parameters:
num – Number in feature list
Returns:
Feature policy
staticmarshal_from_cell
(item, index, libvirtxml)¶
Convert a dict to cell tag and attributes.
staticmarshal_to_cell
(tag, attr_dict, index, libvirtxml)¶
Convert a cell tag and attributes to a dict.
match
¶
mode
¶
model
¶
numa_cell
¶
remove_feature
(num)¶
Remove a feature from xml
Parameters:
num – Number in feature list
remove_numa_cells
()¶
Remove numa cells from xml
set_feature
(num, name='', policy='')¶
Set feature name (and policy) to xml
Parameters:
- num – Number in feature list
- name – New feature name
- policy – New feature policy
topology
¶
vendor
¶
classvirttest.libvirt_xml.vm_xml.``VMClockXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>, offset='utc')¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
Higher-level manipulations related to VM’s XML(Clock)
Create new VMClock XML instance
classTimerXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>, timer_name='tsc')¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
Timer element of clock
Create new TimerXML instance
catchup_limit
¶
catchup_slew
¶
catchup_threshold
¶
frequency
¶
mode
¶
name
¶
present
¶
tickpolicy
¶
track
¶
update
(attr_dict)¶
VMClockXML.``adjustment
¶
VMClockXML.``from_dumpxml
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Helper to load xml from domain.
staticVMClockXML.``marshal_from_timer
(item, index, libvirtxml)¶
Convert a TimerXML instance into tag + attributes
staticVMClockXML.``marshal_to_timer
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes to a TimerXML instance
VMClockXML.``offset
¶
VMClockXML.``timers
¶
VMClockXML.``timezone
¶
classvirttest.libvirt_xml.vm_xml.``VMFeaturesXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Class to access <features> tag of domain XML.
Elements:
feature_list list of top level element hyperv_relaxed: attribute - state hyperv_vapic: attribute - state hyperv_spinlocks: attributes - state, retries kvm_hidden: attribute - state pvspinlock: attribute - state
add_feature
(name, attr_name='', attr_value='')¶
Add a feature element to xml
Params name:
Feature name
feature_list
¶
get_feature_list
()¶
Return all features(top level elements) in xml
has_feature
(name)¶
Return true if the given feature exist in xml
hyperv_relaxed_state
¶
hyperv_spinlocks_retries
¶
hyperv_spinlocks_state
¶
hyperv_vapic_state
¶
kvm_hidden_state
¶
pvspinlock_state
¶
remove_feature
(name)¶
Remove a feature element from xml
Params name:
Feature name
classvirttest.libvirt_xml.vm_xml.``VMHugepagesXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
hugepages element
classPageXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
Page element of hugepages
Create new PageXML instance
nodeset
¶
size
¶
unit
¶
update
(attr_dict)¶
staticVMHugepagesXML.``marshal_from_page
(item, index, libvirtxml)¶
Convert a PageXML instance into tag + attributes
staticVMHugepagesXML.``marshal_to_page
(tag, attr_dict, index, libvirtxml)¶
Convert a tag + attributes to a PageXML instance
VMHugepagesXML.``pages
¶
classvirttest.libvirt_xml.vm_xml.``VMIothreadidsXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
iothreadids tag XML class
Elements:
iothread
iothread
¶
staticmarshal_from_iothreads
(item, index, libvirtxml)¶
Convert a string to iothread tag and attributes.
staticmarshal_to_iothreads
(tag, attr_dict, index, libvirtxml)¶
Convert a iothread tag and attributes to a string.
classvirttest.libvirt_xml.vm_xml.``VMMemBackingXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vm_xml.VMXML
memoryBacking tag XML class
Elements:
hugepages nosharepages locked
hugepages
¶
locked
¶
nosharepages
¶
classvirttest.libvirt_xml.vm_xml.``VMMemTuneXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Memory Tuning tag XML class
Element:
hard_limit: int hard_limit_unit: attribute soft_limit: int soft_limit_unit: attribute swap_hard_limit: int swap_limit_unit: attribute min_guarantee: int min_guarantee_unit: attribute
hard_limit
¶
hard_limit_unit
¶
min_guarantee
¶
min_guarantee_unit
¶
soft_limit
¶
soft_limit_unit
¶
swap_hard_limit
¶
swap_limit_unit
¶
classvirttest.libvirt_xml.vm_xml.``VMOSXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Class to access <os> tag of domain XML.
Elements:
type: text attributes - arch, machine loader: path boots: list attributes - dev bootmenu: attributes - enable smbios: attributes - mode bios: attributes - useserial, rebootTimeout init: text bootloader: text bootloader_args: text kernel: text initrd: text cmdline: text dtb: text
TODO:
initargs: list
arch
¶
bios_reboot_timeout
¶
bios_useserial
¶
bootloader
¶
bootloader_args
¶
bootmenu_enable
¶
boots
¶
cmdline
¶
dtb
¶
init
¶
initargs
¶
initrd
¶
kernel
¶
loader
¶
machine
¶
staticmarshal_from_boots
(item, index, libvirtxml)¶
Convert a string to boot tag and attributes.
staticmarshal_to_boots
(tag, attr_dict, index, libvirtxml)¶
Convert a boot tag and attributes to a string.
smbios_mode
¶
type
¶
classvirttest.libvirt_xml.vm_xml.``VMPMXML
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
VM power management tag XML class
Elements:
suspend-to-disk: attribute - enabled suspend-to-mem: attribute - enabled
disk_enabled
¶
mem_enabled
¶
classvirttest.libvirt_xml.vm_xml.``VMXML
(hypervisor_type='kvm', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vm_xml.VMXMLBase
Higher-level manipulations related to VM’s XML or guest/host state
Create new VM XML instance
add_device
(value)¶
Add a device into VMXML.
Parameters:
value – instance of device in libvirt_xml/devices/
add_hostdev
(source_address, mode='subsystem', hostdev_type='pci', managed='yes', boot_order=None)¶
Add a hostdev device to guest.
Parameters:
source_address – A dict include slot, function, bus, domain
staticadd_security_info
(vmxml, passwd, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Add passwd for graphic
Parameters:
- vmxml – instance of VMXML
- passwd – Password you want to set
staticcheck_cpu_mode
(mode)¶
Check input cpu mode invalid or not.
Parameters:
mode – the mode of cpu:’host-model’...
staticcheck_disk_exist
(vm_name, disk_src, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Check if given disk exist in VM.
Parameters:
- vm_name – Domain name.
- disk_src – Domian disk source path or darget dev.
Returns:
True/False
staticcheck_disk_type
(vm_name, disk_src, disk_type, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Check if disk type is correct in VM
Parameters:
- vm_name – Domain name.
- disk_src – Domain disk source path
- disk_type – Domain disk type
Returns:
True/False
define
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Define VM with virsh from this instance
del_device
(value, by_tag=False)¶
Remove a device from VMXML
Parameters:
- value – instance of device in libvirt_xml/devices/ or device tag
- by_tag – Boolean value. True for delete device by tag name
staticdel_memoryBacking_tag
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Remove the memoryBacking tag from a domain
get_agent_channels
()¶
Get all qemu guest agent channels
staticget_blkdevio_params
(vm_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s block I/O tuning setting from XML definition
staticget_blkio_params
(vm_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s block I/O setting from XML definition
get_cpu_topology
()¶
Return cpu topology dict
staticget_device_class
(type_name)¶
Return class that handles type_name devices, or raise exception.
staticget_disk_address
(vm_name, disk_target, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get disk address in VM
Parameters:
- vm_name – Domain name.
- disk_target – Domain disk target
Returns:
disk address
get_disk_all
()¶
Return VM’s disk from XML definition, None if not set
staticget_disk_attr
(vm_name, target, tag, attr, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get value of disk tag attribute for a given target dev.
staticget_disk_blk
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get block device of a defined VM’s disks.
Parameters:
vm_name – Name of defined vm.
staticget_disk_count
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get count of VM’s disks.
Parameters:
vm_name – Name of defined vm.
staticget_disk_serial
(vm_name, disk_target, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get disk serial in VM
Parameters:
- vm_name – Domain name.
- disk_target – Domain disk target
Returns:
disk serial
staticget_disk_source
(vm_name, option='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get block device of a defined VM’s disks.
Parameters:
- vm_name – Name of defined vm.
- option – extra option.
staticget_first_mac_by_name
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Convenience method for getting first mac of a defined VM
Param:
vm_name: Name of defined vm to get mac
get_graphics_devices
(type_name='')¶
Get all graphics devices or desired type graphics devices
Parameters:
type_name – graphic type, vnc or spice
get_iface_all
()¶
Get a dict with interface’s mac and node.
staticget_iface_by_mac
(vm_name, mac, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Get the interface if mac is matched.
Parameters:
- vm_name – Name of defined vm.
- mac – a mac address.
Returns:
return a dict include main interface’s features
staticget_iface_dev
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s interface device from XML definition, None if not set
staticget_iftune_params
(vm_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s interface tuning setting from XML definition
get_net_all
()¶
Return VM’s net from XML definition, None if not set
staticget_net_dev
(vm_name)¶
Get net device of a defined VM’s nets.
Parameters:
vm_name – Name of defined vm.
staticget_numa_memnode_params
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s numa memnode setting from XML definition
staticget_numa_memory_params
(vm_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return VM’s numa memory setting from XML definition
get_primary_serial
()¶
Get a dict with primary serial features.
staticnew_from_dumpxml
(vm_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new VMXML instance from virsh dumpxml command
Parameters:
- vm_name – Name of VM to dumpxml
- virsh_instance – virsh module or instance to use
Returns:
New initialized VMXML instance
staticnew_from_inactive_dumpxml
(vm_name, options='', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new VMXML instance of inactive domain from virsh dumpxml command
Parameters:
- vm_name – Name of VM to dumpxml
- options – virsh dumpxml command’s options
- virsh_instance – virsh module or instance to use
Returns:
New initialized VMXML instance
remove_agent_channels
()¶
Delete all channels for guest agent
remove_all_boots
()¶
Remove all OS boots
remove_all_device_by_type
(device_type)¶
Remove all devices of a given type.
Parameters:
type – Type name for devices should be removed.
remove_all_graphics
()¶
Remove all graphics devices.
set_agent_channel
(src_path=None, tgt_name='org.qemu.guest_agent.0', ignore_exist=False)¶
Add a channel for guest agent if non exists.
Parameters:
- src_path – Source path of the channel
- tgt_name – Target name of the channel
- ignore_exist – Whether add a channel even if another already exists.
staticset_cpu_mode
(vm_name, mode='host-model')¶
Set cpu’s mode of VM.
Parameters:
- vm_name – Name of defined vm to set cpu mode.
- mode – the mode of cpu:’host-model’...
staticset_graphics_attr
(vm_name, attr, index=0, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Set attributes of graphics label of vm xml
Parameters:
- vm_name – name of vm
- attr – attributes dict to set
- index – index of graphics label to set
- virsh_instance – virsh instance
staticset_memoryBacking_tag
(vm_name, hpgs=True, nosp=False, locked=False, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
let the guest using hugepages.
staticset_multiqueues
(vm_name, queues, index=0)¶
Set multiqueues for interface.
Parameters:
- queues – the count of queues for interface
- index – the index of interface
staticset_pm_suspend
(vm_name, mem='yes', disk='yes', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Add/set pm suspend Support
Params vm_name:
Name of defined vm
Params mem:
Enable suspend to memory
Params disk:
Enable suspend to disk
staticset_primary_serial
(vm_name, dev_type, port, path=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Set primary serial’s features of vm_name.
Parameters:
- vm_name – Name of defined vm to set primary serial.
-
dev_type – the type of
serial:pty,file...
- port – the port of serial
- path – the path of serial, it is not necessary for pty
staticset_vm_vcpus
(vm_name, value, current=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Convenience method for updating ‘vcpu’ and ‘current’ attribute property of a defined VM
Parameters:
- vm_name – Name of defined vm to change vcpu elemnet data
- value – New data value, None to delete.
- current – New current value, None will not change current value
sync
(options=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Rebuild VM with the config file.
undefine
(options=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Undefine this VM with libvirt retaining XML in instance
staticvm_rename
(vm, new_name, uuid=None, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Rename a vm from its XML.
Parameters:
- vm – VM class type instance
- new_name – new name of vm
- uuid – new_vm’s uuid, if None libvirt will generate.
Returns:
a new VM instance or raise LibvirtXMLError
classvirttest.libvirt_xml.vm_xml.``VMXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for VMXML class properties (items in __slots__)
Properties:
hypervisor_type: string, hypervisor type name
get: return domain’s type attribute value set: change domain type attribute value del: raise xcepts.LibvirtXMLError
vm_name: string, name of the vm
get: return text value of name tag set: set text value of name tag del: raise xcepts.LibvirtXMLError
uuid: string, uuid string for vm
get: return text value of uuid tag set: set text value for (new) uuid tag (unvalidated) del: remove uuid tag
vcpu, max_mem, current_mem, iothreads: integers
get: returns integer set: set integer del: removes tag
dumpcore: string, control guest OS memory dump
get: return text value set: set ‘on’ or ‘off’ for guest OS memory dump del: removes tag
numa_memory: dictionary
get: return dictionary of numatune/memory attributes set: set numatune/memory attributes from dictionary del: remove numatune/memory tag
numa_memnode: list dict of memnode attributes cellid, mode and nodeset
get: return list of dictionary with numatune/memnode attributes set: set multiple numatune/memnode attributes from dictionary list del: remove numatune/memnode tag
on_poweroff: string, action to take when the guest requests a poweroff
get: returns text value of on_poweroff tag set: set test of on_poweroff tag del: remove on_poweroff tag
on_reboot: string, action to take when the guest requests a reboot
get: returns text value of on_reboot tag set: set test of on_reboot tag del: remove on_reboot tag
on_crash: string, action to take when the guest crashes
get: returns text value of on_crash tag set: set test of on_crash tag del: remove on_crash tag
devices: VMXMLDevices (list-like)
get: returns VMXMLDevices instance for all devices set: Define all devices from VMXMLDevices instance del: remove all devices
cputune: VMCPUTuneXML
get: return VMCPUTuneXML instance for the domain. set: Define cputune tag from a VMCPUTuneXML instance. del: remove cputune tag
cpu: VMCPUXML
get: return VMCPUXML instance for the domain. set: Define cpu tag from a VMCPUXML instance. del: remove cpu tag
current_vcpu: string, ‘current’ attribute of vcpu tag
get: return a string for ‘current’ attribute of vcpu set: change ‘current’ attribute of vcpu del: remove ‘current’ attribute of vcpu
placement: string, ‘placement’ attribute of vcpu tag
get: return a string for ‘placement’ attribute of vcpu set: change ‘placement’ attribute of vcpu del: remove ‘placement’ attribute of vcpu
cpuset: string, ‘cpuset’ attribute of vcpu tag
get: return a string for ‘cpuset’ attribute of vcpu set: change ‘cpuset’ attribute of vcpu del: remove ‘cpuset’ attribute of vcpu
emulatorpin: string, cpuset value (see man virsh: cpulist)
get: return text value of cputune/emulatorpin attributes set: set cputune/emulatorpin attributes from string del: remove cputune/emulatorpin tag
features: VMFeaturesXML
get: return VMFeaturesXML instances for the domain. set: define features tag from a VMFeaturesXML instances. del: remove features tag
mem_backing: VMMemBackingXML
get: return VMMemBackingXML instances for the domain. set: define memoryBacking tag from a VMMemBackingXML instances. del: remove memoryBacking tag
max_mem_unit: string, ‘unit’ attribute of memory
get: return text value of memory unit attribute set: set memory unit attribute del: remove memory unit attribute
current_mem_unit: string, ‘unit’ attribute of memory
get: return text value of current_memory unit attribute set: set current_memory unit attribute del: remove current_memory unit attribute
memtune: VMMemTuneXML
get: return VMMemTuneXML instance for the domain. set: Define memtune tag from a VMCPUTuneXML instance. del: remove memtune tag
cpu
¶
cpuset
¶
cputune
¶
current_mem
¶
current_mem_unit
¶
current_vcpu
¶
del_controller
(controller_type=None)¶
Delete controllers according controller type
Returns:
None if deleting all controllers
del_devices
()¶
Remove all devices
del_seclabel
()¶
Remove the seclabel tag from a domain
devices
¶
dumpcore
¶
features
¶
get_devices
(device_type=None)¶
Put all nodes of devices into a VMXMLDevices instance.
get_seclabel
()¶
Return seclabel + child attribute dict list or raise LibvirtXML error
Returns:
None if no seclabel in xml, list contains dict of seclabel’s attributs and children.
hypervisor_type
¶
iothreadids
¶
iothreads
¶
staticmarshal_from_memnode
(item, index, libvirtxml)¶
Convert a dict to memnode tag and attributes.
staticmarshal_to_memnode
(tag, attr_dict, index, libvirtxml)¶
Convert a memnode tag and attributes to a dict.
max_mem
¶
max_mem_rt
¶
max_mem_rt_slots
¶
max_mem_rt_unit
¶
max_mem_unit
¶
mb
¶
memtune
¶
numa_memnode
¶
numa_memory
¶
on_crash
¶
on_poweroff
¶
on_reboot
¶
os
¶
placement
¶
pm
¶
seclabel
¶
set_controller
(controller_list)¶
Set controller of vm. Create new controllers use xmltreefile from given controller_list.
set_devices
(value)¶
Define devices based on contents of VMXMLDevices instance
set_seclabel
(seclabel_dict_list)¶
Set seclabel of vm. Delete all seclabels if seclabel exists, create new seclabels use dict values from given seclabel_dict_list in xmltreefile.
uuid
¶
vcpu
¶
vm_name
¶
classvirttest.libvirt_xml.vm_xml.``VMXMLDevices
¶
Bases: list
List of device instances from classes handed out by librarian.get()
append
(value)¶
by_device_tag
(tag)¶
extend
(iterable)¶
virttest.libvirt_xml.vol_xml module¶
Module simplifying manipulation of XML described at http://libvirt.org/formatstorage.html#StorageVol
classvirttest.libvirt_xml.vol_xml.``VolXML
(vol_name='default', virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.vol_xml.VolXMLBase
Manipulators of a Virtual Vol through it’s XML definition.
Initialize new instance with empty XML
classEncryption
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Encryption volume XML class
Properties:
format:
string.
secret:
dict, keys: type, uuid
format
¶
secret
¶
VolXML.``create
(pool_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Create volume with virsh from this instance
staticVolXML.``get_vol_details_by_name
(vol_name, pool_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return volume xml dictionary by Vol’s uuid or name.
Parameters:
vol_name – Vol’s name
Returns:
volume xml dictionary
VolXML.``new_encryption
(**dargs)¶
Return a new volume encryption instance and set properties from dargs
staticVolXML.``new_from_vol_dumpxml
(vol_name, pool_name, virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Return new VolXML instance from virsh vol-dumpxml command
Parameters:
- vol_name – Name of vol to vol-dumpxml
- virsh_instance – virsh module or instance to use
Returns:
New initialized VolXML instance
staticVolXML.``new_vol
(**dargs)¶
Return a new VolXML instance and set properties from dargs
Parameters:
dargs – param dictionary
Returns:
new VolXML instance
classvirttest.libvirt_xml.vol_xml.``VolXMLBase
(virsh_instance=<module 'virttest.virsh' from '/tmp/avocado-vt/virttest/virsh.py'>)¶
Bases: virttest.libvirt_xml.base.LibvirtXMLBase
Accessor methods for VolXML class.
Properties:
name: string, operates on XML name tag key: string, operates on key tag capacity: integer, operates on capacity attribute of capacity tag allocation: integer, operates on allocation attribute of allocation format: string, operates on type attribute of format tag path: string, operates on path attribute of path tag owner, integer, operates on owner attribute of owner tag group, integer, operates on group attribute of group tag mode: string, operates on mode attribute of mode tag label: string, operates on label attribute of label tag compat: string, operates on compat attribute of label tag lazy_refcounts: bool, True/False encryption: VolXMLBase.Encryption instance. capacity_unit: string, operates on unit attribute of capacity tag
allocation
¶
capacity
¶
capacity_unit
¶
compat
¶
encryption
¶
format
¶
group
¶
key
¶
label
¶
lazy_refcounts
¶
mode
¶
name
¶
owner
¶
path
¶
virttest.libvirt_xml.xcepts module¶
Module of common exceptions used in libvirt_xml package
exceptionvirttest.libvirt_xml.xcepts.``LibvirtXMLAccessorError
(details='')¶
Bases: virttest.libvirt_xml.xcepts.LibvirtXMLError
LibvirtXMLError related to an accessor generator class/method
exceptionvirttest.libvirt_xml.xcepts.``LibvirtXMLError
(details='')¶
Bases: exceptions.Exception
Error originating within libvirt_xml module
exceptionvirttest.libvirt_xml.xcepts.``LibvirtXMLForbiddenError
(details='')¶
Bases: virttest.libvirt_xml.xcepts.LibvirtXMLError
LibvirtXMLError raised when operating on a property is prohibited
exceptionvirttest.libvirt_xml.xcepts.``LibvirtXMLNotFoundError
(details='')¶
Bases: virttest.libvirt_xml.xcepts.LibvirtXMLError
LibvirtXMLError related when an element cannot be found
Module contents¶
Intermediate module for working with XML-related virsh functions/methods.
The intention of this module is to hide the details of working with XML from test module code. Helper methods are all high-level and not condusive to direct use in error-testing. However, access to a virsh instance is available.
All classes defined here should inherit from LibvirtXMLBase and utilize the property-like interface provided by utils_misc.PropCanBase to manipulate XML from the ‘xml’ property. Please refer to the xml_utils module documentation for more information on working with XMLTreeFile instances. Please see the virsh and utils_misc modules for information on working with Virsh and PropCanBase classes.
All properties defined in __slots__ are intended for test-module manipulation. External calling of accessor methods isn’t forbidden, but discouraged. Instead, test modules should use normal reference, assignment, and delete operations on instance properties as if they were attributes. It’s up to the test if it uses the dict-like or instance-attribute interface.
Internally, accessor methods (get_*(), set_*(), & del_*()) should always use __dict_get__(), __dict_set__(), and/or __dict_del__() to manipulate properties (otherwise infinite recursion can occur). In some cases, where class or instance attributes are needed (ousdie of __slots__) they must be accessed via the __super_set__(), __super_get__(), and/or __super_del__() methods. None of the __super_*() or the __dict_*() methods are intended for use by test-modules.
Errors originating beneath this module (e.g. w/in virsh or libvirt_vm) should not be caught (so caller can test for them). Errors detected within this module should raise LibvirtXMLError or a subclass.
-
virttest.libvirt_xml package
- Subpackages
- Submodules
- virttest.libvirt_xml.accessors module
- virttest.libvirt_xml.base module
- virttest.libvirt_xml.capability_xml module
- virttest.libvirt_xml.network_xml module
- virttest.libvirt_xml.nodedev_xml module
- virttest.libvirt_xml.nwfilter_xml module
- virttest.libvirt_xml.pool_xml module
- virttest.libvirt_xml.secret_xml module
- virttest.libvirt_xml.snapshot_xml module
- virttest.libvirt_xml.sysinfo_xml module
- virttest.libvirt_xml.vm_xml module
- virttest.libvirt_xml.vol_xml module
- virttest.libvirt_xml.xcepts module
- Module contents
virttest.libvirt_xml.devices package
© Copyright 2014, Red Hat. Created using Sphinx 1.5.1.