Rename QubesXenVmStorage to XenStorage

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2015-11-07 19:04:51 +01:00
parent bfaf37dae5
commit 8e0207a199
3 changed files with 12 additions and 12 deletions

View File

@ -2,9 +2,9 @@
from __future__ import absolute_import
from qubes.storage.xen import QubesXenVmStorage, XenPool
from qubes.storage.xen import XenStorage, XenPool
def apply(system_path, vm_files, defaults):
defaults['storage_class'] = QubesXenVmStorage
defaults['storage_class'] = XenStorage
defaults['pool_types'] = {'xen': XenPool}

View File

@ -32,13 +32,13 @@ from qubes.qubes import QubesException, vm_files
from qubes.storage import Pool, QubesVmStorage
class QubesXenVmStorage(QubesVmStorage):
class XenStorage(QubesVmStorage):
"""
Class for VM storage of Xen VMs.
"""
def __init__(self, vm, **kwargs):
super(QubesXenVmStorage, self).__init__(vm, **kwargs)
super(XenStorage, self).__init__(vm, **kwargs)
self.root_dev = "xvda"
self.private_dev = "xvdb"
@ -158,7 +158,7 @@ class QubesXenVmStorage(QubesVmStorage):
self.commit_template_changes()
def rename(self, old_name, new_name):
super(QubesXenVmStorage, self).rename(old_name, new_name)
super(XenStorage, self).rename(old_name, new_name)
old_dirpath = os.path.join(os.path.dirname(self.vmdir), old_name)
if self.rootcow_img:
@ -226,11 +226,11 @@ class QubesXenVmStorage(QubesVmStorage):
f_volatile.close()
f_root.close()
return
super(QubesXenVmStorage, self).reset_volatile_storage(
super(XenStorage, self).reset_volatile_storage(
verbose=verbose, source_template=source_template)
def prepare_for_vm_startup(self, verbose):
super(QubesXenVmStorage, self).prepare_for_vm_startup(verbose=verbose)
super(XenStorage, self).prepare_for_vm_startup(verbose=verbose)
if self.drive is not None:
(drive_type, drive_domain, drive_path) = self.drive.split(":")

View File

@ -21,7 +21,7 @@ from qubes.tests import QubesTestCase, SystemTestsMixin
from qubes.qubes import defaults
import qubes.storage
from qubes.storage.xen import QubesXenVmStorage, XenPool
from qubes.storage.xen import XenStorage, XenPool
class TC_00_Storage(SystemTestsMixin, QubesTestCase):
@ -33,13 +33,13 @@ class TC_00_Storage(SystemTestsMixin, QubesTestCase):
storage = self.qc.add_new_vm('QubesAppVm', name=vmname, pool='default',
template=template).storage
result = qubes.storage.dump(storage)
expected = 'qubes.storage.xen.QubesXenVmStorage'
expected = 'qubes.storage.xen.XenStorage'
self.assertEquals(result, expected)
def test_001_load(self):
""" Loads storage type from a storage string """
result = qubes.storage.load('qubes.storage.xen.QubesXenVmStorage')
self.assertTrue(result is QubesXenVmStorage)
result = qubes.storage.load('qubes.storage.xen.XenStorage')
self.assertTrue(result is XenStorage)
def test_002_default_pool_types(self):
""" The only predifined pool type is xen """
@ -60,4 +60,4 @@ class TC_01_Storage(SystemTestsMixin, QubesTestCase):
template = self.qc.get_default_template()
vm = self.qc.add_new_vm('QubesAppVm', name=vmname, template=template,
pool='default')
self.assertIsInstance(vm.storage, QubesXenVmStorage)
self.assertIsInstance(vm.storage, XenStorage)