diff --git a/tests/clone-xml/nvram-newpool-in.xml b/tests/clone-xml/nvram-newpool-in.xml
new file mode 100644
index 000000000..d27da4720
--- /dev/null
+++ b/tests/clone-xml/nvram-newpool-in.xml
@@ -0,0 +1,23 @@
+
+ clone-orig
+ aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82
+ 262144
+ 262144
+ 1
+
+ hvm
+
+ /usr/share/ovmf/ovmf-efi.fd
+ /nvram-newpool/clone-orig-vars.fd
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-kvm
+
+
diff --git a/tests/clone-xml/nvram-newpool-out.xml b/tests/clone-xml/nvram-newpool-out.xml
new file mode 100644
index 000000000..42d95460e
--- /dev/null
+++ b/tests/clone-xml/nvram-newpool-out.xml
@@ -0,0 +1,23 @@
+
+ clone-new
+ 12345678-1234-1234-1234-123456789012
+ 262144
+ 262144
+ 1
+
+ hvm
+
+ /usr/share/ovmf/ovmf-efi.fd
+ /nvram-newpool/clone-new_VARS.fd
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-kvm
+
+
diff --git a/tests/clonetest.py b/tests/clonetest.py
index e0570e0d6..6e58a5f1e 100644
--- a/tests/clonetest.py
+++ b/tests/clonetest.py
@@ -183,3 +183,7 @@ class TestClone(unittest.TestCase):
def testCloneNvramAuto(self):
base = "nvram-auto"
self._clone_helper(base)
+
+ def testCloneNvramNewpool(self):
+ base = "nvram-newpool"
+ self._clone_helper(base)
diff --git a/tests/utils.py b/tests/utils.py
index d23434cf3..bee38a95a 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -98,6 +98,19 @@ def openconn(uri):
for key, value in _conn_cache[uri].items():
conn._fetch_cache[key] = value[:]
+ def cb_cache_new_pool(poolobj):
+ # Used by clonetest.py nvram-newpool test
+ if poolobj.name() == "nvram-newpool":
+ from virtinst import StorageVolume
+ vol = StorageVolume(conn)
+ vol.pool = poolobj
+ vol.name = "clone-orig-vars.fd"
+ vol.capacity = 1024 * 1024
+ vol.install()
+ conn._cache_new_pool_raw(poolobj)
+
+ conn.cb_cache_new_pool = cb_cache_new_pool
+
return conn
diff --git a/virtinst/connection.py b/virtinst/connection.py
index 1bd6eac93..d6d66fca3 100644
--- a/virtinst/connection.py
+++ b/virtinst/connection.py
@@ -239,14 +239,7 @@ class VirtualConnection(object):
self._fetch_cache[key] = self._fetch_all_vols_raw()
return self._fetch_cache[key][:]
- def cache_new_pool(self, poolobj):
- """
- Insert the passed poolobj into our cache
- """
- if self.cb_cache_new_pool:
- # pylint: disable=not-callable
- return self.cb_cache_new_pool(poolobj)
-
+ def _cache_new_pool_raw(self, poolobj):
# Make sure cache is primed
if self._FETCH_KEY_POOLS not in self._fetch_cache:
# Nothing cached yet, so next poll will pull in latest bits,
@@ -259,6 +252,15 @@ class VirtualConnection(object):
vollist = self._fetch_cache[self._FETCH_KEY_VOLS]
vollist.extend(self._fetch_vols_raw(poolxmlobj))
+ def cache_new_pool(self, poolobj):
+ """
+ Insert the passed poolobj into our cache
+ """
+ if self.cb_cache_new_pool:
+ # pylint: disable=not-callable
+ return self.cb_cache_new_pool(poolobj)
+ return self._cache_new_pool_raw(poolobj)
+
def _fetch_all_nodedevs_raw(self):
ignore, ignore, ret = pollhelpers.fetch_nodedevs(
self, {}, lambda obj, ignore: obj)