qubes/storage: fix storage instantiation

This commit is contained in:
Wojtek Porczyk 2015-01-16 15:52:01 +01:00
parent 8805db5e5f
commit 8e16dd2b28
4 changed files with 11 additions and 4 deletions

View File

@ -22,7 +22,6 @@
# #
# #
qubes_base_dir = "/var/lib/qubes" qubes_base_dir = "/var/lib/qubes"
system_path = { system_path = {
'qubes_guid_path': '/usr/bin/qubes-guid', 'qubes_guid_path': '/usr/bin/qubes-guid',
@ -75,7 +74,7 @@ defaults = {
'private_img_size': 2*1024*1024*1024, 'private_img_size': 2*1024*1024*1024,
'root_img_size': 10*1024*1024*1024, 'root_img_size': 10*1024*1024*1024,
'storage_class': None, 'storage_class': 'qubes.storage.xen.XenVMStorage',
# how long (in sec) to wait for VMs to shutdown, # how long (in sec) to wait for VMs to shutdown,
# before killing them (when used qvm-run with --wait option), # before killing them (when used qvm-run with --wait option),

View File

@ -22,6 +22,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import importlib
import os import os
import os.path import os.path
import re import re
@ -32,7 +33,6 @@ import sys
import qubes import qubes
import qubes.utils import qubes.utils
class VMStorage(object): class VMStorage(object):
'''Class for handling VM virtual disks. '''Class for handling VM virtual disks.

View File

@ -322,6 +322,12 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase):
class TC_90_Qubes(qubes.tests.QubesTestCase): class TC_90_Qubes(qubes.tests.QubesTestCase):
@qubes.tests.skipUnlessDom0
def test_000_init_empty(self):
try: os.unlink('/tmp/qubestest.xml')
except: pass
app = qubes.Qubes('/tmp/qubestest.xml')
@qubes.tests.skipUnlessGit @qubes.tests.skipUnlessGit
def test_900_example_xml_in_doc(self): def test_900_example_xml_in_doc(self):
self.assertXMLIsValid( self.assertXMLIsValid(

View File

@ -41,6 +41,7 @@ import qubes.config
#import qubes.qdb #import qubes.qdb
#import qubes.qmemman #import qubes.qmemman
#import qubes.qmemman_algo #import qubes.qmemman_algo
import qubes.storage
import qubes.utils import qubes.utils
import qubes.vm import qubes.vm
@ -440,7 +441,8 @@ class QubesVM(qubes.vm.BaseVM):
self.services['meminfo-writer'] = False self.services['meminfo-writer'] = False
# Initialize VM image storage class # Initialize VM image storage class
self.storage = qubes.config.defaults["storage_class"](self) self.storage = qubes.storage.get_storage(self)
if hasattr(self, 'kernels_dir'): if hasattr(self, 'kernels_dir'):
self.storage.modules_img = os.path.join(self.kernels_dir, self.storage.modules_img = os.path.join(self.kernels_dir,
"modules.img") "modules.img")