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 کامیت شده توسط Wojtek Porczyk
والد d3f9c0b169
کامیت 3af71ab65d
2فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده

مشاهده پرونده

@ -526,9 +526,11 @@ class Pool(object):
elif vm.is_disposablevm(): elif vm.is_disposablevm():
subdir = 'appvms' subdir = 'appvms'
return os.path.join(pool_dir, subdir, vm.template.name + '-dvm') return os.path.join(pool_dir, subdir, vm.template.name + '-dvm')
elif isinstance(vm, qubes.vm.adminvm.AdminVM):
subdir = 'servicevms'
else: else:
raise qubes.exc.QubesException( 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) return os.path.join(pool_dir, subdir, vm.name)

مشاهده پرونده

@ -398,6 +398,12 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
DeprecationWarning) DeprecationWarning)
return isinstance(self, qubes.vm.dispvm.DispVM) 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 # network-related