admin: add missing parts to admin.vm.Clone
Clone all the things.
This commit is contained in:
parent
8533ec9773
commit
f3c7fb8129
@ -727,10 +727,12 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI):
|
||||
dst_vm = self.app.add_new_vm(src_vm.__class__, name=new_name)
|
||||
try:
|
||||
dst_vm.clone_properties(src_vm)
|
||||
# TODO: tags
|
||||
# TODO: features
|
||||
# TODO: firewall
|
||||
# TODO: persistent devices
|
||||
dst_vm.tags.update(src_vm.tags)
|
||||
dst_vm.features.update(src_vm.features)
|
||||
dst_vm.firewall.clone(src_vm.firewall)
|
||||
for devclass in src_vm.devices:
|
||||
for device_assignment in src_vm.devices[devclass].assignments():
|
||||
dst_vm.devices[devclass].attach(device_assignment.clone())
|
||||
yield from dst_vm.clone_disk_files(src_vm)
|
||||
except:
|
||||
del self.app.domains[dst_vm]
|
||||
|
@ -1233,6 +1233,9 @@ class TC_00_VMs(AdminAPITestCase):
|
||||
vm = self.app.domains['test-vm2']
|
||||
self.assertEqual(vm.label, self.app.get_label('red'))
|
||||
self.assertEqual(vm.template, self.app.domains['test-template'])
|
||||
self.assertEqual(vm.tags, self.vm.tags)
|
||||
self.assertEqual(vm.features, self.vm.features)
|
||||
self.assertEqual(vm.firewall, self.vm.firewall)
|
||||
self.assertEqual(mock_clone.mock_calls,
|
||||
[unittest.mock.call(self.app.domains['test-vm2']).clone(
|
||||
self.app.domains['test-vm1'])])
|
||||
|
Loading…
Reference in New Issue
Block a user