File drop-wrong-virt-capabilities-code-after-rebasing-pat.patch of Package salt
From 79ae019ac7515614c6fbc620e66575f015bc447d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 5 Jan 2021 09:34:45 +0000
Subject: [PATCH] Drop wrong virt capabilities code after rebasing
patches
---
salt/modules/virt.py | 66 --------------------------------------------
1 file changed, 66 deletions(-)
diff --git a/salt/modules/virt.py b/salt/modules/virt.py
index e3960a5a90..786bfa1e58 100644
--- a/salt/modules/virt.py
+++ b/salt/modules/virt.py
@@ -143,7 +143,6 @@ import salt.utils.xmlutil as xmlutil
import salt.utils.yaml
from salt._compat import ElementTree, ipaddress, saxutils
from salt.exceptions import CommandExecutionError, SaltInvocationError
-from salt.ext import six
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
from salt.ext.six.moves.urllib.parse import urlparse, urlunparse
from salt.utils.virt import check_remote, download_remote
@@ -5416,71 +5415,6 @@ def _parse_domain_caps(caps):
return result
-def _parse_domain_caps(caps):
- """
- Parse the XML document of domain capabilities into a structure.
- """
- result = {
- "emulator": caps.find("path").text if caps.find("path") is not None else None,
- "domain": caps.find("domain").text if caps.find("domain") is not None else None,
- "machine": caps.find("machine").text
- if caps.find("machine") is not None
- else None,
- "arch": caps.find("arch").text if caps.find("arch") is not None else None,
- }
-
-
-def all_capabilities(**kwargs):
- """
- Return the host and domain capabilities in a single call.
-
- .. versionadded:: 3001
-
- :param connection: libvirt connection URI, overriding defaults
- :param username: username to connect with, overriding defaults
- :param password: password to connect with, overriding defaults
-
- CLI Example:
-
- .. code-block:: bash
-
- salt '*' virt.all_capabilities
-
- """
- conn = __get_conn(**kwargs)
- try:
- host_caps = ElementTree.fromstring(conn.getCapabilities())
- domains = [
- [
- (guest.get("arch", {}).get("name", None), key)
- for key in guest.get("arch", {}).get("domains", {}).keys()
- ]
- for guest in [
- _parse_caps_guest(guest) for guest in host_caps.findall("guest")
- ]
- ]
- flattened = [pair for item in (x for x in domains) for pair in item]
- result = {
- "host": {
- "host": _parse_caps_host(host_caps.find("host")),
- "guests": [
- _parse_caps_guest(guest) for guest in host_caps.findall("guest")
- ],
- },
- "domains": [
- _parse_domain_caps(
- ElementTree.fromstring(
- conn.getDomainCapabilities(None, arch, None, domain)
- )
- )
- for (arch, domain) in flattened
- ],
- }
- return result
- finally:
- conn.close()
-
-
def domain_capabilities(emulator=None, arch=None, machine=None, domain=None, **kwargs):
"""
Return the domain capabilities given an emulator, architecture, machine or virtualization type.
--
2.29.2