We've got some updates regarding OBS and GitHub/GitLab integration. Have a look and let us know what you think! 🧐

https://openbuildservice.org/2021/06/14/scm-integration-improvements/

File virt._get_domain-don-t-raise-an-exception-if-there-i.patch of Package salt

From 3cb366a1f777a9c8ee1a1c679c65d67fe5b89db0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
Date: Tue, 17 Mar 2020 11:01:48 +0100
Subject: [PATCH] virt._get_domain: don't raise an exception if there
 is no VM

Raising an exception if there is no VM in _get_domain makes sense if
looking for some VMs, but not when listing all VMs.
---
 tests/unit/modules/test_virt.py | 155 --------------------------------
 1 file changed, 155 deletions(-)

diff --git a/tests/unit/modules/test_virt.py b/tests/unit/modules/test_virt.py
index db6ba007b7..a5c876e27d 100644
--- a/tests/unit/modules/test_virt.py
+++ b/tests/unit/modules/test_virt.py
@@ -4898,158 +4898,3 @@ class VirtTestCase(TestCase, LoaderModuleMockMixin):
             "vm2",
             inactive=False,
         )
-
-    def test_volume_define(self):
-        """
-        Test virt.volume_define function
-        """
-        # Normal test case
-        pool_mock = MagicMock()
-        pool_mock.XMLDesc.return_value = "<pool type='dir'></pool>"
-        self.mock_conn.storagePoolLookupByName.return_value = pool_mock
-
-        self.assertTrue(
-            virt.volume_define(
-                "testpool",
-                "myvm_system.qcow2",
-                8192,
-                allocation=4096,
-                format="qcow2",
-                type="file",
-            )
-        )
-
-        expected_xml = (
-            "<volume type='file'>\n"
-            "  <name>myvm_system.qcow2</name>\n"
-            "  <source>\n"
-            "  </source>\n"
-            "  <capacity unit='KiB'>8388608</capacity>\n"
-            "  <allocation unit='KiB'>4194304</allocation>\n"
-            "  <target>\n"
-            "    <format type='qcow2'/>\n"
-            "  </target>\n"
-            "</volume>"
-        )
-
-        pool_mock.createXML.assert_called_once_with(expected_xml, 0)
-
-        # backing store test case
-        pool_mock.reset_mock()
-        self.assertTrue(
-            virt.volume_define(
-                "testpool",
-                "myvm_system.qcow2",
-                8192,
-                allocation=4096,
-                format="qcow2",
-                type="file",
-                backing_store={"path": "/path/to/base.raw", "format": "raw"},
-            )
-        )
-
-        expected_xml = (
-            "<volume type='file'>\n"
-            "  <name>myvm_system.qcow2</name>\n"
-            "  <source>\n"
-            "  </source>\n"
-            "  <capacity unit='KiB'>8388608</capacity>\n"
-            "  <allocation unit='KiB'>4194304</allocation>\n"
-            "  <target>\n"
-            "    <format type='qcow2'/>\n"
-            "  </target>\n"
-            "  <backingStore>\n"
-            "    <path>/path/to/base.raw</path>\n"
-            "    <format type='raw'/>\n"
-            "  </backingStore>\n"
-            "</volume>"
-        )
-
-        pool_mock.createXML.assert_called_once_with(expected_xml, 0)
-
-        # logical pool test case
-        pool_mock.reset_mock()
-        pool_mock.XMLDesc.return_value = "<pool type='logical'></pool>"
-        self.mock_conn.storagePoolLookupByName.return_value = pool_mock
-
-        self.assertTrue(
-            virt.volume_define(
-                "testVG",
-                "myvm_system",
-                8192,
-                backing_store={"path": "/dev/testVG/base"},
-            )
-        )
-
-        expected_xml = (
-            "<volume>\n"
-            "  <name>myvm_system</name>\n"
-            "  <source>\n"
-            "  </source>\n"
-            "  <capacity unit='KiB'>8388608</capacity>\n"
-            "  <allocation unit='KiB'>8388608</allocation>\n"
-            "  <target>\n"
-            "  </target>\n"
-            "  <backingStore>\n"
-            "    <path>/dev/testVG/base</path>\n"
-            "  </backingStore>\n"
-            "</volume>"
-        )
-
-        pool_mock.createXML.assert_called_once_with(expected_xml, 0)
-
-    def test_volume_upload(self):
-        """
-        Test virt.volume_upload function
-        """
-        pool_mock = MagicMock()
-        vol_mock = MagicMock()
-        pool_mock.storageVolLookupByName.return_value = vol_mock
-        self.mock_conn.storagePoolLookupByName.return_value = pool_mock
-        stream_mock = MagicMock()
-        self.mock_conn.newStream.return_value = stream_mock
-
-        open_mock = MagicMock()
-        close_mock = MagicMock()
-        with patch.dict(
-            os.__dict__, {"open": open_mock, "close": close_mock}
-        ):  # pylint: disable=no-member
-            # Normal case
-            self.assertTrue(virt.volume_upload("pool0", "vol1.qcow2", "/path/to/file"))
-            stream_mock.sendAll.assert_called_once()
-            stream_mock.finish.assert_called_once()
-            self.mock_conn.close.assert_called_once()
-            vol_mock.upload.assert_called_once_with(stream_mock, 0, 0, 0)
-
-            # Sparse upload case
-            stream_mock.sendAll.reset_mock()
-            vol_mock.upload.reset_mock()
-            self.assertTrue(
-                virt.volume_upload(
-                    "pool0",
-                    "vol1.qcow2",
-                    "/path/to/file",
-                    offset=123,
-                    length=456,
-                    sparse=True,
-                )
-            )
-            stream_mock.sendAll.assert_not_called()
-            stream_mock.sparseSendAll.assert_called_once()
-            vol_mock.upload.assert_called_once_with(
-                stream_mock,
-                123,
-                456,
-                self.mock_libvirt.VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM,
-            )
-
-            # Upload unsupported case
-            vol_mock.upload.side_effect = self.mock_libvirt.libvirtError("Unsupported")
-            self.assertRaisesRegex(
-                CommandExecutionError,
-                "Unsupported",
-                virt.volume_upload,
-                "pool0",
-                "vol1.qcow2",
-                "/path/to/file",
-            )
-- 
2.29.2
openSUSE Build Service is sponsored by