From 2f99efa4b8e647c02e73f42058c1fb0f0c9c15ab Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Thu, 24 Mar 2016 22:15:24 +0100 Subject: [PATCH] Add BlockDevice --- qubes/devices.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubes/devices.py b/qubes/devices.py index 0911344f..b9799b50 100644 --- a/qubes/devices.py +++ b/qubes/devices.py @@ -6,6 +6,7 @@ # # Copyright (C) 2010-2016 Joanna Rutkowska # Copyright (C) 2015-2016 Wojtek Porczyk +# Copyright (C) 2016 Bahtiar `kalkin-` Gadimov # # 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 @@ -26,6 +27,7 @@ import re import qubes + class DeviceCollection(object): '''Bag for devices. @@ -121,3 +123,16 @@ class RegexDevice(str): class PCIDevice(RegexDevice): regex = re.compile( r'^(?P[0-9a-f]+):(?P[0-9a-f]+)\.(?P[0-9a-f]+)$') + + +class BlockDevice(object): + def __init__(self, path, name, script=None, rw=True, domain=None, + devtype='disk'): + assert name, 'Missing device name' + assert path, 'Missing device path' + self.path = path + self.name = name + self.rw = rw + self.script = script + self.domain = domain + self.devtype = devtype