qubes/vm: handle VM toplevel directory in QubesVM object not Storage
This directory is not only for disk images (in fact disk images may be elsewhere depending on choosen volume pool), so it would be cleaner to handle (create/remove) it directly in QubesVM class.
This commit is contained in:
parent
ed6e69b77e
commit
bb2e1f2870
@ -149,8 +149,6 @@ class Storage(object):
|
||||
|
||||
old_umask = os.umask(002)
|
||||
|
||||
self.log.info('Creating directory: {0}'.format(self.vm.dir_path))
|
||||
os.makedirs(self.vm.dir_path)
|
||||
for name, volume in self.vm.volumes.items():
|
||||
source_volume = None
|
||||
if source_template and hasattr(source_template, 'volumes'):
|
||||
@ -195,6 +193,7 @@ class Storage(object):
|
||||
Errors on removal are catched and logged.
|
||||
'''
|
||||
for name, volume in self.vm.volumes.items():
|
||||
self.log.info('Removing volume %s: %s' % (name, volume.vid))
|
||||
try:
|
||||
self.get_pool(volume).remove(volume)
|
||||
except (IOError, OSError) as e:
|
||||
|
@ -1092,6 +1092,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
# pylint: disable=no-member
|
||||
source_template = self.template
|
||||
|
||||
self.log.info('Creating directory: {0}'.format(self.dir_path))
|
||||
os.makedirs(self.dir_path, mode=0o775)
|
||||
|
||||
self.storage.create_on_disk(source_template)
|
||||
|
||||
self.log.info('Creating icon symlink: {} -> {}'.format(
|
||||
|
Loading…
Reference in New Issue
Block a user