app: add option to ignore select volumes on app.clone_vm()
QubesOS/qubes-issues#3793
This commit is contained in:
parent
4cd513757b
commit
4ca6c32e6c
@ -285,7 +285,7 @@ class QubesBase(qubesadmin.base.PropertyHolder):
|
|||||||
return self.domains[name]
|
return self.domains[name]
|
||||||
|
|
||||||
def clone_vm(self, src_vm, new_name, new_cls=None,
|
def clone_vm(self, src_vm, new_name, new_cls=None,
|
||||||
pool=None, pools=None, ignore_errors=False):
|
pool=None, pools=None, ignore_errors=False, ignore_volumes=None):
|
||||||
'''Clone Virtual Machine
|
'''Clone Virtual Machine
|
||||||
|
|
||||||
Example usage with custom storage pools:
|
Example usage with custom storage pools:
|
||||||
@ -304,6 +304,8 @@ class QubesBase(qubesadmin.base.PropertyHolder):
|
|||||||
:param dict pools: storage pool for specific volumes
|
:param dict pools: storage pool for specific volumes
|
||||||
:param bool ignore_errors: should errors on meta-data setting be only
|
:param bool ignore_errors: should errors on meta-data setting be only
|
||||||
logged, or abort the whole operation?
|
logged, or abort the whole operation?
|
||||||
|
:param list ignore_volumes: do not clone volumes on this list,
|
||||||
|
like 'private' or 'root'
|
||||||
:return new VM object
|
:return new VM object
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@ -393,6 +395,8 @@ class QubesBase(qubesadmin.base.PropertyHolder):
|
|||||||
if not dst_volume.save_on_stop:
|
if not dst_volume.save_on_stop:
|
||||||
# clone only persistent volumes
|
# clone only persistent volumes
|
||||||
continue
|
continue
|
||||||
|
if ignore_volumes and dst_volume.name in ignore_volumes:
|
||||||
|
continue
|
||||||
src_volume = src_vm.volumes[dst_volume.name]
|
src_volume = src_vm.volumes[dst_volume.name]
|
||||||
dst_vm.log.info('Cloning {} volume'.format(dst_volume.name))
|
dst_vm.log.info('Cloning {} volume'.format(dst_volume.name))
|
||||||
dst_volume.clone(src_volume)
|
dst_volume.clone(src_volume)
|
||||||
|
Loading…
Reference in New Issue
Block a user