Inadequate error message: 'oneimage create' says "Not enough space in datastore"

OpenNebula 4.12.1:
It seems that changing replication settings on a slave makes the datastore temporarily unavailable. This is all fine, but the error message given by ‘oneimage create’ is unclear: “Not enough space in datastore”. This creates an intermittent problem that is hard to debug. A message like “Datastore not available” or “Datastore not yet initialized” would be much better.

Steps to reproduce:

Create a federated OpenNebula with MySQL backend, and run the folowing ansible tasks on the slave:


- name: stop slave
  mysql_replication: login_user=root login_password='{{rootpass}}' mode=stopslave

####################################################
#  THIS TASK SEEMS TO BE CREATING A DATASTORE TIMING ISSUE
#  ##################################################
- name: set replication master
  mysql_replication: login_user=root login_password='{{rootpass}}' mode=changemaster master_host={{opennebula.sunstone_master_ip}} master_user='one-slave' master_password='{{opennebula.mysql_oneslave_pass}}'
  ignore_errors: True # FIXME, mysql_replication gives a warning (although things do work)
  
- name: start slave
  mysql_replication: login_user=root login_password='{{rootpass}}' mode=startslave
  tags: replication-restart

- name: restart opennebula-sunstone after adding replication settings
  service: name={{item}} state=restarted
  with_items: 
  - opennebula-sunstone
  - opennebula

- name: create image
  shell: oneimage list | grep -q Ubuntu || oneimage create --name "Ubuntu" --path ~oneadmin/ubuntu-14.04-amd64.img --driver qcow2 --datastore default
  sudo_user: oneadmin
  

The following command will eventually succeed:

# while ! oneimage list | grep Ubuntu ; do oneimage create --name Ubuntu --path ubuntu-14.04-amd64.img --driver qcow2 --datastore default; done; oneimage list
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
Not enough space in datastore
ID: 0
   0 oneadmin   oneadmin   Ubuntu          default       2.2G OS    No lock    0
  ID USER       GROUP      NAME            DATASTORE     SIZE TYPE PER STAT RVMS
   0 oneadmin   oneadmin   Ubuntu          default       2.2G OS    No lock    0

If you remove the task marked above with “TIMING ISSUE”, things will work immediately.

It would be great if oneimage (and similar tools) would give a clearer error if there is things are getting initialized or are otherwise unavailable, as this error makes it fairly hard to debug.

Hi,

That error is probably due to the datastore not being monitored yet. I think this ticket will cover your request (show a non-monitored state the first time).