.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "VIRT-XML 1" .TH VIRT-XML 1 "2019-01-19" "2.0.0" "Virtual Machine Manager" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" virt\-xml \- Edit libvirt XML using command line options. .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBvirt-xml\fR \s-1DOMAIN\s0 XML-ACTION XML-OPTION [\s-1OUTPUT\-OPTION\s0] [\s-1MISC\-OPTIONS\s0] ... .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBvirt-xml\fR is a command line tool for editing libvirt \s-1XML\s0 using explicit command line options. See the \s-1EXAMPLES\s0 section at the end of this document to jump right in. .PP Each \fBvirt-xml\fR invocation requires 3 things: name of an existing domain to alter (or \s-1XML\s0 passed on stdin), an action to on the \s-1XML,\s0 and an \s-1XML\s0 change to make. actions are one of: .PP \&\-\-add\-device: Append a new device definition to the \s-1XML\s0 \&\-\-remove\-device: Remove an existing device definition \&\-\-edit: Edit an existing \s-1XML\s0 block \&\-\-build\-xml: Just build the requested \s-1XML\s0 block and print it (no domain or input \s-1XML\s0 are required here). .PP An \s-1XML\s0 change is one instance of any of the \s-1XML\s0 options provided by virt-xml, for example \-\-disk or \-\-boot. .PP \&\fBvirt-xml\fR only allows one action and \s-1XML\s0 pair per invocation. If you need to make multiple edits, invoke the command multiple times. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-c\fR \s-1URI\s0" 4 .IX Item "-c URI" .PD 0 .IP "\fB\-\-connect\fR=URI" 4 .IX Item "--connect=URI" .PD Connect to a non-default hypervisor. See \fBvirt\-install\fR\|(1) for details .IP "\fBdomain\fR" 4 .IX Item "domain" domain is the name, \s-1UUID,\s0 or \s-1ID\s0 of the existing \s-1VM.\s0 This can be omitted if using \-\-build\-xml, or if \s-1XML\s0 is passed on stdin. .Sp When a domain is specified, the default output action is \-\-define, even if the \s-1VM\s0 is running. To update the running \s-1VM\s0 configuration, add the \-\-update option (but not all options/devices support updating the running \s-1VM\s0 configuration). .Sp If \s-1XML\s0 is passed on stdin, the default output is \-\-print\-xml. .SH "XML ACTIONS" .IX Header "XML ACTIONS" .IP "\fB\-\-edit\fR [\s-1EDIT\-OPTIONS\s0]" 4 .IX Item "--edit [EDIT-OPTIONS]" Edit the specified \s-1XML\s0 block. EDIT-OPTIONS tell \fBvirt-xml\fR which block to edit. The type of \s-1XML\s0 that we are editing is decided by \s-1XML\s0 option that is passed to \fBvirt-xml\fR. So if \-\-disk is passed, EDIT-OPTIONS select which block to edit. .Sp Certain \s-1XML\s0 options only ever map to a single \s-1XML\s0 block, like \-\-cpu, \-\-security, \-\-boot, \-\-clock, and a few others. In those cases, \fBvirt-xml\fR will not complain if a corresponding \s-1XML\s0 block does not already exist, it will create it for you. .Sp Most \s-1XML\s0 options support a special value 'clearxml=yes'. When combined with \-\-edit, it will completely blank out the \s-1XML\s0 block being edited before applying the requested changes. This allows completely rebuilding an \s-1XML\s0 block. See \s-1EXAMPLES\s0 for some usage. .Sp EDIT-OPTIONS examples: .RS 4 .IP "\fB\-\-edit\fR" 4 .IX Item "--edit" \&\-\-edit without any options implies 'edit the first block'. So '\-\-edit \-\-disk \s-1DISK\-OPTIONS\s0' means 'edit the first '. .Sp For the single \s-1XML\s0 block options mentioned above, plain '\-\-edit' without any options is what you always want to use. .IP "\fB\-\-edit\fR #" 4 .IX Item "--edit #" Select the specified \s-1XML\s0 block number. So '\-\-edit 2 \-\-disk \s-1DISK\-OPTS\s0' means 'edit the second '. This option only really applies for device \s-1XML.\s0 .IP "\fB\-\-edit\fR all" 4 .IX Item "--edit all" Modify every \s-1XML\s0 block of the \s-1XML\s0 option type. So '\-\-edit all \-\-disk \s-1DISK\-OPTS\s0' means 'edit ever block'. This option only really applies for device \s-1XML.\s0 .IP "\fB\-\-edit\fR DEVICE-OPTIONS" 4 .IX Item "--edit DEVICE-OPTIONS" Modify every \s-1XML\s0 block that matches the passed device options. The device options are in the same format as would be passed to the \s-1XML\s0 option. .Sp So '\-\-edit path=/tmp/foo \-\-disk \s-1DISK\-OPTS\s0' means 'edit every with path /tmp/foo'. This option only really applies for device \s-1XML.\s0 .RE .RS 4 .RE .IP "\fB\-\-add\-device\fR" 4 .IX Item "--add-device" Append the specified \s-1XML\s0 options to the \s-1XML\s0 list. Example: '\-\-add\-device \-\-disk \s-1DISK\-OPTIONS\s0' will create a new block and add it to the \s-1XML.\s0 .Sp This option will error if specified with a non-device \s-1XML\s0 option (see \-\-edit section for a partial list). .IP "\fB\-\-remove\-device\fR" 4 .IX Item "--remove-device" Remove the specified device from the \s-1XML.\s0 The device to remove is chosen by the \s-1XML\s0 option, which takes arguments in the same format as \-\-edit. Examples .RS 4 .IP "\fB\-\-remove\-device\fR \-\-disk 2" 4 .IX Item "--remove-device --disk 2" Remove the second disk device .IP "\fB\-\-remove\-device\fR \-\-network all" 4 .IX Item "--remove-device --network all" Remove all network devices .IP "\fB\-\-remove\-device\fR \-\-sound pcspk" 4 .IX Item "--remove-device --sound pcspk" Remove all sound devices with model='pcspk' .RE .RS 4 .Sp This option will error if specified with a non-device \s-1XML\s0 option (see \-\-edit section for a partial list). .RE .IP "\fB\-\-build\-xml\fR" 4 .IX Item "--build-xml" Just build the specified \s-1XML,\s0 and print it to stdout. No input domain or input \s-1XML\s0 is required. Example: '\-\-build\-xml \-\-disk \s-1DISK\-OPTIONS\s0' will just print the new device. .Sp This option will error if specified with an \s-1XML\s0 option that does not map cleanly to a specific \s-1XML\s0 block, like \-\-vcpus or \-\-memory. .SH "OUTPUT OPTIONS" .IX Header "OUTPUT OPTIONS" These options decide what action to take after altering the \s-1XML.\s0 In the common case these do not need to be specified, as '\s-1XML\s0 actions' will imply a default output action, described in detail above. These are only needed if you want to modify the default output. .IP "\fB\-\-update\fR" 4 .IX Item "--update" If the specified domain is running, attempt to alter the running \s-1VM\s0 configuration. If combined with \-\-edit, this is an update operation. If combined with \-\-add\-device, this is a device hotplug. If combined with \-\-remove\-device, this is a device hotunplug. .Sp Keep in mind, most \s-1XML\s0 properties and devices do not support live update operations, so don't expect it to succeed in all cases. .Sp Note that \-\-update implies \-\-define: it can't be used in isolation. .IP "\fB\-\-define\fR" 4 .IX Item "--define" Define the requested \s-1XML\s0 change. This is typically the default if no output option is specified, but if a \-\-print option is specified, \-\-define is required to force the change. .IP "\fB\-\-print\-diff\fR" 4 .IX Item "--print-diff" Print the generated \s-1XML\s0 change in unified diff format. If only this output option is specified, all other output options are disabled and no persistent change is made. .IP "\fB\-\-print\-xml\fR" 4 .IX Item "--print-xml" Print the generated \s-1XML\s0 in its entirety. If only this output option is specified, all other output options are disabled and no persistent change is made. .IP "\fB\-\-confirm\fR" 4 .IX Item "--confirm" Before defining or updating the domain, show the generated \s-1XML\s0 diff and interactively request confirmation. .SH "XML OPTIONS" .IX Header "XML OPTIONS" .IP "\fB\-\-disk\fR" 4 .IX Item "--disk" .PD 0 .IP "\fB\-\-network\fR" 4 .IX Item "--network" .IP "\fB\-\-graphics\fR" 4 .IX Item "--graphics" .IP "\fB\-\-metadata\fR" 4 .IX Item "--metadata" .IP "\fB\-\-memory\fR" 4 .IX Item "--memory" .IP "\fB\-\-vcpus\fR" 4 .IX Item "--vcpus" .IP "\fB\-\-cpu\fR" 4 .IX Item "--cpu" .IP "\fB\-\-security\fR" 4 .IX Item "--security" .IP "\fB\-\-numatune\fR" 4 .IX Item "--numatune" .IP "\fB\-\-features\fR" 4 .IX Item "--features" .IP "\fB\-\-clock\fR" 4 .IX Item "--clock" .IP "\fB\-\-pm\fR" 4 .IX Item "--pm" .IP "\fB\-\-boot\fR" 4 .IX Item "--boot" .IP "\fB\-\-filesystem\fR" 4 .IX Item "--filesystem" .IP "\fB\-\-controller\fR" 4 .IX Item "--controller" .IP "\fB\-\-input\fR" 4 .IX Item "--input" .IP "\fB\-\-serial\fR" 4 .IX Item "--serial" .IP "\fB\-\-parallel\fR" 4 .IX Item "--parallel" .IP "\fB\-\-channel\fR" 4 .IX Item "--channel" .IP "\fB\-\-console\fR" 4 .IX Item "--console" .IP "\fB\-\-hostdev\fR" 4 .IX Item "--hostdev" .IP "\fB\-\-sound\fR" 4 .IX Item "--sound" .IP "\fB\-\-watchdog\fR" 4 .IX Item "--watchdog" .IP "\fB\-\-video\fR" 4 .IX Item "--video" .IP "\fB\-\-smartcard\fR" 4 .IX Item "--smartcard" .IP "\fB\-\-redirdev\fR" 4 .IX Item "--redirdev" .IP "\fB\-\-memballoon\fR" 4 .IX Item "--memballoon" .IP "\fB\-\-tpm\fR" 4 .IX Item "--tpm" .IP "\fB\-\-rng\fR" 4 .IX Item "--rng" .IP "\fB\-\-panic\fR" 4 .IX Item "--panic" .IP "\fB\-\-memdev\fR" 4 .IX Item "--memdev" .IP "\fB\-\-qemu\-commandline\fR" 4 .IX Item "--qemu-commandline" .PD These options alter the \s-1XML\s0 for a single class of \s-1XML\s0 elements. More complete documentation is found in \fBvirt\-install\fR\|(1). .Sp Generally these options map pretty straightforwardly to the libvirt \s-1XML,\s0 documented at .Sp Option strings are in the format of: \-\-option opt=val,opt2=val2,... example: \-\-disk path=/tmp/foo,shareable=on. Properties can be used with '\-\-option opt=,', so to clear a disks cache setting you could use '\-\-disk cache=,' .Sp For any option, use \-\-option=? to see a list of all available sub options, example: \-\-disk=? or \-\-boot=? .Sp \&\-\-help output also lists a few general examples. See the \s-1EXAMPLES\s0 section below for some common examples. .SH "MISCELLANEOUS OPTIONS" .IX Header "MISCELLANEOUS OPTIONS" .IP "\fB\-h\fR" 4 .IX Item "-h" .PD 0 .IP "\fB\-\-help\fR" 4 .IX Item "--help" .PD Show the help message and exit .IP "\fB\-\-version\fR" 4 .IX Item "--version" Show program's version number and exit .IP "\fB\-q\fR" 4 .IX Item "-q" .PD 0 .IP "\fB\-\-quiet\fR" 4 .IX Item "--quiet" .PD Avoid verbose output. .IP "\fB\-d\fR" 4 .IX Item "-d" .PD 0 .IP "\fB\-\-debug\fR" 4 .IX Item "--debug" .PD Print debugging information .SH "EXAMPLES" .IX Header "EXAMPLES" See a list of all suboptions that \-\-disk and \-\-network take .PP .Vb 1 \& # virt\-xml \-\-disk=? \-\-network=? .Ve .PP Change the of domain '\s-1EXAMPLE\s0': .PP .Vb 1 \& # virt\-xml EXAMPLE \-\-edit \-\-metadata description="my new description" .Ve .PP # Enable the boot device menu for domain '\s-1EXAMPLE\s0': .PP .Vb 1 \& # virt\-xml EXAMPLE \-\-edit \-\-boot menu=on .Ve .PP Clear the previous definition of domain 'winxp', change it to 'host\-model', but interactively confirm the diff before saving: .PP .Vb 1 \& # virt\-xml winxp \-\-edit \-\-cpu host\-model,clearxml=yes \-\-confirm .Ve .PP Change the second sound card to model=ich6 on 'fedora19', but only output the diff: .PP .Vb 1 \& # virt\-xml fedora19 \-\-edit 2 \-\-sound model=ich6 \-\-print\-diff .Ve .PP Update the every graphics device password to 'foo' of the running \s-1VM\s0 'rhel6': .PP .Vb 1 \& # virt\-xml rhel6 \-\-edit all \-\-graphics password=foo \-\-update .Ve .PP Remove the disk path from disk device hdc: .PP .Vb 1 \& # virt\-xml rhel6 \-\-edit target=hdc \-\-disk path= .Ve .PP Change all disk devices of type 'disk' to use cache=none, using \s-1XML\s0 from stdin, printing the new \s-1XML\s0 to stdout. .PP .Vb 1 \& # cat | virt\-xml \-\-edit device=disk \-\-disk cache=none .Ve .PP Change disk 'hda' \s-1IO\s0 to native and use startup policy as 'optional'. .PP .Vb 2 \& # virt\-xml fedora20 \-\-edit target=hda \e \& \-\-disk io=native,startup_policy=optional .Ve .PP Change all host devices to use driver_name=vfio for \s-1VM\s0 'fedora20' on the remote connection .PP .Vb 2 \& # virt\-xml \-\-connect qemu+ssh://remotehost/system \e \& fedora20 \-\-edit all \-\-hostdev driver_name=vfio .Ve .PP Hotplug host \s-1USB\s0 device 001.003 to running domain 'fedora19': .PP .Vb 1 \& # virt\-xml fedora19 \-\-update \-\-add\-device \-\-hostdev 001.003 .Ve .PP Add a spicevmc channel to the domain 'winxp', that will be available after the next \s-1VM\s0 shutdown. .PP .Vb 1 \& # virt\-xml winxp \-\-add\-device \-\-channel spicevmc .Ve .PP Create a 10G qcow2 disk image and attach it to 'fedora18' for the next \s-1VM\s0 startup: .PP .Vb 2 \& # virt\-xml fedora18 \-\-add\-device \e \& \-\-disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10 .Ve .PP Hotunplug the disk vdb from the running domain 'rhel7': .PP .Vb 1 \& # virt\-xml rhel7 \-\-update \-\-remove\-device \-\-disk target=vdb .Ve .PP Remove all graphics devices from the \s-1VM\s0 'rhel7' after the next shutdown: .PP .Vb 1 \& # virt\-xml rhel7 \-\-remove\-device \-\-graphics all .Ve .PP Generate \s-1XML\s0 for a virtio console device and print it to stdout: .PP .Vb 1 \& # virt\-xml \-\-build\-xml \-\-console pty,target_type=virtio .Ve .PP Add qemu command line passthrough: .PP .Vb 1 \& # virt\-xml f25 \-\-edit \-\-confirm \-\-qemu\-commandline="\-device FOO" .Ve .SH "CAVEATS" .IX Header "CAVEATS" Virtualization hosts supported by libvirt may not permit all changes that might seem possible. Some edits made to a \s-1VM\s0's definition may be ignored. For instance, \s-1QEMU\s0 does not allow the removal of certain devices once they've been defined. .SH "BUGS" .IX Header "BUGS" Please see https://virt\-manager.org/page/BugReporting .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) Red Hat, Inc, and various contributors. This is free software. You may redistribute copies of it under the terms of the \s-1GNU\s0 General Public License \f(CW\*(C`https://www.gnu.org/licenses/gpl.html\*(C'\fR. There is \s-1NO WARRANTY,\s0 to the extent permitted by law. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBvirt\-install\fR\|(1), the project website \f(CW\*(C`https://virt\-manager.org\*(C'\fR