01QubesAppVm.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/python2
  2. # -*- coding: utf-8 -*-
  3. #
  4. # The Qubes OS Project, http://www.qubes-os.org
  5. #
  6. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  7. # Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
  8. #
  9. # This program is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU General Public License
  11. # as published by the Free Software Foundation; either version 2
  12. # of the License, or (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. #
  23. #
  24. import os.path
  25. from qubes.qubes import (
  26. register_qubes_vm_class,
  27. system_path,
  28. QubesResizableVmWithResize2fs,
  29. QubesVmLabel,
  30. )
  31. class QubesAppVm(QubesResizableVmWithResize2fs):
  32. """
  33. A class that represents an AppVM. A child of QubesVm.
  34. """
  35. def get_attrs_config(self):
  36. attrs_config = super(QubesAppVm, self).get_attrs_config()
  37. attrs_config['dir_path']['func'] = \
  38. lambda value: value if value is not None else \
  39. os.path.join(system_path["qubes_appvms_dir"], self.name)
  40. return attrs_config
  41. @property
  42. def type(self):
  43. return "AppVM"
  44. def is_appvm(self):
  45. return True
  46. register_qubes_vm_class(QubesAppVm)