Virtual Machine clone fault (bug?)

el1milka

Cadet
Joined
Feb 20, 2022
Messages
6
Dear Community,

I tried to clone a VM on my Truenas Scale in GUI, but I got the next message:

libvirtError

operation failed: domain '4_ubuntu' is already defined with uuid eb1f9d24-0daf-4b43-a2dc-c8e0ce5c3ba3

Error: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 175, in call_method
result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self)
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1257, in _call
return await methodobj(*prepared_call.args)
File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1261, in nf
return await func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1129, in nf
res = await f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/clone.py", line 130, in clone
raise e
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/clone.py", line 113, in clone
await self.middleware.call('vm.do_create', vm)
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1308, in call
return await self._call(
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1257, in _call
return await methodobj(*prepared_call.args)
File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1129, in nf
res = await f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1261, in nf
return await func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vms.py", line 176, in do_create
await self.middleware.run_in_thread(self._add, vm_id)
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1172, in run_in_thread
return await self.run_in_executor(self.thread_pool_executor, method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1169, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 13, in _add
self._add_with_vm_data(vm)
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 16, in _add_with_vm_data
self.vms[vm['name']] = VMSupervisor(vm, self.middleware)
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 40, in __init__
self.update_domain()
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 59, in update_domain
self.__define_domain()
File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 87, in __define_domain
if not self.LIBVIRT_CONNECTION.defineXML(vm_xml):
File "/usr/lib/python3/dist-packages/libvirt.py", line 4380, in defineXML
raise libvirtError('virDomainDefineXML() failed')
libvirt.libvirtError: operation failed: domain '4_ubuntu' is already defined with uuid eb1f9d24-0daf-4b43-a2dc-c8e0ce5c3ba3

The VM_clone0 was created, but I cannot edit anything in it. Then I tried to delete this clone, but I got the following message.

CallError
[EFAULT] Unable to retrieve VM status. Failed to destroy VM
More info...
Error: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/middlewared/main.py", line 175, in call_method result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self) File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1257, in _call return await methodobj(*prepared_call.args) File "/usr/lib/python3/dist-packages/middlewared/service.py", line 942, in delete rv = await self.middleware._call( File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1257, in _call return await methodobj(*prepared_call.args) File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1129, in nf res = await f(*args, **kwargs) File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1261, in nf return await func(*args, **kwargs) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vms.py", line 400, in do_delete raise CallError('Unable to retrieve VM status. Failed to destroy VM') middlewared.service_exception.CallError: [EFAULT] Unable to retrieve VM status. Failed to destroy VM

Can somebody tell me, how to clone a VM correctly, and how to delete this false VM clone.

Thank you,
Milan Peter

Specs:
ASUS Z9PA-D8C
2pc Intel Xeon E5-2690 V2
8 x 8GB ECC DDR3
2 x 250GB mirrored ssd for sys
2 x 2TB mirrored ssd for VMs
6 x 2TB WDRED raidz2
2 x 2TB mirrored WDGREEN for veeam backup
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
Which version of TrueNAS SCALE were you using?
Any idea whether it worked on a previous version.... or is this your first attempt?
 

luredivino

Cadet
Joined
May 12, 2022
Messages
1
Same error. TrueNAS-SCALE-22.02.1

Tried to clone a vm, now getting the same error. Tried to delete the vm and now its stuck. Tried removing all devices and rebooting, but will not delete
 

el1milka

Cadet
Joined
Feb 20, 2022
Messages
6
Which version of TrueNAS SCALE were you using?
Any idea whether it worked on a previous version.... or is this your first attempt?
Hi,

TrueNAS-SCALE-22.02.1
I installed it last Friday. This was my first attempt.
 

briangr

Cadet
Joined
May 12, 2022
Messages
7
Hello Forum,

I can confirm the cloning error on TrueNAS-SCALE-22.02.1-MASTER-20220508-040717 nightly. After rebooting the cloned VM does appear in the list, but cannot be started:

[EFAULT] Unable to define domain for debianvm2: operation failed: domain '1_debianvm1' is already defined with uuid 058531df-b4a4-4adf-bc6e-3c98e87296e7

Error: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 42, in _check_add_domain self._add(self._vm_from_name(vm_name)['id']) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 13, in _add self._add_with_vm_data(vm) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 16, in _add_with_vm_data self.vms[vm['name']] = VMSupervisor(vm, self.middleware) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 40, in __init__ self.update_domain() File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 59, in update_domain self.__define_domain() File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor_base.py", line 87, in __define_domain if not self.LIBVIRT_CONNECTION.defineXML(vm_xml): File "/usr/lib/python3/dist-packages/libvirt.py", line 4380, in defineXML raise libvirtError('virDomainDefineXML() failed') libvirt.libvirtError: operation failed: domain '1_debianvm1' is already defined with uuid 058531df-b4a4-4adf-bc6e-3c98e87296e7 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/middlewared/main.py", line 176, in call_method result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self) File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1291, in _call return await methodobj(*prepared_call.args) File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1263, in nf return await func(*args, **kwargs) File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1131, in nf res = await f(*args, **kwargs) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_lifecycle.py", line 39, in start await self.middleware.run_in_thread(self._start, vm['name']) File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1206, in run_in_thread return await self.run_in_executor(self.thread_pool_executor, method, *args, **kwargs) File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1203, in run_in_executor return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs)) File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 61, in _start self._check_add_domain(vm_name) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 44, in _check_add_domain raise CallError(f'Unable to define domain for {vm_name}: {e}') middlewared.service_exception.CallError: [EFAULT] Unable to define domain for debianvm2: operation failed: domain '1_debianvm1' is already defined with uuid 058531df-b4a4-4adf-bc6e-3c98e87296e7
 

briangr

Cadet
Joined
May 12, 2022
Messages
7
And just to be complete, trying to delete the (incorrectly) cloned VM triggers the original cloning error again:

operation failed: domain '1_debianvm1' is already defined with uuid 058531df-b4a4-4adf-bc6e-3c98e87296e7

Perhaps the code fails to set a new uuid and/or name for the clone?

Brian
 

Adnan

Dabbler
Joined
Sep 4, 2015
Messages
22
same issue
 

ctag

Patron
Joined
Jun 16, 2017
Messages
225
I'm seeing the same error. Does anyone know if there's a bug report filed?
 

unixland

Dabbler
Joined
May 16, 2022
Messages
16
same issue here.
 
Last edited:

vyper013

Cadet
Joined
Feb 21, 2022
Messages
7
Hey all... I had the same issue... I was fortunate enough that I could try deleting the "original" VM.... this then allowed me to delete the failed clone... I had just started to create a "template" VM to save me doing installs each time... for now that is what I will have to do!! lucky I don't need too many
 

Dasos

Dabbler
Joined
Aug 12, 2016
Messages
17
I can confirm I have ran into the same issue.

The "work around" was mentioned here did work. I had to delete the orginal VM (using the "forced" option) then I was able to remove the other and re-make the original attaching the orginal zvol & re-attaching the NICs with the MAC addresses I saved before hand & same devices & device order etc.
 

stergio

Dabbler
Joined
Jun 30, 2023
Messages
11
I have not cloned anything. I restart to change Bios time to match UTC time, I was curious how my VMs would react, and i got this error when I tried to run it. What gives?! Makes no sense! Wow this is beyong frustrating, it is irritating. Same issue happened when i Forced a bridge connection on the NIC.

Are you all telling me I need to delete the VM and redo thing install and config from scratch everytime I see this kind of error? That is plain crazy

Anyone else seen this before?
 

Attachments

  • 20240122_213226.jpg
    20240122_213226.jpg
    366.8 KB · Views: 38
Top