storage: drop 'internal' and 'removable' volume properties

Since dynamic volumes (qvm-block) are moved to devices API, those two
are not needed anymore.

QubesOS/qubes-issues#2256
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-02 01:07:48 +02:00
parent 075d991114
commit 0e554296e3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
10 changed files with 9 additions and 38 deletions

View File

@ -261,7 +261,7 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI):
volume = self.dest.volumes[self.arg]
# properties defined in API
volume_properties = [
'pool', 'vid', 'size', 'usage', 'rw', 'internal', 'source',
'pool', 'vid', 'size', 'usage', 'rw', 'source',
'save_on_stop', 'snap_on_start']
return ''.join('{}={}\n'.format(key, getattr(volume, key)) for key in
volume_properties)

View File

@ -82,7 +82,7 @@ class Volume(object):
#: for sparse volumes
usage = 0
def __init__(self, name, pool, vid, internal=False, removable=False,
def __init__(self, name, pool, vid,
revisions_to_keep=0, rw=False, save_on_stop=False, size=0,
snap_on_start=False, source=None, **kwargs):
''' Initialize a volume.
@ -90,10 +90,6 @@ class Volume(object):
:param str name: The name of the volume inside owning domain
:param Pool pool: The pool object
:param str vid: Volume identifier needs to be unique in pool
:param bool internal: If `True` volume is hidden when qvm-block ls
is used
:param bool removable: If `True` volume can be detached from vm at
run time
:param int revisions_to_keep: Amount of revisions to keep around
:param bool rw: If true volume will be mounted read-write
:param bool snap_on_start: Create a snapshot from source on
@ -125,8 +121,6 @@ class Volume(object):
self.name = str(name)
#: :py:class:`Pool` instance owning this volume
self.pool = pool
self.internal = internal
self.removable = removable
#: How many revisions of the volume to keep. Each revision is created
# at :py:meth:`stop`, if :py:attr:`save_on_stop` is True
self.revisions_to_keep = int(revisions_to_keep)
@ -317,8 +311,6 @@ class Volume(object):
'name': self.name,
'pool': str(self.pool),
'vid': self.vid,
'internal': self.internal,
'removable': self.removable,
'revisions_to_keep': self.revisions_to_keep,
'rw': self.rw,
'save_on_stop': self.save_on_stop,
@ -382,6 +374,9 @@ class Storage(object):
pool = getattr(self.vm.app, 'default_pool_' + name)
else:
pool = self.vm.app.get_pool(volume_config['pool'])
if 'internal' in volume_config:
# migrate old config
del volume_config['internal']
volume = pool.init_volume(self.vm, volume_config)
self.vm.volumes[name] = volume
return volume

View File

@ -167,7 +167,6 @@ class LinuxKernel(Pool):
kernel_version,
pool=self,
name=kernel_version,
internal=True,
rw=False
)
for kernel_version in os.listdir(self.dir_path)]

View File

@ -37,7 +37,7 @@ import qubes.storage
# properties defined in API
volume_properties = [
'pool', 'vid', 'size', 'usage', 'rw', 'internal', 'source',
'pool', 'vid', 'size', 'usage', 'rw', 'source',
'save_on_stop', 'snap_on_start']

View File

@ -59,7 +59,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'save_on_stop': False,
'rw': True,
}
@ -91,7 +90,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'save_on_stop': True,
'rw': True,
}
@ -126,7 +124,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'save_on_stop': False,
'rw': False,
}
@ -157,7 +154,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'save_on_stop': True,
'rw': True,
}
@ -166,7 +162,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'snap_on_start': True,
'source': testvol.vid,
'rw': True,
@ -225,7 +220,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'save_on_stop': True,
'rw': True,
}
@ -234,7 +228,6 @@ class StorageTestMixin(qubes.tests.SystemTestsMixin):
volume_config = {
'pool': self.pool.name,
'size': size,
'internal': False,
'snap_on_start': True,
'source': testvol.vid,
'rw': True,

View File

@ -49,7 +49,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
'save_on_stop': False,
'rw': False,
'source': None,
'internal': True
},
'private': {
'name': 'private',
@ -58,7 +57,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
'save_on_stop': True,
'rw': True,
'size': defaults['private_img_size'],
'internal': True
},
'volatile': {
'name': 'volatile',
@ -66,7 +64,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
'snap_on_start': False,
'save_on_stop': False,
'size': defaults['root_img_size'],
'internal': True,
'rw': True,
},
'kernel': {
@ -75,7 +72,6 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
'snap_on_start': False,
'save_on_stop': False,
'rw': False,
'internal': True
}
}

View File

@ -47,20 +47,17 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
'snap_on_start': True,
'save_on_stop': False,
'rw': False,
'internal': True
},
'private': {
'name': 'private',
'pool': 'default',
'snap_on_start': True,
'save_on_stop': False,
'internal': True,
'rw': True,
},
'volatile': {
'name': 'volatile',
'pool': 'default',
'internal': True,
'snap_on_start': False,
'save_on_stop': False,
'rw': True,
@ -73,7 +70,6 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
'snap_on_start': False,
'save_on_stop': False,
'rw': False,
'internal': True
}
}
if 'name' not in kwargs and 'dispid' in kwargs:

View File

@ -1815,9 +1815,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
def _clean_volume_config(config):
common_attributes = ['name', 'pool', 'size', 'internal', 'removable',
'revisions_to_keep', 'rw', 'snap_on_start',
'save_on_stop', 'source']
common_attributes = ['name', 'pool', 'size',
'revisions_to_keep', 'rw', 'snap_on_start',
'save_on_stop', 'source']
config_copy = copy.deepcopy(config)
return {k: v for k, v in config_copy.items() if k in common_attributes}

View File

@ -35,7 +35,6 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM):
'save_on_stop': True,
'rw': True,
'source': None,
'internal': True,
'size': qubes.config.defaults['root_img_size'],
},
'private': {
@ -45,7 +44,6 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM):
'save_on_stop': True,
'rw': True,
'source': None,
'internal': True,
'size': qubes.config.defaults['private_img_size'],
},
'volatile': {
@ -53,7 +51,6 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM):
'pool': 'default',
'snap_on_start': False,
'save_on_stop': False,
'internal': True,
'rw': True,
'size': qubes.config.defaults['root_img_size'],
},
@ -63,7 +60,6 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM):
'snap_on_start': False,
'save_on_stop': False,
'rw': False,
'internal': True
}
}
super(StandaloneVM, self).__init__(*args, **kwargs)

View File

@ -71,7 +71,6 @@ class TemplateVM(QubesVM):
'rw': True,
'source': None,
'size': defaults['root_img_size'],
'internal': True
},
'private': {
'name': 'private',
@ -82,7 +81,6 @@ class TemplateVM(QubesVM):
'source': None,
'size': defaults['private_img_size'],
'revisions_to_keep': 0,
'internal': True
},
'volatile': {
'name': 'volatile',
@ -90,7 +88,6 @@ class TemplateVM(QubesVM):
'size': defaults['root_img_size'],
'snap_on_start': False,
'save_on_stop': False,
'internal': True,
'rw': True,
},
'kernel': {
@ -98,7 +95,6 @@ class TemplateVM(QubesVM):
'pool': 'linux-kernel',
'snap_on_start': False,
'save_on_stop': False,
'internal': True,
'rw': False
}
}