How create a image datastore on LVM?

Hi.
I created two VG:

VG #PV #LV #SN Attr VSize VFree
vg-one-103 1 0 0 wz–n- 293,69g 293,69g
vg-one-104 1 0 0 wz–n- <100,00g <100,00g

And i want to use one VG for the Image datastore (vg-one-103) and other for the System Datastore (vg-one-104).

For the System Datastore i created the config - /etc/one/system-ds.conf:

NAME = lvm_system
TM_MAD = fs_lvm
TYPE = SYSTEM_DS
BRIDGE_LIST = “node1 node2”

The System Datastore was successfully create on the node’s.

For the Image datastore i created the config - /etc/one/images-ds.conf:

NAME = production
DS_MAD = fs_lvm
TM_MAD = fs_lvm
DISK_TYPE = “BLOCK”
TYPE = IMAGE_DS
BRIDGE_LIST = “node1 node2”

But, when i run the command - onedatastore create images-ds.conf i get error:
command create: argument 0 must be one of file

Which config for the Image datastore on LVM will be correct?
Please help me.
Thank you.

You need to pass that path to oneimage create, not images-ds.conf

Is it mean that i can’t create the Image Storage on LVM?

When I change the file /etc/one/images-ds.conf to:

NAME = production
DS_MAD = fs
TM_MAD = fs_lvm
DISK_TYPE = “BLOCK”
TYPE = IMAGE_DS
SAFE_DIRS="/var/tmp /tmp"

everything is ok, but i can’t create VM:

Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG E 6 ln: Command " set -e -o pipefail
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 mkdir -p /var/lib/one/datastores/103/6
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 hostname -f >"/var/lib/one/datastores/103/6/.host" ||
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 # zero trailing space
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 if [ “yes” = “yes” ]; then
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 LVSIZE=(sudo lvs --nosuffix--noheadings --units B -o lv_size "/dev/vg-one-103/lv-one-6-0" | tr -d '[:blank:]') Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 dd if=/dev/zero of="/dev/vg-one-10/lv-one-6-0" bs=64k oflag=seek_bytes iflag=count_bytes seek="986710016" count="(( LVSIZE- 986710016 ))"
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 fi
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 qemu-img convert -O raw “/var/lib/one/datastores/104/acf4c226d3bcc644e6b490997f4b0b15” “/dev/vg-one-103/lv-one-6-0”
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 rm -f “/var/lib/one/datastores/103//disk.0”
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 ln -s “/dev/vg-one-103/lv-one-6-0” “/var/lib/one/datastores/103/6/disk.0"” failed: Warning: Permanently added ‘[chv-14-dev.am.hwtool.priv]:26,[10.2.2.19]:26’ (ECDSA) to the list of known hosts.
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 48+0 records in
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 48+0 records out
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 3145728 bytes (3.1 MB) copied, 0.103929 s, 30.3 MB/s
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG I 6 qemu-img: Could not open ‘/var/lib/one/datastores/104/acf4c226d3bcc644e6b490997f4b0b15’: Could not open ‘/var/lib/one/datastores/104/acf4c226d3bcc644e6b490997f4b0b15’: No such file or directory
Wed Feb 26 15:38:02 2020 [Z0][TM][D]: Message received: LOG E 6 Error cloning /var/lib/one/datastores/104/acf4c226d3bcc644e6b490997f4b0b15 to lv-one-6-0

But file /var/lib/one/datastores/104/acf4c226d3bcc644e6b490997f4b0b15 is present

Hi Sir,

May I know did you managed to resolved the issue, my opennebula also encounters the same issue.
Tue Jul 28 22:31:40 2020 [Z0][VM][I]: New state is ACTIVE
Tue Jul 28 22:31:40 2020 [Z0][VM][I]: New LCM state is PROLOG
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: Command execution failed (exit code: 1): /var/lib/one/remotes/tm/fs_lvm/clone pmbhost.net:/var/lib/one//datastores/101/c4b73da5a0ba30be0926779bb1a28cf1 node3.pmbhost.net:/var/lib/one//datastores/100/6/disk.0 6 101
Tue Jul 28 22:31:41 2020 [Z0][TM][E]: clone: Command " set -e -o pipefail
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: mkdir -p /var/lib/one/datastores/100/6
Tue Jul 28 22:31:41 2020 [Z0][TM][I]:
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: hostname -f >"/var/lib/one/datastores/100/6/.host" || :
Tue Jul 28 22:31:41 2020 [Z0][TM][I]:
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: # zero trailing space
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: if [ “yes” = “yes” ]; then
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: LVSIZE=(sudo lvs --nosuffix --noheadings --units B -o lv_size "/dev/vg-one-100/lv-one-6-0" | tr -d '[:blank:]') Tue Jul 28 22:31:41 2020 [Z0][TM][I]: dd if=/dev/zero of="/dev/vg-one-100/lv-one-6-0" bs=64k oflag=seek_bytes iflag=count_bytes seek="2360344576" count="(( LVSIZE - 2360344576 ))"
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: fi
Tue Jul 28 22:31:41 2020 [Z0][TM][I]:
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: qemu-img convert -O raw “/var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1” “/dev/vg-one-100/lv-one-6-0”
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: rm -f “/var/lib/one/datastores/100/6/disk.0”
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: ln -s “/dev/vg-one-100/lv-one-6-0” “/var/lib/one/datastores/100/6/disk.0"” failed: 16+0 records in
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: 16+0 records out
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00686527 s, 153 MB/s
Tue Jul 28 22:31:41 2020 [Z0][TM][I]: qemu-img: Could not open ‘/var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1’: Could not open ‘/var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1’: No such file or directory
Tue Jul 28 22:31:41 2020 [Z0][TM][E]: Error cloning /var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1 to lv-one-6-0
Tue Jul 28 22:31:41 2020 [Z0][TM][E]: Error executing image transfer script: Error cloning /var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1 to lv-one-6-0
Tue Jul 28 22:31:41 2020 [Z0][VM][I]: New LCM state is PROLOG_FAILURE

Best Regards,
Jhonny

Hi,

Looking at your log files:

Tue Jul 28 22:31:41 2020 [Z0][TM][I]: qemu-img: Could not open ‘/var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1’: Could not open ‘/var/lib/one/datastores/101/c4b73da5a0ba30be0926779bb1a28cf1’: No such file or directory

It seems the node does not have access to the file images to dump them into a volume. Note that LVM uses a shared FS to distribute the files across the nodes. Check here: http://docs.opennebula.io/5.12/deployment/open_cloud_storage_setup/lvm_drivers.html (the warning in that page)