blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 04:10:18 +04:00
<domain type= 'qemu' >
2016-01-13 18:43:27 +03:00
<name > QEMUGuest2</name>
<uuid > c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
<memory unit= 'KiB' > 219100</memory>
<currentMemory unit= 'KiB' > 219100</currentMemory>
2012-05-08 20:04:36 +04:00
<vcpu placement= 'static' > 1</vcpu>
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 04:10:18 +04:00
<os >
<type arch= 'i686' machine= 'pc' > hvm</type>
<boot dev= 'hd' />
</os>
<clock offset= 'utc' />
<on_poweroff > destroy</on_poweroff>
<on_reboot > restart</on_reboot>
<on_crash > destroy</on_crash>
<devices >
2019-11-29 19:33:37 +03:00
<emulator > /usr/bin/qemu-system-i386</emulator>
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 04:10:18 +04:00
<disk type= 'block' device= 'disk' >
2018-03-02 17:43:55 +03:00
<driver name= 'qemu' type= 'raw' />
2016-01-13 18:43:27 +03:00
<source dev= '/dev/HostVG/QEMUGuest2' />
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 04:10:18 +04:00
<target dev= 'hda' bus= 'ide' />
<address type= 'drive' controller= '0' bus= '0' target= '0' unit= '0' />
</disk>
2016-01-28 00:03:52 +03:00
<controller type= 'scsi' index= '0' model= 'virtio-scsi' >
2021-03-30 18:48:46 +03:00
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x02' function= '0x0' />
2016-01-28 00:03:52 +03:00
</controller>
<controller type= 'usb' index= '0' >
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x01' function= '0x2' />
</controller>
<controller type= 'ide' index= '0' >
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x01' function= '0x1' />
</controller>
2013-04-22 16:16:13 +04:00
<controller type= 'pci' index= '0' model= 'pci-root' />
2016-01-11 14:40:32 +03:00
<input type= 'mouse' bus= 'ps2' />
<input type= 'keyboard' bus= 'ps2' />
2021-02-24 17:24:10 +03:00
<audio id= '1' type= 'none' />
2016-01-13 18:43:27 +03:00
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source >
<adapter name= 'scsi_host0' />
<address bus= '0' target= '0' unit= '0' />
</source>
<address type= 'drive' controller= '0' bus= '0' target= '4' unit= '8' />
</hostdev>
2020-06-17 16:57:13 +03:00
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source >
<adapter name= 'scsi_host0' />
<address bus= '0' target= '0' unit= '1' />
</source>
<readonly />
<address type= 'drive' controller= '0' bus= '0' target= '4' unit= '7' />
</hostdev>
2020-09-10 16:48:38 +03:00
<hostdev mode= 'subsystem' type= 'scsi' managed= 'no' >
<source >
<adapter name= 'scsi_host0' />
<address bus= '0' target= '0' unit= '2' />
</source>
2020-09-10 18:00:13 +03:00
<alias name= 'ua-7996c8dc-a4fa-4012-b76f-043d20144263' />
2020-09-10 16:48:38 +03:00
<address type= 'drive' controller= '0' bus= '0' target= '4' unit= '6' />
</hostdev>
2020-06-17 16:19:36 +03:00
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source protocol= 'iscsi' name= 'iqn.1992-01.com.example/0' >
<host name= 'example.org' port= '3260' />
</source>
<address type= 'drive' controller= '0' bus= '0' target= '2' unit= '4' />
</hostdev>
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source protocol= 'iscsi' name= 'iqn.1992-01.com.example/1' >
<host name= 'example.org' port= '3260' />
</source>
2020-09-15 18:48:22 +03:00
<readonly />
2020-06-17 16:19:36 +03:00
<address type= 'drive' controller= '0' bus= '0' target= '2' unit= '5' />
</hostdev>
2020-06-17 16:24:05 +03:00
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source protocol= 'iscsi' name= 'iqn.1992-01.com.example:storage/1' >
<host name= 'example.org' port= '3260' />
<auth username= 'myname' >
<secret type= 'iscsi' usage= 'mycluster_myname' />
</auth>
</source>
<address type= 'drive' controller= '0' bus= '0' target= '3' unit= '4' />
</hostdev>
<hostdev mode= 'subsystem' type= 'scsi' managed= 'yes' >
<source protocol= 'iscsi' name= 'iqn.1992-01.com.example:storage/2' >
<host name= 'example.org' port= '3260' />
<auth username= 'myname' >
<secret type= 'iscsi' usage= 'mycluster_myname' />
</auth>
2020-07-10 15:00:12 +03:00
<initiator >
<iqn name= 'iqn.2020-07.com.example:test' />
</initiator>
2020-06-17 16:24:05 +03:00
</source>
<address type= 'drive' controller= '0' bus= '0' target= '3' unit= '5' />
</hostdev>
2016-01-28 00:03:52 +03:00
<memballoon model= 'virtio' >
2021-03-30 18:48:46 +03:00
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x03' function= '0x0' />
2016-01-28 00:03:52 +03:00
</memballoon>
blockjob: enhance xml to track mirrors across libvirtd restart
In order to track a block copy job across libvirtd restarts, we
need to save internal XML that tracks the name of the file
holding the mirror. Displaying this name in dumpxml might also
be useful to the user, even if we don't yet have a way to (re-)
start a domain with mirroring enabled up front. This is done
with a new <mirror> sub-element to <disk>, as in:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/original.img'/>
<mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
...
</disk>
For now, the element is output-only, in live domains; it is ignored
when defining a domain or hot-plugging a disk (since those contexts
use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears
when libvirt knows that the job has changed from the initial pulling
phase over to the mirroring phase, although absence of the attribute
is not a sure indicator of the current phase. If we come up with a way
to make qemu start with mirroring enabled, we can relax the xml
restriction, and allow <mirror> (but not attribute 'ready') on input.
Testing active-only XML meant tweaking the testsuite slightly, but it
was worth it.
* docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
* docs/formatdomain.html.in (elementsDisks): Document it.
* src/conf/domain_conf.h (_virDomainDiskDef): New members.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
(virDomainDiskDefParseXML): Parse them, but only internally.
(virDomainDiskDefFormat): Output them.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
* tests/qemuxml2xmltest.c (testInfo): Alter members.
(testCompareXMLToXMLHelper): Allow more test control.
(mymain): Run new test.
2012-03-29 04:10:18 +04:00
</devices>
</domain>