onedb
- OpenNebula database migration tool
This command enables the user to manage the OpenNebula database. It provides information about the DB version, means to upgrade it to the latest version, and backup tools.
-f, --force Forces the backup even if the DB exists
--federated Limit backup/restore to federated tables
-b, --backup file Use this file to store SQL dump
--extra arg Extra args
-s, --start TIME First time to process
-e, --end TIME Last time to process
--pages pages Nummber of pages to purge VMs
-i, --id ID Filter by ID
-x, --xpath ID Filter by xpath
-e, --expr ID Filter by expression (UNAME=oneadmin)
--dry Do not write in the database, output xml
-d, --delete Delete all matched xpaths
--seq SEQ Sequence number of a hitory record
--recreate Delete FTS index and create a new one
-v, --verbose Verbose mode
-h, --help Show this message
-V, --version Show version and copyright information
-s, --sqlite file SQLite DB file
-S, --server host MySQL server hostname or IP. Defaults to
localhost
-P, --port port MySQL server port. Defaults to 3306
-u, --username user MySQL username
-p, --password pass MySQL password. Leave unset to be prompted for it
-d, --dbname dbname MySQL DB name for OpenNebula
backup [output_file] Dumps the DB to a file specified in the argument valid options: force, federated
version Prints the current DB version. Use -v flag to see also OpenNebula version
history Prints the upgrades history
restore backup_file Restores the DB from a backup file. Only restores backups generated from the same backend (SQLite or MySQL) valid options: force, federated
upgrade [version] Upgrades the DB to the latest version where version : DB version (e.g. 1, 3) to upgrade. By default the DB is upgraded to the latest version valid options: force, backup
fsck Checks the consistency of the DB, and fixes the problems found valid options: force, backup
vcenter-one54 Migrate VM and templates so they can be used by OpenNebula 5.4 valid options: force, backup
patch file Applies a database patch file valid options: backup, extra
sqlite2mysql Migrates a SQLite OpenNebula Database to MySQL valid options: backup
purge-history Deletes all but the last history records from non DONE VMs
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: start_time, end_time
purge-done Deletes all VMs in DONE state
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: start_time, end_time, pages
change-body
You can filter the objects to modify using one of these options:
* --id: object id, example: 156
* --xpath: xpath expression, example: TEMPLATE[count(NIC)>1]
* --expr: xpath expression, can use operators =, !=, <, >, <= or >=
examples: UNAME=oneadmin, TEMPLATE/NIC/NIC_ID>0
If you want to change a value use a third parameter. In case you want
to delete it use --delete option.
Change the second network of VMs that belong to "user":
onedb change-body vm --expr UNAME=user \
'/VM/TEMPLATE/NIC[NETWORK="service"]/NETWORK' new_network
Delete cache attribute in all disks, write xml, do not modify DB:
onedb change-body vm '/VM/TEMPLATE/DISK/CACHE' --delete --dry
Delete cache attribute in all disks in poweroff:
onedb change-body vm --expr LCM_STATE=8 \
'/VM/TEMPLATE/DISK/CACHE' --delete
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id, xpath, expr, dry, delete
change-history xpath value Changes a value from a history record of a VM. History records are defined by its sequence number (SEQ) and VM ID.
* --id: vm id, example: 156
* --seq: sequence number of the record, example: 0
The new value for this elemente is set in the third parameter.
Change the the hostname of first record:
onedb change-history --id 3 --seq 0 '/HISTORY/HOSTNAME' new_host
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id, seq, dry
update-body
* --id: object id, example: 156
For example to update the XML document of VM 23:
onedb update-body vm --id 23
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id
update-history Update history record of a VM. History records are defined by its sequence number (SEQ) and VM ID:
* --id: vm id, example: 156
* --seq: sequence number of the record, example: 0
For example to update the 3rd record of VM 0
onedb update-history --id 0 --seq 3
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id, seq
show-body
* --id: object id, example: 156
For example to show the XML document of VM 23:
onedb show-body vm --id 23
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id
show-history Show body of a history record. History records are defined by its sequence number (SEQ) and VM ID:
* --id: vm id, example: 156
* --seq: sequence number of the record, example: 0
For example to show the 3rd record of VM 0
onedb update-history --id 0 --seq 3
**WARNING**: This action is done while OpenNebula is running. Make
a backup of the datasbase before executing.
valid options: id, seq
create-index Create or recreate FTS index in vm pool to be able to search VMs valid options: recreate
file Path to a file
range List of id's in the form 1,8..15
text String