"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/modules/virt.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

virt.py  (salt-3002.1):virt.py  (salt-3002.2)
skipping to change at line 5092 skipping to change at line 5092
def _parse_caps_guest(guest): def _parse_caps_guest(guest):
""" """
Parse the <guest> element of the connection capabilities XML Parse the <guest> element of the connection capabilities XML
""" """
arch_node = guest.find("arch") arch_node = guest.find("arch")
result = { result = {
"os_type": guest.find("os_type").text, "os_type": guest.find("os_type").text,
"arch": {"name": arch_node.get("name"), "machines": {}, "domains": {}}, "arch": {"name": arch_node.get("name"), "machines": {}, "domains": {}},
} }
child = None
for child in arch_node: for child in arch_node:
if child.tag == "wordsize": if child.tag == "wordsize":
result["arch"]["wordsize"] = int(child.text) result["arch"]["wordsize"] = int(child.text)
elif child.tag == "emulator": elif child.tag == "emulator":
result["arch"]["emulator"] = child.text result["arch"]["emulator"] = child.text
elif child.tag == "machine": elif child.tag == "machine":
_caps_add_machine(result["arch"]["machines"], child) _caps_add_machine(result["arch"]["machines"], child)
elif child.tag == "domain": elif child.tag == "domain":
domain_type = child.get("type") domain_type = child.get("type")
domain = {"emulator": None, "machines": {}} domain = {"emulator": None, "machines": {}}
skipping to change at line 5114 skipping to change at line 5115
domain["emulator"] = emulator_node.text domain["emulator"] = emulator_node.text
for machine in child.findall("machine"): for machine in child.findall("machine"):
_caps_add_machine(domain["machines"], machine) _caps_add_machine(domain["machines"], machine)
result["arch"]["domains"][domain_type] = domain result["arch"]["domains"][domain_type] = domain
# Note that some features have no default and toggle attributes. # Note that some features have no default and toggle attributes.
# This may not be a perfect match, but represent them as enabled by default # This may not be a perfect match, but represent them as enabled by default
# without possibility to toggle them. # without possibility to toggle them.
# Some guests may also have no feature at all (xen pv for instance) # Some guests may also have no feature at all (xen pv for instance)
features_nodes = guest.find("features") features_nodes = guest.find("features")
if features_nodes is not None: if features_nodes is not None and child is not None:
result["features"] = { result["features"] = {
child.tag: { child.tag: {
"toggle": True if child.get("toggle") == "yes" else False, "toggle": child.get("toggle", "no") == "yes",
"default": True if child.get("default") == "no" else True, "default": child.get("default", "on") == "on",
} }
for child in features_nodes for child in features_nodes
} }
return result return result
def _parse_caps_cell(cell): def _parse_caps_cell(cell):
""" """
Parse the <cell> nodes of the connection capabilities XML output. Parse the <cell> nodes of the connection capabilities XML output.
""" """
result = {"id": int(cell.get("id"))} result = {"id": int(cell.get("id"))}
mem_node = cell.find("memory") mem_node = cell.find("memory")
if mem_node is not None: if mem_node is not None:
skipping to change at line 5508 skipping to change at line 5508
:param password: password to connect with, overriding defaults :param password: password to connect with, overriding defaults
CLI Example: CLI Example:
.. code-block:: bash .. code-block:: bash
salt '*' virt.all_capabilities salt '*' virt.all_capabilities
""" """
conn = __get_conn(**kwargs) conn = __get_conn(**kwargs)
result = {}
try: try:
host_caps = ElementTree.fromstring(conn.getCapabilities()) host_caps = ElementTree.fromstring(conn.getCapabilities())
domains = [ domains = [
[ [
(guest.get("arch", {}).get("name", None), key) (guest.get("arch", {}).get("name", None), key)
for key in guest.get("arch", {}).get("domains", {}).keys() for key in guest.get("arch", {}).get("domains", {}).keys()
] ]
for guest in [ for guest in [
_parse_caps_guest(guest) for guest in host_caps.findall("guest") _parse_caps_guest(guest) for guest in host_caps.findall("guest")
] ]
skipping to change at line 5537 skipping to change at line 5536
}, },
"domains": [ "domains": [
_parse_domain_caps( _parse_domain_caps(
ElementTree.fromstring( ElementTree.fromstring(
conn.getDomainCapabilities(None, arch, None, domain) conn.getDomainCapabilities(None, arch, None, domain)
) )
) )
for (arch, domain) in flattened for (arch, domain) in flattened
], ],
} }
return result
finally: finally:
conn.close() conn.close()
return result
def cpu_baseline(full=False, migratable=False, out="libvirt", **kwargs): def cpu_baseline(full=False, migratable=False, out="libvirt", **kwargs):
""" """
Return the optimal 'custom' CPU baseline config for VM's on this minion Return the optimal 'custom' CPU baseline config for VM's on this minion
.. versionadded:: 2016.3.0 .. versionadded:: 2016.3.0
:param full: Return all CPU features rather than the ones on top of the clos est CPU model :param full: Return all CPU features rather than the ones on top of the clos est CPU model
:param migratable: Exclude CPU features that are unmigratable (libvirt 2.13+ ) :param migratable: Exclude CPU features that are unmigratable (libvirt 2.13+ )
:param out: 'libvirt' (default) for usable libvirt XML definition, 'salt' fo r nice dict :param out: 'libvirt' (default) for usable libvirt XML definition, 'salt' fo r nice dict
:param connection: libvirt connection URI, overriding defaults :param connection: libvirt connection URI, overriding defaults
 End of changes. 7 change blocks. 
7 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)