appvm.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/python2 -O
  2. # vim: fileencoding=utf-8
  3. import qubes.events
  4. import qubes.vm.qubesvm
  5. from qubes.config import defaults
  6. class AppVM(qubes.vm.qubesvm.QubesVM):
  7. '''Application VM'''
  8. template = qubes.VMProperty('template',
  9. load_stage=4,
  10. vmclass=qubes.vm.templatevm.TemplateVM,
  11. ls_width=31,
  12. doc='Template, on which this AppVM is based.')
  13. def __init__(self, *args, **kwargs):
  14. self.volume_config = {
  15. 'root': {
  16. 'name': 'root',
  17. 'pool': 'default',
  18. 'volume_type': 'snapshot',
  19. },
  20. 'private': {
  21. 'name': 'private',
  22. 'pool': 'default',
  23. 'volume_type': 'origin',
  24. 'size': defaults['private_img_size'],
  25. },
  26. 'volatile': {
  27. 'name': 'volatile',
  28. 'pool': 'default',
  29. 'volume_type': 'volatile',
  30. 'size': defaults['root_img_size'],
  31. },
  32. 'kernel': {
  33. 'name': 'kernel',
  34. 'pool': 'linux-kernel',
  35. 'volume_type': 'read-only',
  36. }
  37. }
  38. super(AppVM, self).__init__(*args, **kwargs)
  39. @qubes.events.handler('domain-load')
  40. def on_domain_loaded(self, event):
  41. # pylint: disable=unused-argument
  42. # Some additional checks for template based VM
  43. assert self.template
  44. # self.template.appvms.add(self) # XXX