Add storage.pool_exists
This commit is contained in:
parent
8e0207a199
commit
d1685a13df
@ -291,6 +291,15 @@ def _get_pool_klass(name, config=None):
|
|||||||
return klass
|
return klass
|
||||||
|
|
||||||
|
|
||||||
|
def pool_exists(name):
|
||||||
|
""" Check if the specified pool exists """
|
||||||
|
try:
|
||||||
|
_get_pool_klass(name)
|
||||||
|
return True
|
||||||
|
except StoragePoolException:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class StoragePoolException(QubesException):
|
class StoragePoolException(QubesException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -52,6 +52,15 @@ class TC_00_Storage(SystemTestsMixin, QubesTestCase):
|
|||||||
result = qubes.storage._get_pool_klass('default')
|
result = qubes.storage._get_pool_klass('default')
|
||||||
self.assertTrue(result is XenPool)
|
self.assertTrue(result is XenPool)
|
||||||
|
|
||||||
|
def test_004_pool_exists_default(self):
|
||||||
|
""" Expect the default pool to exists """
|
||||||
|
self.assertTrue(qubes.storage.pool_exists('default'))
|
||||||
|
|
||||||
|
def test_005_pool_exists_random(self):
|
||||||
|
""" Expect this pool to not a exist """
|
||||||
|
self.assertFalse(
|
||||||
|
qubes.storage.pool_exists('asdh312096r832598213iudhas'))
|
||||||
|
|
||||||
|
|
||||||
class TC_01_Storage(SystemTestsMixin, QubesTestCase):
|
class TC_01_Storage(SystemTestsMixin, QubesTestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user