gnt-instance(8)
๐ NAME ๐
gnt-instance โ Ganeti instance administration โจ (aka your new bestie for wrangling VMs, gnt-instance(8), Version 3.1.0~rc2)
๐ SYNOPSIS ๐
gnt-instance {command} [arguments...]
๐ DESCRIPTION ๐
So like, the gnt-instance command is the command for instance administration in the Ganeti system. That's it, that's the whole vibe check. ๐
๐ธ COMMANDS ๐ธ
๐ฆ Creation/removal/querying ๐ฆ
โจ ADD โจ
Okay bestie, this is the big one. Buckle up:
add
{-t|--disk-template {diskless | file | plain | drbd | rbd}}
{--disk=*N*: {size=*VAL*[,spindles=*VAL*] | adopt=*LV*}[,options...]
| {size=*VAL*,provider=*PROVIDER*}[,param=*value*... ][,options...]
| {-s|--os-size} SIZE}
[--ip-check] [--name-check] [--no-conflicts-check]
[--no-start] [--no-install] [{--forthcoming | --commit}]
[--net=*N* [:options...] | --no-nics]
[{-B|--backend-parameters} BEPARAMS]
[{-H|--hypervisor-parameters} HYPERVISOR [: option=*value*... ]]
[{-O|--os-parameters} param=*value*... ]
[--os-parameters-private param=*value*... ]
[--os-parameters-secret param=*value*... ]
[--file-storage-dir dir_path] [--file-driver {loop | blktap | blktap2}]
{{-n--iallocator} name | {-g|--node-group} nodegroup}
{{-o|--os-type} os-type}
[--submit] [--print-jobid]
[--ignore-ipolicy]
[--no-wait-for-sync]
[{-cno}]
[{--tags [: tag:value... ]
{instance-name}
Creates a new instance on the specified host. ๐ The instance-name argument must be in DNS, but depending on the bridge/routing setup, it does not have to be in the same network as the nodes in the cluster. (Lowkey flexible of it. ๐ )
The disk option specifies the parameters for the disks of the instance. The numbering of disks starts at zero, and at least one disk needs to be passed. For each disk, either the size or the adoption source needs to be given. The size is interpreted (when no unit is given) in mebibytes. You can also use one of the suffixes m, g or t to specify the exact the units used; these suffixes map to mebibytes, gibibytes and tebibytes. ๐
Each disk can also take these parameters (all optional):
spindlesโ how many spindles (physical disks on the node) the disk should span.modeโ the access mode. Eitherro(read-only) or the defaultrw(read-write).nameโ this option specifies a name for the disk, which can be used as a disk identifier. An instance can not have two disks with the same name. ๐ซvgโ the LVM volume group. This works only for LVM and DRBD devices.metavgโ this option specifies a different VG for the metadata device. This works only for DRBD devices. If not specified, the default metavg of the node-group (possibly inherited from the cluster-wide settings) will be used.accessโ if'userspace', instance will access this disk directly without going through a block device, avoiding expensive context switches with kernel space. This option works only for RBD, Gluster and ExtStorage devices. If not specified, the default access of the node-group (possibly inherited from the cluster-wide settings) will be used.
When creating ExtStorage disks, also arbitrary parameters can be passed, to the ExtStorage provider. Those parameters are passed as additional comma separated options. Therefore, an ExtStorage disk provided by provider pvdr1 with parameters param1, param2 would be passed as --disk 0:size=10G,provider=pvdr1,param1=val1,param2=val2. ๐
When using the adopt key in the disk definition, Ganeti will reuse those volumes (instead of creating new ones) as the instance's disks. Ganeti will rename these volumes to the standard format, and (without installing the OS) will use them as-is for the instance. This allows migrating instances from non-managed mode (e.g. plain KVM with LVM) to being managed via Ganeti. ๐ฆ Please note that this works only for the plain disk template (see below for template details).
Alternatively, a single-disk instance can be created via the -s option which takes a single argument, the size of the disk. This is similar to the Ganeti 1.2 version (but will only create one disk). ๐
The minimum disk specification is therefore --disk 0:size=20G (or -s 20G when using the -s option), and a three-disk instance can be specified as --disk 0:size=20G --disk 1:size=4G --disk 2:size=100G. โจ
The minimum information needed to specify an ExtStorage disk are the size and the provider. For example: --disk 0:size=20G,provider=pvdr1. ๐
The --ip-check option checks that the instance's IP is not already alive (i.e. reachable from the master node). If you pass this option you must also pass the --name-check option, because the name check is used to compute the IP address via the resolver (e.g. in DNS or /etc/hosts, depending on your setup). โ ๏ธ
The --name-check checks for the instance name via the resolver (e.g. in DNS or /etc/hosts, depending on your setup). The name check can be used to compute the IP address (when set to auto). ๐
If you don't want the instance to automatically start after creation, this is possible via the --no-start option. This will leave the instance down until a subsequent gnt-instance start command. ๐ด
The NICs of the instances can be specified via the --net option. By default, one NIC is created for the instance, with a random MAC, and set up according to the cluster level NIC parameters. Each NIC can take these parameters (all optional):
macโ either a value or'generate'to generate a new unique MAC.ipโ specifies the IP address assigned to the instance from the Ganeti side (this is not necessarily what the instance will use, but what the node expects the instance to use). Note that if an IP in the range of a network configured withgnt-network(8)is used, and the NIC is not already connected to it, this network has to be passed in the network parameter if this NIC is meant to be connected to the said network.--no-conflicts-checkcan be used to override this check. The special valuepoolcauses Ganeti to select an IP from the network the NIC is or will be connected to. The special valueautomust be combined with--name-checkand will use the resolved IP. One can pick an externally reserved IP of a network along with--no-conflict-check. Note that this IP cannot be assigned to any other instance until it gets released. ๐modeโ specifies the connection mode for this NIC:routed,bridgedoropenvswitch.linkโ in bridged or openvswitch mode specifies the interface to attach this NIC to, in routed mode it's intended to differentiate between different routing tables/instance groups (but the meaning is dependent on the network script, seegnt-cluster(8)for more details). Note that openvswitch support is also hypervisor dependent.networkโ derives the mode and the link from the settings of the network which is identified by its name. If the network option is chosen,linkandmodemust not be specified. Note that the mode and link depend on the network-to-nodegroup connection, thus allowing different nodegroups to be connected to the same network in different ways. ๐nameโ this option specifies a name for the NIC, which can be used as a NIC identifier. An instance can not have two NICs with the same name. ๐ซvlanโ in bridged and openvswitch mode specifies the VLANs that the NIC will be connected to. To connect as an access port usenor.nwithnbeing the VLAN ID. To connect as a trunk port use:n[:n]. A hybrid port can be created with.n:n[:n]. For bridged mode, the bridge needs VLAN filtering enabled. Assuming a bridge namedgnt-br, this is accomplished by runningip link set dev gnt-br type bridge vlan_filtering 1. Please make sure to only use VLAN IDs accepted by your network equipment (e.g. do not set the PVID) as this will break traffic flow otherwise. ๐
Of these "mode" and "link" are NIC parameters, and inherit their default at cluster level. Alternatively, if no network is desired for the instance, you can prevent the default of one NIC with the --no-nics option. ๐
โ๏ธ
The -o (--os-type) option specifies the operating system to be installed. The available operating systems can be listed with gnt-os list. Passing --no-install will however skip the OS installation, allowing a manual import if so desired. Note that the no-installation mode will automatically disable the start-up of the instance (without an OS, it most likely won't be able to start-up successfully). ๐ญ
Passing the --forthcoming option, Ganeti will not at all try to create the instance or its disks. Instead the instance will only be added to the configuration, so that the resources are reserved. If the --commit option is passed, then it is a prerequisite that an instance with that name has already been added to the configuration as a forthcoming instance and the request is to replace this instance by the newly created real one. Note that if the reason for reserving an instance is that DNS names still need to be propagated, the reservation has to be done without --name-check and --ip-check. ๐
The -B (--backend-parameters) option specifies the backend parameters for the instance. If no such parameters are specified, the values are inherited from the cluster. Possible parameters are:
maxmemโ the maximum memory size of the instance; as usual, suffixes can be used to denote the unit, otherwise the value is taken in mebibytes.minmemโ the minimum memory size of the instance; as usual, suffixes can be used to denote the unit, otherwise the value is taken in mebibytes.vcpusโ the number of VCPUs to assign to the instance (if this value makes sense for the hypervisor).auto_balanceโ whether the instance is considered in the N+1 cluster checks (enough redundancy in the cluster to survive a node failure).always_failoverโTrueorFalse, whether the instance must be failed over (shut down and rebooted) always or it may be migrated (briefly suspended).
Note that before 2.6 Ganeti had a memory parameter, which was the only value of memory an instance could have. With the maxmem/minmem change Ganeti guarantees that at least the minimum memory is always available for an instance, but allows more memory to be used (up to the maximum memory) should it be free. ๐
The -H (--hypervisor-parameters) option specified the hypervisor to use for the instance (must be one of the enabled hypervisors on the cluster) and optionally custom parameters for this instance. If not other options are used (i.e. the invocation is just -H NAME) the instance will inherit the cluster options. The defaults below show the cluster defaults at cluster creation time. โญ
okay so the possible hypervisor options are as follows, bestie โ and yes, every single one matters ๐
boot_orderโ Valid for the Xen HVM and KVM hypervisors. โจ
A string value denoting the boot order. This has different meaning for the Xen HVM hypervisor and for the KVM one.
For Xen HVM, the boot order is a string of letters listing the boot devices, with valid device letters being:
aโ floppy drivecโ hard diskdโ CDROM drivenโ network boot (PXE)
The default is not to set an HVM boot order, which is interpreted as 'dc'.
For KVM the boot order is either "floppy", "cdrom", "disk" or "network". Please note that older versions of KVM couldn't netboot from virtio interfaces. This has been fixed in more recent versions and is confirmed to work at least with qemu-kvm 0.11.1. Also note that if you have set the kernel_path option, that will be used for booting, and this setting will be silently ignored.
blockdev_prefixโ Valid for the Xen HVM and PVM hypervisors. ๐ฆ
Relevant to non-pvops guest kernels, in which the disk device names are given by the host. Allows one to specify xvd, which helps run Red Hat based installers, driven by anaconda.
floppy_image_pathโ Valid for the KVM hypervisor. ๐
The path to a floppy disk image to attach to the instance. This is useful to install Windows operating systems on Virt/IO disks because you can specify here the floppy for the drivers at installation time.
cdrom_image_pathโ Valid for the Xen HVM and KVM hypervisors. ๐ฟ
The path to a CDROM image to attach to the instance.
cdrom2_image_pathโ Valid for the KVM hypervisor. ๐ฟ
The path to a second CDROM image to attach to the instance. NOTE: This image can't be used to boot the system. To do that you have to use the cdrom_image_path option.
nic_typeโ Valid for the Xen HVM and KVM hypervisors. ๐
This parameter determines the way the network cards are presented to the instance. The possible options are:
rtl8139(default for Xen HVM) (HVM & KVM)ne2k_isa(HVM & KVM)ne2k_pci(HVM & KVM)i82551(KVM)i82557b(KVM)i82559er(KVM)pcnet(KVM)e1000(KVM)paravirtual(default for KVM) (HVM & KVM)
vif_typeโ Valid for the Xen HVM hypervisor. ๐ง
This parameter specifies the vif type of the nic configuration of the instance. Unsetting the value leads to no type being specified in the configuration. Note that this parameter only takes effect when the nic_type is not set. The possible options are:
ioemuvif
scsi_controller_typeโ Valid for the KVM hypervisor. ๐
This parameter specifies which type of SCSI controller to use. The possible options are:
lsi[default]megasasvirtio-scsi-pci
kvm_pci_reservationsโ Valid for the KVM hypervisor. ๐ ๏ธ
The number of PCI slots that QEMU will manage implicitly. By default Ganeti will let QEMU use the first 12 slots (i.e. PCI slots 0-11) on its own and will start adding disks and NICs from the 13rd slot (i.e. PCI slot 12) onwards. So by default one can add 20 PCI devices (32 - 12). To support more than that, this hypervisor parameter should be set accordingly (e.g. to 8).
disk_typeโ Valid for the Xen HVM and KVM hypervisors. ๐พ
This parameter determines the way the disks are presented to the instance. The possible options are:
ioemu[default] (HVM & KVM)paravirtual(HVM & KVM)ide(KVM)scsi(KVM)sd(KVM)mtd(KVM)pflash(KVM)
cdrom_disk_typeโ Valid for the KVM hypervisor. ๐ฟ
This parameter determines the way the cdroms disks are presented to the instance. The default behavior is to get the same value of the earlier parameter (disk_type). The possible options are:
paravirtualidescsisdmtdpflash
vnc_bind_addressโ Valid for the Xen HVM and KVM hypervisors. ๐ฅ๏ธ
Specifies the address that the VNC listener for this instance should bind to. Valid values are IPv4 addresses. Use the address 0.0.0.0 to bind to all available interfaces (this is the default) or specify the address of one of the interfaces on the node to restrict listening to that interface.
vnc_password_fileโ Valid for the Xen HVM and KVM hypervisors. ๐
Specifies the location of the file containing the password for connections using VNC. The default is a file named vnc-cluster-password which can be found in the configuration directory.
vnc_tlsโ Valid for the KVM hypervisor. ๐
A boolean option that controls whether the VNC connection is secured with TLS.
vnc_x509_pathโ Valid for the KVM hypervisor. ๐
If vnc_tls is enabled, this options specifies the path to the x509 certificate to use.
vnc_x509_verifyโ Valid for the KVM hypervisor. โspice_bindโ Valid for the KVM hypervisor. ๐ถ๏ธ
Specifies the address or interface on which the SPICE server will listen. Valid values are:
- IPv4 addresses, including
0.0.0.0and127.0.0.1 - IPv6 addresses, including
::and::1 - names of network interfaces
If a network interface is specified, the SPICE server will be bound to one of the addresses of that interface.
spice_ip_versionโ Valid for the KVM hypervisor. ๐ถ๏ธ
Specifies which version of the IP protocol should be used by the SPICE server.
It is mainly intended to be used for specifying what kind of IP addresses should be used if a network interface with both IPv4 and IPv6 addresses is specified via the spice_bind parameter. In this case, if the spice_ip_version parameter is not used, the default IP version of the cluster will be used.
spice_password_fileโ Valid for the KVM hypervisor. ๐
Specifies a file containing the password that must be used when connecting via the SPICE protocol. If the option is not specified, passwordless connections are allowed.
spice_image_compressionโ Valid for the KVM hypervisor. ๐ผ๏ธ
Configures the SPICE lossless image compression. Valid values are:
auto_glzauto_lzquicglzlzoff
spice_jpeg_wan_compressionโ Valid for the KVM hypervisor. ๐
Configures how SPICE should use the jpeg algorithm for lossy image compression on slow links. Valid values are:
autoneveralways
spice_zlib_glz_wan_compressionโ Valid for the KVM hypervisor. ๐
Configures how SPICE should use the zlib-glz algorithm for lossy image compression on slow links. Valid values are:
autoneveralways
spice_streaming_videoโ Valid for the KVM hypervisor. ๐ฅ
Configures how SPICE should detect video streams. Valid values are:
offallfilter
spice_playback_compressionโ Valid for the KVM hypervisor. ๐
Configures whether SPICE should compress audio streams or not.
spice_use_tlsโ Valid for the KVM hypervisor. ๐
Specifies that the SPICE server must use TLS to encrypt all the traffic with the client.
spice_tls_ciphersโ Valid for the KVM hypervisor. ๐
Specifies a list of comma-separated ciphers that SPICE should use for TLS connections. For the format, see man cipher(1).
spice_use_vdagentโ Valid for the KVM hypervisor. ๐ฑ๏ธ
Enables or disables passing mouse events via SPICE vdagent.
cpu_typeโ Valid for the KVM hypervisor. ๐ง
This parameter determines the emulated cpu for the instance. If this parameter is empty (which is the default configuration), it will not be passed to KVM which defaults to the emulated 'qemu64' type.
Be aware of setting this parameter to "host" if you have nodes with mixed CPU models. Live migration may stop working or crash the instance in this situation.
If you leave this parameter unset or use one of the generic types (e.g. "qemu32", "qemu64", "kvm32" or "kvm64") your instances will not be able to benefit from advanced CPU instructions such as AES-NI or RDRAND. Please be aware these generic CPU types also lack security features such as mitigations to the Meltdown and Spectre family of processor vulnerabilities.
You can query for supported CPU types by running the QEMU/KVM binary with the following parameter:
qemu-system-x86_64 -cpu ?
More information can be found in the Qemu / KVM CPU model configuration documentation. Please check there for the recommended settings.
acpiโ Valid for the Xen HVM and KVM hypervisors. ๐
A boolean option that specifies if the hypervisor should enable ACPI support for this instance. By default, ACPI is disabled.
ACPI should be enabled for user shutdown detection. See user_shutdown.
paeโ Valid for the Xen HVM and KVM hypervisors. ๐งฉ
A boolean option that specifies if the hypervisor should enable PAE support for this instance. The default is false, disabling PAE support.
viridianโ Valid for the Xen HVM hypervisor. ๐ฃ
A boolean option that specifies if the hypervisor should enable viridian (Hyper-V) for this instance. The default is false, disabling viridian support.
use_guest_agentโ Valid for the KVM hypervisor. ๐ป
A boolean option that specifies if the hypervisor should enable the QEMU Guest Agent protocol for this instance. By default, the Guest Agent is disabled.
use_localtimeโ Valid for the Xen HVM and KVM hypervisors. ๐ฐ๏ธ- the clock boolean โ yes bestie, it's a boolean, and it decides whether the instance boots with its clock set to the machine's localtime (when true) or to UTC (when false). Default is false, which is the correct vibe for Linux/Unix machines; for Windows OSes it's recommended to enable this parameter. ๐
kernel_pathโ valid for the Xen PVM and KVM hypervisors โจ- It's the path (on the node) to the kernel you want to boot the instance with.
- Xen PVM instances always require this one โ no exceptions, no skipping. ๐ โโ๏ธ
- For KVM, if this option is empty it causes the machine to load the kernel from its disks instead, and the boot happens accordingly to
boot_order. ๐ฆ
kernel_argsโ valid for the Xen PVM and KVM hypervisors โจ- Extra arguments to the kernel that will be loaded. This is always used for Xen PVM, while for KVM it is only used if the
kernel_pathoption is also specified. - The default setting for this value is simply
"ro", which mounts the root disk (initially) in read-only mode. So for example, setting this tosinglewill cause the instance to start in single-user mode. - ๐ Note that the hypervisor setting
serial_consoleappends"console=ttyS0,<serial_speed>"to the end ofkernel_argsin KVM.
- Extra arguments to the kernel that will be loaded. This is always used for Xen PVM, while for KVM it is only used if the
initrd_pathโ valid for the Xen PVM and KVM hypervisors โจ- The path (on the node) to the initrd to boot the instance with. Xen PVM instances can use this always, while for KVM this option is only used if the
kernel_pathoption is also specified. - You can pass here either an absolute filename (the path to the initrd) if you want to use an initrd, or use the format
no_initrd_pathfor no initrd. ๐
- The path (on the node) to the initrd to boot the instance with. Xen PVM instances can use this always, while for KVM this option is only used if the
root_pathโ valid for the Xen PVM and KVM hypervisors โจ- The name of the root device. This is always needed for Xen PVM, while for KVM it is only used if the
kernel_pathoption is also specified. - Please note: if this setting is an empty string and the hypervisor is Xen, it will not be written to the Xen configuration file. ๐ซถ
- The name of the root device. This is always needed for Xen PVM, while for KVM it is only used if the
serial_consoleโ valid for the KVM hypervisor โจ- This boolean says whether to emulate a serial console for the instance.
- Beware bestie: some versions of KVM have a bug that will make an instance hang when configured to use the serial console unless a connection is made to it within about 2 seconds of the instance's startup. For that case it's recommended to disable this option โ which is enabled by default. ๐ญ
- Enabling serial console emulation also appends
"console=ttyS0,<serial_speed>"to the end ofkernel_argsin KVM and may interfere with previous settings.
serial_speedโ valid for the KVM hypervisor โจ- This integer option is the speed of the serial console. Common values are
9600,19200,38400,57600and115200: choose the one which works on your system. ๐ - (The default is
38400for historical reasons, but newer versions of kvm/qemu work with115200.)
- This integer option is the speed of the serial console. Common values are
disk_cacheโ valid for the KVM hypervisor โจ- The disk cache mode. It controls QEMU's internal
cache.writeback,cache.directandcache.no-flushsettings, based on the table found inman qemu-system-x86_64(1). - It supports three cache modes:
none(for direct I/O),writethrough(to use the host cache but report completion to the guest only when the host has committed the changes to disk) orwriteback(to use the host cache and report completion as soon as the data is in the host cache). - The value
defaulthas been kept in Ganeti for backwards compatibility and corresponds towriteback. - Note that certain disk templates in Ganeti may override the cache mode to allow for safe live migrations. ๐ง
- The disk cache mode. It controls QEMU's internal
disk_aioโ valid for the KVM hypervisor โจ- This parameter controls the way in which KVM interacts with the kernel I/O subsystem.
- It defaults to
threadsfor backwards compatibility, but on recent installationsnativeorio_uringwould be the recommended way. - For
io_uringto work, QEMU 5.0 and Linux kernel 5.1 are the minimum requirements. ๐ฅ
disk_discardโ valid for the KVM hypervisor โจdiscardis one ofignoreorunmap, and it controls whether discard (also known as trim or unmap) requests are ignored or passed to the filesystem.- Some machine types may not support discard requests. ๐
security_modelโ valid for the KVM hypervisor โจ- The security model for kvm. Currently one of
none,userorpool. - Under
none, the default, nothing is done and instances are run as the Ganeti daemon user (normallyroot). ๐ - Under
user, kvm will drop privileges and become the user specified by thesecurity_domainparameter. - Under
pool, a global cluster pool of users will be used, making sure no two instances share the same user on the same node. (this mode is not implemented yet ๐)
- The security model for kvm. Currently one of
security_domainโ valid for the KVM hypervisor โจ- Under security model
user, this is the username to run the instance under. It must be a valid username existing on the host. - Cannot be set under security model
noneorpool.
- Under security model
kvm_flagโ valid for the KVM hypervisor โจ- If enabled,
accel=kvmis appended to the-machineparameter. - Disabling it (or not setting this flag at all) currently does nothing. ๐ฆ
- If enabled,
mem_pathโ valid for the KVM hypervisor โจ- This option passes the
-mem-pathargument to kvm with the path (on the node) to the mount point of the hugetlbfs file system, along with the-mem-preallocargument too.
- This option passes the
use_chrootโ valid for the KVM hypervisor โจ- This boolean determines whether to run the KVM instance in a chroot directory.
- If it's set to
true, an empty directory is created before starting the instance and its path is passed via the-chrootflag to kvm. The directory is removed when the instance is stopped. - It is set to
falseby default.
user_shutdownโ valid for the KVM hypervisor โจ- This boolean determines whether the KVM instance supports user shutdown detection. This option does not necessarily require ACPI enabled, but ACPI must be enabled for users to poweroff their KVM instances.
- If it's set to
true, the user can shutdown this KVM instance and its status is reported asUSER_down. - It is set to
falseby default.
migration_downtimeโ valid for the KVM hypervisor โจ- The maximum amount of time (in ms) a KVM instance is allowed to be frozen during a live migration, in order to copy dirty memory pages. Default value is
30ms, but you may need to increase this value for busy instances. ๐ฎโ๐จ - This option is only effective with kvm versions >=
87and qemu-kvm versions >=0.11.0.
- The maximum amount of time (in ms) a KVM instance is allowed to be frozen during a live migration, in order to copy dirty memory pages. Default value is
cpu_maskโ valid for the Xen, KVM and LXC hypervisors โจ- The processes belonging to the given instance are only scheduled on the specified CPUs.
- The format of the mask can be given in three forms:
- First, the word
"all", which signifies the common case where all VCPUs can live on any CPU, based on the hypervisor's decisions. - Second, a comma-separated list of CPU IDs or CPU ID ranges. The ranges are defined by a lower and higher boundary, separated by a dash, and the boundaries are inclusive. In this form, all VCPUs of the instance will be mapped on the selected list of CPUs. Example:
0-2,5, mapping all VCPUs (no matter how many) onto physical CPUs 0, 1, 2 and 5. - The last form is used for explicit control of VCPU-CPU pinnings. In this form, the list of VCPU mappings is given as a colon (
:) separated list, whose elements are the possible values for the second or first form above. In this form, the number of elements in the colon-separated list _must equal_ the number of VCPUs of the instance.
Examples, bestie ๐ (yes, you can literally copy-paste these):
# Map the entire instance to CPUs 0-2
gnt-instance modify -H cpu_mask=0-2 my-inst
# Map vCPU 0 to physical CPU 1 and vCPU 1 to CPU 3 (assuming 2 vCPUs)
gnt-instance modify -H cpu_mask=1:3 my-inst
# Pin vCPU 0 to CPUs 1 or 2, and vCPU 1 to any CPU
gnt-instance modify -H cpu_mask=1-2:all my-inst
# Pin vCPU 0 to any CPU, vCPU 1 to CPUs 1, 3, 4 or 5, and CPU 2 to
# CPU 0 (backslashes for escaping the comma)
gnt-instance modify -H cpu_mask=all:1\\,3-5:0 my-inst
# Pin entire VM to CPU 0
gnt-instance modify -H cpu_mask=0 my-inst
# Turn off CPU pinning (default setting)
gnt-instance modify -H cpu_mask=all my-inst
cpu_capโ valid for the Xen hypervisor โจ- Set the maximum amount of cpu usage by the VM. The value is a percentage between
0and (100* number of VCPUs). - Default cap is
0: unlimited. ๐
- Set the maximum amount of cpu usage by the VM. The value is a percentage between
cpu_weightโ valid for the Xen hypervisor โจ- Set the cpu time ratio to be allocated to the VM. Valid values are between
1and65535. - Default weight is
256.
- Set the cpu time ratio to be allocated to the VM. Valid values are between
usb_mouseโ valid for the KVM hypervisor โจ- This option specifies the usb mouse type to be used. It can be
"mouse"or"tablet". - When using VNC it's recommended to set it to
"tablet". ๐ฑ๏ธ
- This option specifies the usb mouse type to be used. It can be
keymapโ valid for the KVM hypervisor โจ- This option specifies the keyboard mapping to be used. It is only needed when using the VNC console. For example:
"fr"or"en-gb". โจ๏ธ
- This option specifies the keyboard mapping to be used. It is only needed when using the VNC console. For example:
reboot_behaviorโ valid for Xen PVM, Xen HVM and KVM hypervisors โจ- Normally if an instance reboots, the hypervisor will restart it. If this option is set to
exit, the hypervisor will treat a reboot as a shutdown instead. - It is set to
rebootby default.
- Normally if an instance reboots, the hypervisor will restart it. If this option is set to
cpu_coresโ valid for the KVM hypervisor โจ- Number of emulated CPU cores.
cpu_threadsโ valid for the KVM hypervisor โจ- Number of emulated CPU threads.
cpu_socketsโ valid for the KVM hypervisor โจ- Number of emulated CPU sockets.
soundhwโ valid for Xen PVM, Xen HVM and KVM hypervisors โจ- (and that's genuinely all the page says about this one, bestie โ no extra lore, no cap ๐ซถ)
- The soundcard to emulate inside your instance. Please consult Qemu (
-audio model=help) for a list of valid soundcard models โ bestie,hdaorac97are probably the most useful ones. ๐ cpuidโ Valid for the XEN hypervisor. ๐
Modify the values returned by CPUID instructions run within instances.
This allows you to enable migration between nodes with different CPU attributes like cores, threads, hyperthreading or SS4 support by hiding the extra features where needed. It's giving "make everyone compatible" energy fr fr.
See the XEN documentation for syntax and more information.
usb_devicesโ Valid for the KVM hypervisor.
Space separated list of usb devices. These can be emulated devices or passthrough ones, and each one gets passed to kvm with its own -usbdevice option. See the qemu(1) manpage for the syntax of the possible components. Note that values set with this parameter are split on a space character and currently don't support quoting ๐. For backwards compatibility reasons, the RAPI interface keeps accepting comma separated lists too.
vgaโ Valid for the KVM hypervisor.
Emulated vga mode, passed the the kvm -vga option.
kvm_extraโ Valid for the KVM hypervisor.
Any other option to the KVM hypervisor, useful tweaking anything that Ganeti doesn't support. Values with a space in the parameter must be be double quoted. ๐
machine_versionโ Valid for the KVM hypervisor.
Use in case an instance must be booted with an exact type of machine version (due to e.g. outdated drivers). In case it's not set the default version supported by your version of kvm is used. Ganeti currently only supports the pc types properly. However, you should not set it to pc but rather to a specific version, e.g. pc-i440fx-9.2 if you plan to use live migration. You can obtain the default machine version by running:
kvm -M ?
Look for the line containing (default). Setting it just to pc will cause problems during rolling cluster upgrades, because your instance will live-migrate into a different kvm version which has a different understanding of what exactly "pc" is. ๐
migration_capsโ Valid for the KVM hypervisor.
Enable specific migration capabilities by providing a ":" separated list of supported capabilities. QEMU version 1.7.0 defines x-rdma-pin-all, auto-converge, zero-blocks, and xbzrle.
QEMU version 2.5 defines x-postcopy-ram and 2.6 renames this to postcopy-ram. If x-postcopy-ram or postcopy-ram are enabled, Ganeti will automatically move a migration to postcopy mode after a dirty_sync_count of 2. Other than normal live migration, that can recover from dying destination node, it is not possible to recover from dying source node during active postcopy migration. ๐ญ
Please note that while a combination of xbzrle and auto-converge might speed up the migration process significantly, the first may cause BSOD on Windows8r2 instances running on drbd. Not the vibe, bestie.
kvm_pathโ Valid for the KVM hypervisor.
Path to the userspace KVM (or qemu) program.
vhost_netโ Valid for the KVM hypervisor.
This boolean option determines whether the tap devices used by the KVM paravirtual nics (virtio-net) will use accelerated data plane, passing network packets directly between host and guest kernel, without going through userspace emulation layer (qemu). ๐
Historically it is set to false by default. New Clusters created with Ganeti-3.1 and newer defaults to true. Everyone is encouraged to enable it.
vnet_hdrโ Valid for the KVM hypervisor.
This boolean option determines whether the tap devices used by the KVM paravirtual nics (virtio-net) will get created with VNET_HDR (IFF_VNET_HDR) support.
If set to false, it effectively disables offloading on the virio-net interfaces, which prevents host kernel tainting and log flooding, when dealing with broken or malicious virtio-net drivers.
It is set to true by default.
virtio_net_queuesโ Valid for the KVM hypervisor.
Set a number of queues (file descriptors) for tap device to parallelize packets sending or receiving. Tap devices will be created with MULTI_QUEUE (IFF_MULTI_QUEUE) support. This only works with KVM paravirtual nics (virtio-net) and the maximum number of queues is limited to 8. Technically this is an extension of vnet_hdr which must be enabled for multiqueue support.
If set to 1 queue, it effectively disables multiqueue support on the tap and virio-net devices.
For instances it is necessary to manually set number of queues (on Linux using: ethtool -L ethX combined $queues).
It is set to 1 by default.
startup_timeoutโ Valid for the LXC hypervisor.
This integer option specifies the number of seconds to wait for the state of an LXC container changes to "RUNNING" after startup, as reported by lxc-wait. Otherwise we assume an error has occurred and report it.
It is set to 30 by default.
extra_cgroupsโ Valid for the LXC hypervisor.
This option specifies the list of cgroup subsystems that will be mounted alongside the needed ones before starting LXC containers.
Since LXC version >= 1.0.0, LXC strictly requires all cgroup subsystems to be mounted before starting a container. Users can control the list of desired cgroup subsystems for LXC containers by specifying the lxc.cgroup.use parameter in the LXC system configuration file (see: lxc.system.conf(5)). Its default value is "@kernel" which means all cgroup kernel subsystems.
The LXC hypervisor of Ganeti ensures that all cgroup subsystems needed to start an LXC container are mounted, as well as the subsystems specified in this parameter. The needed subsystems are currently cpuset, memory, devices, and cpuacct.
The value of this parameter should be a list of cgroup subsystems separated by a comma (e.g., "net_cls,perf_event,blkio").
If this parameter is not specified, a list of subsystems will be taken from /proc/cgroups instead.
drop_capabilitiesโ Valid for the LXC hypervisor.
This option specifies the list of capabilities which should be dropped for a LXC container. Each value of this option must be in the same form as the lxc.cap.drop configuration parameter of lxc.container.conf(5). It is the lower case of the capability name without the "CAP_" prefix (e.g., "sys_module,sys_time"). See capabilities(7) for more details about Linux capabilities. Note that some capabilities are required by the LXC container (see: lxc.container.conf(5)). Also note that the CAP_SYS_BOOT is required (should not be dropped) to perform the soft reboot for the LXC container. โ ๏ธ
The default value is mac_override,sys_boot,sys_module,sys_time.
devicesโ Valid for the LXC hypervisor.
This option specifies the list of devices that can be accessed from inside of the LXC container. Each value of this option must have the same form as the lxc.cgroup.devices.allow configuration parameter of lxc.container.conf(5). It consists of the type (a: all, b: block, c: character), the major-minor pair, and the access type sequence (r: read, w: write, m: mknod), e.g. "c 1:3 rw". If you'd like to allow the LXC container to access /dev/null and /dev/zero with read-write access, you can set this parameter to: "c 1:3 rw,c 1:5 rw". The LXC hypervisor drops all direct device access by default, so if you want to allow the LXC container to access an additional device which is not included in the default value of this parameter, you have to set this parameter manually.
By default, this parameter contains (/dev/null, /dev/zero, /dev/full, /dev/random, /dev/urandom, /dev/aio, /dev/tty, /dev/console, /dev/ptmx and first block of Unix98 PTY slaves) with read-write (rw) access. ๐ซถ
extra_configโ Valid for the LXC hypervisor.
This option specifies the list of extra config parameters which are not supported by the Ganeti LXC hypervisor natively. Each value of this option must be a valid line of the LXC container config file (see: lxc.container.conf(5)).
This parameter is not set by default.
num_ttysโ Valid for the LXC hypervisor.
This option specifies the number of ttys (actually ptys) that should be allocated for the LXC container. You can disable pty devices allocation for the LXC container by setting this parameter to 0, but you can't use gnt-instance console in this case. ๐
It is set to 6 by default.
The -O (--os-parameters) option allows customisation of the OS parameters. The actual parameter names and values depend on the OS being used, but the syntax is the same key=value. For example, setting a hypothetical dhcp parameter to yes can be achieved by:
gnt-instance add -O dhcp=yes ...
You can also specify OS parameters that should not be logged but reused at the next reinstall with --os-parameters-private and OS parameters that should not be logged or saved to configuration with --os-parameters-secret. Bear in mind that:
- Launching the daemons in debug mode will cause debug logging to happen, which leaks private and secret parameters to the log files. Do not use the debug mode in production. Daemons will emit a warning on startup if they are in debug mode.
- You will have to pass again all
--os-parameters-secretparameters should you want to reinstall this instance.
The -I (--iallocator) option specifies the instance allocator plugin to use (. means the default allocator). If you pass in this option the allocator will select nodes for this instance automatically, so you don't need to pass them with the -n option. For more information please refer to the instance allocator documentation. โจ
The -g (--node-group) option can be used to create the instance in a particular node group, specified by name. ๐ธ
The -t (--disk-template) option sets the disk layout type for the instance. If you don't say a disk template, the default one gets used โ and the default is just the first one in the list of enabled disk templates, which you can tweak cluster-wide with gnt-cluster modify. The choices for disk templates are, bestie:
disklessโ makes an instance with literally no disks. It's useful for testing only (or other special cases). That's it, that's the vibe. ๐ซฅfileโ disk devices are regular files.sharedfileโ disk devices are regular files sitting on a shared directory.plainโ disk devices are logical volumes.drbdโ disk devices are drbd (version 8.x) stacked on top of lvm volumes.rbdโ disk devices are rbd volumes living inside a RADOS cluster.blockdevโ disk devices are adopted pre-existent block devices.extโ disk devices come from external shared storage, through the ExtStorage Interface using ExtStorage providers.
The optional second value of -n (--node) is for the drbd template type and it specifies the remote node. ๐ฏ
If you do not want gnt-instance to sit there waiting for the disk mirror to sync, hit it with the --no-wait-for-sync option.
The --file-storage-dir sets the relative path under the cluster-wide file storage directory where file-based disks get stored. Super useful when you want different subdirectories for different instances. The full path of the directory where the disk files land is: cluster-wide file storage directory + optional subdirectory + instance name. This option is only relevant for instances using the file storage backend.
The --file-driver sets the driver to use for file-based disks. Heads up: currently these drivers work with the xen hypervisor only. This option is only relevant for instances using the file storage backend. Your choices are:
loopโ kernel loopback driver. It uses loopback devices to access the filesystem within the file. But ngl, running I/O intensive applications in your instance with the loop driver might result in slowdowns ๐ญ. Also, if you use the loopback driver, consider bumping the max amount of loopback devices (on most systems it's 8) using themax_loopparam.blktapโ the blktap driver (for Xen hypervisors). To actually use it you should check whether the'blktapctrl'user space disk agent is running (it's usually started automatically viaxend). This user-level disk I/O interface has the advantage of better performance. Especially if you use a network file system (e.g. NFS) to store your instances, this is the recommended choice. โจblktap2โ analogous to theblktapdriver, but used by newer versions of Xen.
If --ignore-ipolicy is given, any instance policy violations that pop up during this operation are just... ignored. ๐
The -c and --communication options specify whether to enable/disable instance communication, which is a communication mechanism between the instance and the host.
The --tags option lets tags be applied to the instance, typically to influence the allocator. Multiple tags can be separated with commas.
See ganeti(7) for a description of --submit and other common options.
Example:
# gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
-n node1.example.com --file-storage-dir=mysubdir instance1.example.com
# gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
-o debian-etch -n node1.example.com instance1.example.com
# gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
-B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
# gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
-n node1.example.com:node2.example.com instance2.example.com
# gnt-instance add -t rbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
-n node1.example.com instance1.example.com
# gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1 -B maxmem=512 \
-o debian-etch -n node1.example.com instance1.example.com
# gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1,param1=val1 \
--disk 1:size=40g,provider=pvdr2,param2=val2,param3=val3 -B maxmem=512 \
-o debian-etch -n node1.example.com instance1.example.com
๐ BATCH-CREATE ๐
batch-create
[{-I|--iallocator} instance allocator]
{instances_file.json}
This command (similar to the Ganeti 1.2 batcher tool) submits multiple instance creation jobs based on a definition file. That file can contain all the options that are valid when adding an instance โ with the one exception of the iallocator field. The IAllocator is, for optimization purposes, only allowed to be set for the whole batch operation using the --iallocator parameter.
The instance file must be a valid-formed JSON file, containing an array of dictionaries with instance creation parameters. All parameters (except iallocator) which are valid for the instance creation OP code are allowed. The most important ones are:
instance_nameโ the FQDN of the new instance.disk_templateโ the disk template to use for the instance, the same as in theaddcommand.disksโ array of disk specifications. Each entry describes one disk as a dictionary of disk parameters.beparamsโ a dictionary of backend parameters.hypervisorโ the hypervisor for the instance.hvparamsโ a dictionary with the hypervisor options. If not passed, the default hypervisor options will be inherited.nicsโ list of NICs that will be created for the instance. Each entry should be a dict, withmac,ip,modeandlinkas possible keys. Please don't provide the"mac, ip, mode, link"parent keys if you use this method for specifying NICs.pnode,snodeโ the primary and optionally the secondary node to use for the instance (in case an iallocator script is not used). If those parameters are given, they have to be given consistently for all instances in the batch operation.startโ whether to start the instance.ip_checkโ skip the check for already-in-use instance; see the description in theaddcommand for details.name_checkโ skip the name check for instances; see the description in theaddcommand for details.file_storage_dir,file_driverโ configuration for the file disk type, see theaddcommand for details.
A simple definition for one instance can be (with most of the parameters taken from the cluster defaults):
[
{
"mode": "create",
"instance_name": "instance1.example.com",
"disk_template": "drbd",
"os_type": "debootstrap",
"disks": [{"size":"1024"}],
"nics": [{}],
"hypervisor": "xen-pvm"
},
{
"mode": "create",
"instance_name": "instance2.example.com",
"disk_template": "drbd",
"os_type": "debootstrap",
"disks": [{"size":"4096", "mode": "rw", "vg": "xenvg"}],
"nics": [{}],
"hypervisor": "xen-hvm",
"hvparams": {"acpi": true},
"beparams": {"maxmem": 512, "minmem": 256}
}
]
The command will display the job id for each submitted instance, as follows:
# gnt-instance batch-create instances.json
Submitted jobs 37, 38
Note: if the allocator is used for computing suitable nodes for the instances, it will only take into account disk information for the default disk template. That means that even if other disk templates are specified for the instances, storage space information of these disk templates will not be considered in the allocation computation. ๐
๐ REMOVE ๐
remove [--ignore-failures] [--shutdown-timeout=*N*] [--submit]
[--print-jobid] [--force] {instance-name}
Remove an instance. This removes all data from the instance and there is no way back. If you're not sure whether you'll use an instance again, use shutdown first and leave it in the shutdown state for a while. ๐
The --ignore-failures option makes the removal proceed even if errors pop up during the removal of the instance (e.g. during the shutdown or the disk removal). If you don't give this option, the command will stop at the first error.
The --shutdown-timeout specifies how much time (in seconds) to wait before forcing the shutdown (e.g. xl destroy in Xen, killing the kvm process for KVM, etc.). By default, two minutes are given to each instance to stop.
The --force option is used to skip the interactive confirmation.
See ganeti(7) for a description of --submit and other common options.
Example:
# gnt-instance remove instance1.example.com
๐ฆ LIST ๐ฆ
list
[--no-headers] [--separator=*SEPARATOR*] [--units=*UNITS*] [-v]
[{-o|--output} [+]FIELD,...] [--filter] [instance-name...]
Shows the currently configured instances with memory usage, disk usage, the node they're running on, and their run status. Main character energy, honestly. โจ
The --no-headers option skips the initial header line. The --separator option takes an argument which denotes what gets used between the output fields. Both of these options are here to help you with scripting.
The units used to display the numeric values in the output varies, depending on the options given. By default, the values get formatted in the most appropriate unit. If the --separator option is given, then the values are shown in mebibytes to allow parsing by scripts. In both cases, the --units option can be used to enforce a given output unit.
The -v option activates verbose mode, which changes the display of special field states (see ganeti(7)).
The -o (--output) option takes a comma-separated list of output fields. The available fields and their meaning are:
admin_stateโ desired state of the instanceadmin_state_sourceโ who last changed the desired state of the instanceadmin_upโ desired state of the instancebe/always_failoverโ the"always_failover"backend parameterbe/auto_balanceโ the"auto_balance"backend parameterbe/maxmemโ the"maxmem"backend parameterbe/memoryโ the"maxmem"backend parameterbe/minmemโ the"minmem"backend parameterbe/spindle_useโ the"spindle_use"backend parameterbe/vcpusโ the"vcpus"backend parameterbeparamsโ backend parameters (merged)bridgeโ bridge of the 1st network interface. the first NIC's bridge, periodt ๐ .consoleโ instance console information. console info, very demure โจ.ctimeโ creation timestamp. when it was born ๐.custom_beparamsโ custom backend parameters. bespoke backend vibes.custom_hvparamsโ custom hypervisor parameters.custom_nicparamsโ custom network interface parameters.custom_osparamsโ custom operating system parameters.disk.countโ number of disks. count 'em, bestie.disk.name/0โ name of 1st disk.disk.name/1โ name of 2nd disk.disk.name/2โ name of 3rd disk.disk.name/3โ name of 4th disk.disk.name/4โ name of 5th disk.disk.name/5โ name of 6th disk.disk.name/6โ name of 7th disk.disk.name/7โ name of 8th disk.disk.name/8โ name of 9th disk.disk.name/9โ name of 10th disk.disk.name/10โ name of 11th disk.disk.name/11โ name of 12th disk.disk.name/12โ name of 13th disk.disk.name/13โ name of 14th disk.disk.name/14โ name of 15th disk.disk.name/15โ name of 16th disk.disk.namesโ list of disk names. all the names, one list, slay ๐disk.size/0โ disk size of 1st disk.disk.size/1โ disk size of 2nd disk.disk.size/2โ disk size of 3rd disk.disk.size/3โ disk size of 4th disk.disk.size/4โ disk size of 5th disk.disk.size/5โ disk size of 6th disk.disk.size/6โ disk size of 7th disk.disk.size/7โ disk size of 8th disk.disk.size/8โ disk size of 9th disk.disk.size/9โ disk size of 10th disk.disk.size/10โ disk size of 11th disk.disk.size/11โ disk size of 12th disk.disk.size/12โ disk size of 13th disk.disk.size/13โ disk size of 14th disk.disk.size/14โ disk size of 15th disk.disk.size/15โ disk size of 16th disk.disk.sizesโ list of disk sizes. sizes, plural, iconicdisk.spindlesโ list of disk spindles.disk.spindles/0โ spindles of 1st disk.disk.spindles/1โ spindles of 2nd disk.disk.spindles/2โ spindles of 3rd disk.disk.spindles/3โ spindles of 4th disk.disk.spindles/4โ spindles of 5th disk.disk.spindles/5โ spindles of 6th disk.disk.spindles/6โ spindles of 7th disk.disk.spindles/7โ spindles of 8th disk.disk.spindles/8โ spindles of 9th disk.disk.spindles/9โ spindles of 10th disk.disk.spindles/10โ spindles of 11th disk.disk.spindles/11โ spindles of 12th disk.disk.spindles/12โ spindles of 13th disk.disk.spindles/13โ spindles of 14th disk.disk.spindles/14โ spindles of 15th disk.disk.spindles/15โ spindles of 16th disk.disk.uuid/0โ UUID of 1st disk.disk.uuid/1โ UUID of 2nd disk.disk.uuid/2โ UUID of 3rd disk.disk.uuid/3โ UUID of 4th disk.disk.uuid/4โ UUID of 5th disk.disk.uuid/5โ UUID of 6th disk.disk.uuid/6โ UUID of 7th disk.disk.uuid/7โ UUID of 8th disk.disk.uuid/8โ UUID of 9th disk.disk.uuid/9โ UUID of 10th disk.disk.uuid/10โ UUID of 11th disk.disk.uuid/11โ UUID of 12th disk.disk.uuid/12โ UUID of 13th disk.disk.uuid/13โ UUID of 14th disk.disk.uuid/14โ UUID of 15th disk.disk.uuid/15โ UUID of 16th disk.disk.uuidsโ list of disk UUIDs. all the UUIDs, no cap ๐disk_templateโ instance disk template.disk_usageโ total disk space used by the instance on each of its nodes; this is not the disk size visible to the instance, but the usage on the node. important distinction, bestie โ don't mix them up ๐disks_activeโ desired state of the instance disks.forthcomingโ whether the Instance is forthcoming.hv/acpiโ the"acpi"hypervisor parameter.hv/blockdev_prefixโ the"blockdev_prefix"hypervisor parameter.hv/boot_orderโ the"boot_order"hypervisor parameter.hv/bootloader_argsโ the"bootloader_args"hypervisor parameter.hv/bootloader_pathโ the"bootloader_path"hypervisor parameter.hv/cdrom2_image_pathโ the"cdrom2_image_path"hypervisor parameter.hv/cdrom_disk_typeโ the"cdrom_disk_type"hypervisor parameter.hv/cdrom_image_pathโ the"cdrom_image_path"hypervisor parameter.hv/cpu_capโ the"cpu_cap"hypervisor parameter.hv/cpu_coresโ the"cpu_cores"hypervisor parameter.hv/cpu_maskโ the"cpu_mask"hypervisor parameter.hv/cpu_socketsโ the"cpu_sockets"hypervisor parameter.hv/cpu_threadsโ the"cpu_threads"hypervisor parameter.hv/cpu_typeโ the"cpu_type"hypervisor parameter.hv/cpu_weightโ the"cpu_weight"hypervisor parameter.hv/cpuidโ the"cpuid"hypervisor parameter.hv/device_modelโ the"device_model"hypervisor parameter.hv/devicesโ the"devices"hypervisor parameter.hv/disk_aioโ the"disk_aio"hypervisor parameter.hv/disk_cacheโ the"disk_cache"hypervisor parameter.hv/disk_discardโ the"disk_discard"hypervisor parameter.hv/disk_typeโ the"disk_type"hypervisor parameter.hv/drop_capabilitiesโ the"drop_capabilities"hypervisor parameter.hv/extra_cgroupsโ the"extra_cgroups"hypervisor parameter.hv/extra_configโ the"extra_config"hypervisor parameter.hv/floppy_image_pathโ the"floppy_image_path"hypervisor parameter.hv/init_scriptโ the"init_script"hypervisor parameter.hv/initrd_pathโ the"initrd_path"hypervisor parameter.hv/kernel_argsโ the"kernel_args"hypervisor parameter.hv/kernel_pathโ the"kernel_path"hypervisor parameter.hv/keymapโ the"keymap"hypervisor parameter.hv/kvm_extraโ the"kvm_extra"hypervisor parameter.hv/kvm_flagโ the"kvm_flag"hypervisor parameter.hv/kvm_pathโ the"kvm_path"hypervisor parameter.hv/kvm_pci_reservationsโ the"kvm_pci_reservations"hypervisor parameter.hv/machine_versionโ the"machine_version"hypervisor parameter.hv/mem_pathโ the"mem_path"hypervisor parameter.hv/migration_capsโ the"migration_caps"hypervisor parameter.hv/migration_downtimeโ the"migration_downtime"hypervisor parameter.hv/nic_typeโ the"nic_type"hypervisor parameter.hv/num_ttysโ the"num_ttys"hypervisor parameter.hv/paeโ the"pae"hypervisor parameter.hv/pci_passโ the"pci_pass"hypervisor parameter.hv/reboot_behaviorโ the"reboot_behavior"hypervisor parameter.hv/root_pathโ the"root_path"hypervisor parameter.hv/scsi_controller_typeโ the"scsi_controller_type"hypervisor parameter.hv/security_domainโ the"security_domain"hypervisor parameter.hv/security_modelโ the"security_model"hypervisor parameter.hv/serial_consoleโ the"serial_console"hypervisor parameter.hv/serial_speedโ the"serial_speed"hypervisor parameter.hv/soundhwโ the"soundhw"hypervisor parameter.hv/spice_bindโ the"spice_bind"hypervisor parameter.hv/spice_image_compressionโ the"spice_image_compression"hypervisor parameter.hv/spice_ip_versionโ the"spice_ip_version"hypervisor parameter.hv/spice_jpeg_wan_compressionโ the"spice_jpeg_wan_compression"hypervisor parameter.hv/spice_password_fileโ the"spice_password_file"hypervisor parameter.hv/spice_playback_compressionโ the"spice_playback_compression"hypervisor parameter.hv/spice_streaming_videoโ the"spice_streaming_video"hypervisor parameter.hv/spice_tls_ciphersโ the"spice_tls_ciphers"hypervisor parameter.hv/spice_use_tlsโ the"spice_use_tls"hypervisor parameter.hv/spice_use_vdagentโ the"spice_use_vdagent"hypervisor parameter.hv/spice_zlib_glz_wan_compressionโ the"spice_zlib_glz_wan_compression"hypervisor parameter.hv/startup_timeoutโ the"startup_timeout"hypervisor parameter.hv/usb_devicesโ the"usb_devices"hypervisor parameter.hv/usb_mouseโ the"usb_mouse"hypervisor parameter.hv/use_bootloaderโ the"use_bootloader"hypervisor parameter.hv/use_chrootโ the"use_chroot"hypervisor parameter.hv/use_guest_agentโ the"use_guest_agent"hypervisor parameter.hv/use_localtimeโ the"use_localtime"hypervisor parameter.hv/user_shutdownโ the"user_shutdown"hypervisor parameter.hv/vgaโ the"vga"hypervisor parameter.hv/vhost_netโ the"vhost_net"hypervisor parameter.hv/vif_scriptโ the"vif_script"hypervisor parameter.hv/vif_typeโ the"vif_type"hypervisor parameter.hv/viridianโ the"viridian"hypervisor parameter.hv/virtio_net_queuesโ the"virtio_net_queues"hypervisor parameter.hv/vnc_bind_addressโ the"vnc_bind_address"hypervisor parameter.hv/vnc_password_fileโ the"vnc_password_file"hypervisor parameter.hv/vnc_tlsโ the"vnc_tls"hypervisor parameter.hv/vnc_x509_pathโ the"vnc_x509_path"hypervisor parameter.hv/vnc_x509_verifyโ the"vnc_x509_verify"hypervisor parameter.hv/vnet_hdrโ the"vnet_hdr"hypervisor parameter.hvparamsโ hypervisor parameters (merged). all merged together, cutehypervisorโ hypervisor name.ipโ IP address of 1st network interface.macโ MAC address of 1st network interface.mtimeโ modification timestamp.nameโ instance name.network_portโ instance network port if available (e.g. for VNC console).nic.bridge/0โ bridge of 1st network interface.nic.bridge/1โ bridge of 2nd network interface.nic.bridge/2โ bridge of 3rd network interface.nic.bridge/3โ bridge of 4th network interface.nic.bridge/4โ bridge of 5th network interface.nic.bridge/5โ bridge of 6th network interface.nic.bridge/6โ bridge of 7th network interface.nic.bridge/7โ bridge of 8th network interface.nic.bridgesโ a list holding every network interface's bridge ๐nic.countโ how many network interfaces there are (the count, bestie) ๐ขnic.ip/0โ IP address of the 1st network interfacenic.ip/1โ IP address of the 2nd network interfacenic.ip/2โ IP address of the 3rd network interfacenic.ip/3โ IP address of the 4th network interfacenic.ip/4โ IP address of the 5th network interfacenic.ip/5โ IP address of the 6th network interfacenic.ip/6โ IP address of the 7th network interfacenic.ip/7โ IP address of the 8th network interfacenic.ipsโ a list holding each network interface's IP addressnic.link/0โ link of the 1st network interfacenic.link/1โ link of the 2nd network interfacenic.link/2โ link of the 3rd network interfacenic.link/3โ link of the 4th network interfacenic.link/4โ link of the 5th network interfacenic.link/5โ link of the 6th network interfacenic.link/6โ link of the 7th network interfacenic.link/7โ link of the 8th network interfacenic.linksโ a list holding each network interface's linknic.mac/0โ MAC address of the 1st network interfacenic.mac/1โ MAC address of the 2nd network interfacenic.mac/2โ MAC address of the 3rd network interfacenic.mac/3โ MAC address of the 4th network interfacenic.mac/4โ MAC address of the 5th network interfacenic.mac/5โ MAC address of the 6th network interfacenic.mac/6โ MAC address of the 7th network interfacenic.mac/7โ MAC address of the 8th network interfacenic.macsโ a list holding each network interface's MAC addressnic.mode/0โ mode of the 1st network interfacenic.mode/1โ mode of the 2nd network interfacenic.mode/2โ mode of the 3rd network interfacenic.mode/3โ mode of the 4th network interfacenic.mode/4โ mode of the 5th network interfacenic.mode/5โ mode of the 6th network interfacenic.mode/6โ mode of the 7th network interfacenic.mode/7โ mode of the 8th network interfacenic.modesโ a list holding each network interface's modenic.name/0โ name address of the 1st network interfacenic.name/1โ name address of the 2nd network interfacenic.name/2โ name address of the 3rd network interfacenic.name/3โ name address of the 4th network interfacenic.name/4โ name address of the 5th network interfacenic.name/5โ name address of the 6th network interfacenic.name/6โ name address of the 7th network interfacenic.name/7โ name address of the 8th network interfacenic.namesโ a list holding each network interface's namenic.network.name/0โ network name of the 1st network interfacenic.network.name/1โ network name of the 2nd network interfacenic.network.name/2โ network name of the 3rd network interfacenic.network.name/3โ network name of the 4th network interfacenic.network.name/4โ network name of the 5th network interfacenic.network.name/5โ network name of the 6th network interfacenic.network.name/6โ network name of the 7th network interfacenic.network.name/7โ network name of the 8th network interfacenic.network/0โ network of the 1st network interfacenic.network/1โ network of the 2nd network interfacenic.network/2โ network of the 3rd network interfacenic.network/3โ network of the 4th network interfacenic.network/4โ network of the 5th network interfacenic.network/5โ network of the 6th network interfacenic.network/6โ network of the 7th network interfacenic.network/7โ network of the 8th network interfacenic.networksโ a list holding each interface's networknic.networks.namesโ a list holding each interface's networknic.uuid/0โ UUID address of the 1st network interfacenic.uuid/1โ UUID address of the 2nd network interfacenic.uuid/2โ UUID address of the 3rd network interfacenic.uuid/3โ UUID address of the 4th network interfacenic.uuid/4โ UUID address of the 5th network interfacenic.uuid/5โ UUID address of the 6th network interfacenic.uuid/6โ UUID address of the 7th network interfacenic.uuid/7โ UUID address of the 8th network interfacenic.uuidsโ a list holding each network interface's UUIDnic.vlan/0โ VLAN of the 1st network interfacenic.vlan/1โ VLAN of the 2nd network interfacenic.vlan/2โ VLAN of the 3rd network interfacenic.vlan/3โ VLAN of the 4th network interfacenic.vlan/4โ VLAN of the 5th network interfacenic.vlan/5โ VLAN of the 6th network interfacenic.vlan/6โ VLAN of the 7th network interfacenic.vlan/7โ VLAN of the 8th network interfacenic.vlansโ a list holding each network interface's VLANnic_linkโ link of the 1st network interfacenic_modeโ mode of the 1st network interfacenic_networkโ network of the 1st network interfaceoper_ramโ actual memory usage as seen by the hypervisor ๐oper_stateโ actual state of the instanceoper_vcpusโ actual number of VCPUs as seen by the hypervisorosโ operating system ๐ฅ๏ธosparamsโ operating system parameters (merged)pnodeโ primary nodepnode.groupโ primary node's grouppnode.group.uuidโ primary node's group UUIDsda_sizeโ disk size of the 1st disksdb_sizeโ disk size of the 2nd diskserial_noโ instance object serial number, incremented on each modificationsnodesโ secondary nodes; usually this will just be one nodesnodes.groupโ node groups of secondary nodessnodes.group.uuidโ node group UUIDs of secondary nodesstatusโ instance status; read this one carefully bestie it's"running"if the instance is set to be running and actually is,"ADMIN_down"if the instance is stopped and is not running,"ERROR_wrongnode"if the instance is running, but not on its designated primary node,"ERROR_up"if the instance should be stopped, but is actually running,"ERROR_down"if the instance should run, but doesn't,"ERROR_nodedown"if the instance's primary node is down,"ERROR_nodeoffline"if the instance's primary node is marked offline,"ADMIN_offline"if the instance is offline and does not use dynamic,"USER_down"if the user shutdown the instance resources ๐tagsโ tags ๐ท๏ธuuidโ instance UUIDvcpusโ the"vcpus"backend parameter
okay so here's a little โจlife hackโจ โ if the value of the option starts with the character +, the new field(s) get added to the default list instead of replacing it. So you can quickly see the default list plus a few extra fields without retyping the entire list of fields. iconique, no notes ๐
And there's a subtle grouping thing going on with the available output fields, so listen up: all fields except for oper_state, oper_ram, oper_vcpus and status are configuration values and not run-time values. Which means if you don't select any of these fields, the query gets satisfied instantly from the cluster configuration, without having to ask the remote nodes for the data. This is lowkey a big deal for big clusters โ when you only want some data, it makes total sense to specify a reduced set of output fields. ๐ง
Also: if exactly one argument is given and it appears to be a query filter (see ganeti(7)), the query result is filtered accordingly. For the ambiguous cases (e.g. a single field name as a filter), the --filter (-F) option forces the argument to be treated as a filter (e.g. gnt-instance list -F admin_state). fr fr, that flag is the tiebreaker. ๐ซถ
The default output field list is: name, os, pnode, admin_state, oper_state, oper_ram.
โจ LIST-FIELDS โจ
list-fields [field...]
Lists available fields for instances. That's it, that's the whole job ๐ธ
โจ INFO โจ
info [-s | --static] [--roman] {--all | instance-name}
Show detailed information about the given instance(s). Not me being dramatic, but this is different from list โ it shows detailed data about the instance's disks (especially useful for the drbd disk template). ๐ฆ
If the option -s is used, only information available in the configuration file is returned, without querying nodes, making the operation faster. โก
Use the --all to get info about all instances, rather than explicitly passing the ones you're interested in. ๐
The --roman option can be used to cause envy among people who like ancient cultures, but are stuck with non-latin-friendly cluster virtualization technologies. ๐๏ธ (yes really, that's what it says, and honestly? iconic.)
โจ MODIFY โจ
modify
[{-H|--hypervisor-parameters} HYPERVISOR_PARAMETERS]
[{-B|--backend-parameters} BACKEND_PARAMETERS]
[{-m|--runtime-memory} SIZE]
[--net add[:options...] |
--net [N:]add[,options...] |
--net [ID:]remove |
--net ID:modify[,options...]]
[--disk add:size=*SIZE*[,options...] |
--disk N:add,size=*SIZE*[,options...] |
--disk
N:add,size=*SIZE*,provider=*PROVIDER*[,options...][,param=*value*... ]
|
--disk N:attach,{name=*NAME* | uuid=*UUID*}|
--disk ID:modify[,options...]
--disk [ID:]remove]
--disk [ID:]detach]
[{-t rbd } |
{-t|--disk-template} drbd -n new_secondary] [--no-wait-for-sync] |
{-t--ext-params} {provider=*PROVIDER*}[,param=*value*... ] |
{-t sharedfile | gluster }
| [--file-storage-dir dir_path] [--file-driver {loop | blktap |
blktap2}]
[--new-primary=*node*]
[--os-type=*OS* [--force-variant]]
[{-O|--os-parameters} param=*value*... ]
[--os-parameters-private param=*value*... ]
[--offline | --online]
[--submit] [--print-jobid]
[--ignore-ipolicy]
[--no-hotplug]
{instance-name}
Modifies the memory size, number of vcpus, ip address, MAC address and/or NIC parameters for an instance. It can also add and remove disks and NICs to/from the instance. ๐
Heads up bestie: you need to give at least one of the arguments, otherwise the command complains. It's giving needy, but that's just how it is ๐
The -H (--hypervisor-parameters), -B (--backend-parameters) and -O (--os-parameters) options specify hypervisor, backend and OS parameter options in the form of name=value[,...]. For details on which options can be specified, see the add command. ๐
Okay so the -t / --disk-template option is the one that changes the disk template of the instance. And bestie, conversions between all the available templates are supported โ except the diskless and the blockdev templates, bestie, we don't do those. ๐ For the blockdev disk template there's only partial support, and it acts only as a source template. Because those volumes are adopted pre-existent block devices, conversions targeting this template are just not supported. Also, there is no support for conversions to or from the diskless template. Ngl that's just how it is.
The instance must be stopped before you even attempt the conversion. No cap. ๐
When you're changing from the plain to the drbd disk template, a new secondary node must be specified via the -n option. The --no-wait-for-sync option can be used when converting to the drbd template so the instance is available for startup before DRBD has finished resyncing. When changing to a file-based disk template โ i.e. file, sharedfile and gluster โ the file storage directory and the file driver can be specified via the --file-storage-dir and --file-driver options, respectively. For more deets on these options please refer to the add command section (iykyk). ๐
When changing to an ext template, the provider's name must be specified. Also, arbitrary parameters can be passed as additional comma separated options. Those parameters, along with the ExtStorage provider, must be passed using either the --ext-params or -e option. It is not allowed to specify existing disk parameters such as the size, mode, name, access, adopt, vg, metavg, provider, or spindles options. ๐ซ
The -m / --runtime-memory option will change an instance's runtime memory to the given size (in MB if a different suffix is not specified), by ballooning it up or down to the new value. ๐
The --disk add:size=SIZE,[options..] option adds a disk to the instance, and --disk N:add,size=SIZE,[options..] will add a disk to the instance at a specific index. The available options are the same as in the add command (spindles, mode, name, vg, metavg and access). By default, gnt-instance waits for the disk mirror to sync. If you do not want this behavior, use the --no-wait-for-sync option. ๐ธ
When adding an ExtStorage disk, the provider=PROVIDER option is also mandatory and specifies the ExtStorage provider. Also, for ExtStorage disks arbitrary parameters can be passed as additional comma separated options, same as in the add command.
The --disk attach:name=NAME option attaches an existing disk to the instance at the last disk index, and --disk N:attach,name=NAME` will attach a disk to the instance at a specific index. The accepted disk identifiers are its name or uuid. ๐
The --disk remove option will remove the last disk of the instance. Use --disk ID:remove to remove a disk by its identifier. ID can be the index of the disk, the disk's name or the disk's UUID. The above applies also to the --disk detach option, which removes a disk from an instance but keeps it in the configuration and doesn't destroy it. ๐ซถ
The --disk ID:modify[,options...] will change the options of the disk. Available options are:
modeโ the access mode. Eitherro(read-only) or the defaultrw(read-write).nameโ this option specifies a name for the disk, which can be used as a disk identifier. An instance can not have two disks with the same name.
The --net N:add[,options..] will add a new network interface to the instance. The available options are the same as in the add command (mac, ip, link, mode, network).
The --net ID,remove will remove the instance's NIC with ID identifier, which can be the index of the NIC, the NIC's name or the NIC's UUID.
The --net ID:modify[,options..] option will change the parameters of the instance network interface with the ID identifier. โจ
The option -o / --os-type will change the OS name for the instance (without reinstallation). In case an OS variant is specified that is not found, then by default the modification is refused, unless --force-variant is passed. An invalid OS will also be refused, unless the --force option is given.
The option --new-primary will set the new primary node of an instance, assuming the disks have already been moved manually. Unless the --force option is given, it is verified that the instance is no longer running on its current primary node. ๐
The --online and --offline options are used to transition an instance into and out of the offline state. An instance can be turned offline only if it was previously down. The --online option fails if the instance was not in the offline state, otherwise it changes the instance's state to down. These modifications take effect immediately. โก
If --ignore-ipolicy is given, any instance policy violations occurring during this operation are ignored.
If --no-hotplug is given, any disk and NIC modifications will not be hot-plugged. The change will take place after the reboot. ๐
Without the --no-hotplug parameter, Ganeti attempts to perform the operation hot if possible. Hotplug is currently supported only for disk and NIC modifications in the KVM hypervisor. If hotplug fails (for any reason) a warning is printed but execution is continued. For existing NIC modification interactive verification is needed unless the --force option is passed.
See ganeti(7) for a description of --submit and other common options.
Most of the changes take effect at the next restart. If the instance is running, there is no effect on the instance. ๐
REINSTALL ๐
reinstall [{-o|--os-type} os-type] [--select-os] [-f force]
[--force-multiple]
[--instance | --node | --primary | --secondary | --all]
[{-O|--os-parameters} OS_PARAMETERS]
[--os-parameters-private} OS_PARAMETERS]
[--os-parameters-secret} OS_PARAMETERS]
[--submit] [--print-jobid]
{instance...}
Reinstalls the operating system on the given instance(s). The instance(s) must be stopped when running this command. If the -o / --os-type is specified, the operating system is changed. ๐ฆ
The --select-os option switches to an interactive OS reinstall. The user is prompted to select the OS template from the list of available OS templates. OS parameters can be overridden using -O / --os-parameters (more documentation for this option is under the add command).
Since this is a potentially dangerous command, the user will be required to confirm this action, unless the -f flag is passed. ๐
When multiple instances are selected (either by passing multiple arguments or by using the --node, --primary, --secondary or --all options), the user must pass the --force-multiple options to skip the interactive confirmation.
See ganeti(7) for a description of --submit and other common options.
RENAME ๐
rename [--ip-check] [--name-check]
[--submit] [--print-jobid]
{instance} {new_name}
Renames the given instance. The instance must be stopped when running this command. ๐ธ
The --name-check checks for the new instance name via the resolver (e.g. in DNS or /etc/hosts, depending on your setup) and that the resolved name matches the new name. In addition the --ip-check can be used to prevent duplicate IPs, by checking that the new name's IP is not already alive (i.e. reachable from the master node).
Note that you can rename an instance to its same name, to force re-executing the os-specific rename script for that instance, if needed. Iconic behaviour honestly. ๐
See ganeti(7) for a description of --submit and other common options.
Starting/stopping/connecting to console ๐
STARTUP โจ
startup
[--force] [--ignore-offline]
[--force-multiple] [--no-remember]
[--instance | --node | --primary | --secondary | --all |
--tags | --node-tags | --pri-node-tags | --sec-node-tags]
[{-H|--hypervisor-parameters} key=value...]
[{-B|--backend-parameters} key=value...]
[--submit] [--print-jobid] [--paused]
{instance...}
Starts one or more instances, depending on the following options. The four available modes are:
--instanceโ will start the instances given as arguments (at least one argument required); this is the default selection--nodeโ will start the instances who have the given node as either primary or secondary--primaryโ will start all instances whose primary node is in the list of nodes passed as arguments (at least one node required)--secondaryโ will start all instances whose secondary node is in the list of nodes passed as arguments (at least one node required)--allโ will start all instances in the cluster (no arguments accepted)--tagsโ will start all instances in the cluster with the tags given as arguments--node-tagsโ will start all instances in the cluster on nodes with the tags given as arguments--pri-node-tagsโ will start all instances in the cluster on primary nodes with the tags given as arguments--sec-node-tagsโ will start all instances in the cluster on secondary nodes with the tags given as arguments
Note that although you can pass more than one selection option, the last one wins, so in order to guarantee the desired result, don't pass more than one such option. ๐
Use --force to start even if secondary disks are failing. --ignore-offline can be used to ignore offline primary nodes and mark the instance as started even if the primary is not available.
The --force-multiple will skip the interactive confirmation in the case that more than one instance will be affected.
The --no-remember option will perform the startup but not change the state of the instance in the configuration file (if it was stopped before, Ganeti will still think it needs to be stopped). This can be used for testing, or for a one shot-start where you don't want the watcher to restart the instance if it crashes. ๐ซถ
The -H / --hypervisor-parameters and -B / --backend-parameters options specify temporary hypervisor and backend parameters that can be used to start an instance with modified parameters. They can be useful for quick testing without having to modify an instance back and forth, e.g.:
# gnt-instance start -H kernel_args="single" instance1
# gnt-instance start -B maxmem=2048 instance2
The first form will start the instance instance1 in single-user mode, and the instance instance2 with 2GB of RAM (this time only, unless that is the actual instance memory size already). Note that the values override the instance parameters (and not extend them): an instance with "kernel_args=ro" when started with -H kernel_args=single will result in "single", not "ro single". No cap. ๐ฅ
The --paused option is only valid for Xen and kvm hypervisors. This pauses the instance at the start of bootup, awaiting gnt-instance console to unpause it, allowing the entire boot process to be monitored for debugging. ๐
ok bestie real quick โ peep ganeti(7) for the tea on --submit and all the other common options, k? iykyk. ๐
Example:
# gnt-instance start instance1.example.com
# gnt-instance start --node node1.example.com node2.example.com
# gnt-instance start --all
โจ SHUTDOWN โจ
shutdown
[--timeout=*N*]
[--force] [--force-multiple] [--ignore-offline] [--no-remember]
[--instance | --node | --primary | --secondary | --all |
--tags | --node-tags | --pri-node-tags | --sec-node-tags]
[--submit] [--print-jobid]
{instance...}
So this one stops one or more instances, right? But here's the drama: if the instance won't stop nicely within a hardcoded interval (currently 2 minutes), Ganeti will straight up forcibly stop it โ which is literally the equivalent of reaching behind a physical machine and yanking the power cord. ๐
The --timeout option is how you say how much time (in seconds) to wait before the forcing happens (like xl destroy in Xen, or killing the kvm process for KVM, etc.). By default every instance gets two minutes to get its life together and stop.
The --instance, --node, --primary, --secondary, --all, --tags, --node-tags, --pri-node-tags and --sec-node-tags options work basically the same as they do for the startup command, and they're what decides which actual instances get shut down. ๐ฏ
--ignore-offline lets you ignore offline primary nodes and just force the instance to be marked as stopped. Handle with care though, because it can leave your cluster state inconsistent. ๐
Use --force when you need to shut down an instance that's already marked as offline. Super useful if an offline instance ends up in the ERROR_up state, for example.
The --no-remember option performs the shutdown but does not change the instance's state in the configuration file (so if it was running before, Ganeti will still think it needs to be running). Iconic for a cluster-wide shutdown where some instances are marked up and some are marked down and you do not want to touch the running state: you just disable the watcher, shut down every instance with --no-remember, and then when the watcher comes back on it restores the correct runtime state for all of them. โจ
See ganeti(7) for a description of --submit and other common options.
Example:
# gnt-instance shutdown instance1.example.com
# gnt-instance shutdown --all
๐ธ REBOOT ๐ธ
reboot
[{-t|--type} REBOOT-TYPE]
[--ignore-secondaries]
[--shutdown-timeout=*N*]
[--force-multiple]
[--instance | --node | --primary | --secondary | --all |
--tags | --node-tags | --pri-node-tags | --sec-node-tags]
[--submit] [--print-jobid]
[instance...]
Reboots one or more instances, periodt. The kind of reboot you get depends on the value of -t (--type):
- a soft reboot does a hypervisor reboot
- a hard reboot does an instance stop, recreates the hypervisor config for the instance, and starts the instance
- a full reboot does the equivalent of
gnt-instance shutdown && gnt-instance startup
The default is hard reboot. ๐
For the hard reboot, the --ignore-secondaries option ignores errors on the secondary node while re-assembling the instance disks.
The --instance, --node, --primary, --secondary, --all, --tags, --node-tags, --pri-node-tags and --sec-node-tags options are similar as for the startup command, and they influence the actual instances being rebooted.
The --shutdown-timeout is how you specify how much time (in seconds) to wait before forcing the shutdown (xl destroy in xen, killing the kvm process, for kvm). By default two minutes are given to each instance to stop. โณ
The --force-multiple will skip the interactive confirmation in the case that more than one instance will be affected. (no "are you sure bestie" moment, it just goes)
See ganeti(7) for a description of --submit and other common options.
Example:
# gnt-instance reboot instance1.example.com
# gnt-instance reboot --type=full instance1.example.com
๐ฆ CONSOLE ๐ฆ
console [--show-cmd] {instance}
Connects to the console of the given instance. If the instance is not up, you get an error, sorry babe. Use the --show-cmd option to display the command instead of actually executing it. ๐
For HVM instances, this will attempt to connect to the serial console of the instance. To connect to the virtualized "physical" console of a HVM instance, use a VNC client with the connection info from the info command.
For Xen/kvm instances, if the instance is paused, this attempts to unpause the instance after waiting a few seconds for the connection to the console to be made.
Example:
# gnt-instance console instance1.example.com
๐ฟ Disk management ๐ฟ
๐ REPLACE-DISKS ๐
replace-disks [--submit] [--print-jobid] [--early-release]
[--ignore-ipolicy] {-p} [--disks idx] {instance-name}
replace-disks [--submit] [--print-jobid] [--early-release]
[--ignore-ipolicy] {-s} [--disks idx] {instance-name}
replace-disks [--submit] [--print-jobid] [--early-release]
[--ignore-ipolicy]
{{-I|--iallocator} name | {{-n|--new-secondary} node }
{instance-name}
replace-disks [--submit] [--print-jobid] [--early-release]
[--ignore-ipolicy] {-a|--auto} {instance-name}
This command is the generalized form for replacing disks. rn it's only valid for the mirrored (DRBD) disk template. no cap.
Okay so, the first form (when you pass -p) replaces the disks on the primary, while the second form (when you pass -s) replaces the disks on the secondary node. For these two cases โ since the node doesn't change โ you can run the replace for only a subset of the disks, using the --disks option, which takes a list of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only the first and third disks. ๐ฏ
The third form (when you pass either --iallocator or --new-secondary) is designed to change the secondary node of the instance. Specifying --iallocator makes the new secondary get picked automatically by the specified allocator plugin (use . to indicate the default allocator), otherwise the new secondary node will be the one you chose manually via --new-secondary.
Note: it is not possible to select an offline or drained node as a new secondary. ๐ซ
The fourth form (when using --auto) automatically figures out which disks of an instance are faulty and replaces them within the same node. The --auto option only works when an instance has only faulty disks on either the primary or secondary node โ it does not work when both sides have faulty disks.
The --early-release changes the code so the old storage on secondary node(s) gets removed early (before the resync is completed) and the internal Ganeti locks for the current (and new, if any) secondary node are also released, which allows more parallelism in the cluster operation. Only use this when you're recovering from a disk failure on the current secondary (so the old storage is already broken anyway) or when the storage on the primary node is known to be fine (so you won't need the old storage for potential recovery).
The --ignore-ipolicy lets the command ignore instance policy violations if replace-disks changes groups and the instance would violate the new group's instance policy.
See ganeti(7) for a description of --submit and other common options.
โจ ACTIVATE-DISKS โจ
activate-disks [--submit] [--print-jobid] [--ignore-size]
[--wait-for-sync] {instance-name}
Activates the block devices of the given instance. If it works, the command shows you the location and name of the block devices:
node1.example.com:disk/0:/dev/drbd0
node1.example.com:disk/1:/dev/drbd1
In this example, node1.example.com is the name of the node on which the devices have been activated. The disk/0 and disk/1 are the Ganeti-names of the instance disks โ how they show up inside the instance is hypervisor-specific, so don't @ me. โ/dev/drbd0 and /dev/drbd1 are the actual block devices as visible on the node. ๐
The --ignore-size option can be used to activate disks while ignoring the currently configured size in Ganeti. This is for when the configuration has gotten out of sync with the real-world (e.g. after a partially-failed grow-disk operation, or due to rounding in LVM devices). Do not use this in normal cases โ only when activate-disks fails without it. ๐
The --wait-for-sync option ensures the command returns only after the instance's disks are synchronised (mostly for DRBD). This can be useful for ensuring consistency, since otherwise there are no commands that can wait until synchronisation is done. But heads up: when you pass this option, the command will have additional output, which makes it harder to parse the disk information.
Note: it is safe to run this command while the instance is already running. โ
See ganeti(7) for a description of --submit and other common options.
๐ DEACTIVATE-DISKS ๐
deactivate-disks [-f] [--submit] [--print-jobid] {instance-name}
De-activates the block devices of the given instance. But listen โ if you run this for an instance with a drbd disk template while it's running, it will not be able to shut down the block devices on the primary node, but it will shut down the block devices on the secondary nodes, thus breaking the replication. ๐ญ
The -f/--force option skips the checks that the instance is down. Normally, if the hypervisor is confused and we can't talk to it, Ganeti will refuse to deactivate the disks โ but with this option passed it skips that check and goes straight to trying to deactivate the disks. It can still fail though, if the instance is actually running or due to other issues. bestie, it's giving "fingers crossed" energy.
See ganeti(7) for a description of --submit and other common options.
๐ GROW-DISK ๐
grow-disk [--no-wait-for-sync] [--submit] [--print-jobid]
[--absolute]
{instance-name} {disk} {amount}
Grows an instance's disk. This is only possible for instances with a plain, drbd, file, sharedfile, rbd or ext disk template. For the ext template to work, the ExtStorage provider should also support growing โ meaning it has a grow script that actually grows the volume of the external shared storage. ๐ฑ
Big important note: this command only changes the block device size โ it will not grow the actual filesystems, partitions, etc. that live on that disk.
So usually you'll need to:
- use
gnt-instance grow-disk - reboot the instance (later, at a convenient time)
- use a filesystem resizer, such as
ext2online(8)orxfs_growfs(8)to resize the filesystem, or usefdisk(8)to change the partition table on the disk
The disk argument is the index of the instance disk to grow. The amount argument is given as a number which can have a suffix (like the disk size in instance create); if the suffix is missing, the value will be interpreted as mebibytes. ๐ซถ
By default, the amount value is the growth you want, like the delta โ so an amount of 1G takes a disk from 3G to 4G, cute right? But if you pass the optional --absolute parameter, then amount isn't a delta at all, it's the final size you want the disk to be. So an amount of 8G takes a disk of size 4G up to 8G. ๐
For instances with a drbd template, heads up: the disk grow operation might finish on one node and fail on the other. That leaves the instance with different-sized LVs on the two nodes, which lowkey sounds scary but won't create problems โ except for unused space. ๐ซถ
If you don't wanna wait around for the new disk region to sync, use the --no-wait-for-sync option. Go do something else bestie. โจ
See ganeti(7) for a description of --submit and other common options.
Example (increase the first disk for instance1 by 16GiB):
# gnt-instance grow-disk instance1.example.com 0 16g
Example for increasing the disk size to a certain size:
# gnt-instance grow-disk --absolute instance1.example.com 0 32g
Also note that disk shrinking is not supported โ it's giving one-way street. Usegnt-backup exportand thengnt-backup importto reduce the disk size of an instance. ๐
๐ฉน RECREATE-DISKS ๐ฉน
recreate-disks [--submit] [--print-jobid]
[{-n node1:[node2] | {-I|--iallocator name}}]
[--disk=*N*[:[size=*VAL*][,spindles=*VAL*][,mode=*ro|rw*]]]
{instance-name}
Recreates all of the disks of the given instance, or just a subset. ๐
Note that this functionality should only be used for missing disks. If any of the given disks already exists, the operation will fail. Yeah, this is suboptimal, but recreate-disks should hopefully not be needed in normal operation, so the impact of that is low. No cap.
If you only want a subset recreated, you can specify any number of disk options. It expects a disk index plus an optional list of disk parameters to change. While recreating disks, only size, spindles, and mode can be changed. And to recreate all disks while changing parameters on just a subset, a --disk option must be given for every disk of the instance. Periodt.
Optionally the instance's disks can be recreated on different nodes. This is iconic if, for example, the original nodes of the instance have gone down (and are marked offline), so we can't recreate on the same nodes. To do that, pass the new node(s) via the -n option, with a syntax similar to the add command. The number of nodes passed must equal the number of nodes that the instance currently has. Note that changing nodes is only allowed when all disks are replaced, e.g. when no --disk option is passed. ๐
Another method of choosing which nodes to place the instance on is using the specified iallocator, by passing the --iallocator option. The primary and secondary nodes will be chosen by the specified iallocator plugin, or by the default allocator if . is specified.
See ganeti(7) for a description of --submit and other common options.
๐ Recovery/moving ๐
๐ FAILOVER ๐
failover [-f] [--ignore-consistency] [--ignore-ipolicy]
[--shutdown-timeout=*N*]
[{-n--iallocator} name]
[--cleanup]
[--submit] [--print-jobid]
{instance-name}
Failover will stop the instance (if it's running), change its primary node, and if it was originally running it'll start it again โ on the new primary, obvi. This works for instances with a drbd template (in which case you can only fail to the secondary node) and for externally mirrored templates (sharedfile, blockdev, rbd and ext) (in which case you can fail to any other node). โจ
If the instance's disk template is of type sharedfile, blockdev, rbd or ext, then you can explicitly specify the target node (which can be any node) using the -n or --target-node option, or specify an iallocator plugin using the -I or --iallocator option. If you omit both, the default iallocator will be used to specify the target node.
If the instance's disk template is of type drbd, the target node is automatically selected as the drbd's secondary node. Changing the secondary node is possible with a replace-disks operation. ๐ฆ
Normally the failover will check the consistency of the disks before failing over the instance. If you're trying to migrate instances off a dead node, this will fail. Use the --ignore-consistency option for this purpose.
Note that this option can be dangerous โ errors in shutting down the instance will be ignored, which can result in possibly having the instance running on two machines in parallel (on disconnected DRBD drives). ๐ญ This flag requires the source node to be marked offline first to succeed.
The --shutdown-timeout is used to specify how much time (in seconds) to wait before forcing the shutdown (xl destroy in xen, killing the kvm process, for kvm). By default two minutes are given to each instance to stop. โณ
If --ignore-ipolicy is given, any instance policy violations occurring during this operation are ignored.
If the --cleanup option is passed, the operation changes from performing a failover to attempting recovery from a failed previous failover. In this mode, Ganeti checks if the instance runs on the correct node (and updates its configuration if not) and ensures the instance's disks are configured correctly. ๐
See ganeti(7) for a description of --submit and other common options.
Example:
# gnt-instance failover instance1.example.com
For externally mirrored templates also -n is available:
# gnt-instance failover -n node3.example.com instance1.example.com
๐ซ MIGRATE ๐ซ
migrate [-f] [--allow-failover] [--non-live]
[--migration-mode=live|non-live] [--ignore-ipolicy]
[--ignore-hvversions]
[--no-runtime-changes] [--submit] [--print-jobid]
[{-n--iallocator} name] {instance-name}
migrate [-f] --cleanup [--submit] [--print-jobid] {instance-name}
Migrate will move the instance to its secondary node without shutdown. Slay. As with failover, it works for instances having the drbd disk template or an externally mirrored disk template type such as sharedfile, blockdev, rbd or ext. ๐
If the instance's disk template is of type sharedfile, blockdev, rbd or ext, then you can explicitly specify the target node (which can be any node) using the -n or --target-node option, or specify an iallocator plugin using the -I or --iallocator option. If you omit both, the default iallocator will be used to specify the target node. Alternatively, the default iallocator can be requested by specifying . as the name of the plugin. ๐ธ
If the instance's disk template is of type drbd, the target node is automatically selected as the drbd's secondary node. Changing the secondary node is possible with a replace-disks operation.
The migration command needs a perfectly healthy instance for drbd instances, since we rely on the dual-master capability of drbd8 and the disks of the instance are not allowed to be degraded. Vibe check: passed or it's not happening. ๐
The --non-live and --migration-mode=non-live options will switch (for the hypervisors that support it) between a "fully live" migration (i.e. the interruption is as minimal as possible) and one in which the instance is frozen, its state saved and transported to the remote node, and then resumed there. This all depends on the hypervisor support for two different methods. In any case, it is not an error to pass this parameter โ it'll just be ignored if the hypervisor doesn't support it. The --migration-mode=live option will request a fully-live migration. The default, when neither option is passed, depends on the hypervisor parameters (and can be viewed with the gnt-cluster info command). โจ
If the --cleanup option is passed, the operation changes from migration to attempting recovery from a failed previous migration. In this mode, Ganeti checks if the instance runs on the correct node (and updates its configuration if not) and ensures the instances' disks are configured correctly. In this mode, the --non-live option is ignored. ๐
The option -f will skip the prompting for confirmation.
If --allow-failover is specified it tries to fallback to failover if it already can determine that a migration won't work (e.g. if the instance is shut down). Please note that the fallback will not happen during execution. If a migration fails during execution it still fails. ๐ญ
If --ignore-ipolicy is given, any instance policy violations occurring during this operation are ignored.
Normally, Ganeti will verify that the hypervisor versions on source and target are compatible and error out if they are not. If --ignore-hvversions is given, Ganeti will only warn in this case. ๐ซถ
The --no-runtime-changes option forbids migrate to alter an instance's runtime before migrating it (eg. ballooning an instance down because the target node doesn't have enough available memory).
If an instance has the backend parameter always_failover set to true, then the migration is automatically converted into a failover.
See ganeti(7) for a description of --submit and other common options.
Example (and expected output):
# gnt-instance migrate instance1
Instance instance1 will be migrated. Note that migration
might impact the instance if anything goes wrong (e.g. due to bugs in
the hypervisor). Continue?
y/[n]/?: y
Migrating instance instance1.example.com
* checking disk consistency between source and target
* switching node node2.example.com to secondary mode
* changing into standalone mode
* changing disks into dual-master mode
* wait until resync is done
* preparing node2.example.com to accept the instance
* migrating instance to node2.example.com
* switching node node1.example.com to secondary mode
* wait until resync is done
* changing into standalone mode
* changing disks into single-master mode
* wait until resync is done
* done
#
๐ฆ MOVE ๐ฆ
move [-f] [--ignore-consistency]
[-n node] [--compress=*compression-mode*] [--shutdown-timeout=*N*]
[--submit] [--print-jobid] [--ignore-ipolicy]
{instance-name}
Move will move the instance to an arbitrary node in the cluster. This works only for instances having a plain or file disk template. ๐
Note that since this operation is done via data copy, it will take a long time for big disks (similar toreplace-disksfor adrbdinstance). Grab a snack bestie. ๐
The --compress option is used to specify which compression mode is used during the move. Valid values are 'none' (the default) and any values specified in the 'compression_tools' cluster parameter.
The --shutdown-timeout is used to specify how much time (in seconds) to wait before forcing the shutdown (e.g. xl destroy in XEN, killing the kvm process for KVM, etc.). By default two minutes are given to each instance to stop. โณ
--ignore-consistency makes Ganeti straight-up ignore any errors it hits while trying to shut the instance down on its node ๐
โ lowkey a lifesaver if the hypervisor is broken and you just want your data back, fr fr.
If you hand it --ignore-ipolicy, then any instance policy violations that pop up during this whole operation just get ignored. Not a vibe check it's willing to fail, apparently. ๐
Peep ganeti(7) for the rundown on --submit and all the other common options ๐ซถ
Example, bestie:
# gnt-instance move -n node3.example.com instance1.example.com
CHANGE-GROUP ๐
change-group [--submit] [--print-jobid]
[--iallocator name] [--to group...] {instance-name}
This one moves an instance to another node group โจ The move gets calculated by an iallocator โ either the one you pass on the command line or the cluster default, whichever. Heads up though: the iallocator only looks at disk information of the default disk template, even if the instances' disk templates are different from that. So like, don't come for it when it doesn't know about your other templates. ๐
If you don't specify any destination groups with --to, then every group except the one your instance is already chilling in gets considered. It's giving "anywhere but here" energy.
See ganeti(7) for what --submit and the other common options do ๐ธ
Example:
# gnt-instance change-group -I hail --to rack2 inst1.example.com
Tags ๐ท๏ธ
ADD-TAGS โ
add-tags [--from file] {instance-name} {tag...}
Adds tags to the instance you named ๐ If any of the tags has invalid characters in it, the entire operation aborts โ no partial sends, it's all or nothing, periodt.
If you pass the --from option, the tag list gets extended with the contents of that file, where each line becomes a tag ๐ In that case you don't even need to pass tags on the command line โ but if you do, bestie, both sources get used. A file name of - gets read as stdin ๐
LIST-TAGS ๐
list-tags {instance-name}
Lists the tags of the instance you named. Short, sweet, iconic ๐
REMOVE-TAGS ๐๏ธ
remove-tags [--from file] {instance-name} {tag...}
Removes tags from the instance you named. If any of the tags don't already exist on the node, the whole operation aborts ๐ญ โ again, all or nothing, she does not do half-measures.
If --from is given, the list of tags to remove gets extended with the contents of that file, where each line becomes a tag ๐ฆ In that case you don't need to pass tags on the command line โ but if you do, tags from both sources get removed. A file name of - gets read as stdin ๐ธ
REPORTING BUGS ๐
Found a bug? Report it to the project's issue tracker, or hit up the developers on the Ganeti mailing list ๐ฌ They wanna know, fr fr.
SEE ALSO ๐
Ganeti overview and specifications: ganeti(7) (general overview), ganeti-os-interface(7) (guest OS definitions), ganeti-extstorage-interface(7) (external storage providers) ๐
Ganeti commands: gnt-cluster(8) (cluster-wide commands), gnt-job(8) (job-related commands), gnt-node(8) (node-related commands), gnt-instance(8) (instance commands), gnt-os(8) (guest OS commands), gnt-storage(8) (storage commands), gnt-group(8) (node group commands), gnt-backup(8) (instance import/export commands), gnt-debug(8) (debug commands) โจ
Ganeti daemons: ganeti-watcher(8) (automatic instance restarter), ganeti-cleaner(8) (job queue cleaner), ganeti-noded(8) (node daemon), ganeti-rapi(8) (remote API daemon) ๐
Ganeti htools: htools(1) (generic binary), hbal(1) (cluster balancer), hspace(1) (capacity calculation), hail(1) (IAllocator plugin), hscan(1) (data gatherer from remote clusters), hinfo(1) (cluster information printer), mon-collector(7) (data collectors interface) ๐ฅ
COPYRIGHT โ๏ธ
Copyright (C) 2006-2015 Google Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
and that's a wrap, bestie!! ๐ this whole thing came to you from the Ganeti source, as the gnt-instance(8) manual page โ copyright stamped 2006-2015 ๐ go forth and instance, you absolute icon ๐โจ๐ฆ
๐ฆ where this page comes from
- debian trixie: ganeti-3.1 3.1.0~rc2-3 ยท BSD-2-Clause
- ubuntu questing: ganeti-3.1 3.1.0~rc2-4
- ubuntu resolute: ganeti-3.1 3.1.0~rc2-4build1 ยท BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms