onevm
- manages OpenNebula virtual machines
onevm
command [args] [options]
-m, --multiple x Instance multiple VMs
--hold Creates the new VM on hold state instead of
pending
--name name Name for the new VM
--cpu cpu CPU percentage reserved for the VM (1=100% one
CPU)
--vcpu vcpu Number of virtualized CPUs
--arch arch Architecture of the VM, e.g.: i386 or x86_64
--memory memory Memory amount given to the VM. By default the
unit is megabytes. To use gigabytes add a 'g',
floats can be used: 8g=8192, 0.5g=512
--disk image0,image1 Disks to attach. To use an image owned by other
user use user[disk]. Add any additional
attributes separated by ':' and in the shape of
KEY=VALUE. For example, if the disk must be
resized, use image0:size=1000 . Or
image0:size=1000:target=vda,image1:target=vdb
--nic network0,network1 Networks to attach. To use a network owned by
other user use user[network]. Additional
attributes are supported like with the --disk
option.
--raw string Raw string to add to the template. Not to be
confused with the RAW attribute
--vnc Add VNC server to the VM
--vnc-password password VNC password
--vnc-listen ip VNC IP where to listen for connections. By
default is 0.0.0.0 (all interfaces).
--vnc-keymap keymap VNC keyboard layout
--spice Add spice server to the VM
--spice-password password spice password
--spice-listen ip spice IP where to listen for connections. By
default is 0.0.0.0 (all interfaces).
--spice-keymap keymap spice keyboard layout
--ssh [file] Add an ssh public key to the context. If the file
is omited then the user variable SSH_PUBLIC_KEY
will be used.
--net_context Add network contextualization parameters
--context line1,line2,line3 Lines to add to the context section
--boot device_list Set boot device list e.g. disk0,disk2,nic0
--files_ds file1,file2 Add files to the contextualization CD from
thefiles datastore
--init script1,script2 Script or scripts to start in context
--startscript [file] Start script to be executed
--report_ready Sends READY=YES to OneGate, useful for OneFlow
--vcenter_vm_folder path In a vCenter environment sets the the VMs and
Template folder where the VM will be placed in.
The path uses slashes to separate folders. For
example: --vcenter_vm_folder "/Management/VMs"
--as_uid uid The User ID to instantiate the VM
--as_gid gid The Group ID to instantiate the VM
--dry Just print the template
-a, --append Append new attributes to the current template
--schedule TIME Schedules this action to be executed afterthe
given time. For example: onevm resume 0
--schedule "09/23 14:15"
--weekly days Schedules this action to be executed afterthe
given time. For example: onevm resume 0
--schedule "09/23 14:15"
--monthly days Schedules this action to be executed afterthe
given time. For example: onevm resume 0
--schedule "09/23 14:15"
--yearly days Schedules this action to be executed afterthe
given time. For example: onevm resume 0
--schedule "09/23 14:15"
--hourly hour Schedules this action to be executed afterthe
given time. For example: onevm resume 0
--schedule "09/23 14:15"
--end number|TIME ----
-t, --type type Type of the new Image
-s, --snapshot snapshot ID of the Snapshot to save.
--hard Does not communicate with the guest OS
-e, --enforce Enforce that the host capacity is not exceeded
--live Do the action with the VM running
--success Recover a VM by succeeding the pending action
--failure Recover a VM by failing the pending action
--retry Recover a VM by retrying the last failed action
--interactive Enables interactive recovery. Only works
alongside the --retry option.
--delete No recover action possible, delete the VM
--recreate No recover action possible, delete and recreate
the VM
-f, --file file Selects the template file
-i, --image id|name Selects the image
-t, --target target Device where the image will be attached
--cache cache_mode Hypervisor cache mode: default, none,
writethrough, writeback, directsync or unsafe.
(Only KVM driver)
--discard discard_mode Hypervisor discard mode: ignore or unmap. (Only
KVM driver)
--prefix prefix Overrides the DEV_PREFIX of the image
-n, --network id|name Selects the virtual network
-i, --ip ip IP address for the new NIC
-l, --list x,y,z Selects columns to display with list command
-c, --listconf conf Selects a predefined column list
-d, --delay x Sets the delay in seconds for top command
-f, --filter x,y,z Filter data. An array is specified with
column=value pairs.
--csv Write table in csv format
-x, --xml Show the resource in xml format
-n, --numeric Do not translate user and group IDs
-k, --kilobytes Show units in kilobytes
--describe Describe list columns
--all Show all template data
--persistent Make the new images persistent
--use lock use actions
--manage lock manage actions
--admin lock admin actions
-v, --verbose Verbose mode
-h, --help Show this message
-V, --version Show version and copyright information
--user name User name used to connect to OpenNebula
--password password Password to authenticate with OpenNebula
--endpoint endpoint URL of OpenNebula xmlrpc frontend
create [file] Creates a new VM from the given description instead of using a previously defined template (see 'onetemplate create' and 'onetemplate instantiate').
Examples:
- using a template description file:
onevm create vm_description.tmpl
- new VM named "arch vm" with a disk and a nic
onevm create --name "arch vm" --memory 128 --cpu 1 --disk arch \
--network private_lan
- a vm with two disks
onevm create --name "test vm" --memory 128 --cpu 1 --disk arch,data
valid options: multiple, hold, name, cpu, vcpu, arch, memory, disk, nic, raw, vnc, vnc_password, vnc_listen, vnc_keymap, spice, spice_password, spice_listen, spice_keymap, ssh, net_context, context, boot, files_ds, init, startscript, report_ready, vcenter_vm_folder, as_uid, as_gid, dry
update vmid [file] Update the user template contents. If a path is not provided the editor will be launched to modify the current content. valid options: append
hold range|vmid_list Sets the given VM on hold. A VM on hold is not scheduled until it is released. It can be, however, deployed manually; see 'onevm deploy'
States: PENDING
valid options: schedule, weekly, monthly, yearly, hourly, end
release range|vmid_list Releases a VM on hold. See 'onevm hold'
States: HOLD
valid options: schedule, weekly, monthly, yearly, hourly, end
disk-saveas vmid diskid img_name Saves the specified VM disk as a new Image. The Image is created immediately, and the contents of the VM disk will be saved to it.
States: ANY
valid options: type, snapshot
terminate range|vmid_list Terminates the given VM. The VM life cycle will end.
With --hard it unplugs the VM.
States: valid if no operation is being performed on the VM
valid options: schedule, weekly, monthly, yearly, hourly, end, hard
undeploy range|vmid_list Shuts down the given VM. The VM is saved in the system Datastore.
With --hard it unplugs the VM.
States: RUNNING
valid options: schedule, weekly, monthly, yearly, hourly, end, hard
poweroff range|vmid_list Powers off the given VM. The VM will remain in the poweroff state, and can be powered on with the 'onevm resume' command.
States: RUNNING
valid options: schedule, weekly, monthly, yearly, hourly, end, hard
reboot range|vmid_list Reboots the given VM, this is equivalent to execute the reboot command from the VM console.
The VM will be ungracefully rebooted if --hard is used.
States: RUNNING
valid options: schedule, weekly, monthly, yearly, hourly, end, hard
deploy range|vmid_list hostid [datastoreid] Deploys the given VM in the specified Host. This command forces the deployment, in a standard installation the Scheduler is in charge of this decision
States: PENDING, HOLD, STOPPED, UNDEPLOYED
valid options: enforce
migrate range|vmid_list hostid [datastoreid] Migrates the given running VM to another Host. If used with --live parameter the miration is done without downtime.
States: RUNNING
valid options: enforce, live
stop range|vmid_list Stops a running VM. The VM state is saved and transferred back to the front-end along with the disk files
States: RUNNING
valid options: schedule, weekly, monthly, yearly, hourly, end
suspend range|vmid_list Saves a running VM. It is the same as 'onevm stop', but the files are left in the remote machine to later restart the VM there (i.e. the resources are not freed and there is no need to re-schedule the VM).
States: RUNNING
valid options: schedule, weekly, monthly, yearly, hourly, end
resume range|vmid_list Resumes the execution of the a saved VM
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
valid options: schedule, weekly, monthly, yearly, hourly, end
recover range|vmid_list Recovers a stuck VM that is waiting for a driver operation. The recovery may be done by failing, succeeding or retrying the current operation. YOU NEED TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation was successful or not, or if it can be retried.
Example: A VM is stuck in "migrate" because of a hardware failure. You
need to check if the VM is running in the new host or not to recover
the vm with --success or --failure, respectively.
States for success/failure recovers: Any ACTIVE state.
States for a retry recover: Any *FAILURE state
States for delete: Any
States for delete-recreate: Any but STOP/UNDEPLOYED
valid options: success, failure, retry, interactive, delete, recreate
disk-attach vmid Attaches a disk to a running VM. When using --file add only one DISK instance.
States: RUNNING, POWEROFF
valid options: file, image, target, cache, discard, prefix
disk-detach vmid diskid Detaches a disk from a running VM
States: RUNNING, POWEROFF
nic-attach vmid Attaches a NIC to a running VM. When using --file add only one NIC instance.
States: RUNNING, POWEROFF
valid options: file, network, ip
nic-detach vmid nicid Detaches a NIC from a running VM
States: RUNNING, POWEROFF
chgrp range|vmid_list groupid Changes the VM group
chown range|vmid_list userid [groupid] Changes the VM owner and group
chmod range|vmid_list octet Changes the VM permissions
resched range|vmid_list Sets the rescheduling flag for the VM.
States: RUNNING
unresched range|vmid_list Clears the rescheduling flag for the VM.
States: RUNNING
rename vmid name Renames the VM
snapshot-create range|vmid_list [name] Creates a new VM snapshot valid options: schedule, weekly, monthly, yearly, hourly, end
snapshot-revert vmid snapshot_id Reverts a VM to a saved snapshot
snapshot-delete vmid snapshot_id Delets a snapshot of a VM
disk-snapshot-create vmid diskid name Takes a new snapshot of the given disk. This operation needs support from the Datastore drivers: QCOW2 or Ceph.
States: RUNNING, POWEROFF, SUSPENDED
disk-snapshot-revert vmid diskid disk_snapshot_id Reverts disk state to a previously taken snapshot.
States: POWEROFF, SUSPENDED
disk-snapshot-delete vmid diskid disk_snapshot_id Deletes a disk snapshot.
States: RUNNING, POWEROFF, SUSPENDED
disk-resize vmid diskid size Resizes a VM disk. The new size should be larger than the old one. The valid units are:
- T: TiB
- G: GiB
- M: MiB
By default is MiB.
States: RUNNING, POWEROFF
list [filterflag] Lists VMs in the pool valid options: list, listconf, delay, filter, csv, xml, numeric, kilobytes, describe
show vmid Shows information for the given VM valid options: xml, all
top [filterflag] Lists Images continuously valid options: list, listconf, delay, filter, csv, xml, numeric, kilobytes
resize vmid Resizes the capacity of a Virtual Machine (offline, the VM cannot be RUNNING) valid options: cpu, vcpu, memory, enforce, file
save vmid name Clones the VM's source Template, replacing the disks with live snapshots of the current disks. The VM capacity and NICs are also preserved
States: POWEROFF
valid options: persistent
updateconf vmid [file] Updates the configuration of a VM. The VM cannot be in an active (running) state, valid states are: pending, failure, poweroff, undeploy, hold or cloning.
This command accepts a template file or opens an editor, the full list of
configuration attributes are:
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
INPUT = ["TYPE", "BUS"]
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
RAW = ["DATA", "DATA_VMX", "TYPE"]
CONTEXT (any value, **variable substitution will be made**)
lock vmid Locks a VM with differents levels for lock any actions with this VM, show and monitoring never will be locked. Aalid states are: All. valid options: use, manage, admin, all
unlock vmid Unlocks a VM for unlock any actions with this VM. Valid states are: All.
file Path to a file
range List of id's in the form 1,8..15
text String
hostid OpenNebula HOST name or id
groupid OpenNebula GROUP name or id
userid OpenNebula USER name or id
datastoreid OpenNebula DATASTORE name or id
vmid OpenNebula VM name or id
vmid_list Comma-separated list of OpenNebula VM names or ids
filterflag a, all all the known VMs m, mine the VM belonging to the user in ONE_AUTH g, group 'mine' plus the VM belonging to the groups the user is member of G, primary group the VM owned the user's primary group uid VM of the user identified by this uid user VM of the user identified by the username
diskid Integer
size Disk size in MiB
snapshot_id Snapshot identifier
OpenNebula 5.6.0 Copyright 2002-2018, OpenNebula Project, OpenNebula Systems
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0