A persistent image in OpenNebula keeps its data beyond the life of a VM – and always belongs to exactly one VM. If a second VM wants to use it at the same time, OpenNebula refuses to even create it.
Symptom
onetemplate instantiate 1 --name speicher3 --disk "Alpine Linux 3.20,daten" [one.template.instantiate] Error allocating a new virtual machine template. DISK 1: Cannot acquire image 2, it is persistent and already in use
In the course the data disk daten is already attached to the running VM speicher2.
Diagnosis
Whether the disk is attached to a VM shows in the VM itself. Expected is 1 or more.
onevm show speicher2 | grep -c 'daten'
Causes
PER YesA persistent image belongs to exactly one VM
Two VMs writing to the same ext4 at the same time would destroy it. That is why OpenNebula does not allow it in the first place.
STAT usedThe VM holding it is still running
oneimage list shows the image with STAT used and RVMS 1. Only when that VM is terminated is the image free again.
Fix
onevm terminate speicher2
Don't: Delete a persistent image with data by accident – run oneimage delete only when you are really sure.
OpenNebula hands-on, Day 3: images, datastores, persistent and non-persistent disks.
Go to day 3 →
FAQ
How do several VMs share the same data?
Through shared storage – a cluster file system or a network service such as NFS – not through the same persistent image.
Is the image kept when I terminate the VM?
Yes. A persistent image outlives the VM; the data stays in the datastore.