#!/usr/bin/python2 # # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2013 Marek Marczykowski # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. # from __future__ import absolute_import import os import os.path import re import subprocess import sys from qubes.qubes import QubesException, defaults, vm_files from qubes.storage import Pool, QubesVmStorage class XenStorage(QubesVmStorage): """ Class for VM storage of Xen VMs. """ def __init__(self, vm, **kwargs): super(XenStorage, self).__init__(vm, **kwargs) self.root_dev = "xvda" self.private_dev = "xvdb" self.volatile_dev = "xvdc" self.modules_dev = "xvdd" if self.vm.is_template(): self.rootcow_img = os.path.join(self.vmdir, vm_files["rootcow_img"]) else: self.rootcow_img = None def _format_disk_dev(self, path, script, vdev, rw=True, type="disk", domain=None): if path is None: return '' template = " \n" \ " \n" \ " \n" \ " \n" \ "{params}" \ " \n" params = "" if not rw: params += " \n" if domain: params += " \n" % domain if script: params += "