Database Schema for Accounting 2.0

This page presents a simplified view of the database schema used by OpenNebula. It includes only the tables relevant for third party accounting software developers.

These tables apply to both the Sqlite and MySQL backends.

History table

It contains information of VM execution on a given host. During its life-cycle a VM can be executed on multiple hosts (e.g. because of a migration or a stop/resume operation).

  • PRIMARY KEY: (vid,seq)
Name SQL Type Description
vid int(11) Corresponds with oid identifier of vm_pool, matching VMs with their history
seq int(11) Sequence number, one VM can have more than one history. Sequence number 0 means first host
host_name text Hostname where the VM is running on
vm_dir text Path of the VM specific (for checkpointing, logs, …) directory in the remote host
hid int(11) Host Id where the VM is running on
vm_mad text Name of the driver needed to access the hypervisor present in the host where the VM is running
tm_mad text Name of the driver needed to stage files to/from the hosts where the VM is running
stime int(11) Start time. Time at which the VM started its life cycle in the host
etime int(11) End time. Time at which the VM ended its life cycle in the host
pstime int(11) Prolog start time. Time at which files were started being staged into the host prior the running of the VM
petime int(11) Prolog end time. Time at which files were finished being staged into the host prior the running of the VM
rstime int(11) Running start time. Time at which the VM actually was handed to the hypervisor of this host for execution
retime int(11) Running end time. Time at which the VM stop running at this host
estime int(11) Epilog start time. Time at which files were started being staged out of the host after the VM finished running
eetime int(11) Epilog end time. Time at which files were ended being staged out of the host after the VM finished running
reason int(11) Reason of the migration from this host. See table below

Specific reasons:

Value Name Description
0 NONE Normal termination in host
1 ERROR The VM was migrated because of an error
2 STOP_RESUME The VM was migrated because of a stop/resume request
3 USER The VM was migrated because of an explicit request
4 CANCEL The VM was migrated because of an explicit cancel

Host pool

Information about the hosts.

  • PRIMARY KEY: oid
  • UNIQUE KEY: host_name
Name SQL Type Description
oid int(11) Unique Host Identifier
host_name varchar(256) Hostname of this host
state int(11) Host state. See table below for details
im_mad varchar(128) Name of the information driver used to monitor this host
vm_mad varchar(128) Name of the driver needed for communication with the hypervisor present in this host
tm_mad varchar(128) Name of the driver needed for staging files to and from this host
last_mon_time int(11) Time at which this host was last monitored
cluster varchar(128) Cluster of this host
template text Host template. It includes also monitorization metrics

Possible values for state column:

Value Name Description
0 INIT Initial state for enabled hosts
1 MONITORING The host is being monitored
2 MONITORED The host has been successfully monitored
3 ERROR An error ocurrer while monitoring the host
4 DISABLED The host is disabled won't be monitored

Host Shares

Host share repesents the capacity of a host to run VMs. Each host has just one share.

  • PRIMARY KEY: hid
Name SQL Type Description
hid int(11) Unique Host Identifier
disk_usage int(11) Allocated capacity as requested in VM templates
mem_usage int(11)
cpu_usage int(11)
max_disk int(11) Max capacity as returned by IM probes
max_mem int(11)
max_cpu int(11)
free_disk int(11) Free capacity as returned by IM probes
free_mem int(11)
free_cpu int(11)
used_disk int(11) Used capacity as returned by IM probes
used_mem int(11)
used_cpu int(11)
running_vms int(11) Number of VMs running in the host

Virtual Machine Pool

The Virtual Machines.

  • PRIMARY KEY: oid
Name SQL Type Description
oid int(11) Unique DB identifier for this VM
uid int(11) The id of the owner
name text Name of the Virtual Machine
last_poll int(11) Last time the VM was polled
state int(11) Dispatch Manager (main) VM state, check table below
lcm_state int(11) Life Cycle Manager (ACTIVE sub-states) VM state, check table below
stime int(11) Start time, time the VM was created
etime int(11) End time, time the VM entered DONE state
deploy_id text Hypervisor specific id for this VM
memory int(11) Used by the VM as reported by the monitor system
cpu int(11) Used by the VM as reported by the monitor system
net_tx int(11) Transmitted by the VM as reported by the monitor system
net_rx int(11) Received by the VM as reported by the monitor system
last_seq int(11) The last sequence number used
template text Coded in XML format

Possible values for state column:

Value Name
0 INIT
1 PENDING
2 HOLD
3 ACTIVE
4 STOPPED
5 SUSPENDED
6 DONE
7 FAILED

The lcm_state is a sub-state of the ACTIVE “main” state. Possible values for lcm_state column:

Value Name
0 LCM_INIT
1 PROLOG
2 BOOT
3 RUNNING
4 MIGRATE
5 SAVE_STOP
6 SAVE_SUSPEND
7 SAVE_MIGRATE
8 PROLOG_MIGRATE
9 PROLOG_RESUME
10 EPILOG_STOP
11 EPILOG
12 SHUTDOWN
13 CANCEL
14 FAILURE
15 DELETE
16 UNKNOWN