I’ve been trying for days now with different settings to use my image (an LV of 20GB) as the base for creating a new image in a block LVM datastore.
Each time I create it with path /dev/<vg>/<lv> it works but it calculates the size as 1MB. This makes that creating new instances get a LV with size of 1MB and thus the dd fails.
I can’t seem to change the size.
I’m trying to convert an existing setup from ganeti to opennebula but not being able to create images from an existing LV makes this impossible.
Can someone explain what to do, or where this is calculated? As I’m about to give up on opennebula.
Warning
As this datastore does is just a container for existing devices images does
not take any size from it. All devices registered will render size of 0 and
the overall devices datastore will show up with 1MB of available space
You may try to set the SIZE in the image when it is created for information
purposes.
I’m using the BLOCK LVM datastore, with the virtio drivers for kvm. When creating the image and setting SIZE 20480 as custom attributes, it still creates the image with 1MB size.
LOGS:
==> /var/log/one/oned.log <==
Tue May 26 20:25:52 2015 [Z0][ReM][D]: Req:2528 UID:0 ImageAllocate invoked , "NAME=“ubuntu sejo lt…”, 100
Tue May 26 20:25:52 2015 [Z0][ImM][I]: Copying /dev/data/9104e29c-54d5-4b87-8585-2dd430696724.disk0 to repository for image 15
Tue May 26 20:25:52 2015 [Z0][ReM][D]: Req:2528 UID:0 ImageAllocate result SUCCESS, 15
Tue May 26 20:25:52 2015 [Z0][ReM][D]: Req:6160 UID:0 ImageInfo invoked , 15
Tue May 26 20:25:52 2015 [Z0][ReM][D]: Req:6160 UID:0 ImageInfo result SUCCESS, “15<U…”
oneadmin@duvel:~$ onedatastore show 100
DATASTORE 100 INFORMATION
ID : 100
NAME : SeJoITLVM
USER : oneadmin
GROUP : oneadmin
CLUSTER : SeJoIT
TYPE : IMAGE
DS_MAD : lvm
TM_MAD : lvm
BASE PATH : /var/lib/one//datastores/100
DISK_TYPE : BLOCK
STATE : READY
The problem could be in the stat action we call on image registering. The driver is meant to register images into LVM and it’s using stat command to get the image size. This is the call sequence:
Maybe you can change the stat action from LVM datastore to one that retrieves the LV size. Do it in /var/lib/one/remotes/datastore/lvm/stat. Something like:
Still, as I said before, the drivers are meant to have files as origin. These steps are just hacks that can give you more problems than help unless you know what they’re doing.
What I mean is a hack is the changes I’ve sent you. The driver was not designed to import LVs. Only images. This is the workflow it was designed for:
Import raw file image
The driver gets the size of the file and creates a LV of that size
The driver dd’s the file into the LV
Now the LV can be used for VMs or cloned in case it is not persistent
You are trying to import a LV, that’s the problem.
There are different solutions to use your LVs:
Create a file image with dd and import that file
Modify the drivers so it can import LVs directly. The changes I’ve sent you are a good start but I have not tested them
If the images are persistent (used by only one VM) you can use the devices datastore
Create an empty datablock image in the datastore with the same size, get its LV name (use oneimage show and search for SOURCE) and rename the LV you want to import to it