Oneimage create not working

Hey,

I am trying to import an image to our ceph cluster via oneimage create. I use the following command:

oneimage create -d 104 --name mailserver --path /home/one/image.qcow2

also trying with /var/tmp

oneimage create -d 104 --name mailserver --path /var/tmp/image.qcow2

always leads to:

[one.image.allocate] Cannot parse image SIZE:

And in oned.log nothing special:

Thu Feb  1 10:36:07 2018 [Z0][ReM][D]: Req:1440 UID:0 one.image.allocate invoked , "NAME="mailserver"...", 102
Thu Feb  1 10:36:08 2018 [Z0][ReM][E]: Req:1440 UID:0 one.image.allocate result FAILURE [one.image.allocate] Cannot parse image SIZE:

Thank you for helping.

NOTE: For the first command I have added /home/one to the list of SAFE_DIRS of datastore with 104.

hi,

The error message is just a notification that the produced result cannot be read, so size is unknown.
I’m not sure if this helps, but in the docs they show you how to first create a template, with details like “path” in it. Then they create the image using that template, to the datastore.
Seems you can’t create the image from a file straight into a datastore.

source: https://docs.opennebula.org/5.4/operation/vm_management/img_guide.html

To register it from the command line you need to create a new image template, and submit it using the oneimage create command.

The complete reference for the image template is here. This is how a sample template looks like:

cat ubuntu_img.one
NAME          = "Ubuntu"
PATH          = "/home/cloud/images/ubuntu-desktop/disk.0"
TYPE          = "OS"
DESCRIPTION   = "Ubuntu desktop for students."

You need to choose the Datastore where to register the new Image. To know the available datastores, use the onedatastore list command. In a clean installation you will only have one datastores with type img, default.

onedatastore list
  ID NAME                SIZE AVAIL CLUSTERS     IMAGES TYPE DS      TM      STAT
   0 system            145.2G 56%   0                 0 sys  -       shared  on
   1 default           145.2G 56%   0                 3 img  fs      shared  on
   2 files             145.2G 56%   0                 0 fil  fs      ssh     on

To submit the template, you just have to issue the command

oneimage create ubuntu_img.one --datastore default
ID: 0