I’m not sure which version it changed, but in 3.8 at least, we could do the following:
oneimage create --name … --type OS --source /var/lib/one/datastores/1/image_file
This let us copy images between different clusters/environments, and create an image using the same image_file filename, and avoiding it cloning the image file to a randomly generated filename like it does if you use --path in 4.x
If we can’t do that anymore, is there any way of setting the final filename that the image will clone to rather than random?
That command should still work as you described. What version are you using?
$ ls -l /var/lib/one/images/
-rw-rw-r-- 1 oneadmin oneadmin 5343805440 Jun 8 10:03 0cd903f65634b259006a9bab8eb56da5
$ oneimage create -d default --name "test-oneimage-create" --type OS --source /var/lib/one/images/0cd903f65634b259006a9bab8eb56da5
[ImageAllocate] Cannot determine Image SIZE. Wrong number or missing SIZE attribute.
seems like you’re missing the --size attribute ?
–size size Size in MB. Used for DATABLOCK type or SOURCE based images.
Yes it works if you specify
SIZE manually, but its a local file, we shouldn’t need to specify it since the tool has access to it, and we never needed to specify it in previous versions as it worked out the size itself, but somewhere along the line it now requires you to provide it.
hi Andy, just remembered I had seen the error before, in the (NFS-mounted) /var/lib/one folder.
I wasnt able to add images from a directory like /var/lib/one/upload
If I mounted that same dir as /mnt/upload it would work ok.
the error message was similar: [ImageAllocate] Cannot determine Image SIZE.
The need to set SIZE is a requirement of images registered providing SOURCE
(as opposed to set PATH and let the drivers set the source). In this case
(setting SOURCE) the stat action of the driver is not invoked. Using SOURCE
is target to recovery situations.
Sorry for resurrecting 4 years old thread but I am facing similar problem that becomes quite annoying.
Let me explain:
- I have recent OpenNebula 5.6 installation with NFS datastore and I am trying to migrate qcow2 images from old Archipel orchestration system via “oneimage create”. I have to nfs mount previous system under /var/tmp to be able to import old images.
the command looks like this
oneimage create --name “os-oldvps1” --type OS --description “old vps1” --path=/var/tmp/vms1/vm/drives/e9757498-6926-11e4-9b45-001e67121b2c/vps1.qcow2 -d imgfsds --driver qcow2
(where /var/tmp/vms1 is NFS share mounted from old server)
The problem is that oneimage creates temporary copy under /var/tmp first and /var/tmp size is quite limited - I have 100-500gb image files and /var/tmp has only 35Gb available. Not to mention the speed of the whole procedure - copy from NFS to local disk, only to copy it agan to another NFS share.
Is there a way to force the location of temporary files for oneimage? Ideally I’d point it somewhere else on the same NFS share where I have my datastore, so that temp image->ds image operation would be almost instant.
Could somebody please point me to right direction?
Could you share the XML of your image datastore?
Any hope? if it needs to have transit temp copy it’s ok by me. how can I force oneimage to make this transit copy somewhere else? Why doesn’t it honor TMPDIR/TMP/TEMP environment variables?
It seems that you are using a BRIDGE_LIST so the STAGING_DIR is been used as temp folder for copying the images. Default value for STAGING_DIR is
You can try defining the STAGING_DIR for you datastores and set it to a convenient path.
Thank you that works perfect.
There was just some element of surprise - I assumed that oneimage create operations are async and independent, and started importing 2 images at the same time - 1st 3.7Gb and 2nd - 15Gb while watching the progress - to my surprise 3.7Gb image was created sooner, but tmp file was just sitting there waiting for 15Gb image to finish creating - why is it so?
Delayed thought - for the BRIDGE_LIST attribute of image datastore - if I will clear it will oneimage create import image file without staging copy?