appvm.py 1.6 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.volumes = {}
  15. self.volume_config = {
  16. 'root': {
  17. 'name': 'root',
  18. 'pool': 'default',
  19. 'volume_type': 'snapshot',
  20. },
  21. 'private': {
  22. 'name': 'private',
  23. 'pool': 'default',
  24. 'volume_type': 'read-write',
  25. 'size': defaults['private_img_size'],
  26. },
  27. 'volatile': {
  28. 'name': 'volatile',
  29. 'pool': 'default',
  30. 'volume_type': 'volatile',
  31. 'size': defaults['root_img_size'],
  32. },
  33. 'kernel': {
  34. 'name': 'kernel',
  35. 'pool': 'linux-kernel',
  36. 'volume_type': 'read-only',
  37. }
  38. }
  39. super(AppVM, self).__init__(*args, **kwargs)
  40. @qubes.events.handler('domain-load')
  41. def on_domain_loaded(self, event):
  42. # pylint: disable=unused-argument
  43. # Some additional checks for template based VM
  44. assert self.template
  45. # self.template.appvms.add(self) # XXX