Rename qubes.devices.BlockDevice to qubes.storage.BlockDevice
Signed-off-by: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
This commit is contained in:
parent
09e324254e
commit
e446e7a2f4
@ -344,19 +344,6 @@ class UnknownDevice(DeviceInfo):
|
||||
frontend_domain, **kwargs)
|
||||
|
||||
|
||||
class BlockDevice(object):
|
||||
# pylint: disable=too-few-public-methods
|
||||
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
|
||||
|
||||
class PersistentCollection(object):
|
||||
|
||||
''' Helper object managing persistent `DeviceAssignment`s.
|
||||
|
@ -34,7 +34,6 @@ from datetime import datetime
|
||||
import lxml.etree
|
||||
import pkg_resources
|
||||
import qubes
|
||||
import qubes.devices
|
||||
import qubes.exc
|
||||
import qubes.utils
|
||||
|
||||
@ -46,6 +45,21 @@ class StoragePoolException(qubes.exc.QubesException):
|
||||
pass
|
||||
|
||||
|
||||
class BlockDevice(object):
|
||||
''' Represents a storage block device. '''
|
||||
# pylint: disable=too-few-public-methods
|
||||
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
|
||||
|
||||
|
||||
class Volume(object):
|
||||
''' Encapsulates all data about a volume for serialization to qubes.xml and
|
||||
libvirt config.
|
||||
@ -119,10 +133,10 @@ class Volume(object):
|
||||
return lxml.etree.Element('volume', **config)
|
||||
|
||||
def block_device(self):
|
||||
''' Return :py:class:`qubes.devices.BlockDevice` for serialization in
|
||||
''' Return :py:class:`BlockDevice` for serialization in
|
||||
the libvirt XML template as <disk>.
|
||||
'''
|
||||
return qubes.devices.BlockDevice(self.path, self.name, self.script,
|
||||
return BlockDevice(self.path, self.name, self.script,
|
||||
self.rw, self.domain, self.devtype)
|
||||
|
||||
@property
|
||||
|
@ -30,7 +30,6 @@ import os.path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import qubes.devices
|
||||
import qubes.storage
|
||||
|
||||
BLKSIZE = 512
|
||||
@ -358,7 +357,7 @@ class FileVolume(qubes.storage.Volume):
|
||||
return 'block-snapshot'
|
||||
|
||||
def block_device(self):
|
||||
''' Return :py:class:`qubes.devices.BlockDevice` for serialization in
|
||||
''' Return :py:class:`qubes.storage.BlockDevice` for serialization in
|
||||
the libvirt XML template as <disk>.
|
||||
'''
|
||||
path = self.path
|
||||
@ -366,7 +365,7 @@ class FileVolume(qubes.storage.Volume):
|
||||
path += ":" + self.path_source_cow
|
||||
if self._is_origin or self._is_snapshot:
|
||||
path += ":" + self.path_cow
|
||||
return qubes.devices.BlockDevice(path, self.name, self.script, self.rw,
|
||||
return qubes.storage.BlockDevice(path, self.name, self.script, self.rw,
|
||||
self.domain, self.devtype)
|
||||
|
||||
@property
|
||||
|
@ -394,11 +394,11 @@ class ThinVolume(qubes.storage.Volume):
|
||||
"You shouldn't use lvm size setter")
|
||||
|
||||
def block_device(self):
|
||||
''' Return :py:class:`qubes.devices.BlockDevice` for serialization in
|
||||
''' Return :py:class:`qubes.storage.BlockDevice` for serialization in
|
||||
the libvirt XML template as <disk>.
|
||||
'''
|
||||
if self.snap_on_start:
|
||||
return qubes.devices.BlockDevice(
|
||||
return qubes.storage.BlockDevice(
|
||||
'/dev/' + self._vid_snap, self.name, self.script,
|
||||
self.rw, self.domain, self.devtype)
|
||||
else:
|
||||
|
@ -567,7 +567,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
|
||||
@property
|
||||
def block_devices(self):
|
||||
''' Return all :py:class:`qubes.devices.BlockDevice`s for current domain
|
||||
''' Return all :py:class:`qubes.storage.BlockDevice`s for current domain
|
||||
for serialization in the libvirt XML template as <disk>.
|
||||
'''
|
||||
return [v.block_device() for v in self.volumes.values()]
|
||||
|
Loading…
Reference in New Issue
Block a user