storage: fix handling netvm and adminvm

@woju what was consensus on 'servicevms' dir? Since "being network
provider" is no longer separate type and can be changed during VM
lifetime, maybe we should abandon that idea? Or maybe just set it as VM
property (some storage pool config argument) - that way mgmt stack could
put all the sys-* VMs into separate directory, regardless of the type.
This commit is contained in:
Marek Marczykowski-Górecki 2016-02-08 20:23:51 +01:00 committed by Wojtek Porczyk
parent d3f9c0b169
commit 3af71ab65d
2 changed files with 9 additions and 1 deletions

View File

@ -526,9 +526,11 @@ class Pool(object):
elif vm.is_disposablevm():
subdir = 'appvms'
return os.path.join(pool_dir, subdir, vm.template.name + '-dvm')
elif isinstance(vm, qubes.vm.adminvm.AdminVM):
subdir = 'servicevms'
else:
raise qubes.exc.QubesException(
'unknown vm type: {!r}'.format(vm.type()))
'unknown vm type: {!r}'.format(str(vm.__class__)))
return os.path.join(pool_dir, subdir, vm.name)

View File

@ -398,6 +398,12 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
DeprecationWarning)
return isinstance(self, qubes.vm.dispvm.DispVM)
def is_netvm(self):
warnings.warn('vm.is_netvm() is deprecated, use isinstance()',
DeprecationWarning)
return isinstance(self, qubes.vm.mix.net.NetVMMixin) \
and self.provides_network
# network-related