Remove VM from system

Hello,

I want to delete a Virtual Private Network but I can’t because OpenNebula says there is a VM attached to it:

However, that VM doesn’t exist at system:

oneadmin@myserver:~$ onevm list | grep 1427
oneadmin@myserver:~$

But if for onevnet, VM is attached:

[...]
LEASES
AR  OWNER                    MAC           IP PORT_FORWARD   IP6
0   V:1427     02:00:0a:0a:0a:64 10.10.10.100     -     -
[...]

I have tried with all these commands but VM continues attached to Virtual Network:

onedb update-body vnet --id 0
onedb update-body vm --id 1427
onevm recover --delete 1427
onevm terminate 1427
onevm terminate --hard 1427
onevnet release 0 10.10.10.100

VM appears in state “DONE” and all options like “Power Off”, “Undeploy”, “Release” or “Recover” (and more…) and disabled, so I can’t do anything:

How could I delete it and free Virtual Network from that attached VM?

Thanks.

Have you tried to run onedb fsck command to try to fix the DB?
You might want to run onedb fsck --dry first to see the changes going to be done.

I can’t run onedb fsck --dry because it seems “--dry” is not a valid option:

oneadmin@myserver:~$ onedb fsck --dry
invalid option: --dry

and I would apreciate running a “--dry” to check what onedb fsck will do.

I’m running OpenNebula-6.8.0-1 in an Ubuntu Server 22.04.4 LTS

Thanks.

If there is no --dry option in your onedb tool then you can make a DB backup

onedb backup

restore it on some test VM and run onedb fsck there to check the changes.

Of you can run onedb fsck command directly on your production cloud and revert to backup DB in case you want to discard the changes made.

You might also consider to submit a request for migration package to upgrade to the OpenNebula 6.10 CE.

1 Like