Problen deploying VM on a NFS share. OpenNebula uses wrong links

Hello,

I have an OpenNebula installation which uses a NFS share.

On the share i have correctly defined several datastores an I’m able of uploading images.

When I create a template for a VM I can use and access the images defined on those shares but when I deploy the VM the disk images are linked to wrong directories.

For example, is linked this way
disk.0 -> /var/lib/one/datastores/107/ceb5a0eec8c8ee034b1e35d78ec69f7f
when the file exists here
-rw-rw-r-- 1 oneadmin oneadmin 607125504 mar 18 14:01 /mnt/nfs/one-ds-iso/107/ceb5a0eec8c8ee034b1e35d78ec69f7f

The same happens for
lrwxrwxrwx 1 oneadmin oneadmin 60 mar 21 13:06 disk.1 -> /var/lib/one/datastores/108/aebf77f88bd8f0420f45d046d0246d33
which exists here
-rw-rw-r-- 1 oneadmin oneadmin 16777217 mar 18 13:51 /mnt/nfs/one-diskimages/108/aebf77f88bd8f0420f45d046d0246d33

It seems like, on deployment tasks, opennebula omits or uses the wrong base path defined.

Any help or clarification about this problem?

Thans in advance.

There are two parameters in oned.conf to change the datastores directory and you’ll probably need to update both. Still, I don’t recommend you to use it. The safest and most flexible way to have datastores in another location is to create symlinks for them:

$ ln -s /mnt/nfs/one-diskimages/{107,108} /var/lib/one/datastores

Thank you for your answer but…

  1. the new created datastores are defined in Infrastructure->Datastores
  2. the BASE_PATH attribute of these datastores is /mnt/nfs/one-ds-iso and in information shows base path /mnt/nfs/one-ds-iso/107 (these are the values defined for data store name nfs01-iso and ID 107
  3. when deploying a VM based on template that uses this datastores happens the error that I showed: the virtual disks are linked to files in the /var/lib/one/datastores omiting or ignoring the BASE_PATH value defined in the datastores that the template uses.
    disk.0 -> /var/lib/one/datastores/107/ceb5a0eec8c8ee034b1e35d78ec69f7f
    when the file exists in
    /mnt/nfs/one-ds-iso/107/ceb5a0eec8c8ee034b1e35d78ec69f7f

From the datastores documentation:

BASE_PATH: Base path to build the path of the Datastore Images. This path is used to store the images when they are created in the datastores. Defaults to /var/lib/one/datastores.

This is only used to register and manage images, that is, on the frontend. For nodes this value does not apply. To change the directory in the hosts you must use DATASTORE_LOCATION in oned.conf or per cluster. Take into account that this changes the base of all datastores, not only one.

I can not recommend to use these parameters if there is not a very special reason for not creating symlinks like, for example, a read only root system.

Use always the default /var/lib/one/datastores and make symlinks to where the storage is mounted. In your last example it should be something like:

$ ln -s /mnt/nfs/one-ds-iso/107 /var/lib/one/datastores/

Ok, thank you.

So, all the datastores created on an infrastructure must exist in the same directory and the field Base Path that is in the form for creating a datastore must no be used, is this correct?

Nevertheless, the help about the field Base Path says that “When needed, the front-end will access the datastores using BASE_PATH (deafults to /var/lib/one/datastores)”. The problem was that, when creating a VM, does not access using the Base Path assigned to the datastore.