unsigned int flags)
{
const char *format;
+ bool inactive = flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE;
if (!backingStore)
return 0;
+ /* don't write detected backing chain members to inactive xml */
+ if (inactive && backingStore->detected)
+ return 0;
+
if (backingStore->type == VIR_STORAGE_TYPE_NONE) {
virBufferAddLit(buf, "<backingStore/>\n");
return 0;
/* Don't format backingStore to inactive XMLs until the code for
* persistent storage of backing chains is ready. */
- if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
- virDomainDiskBackingStoreFormat(buf, def->src->backingStore,
+ if (virDomainDiskBackingStoreFormat(buf, def->src->backingStore,
xmlopt, flags) < 0)
return -1;
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
+ <backingStore type='block'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image2.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image5.qcow'/>
+ <backingStore type='file'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/>
</source>
+ <backingStore/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<host name='mon2.example.org' port='6322'/>
<host name='mon3.example.org' port='6322'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ </backingStore>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>
+ <backingStore type='file' index='1'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
+ <backingStore type='block' index='8'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file' index='7'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file' index='6'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file' index='5'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file' index='4'>
+ <format type='qcow2'/>
+ <source file='/tmp/image5.qcow'/>
+ <backingStore type='file' index='3'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/>
</source>
+ <backingStore/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<host name='mon2.example.org' port='6322'/>
<host name='mon3.example.org' port='6322'/>
</source>
+ <backingStore type='file' index='11'>
+ <format type='qcow2'/>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ </backingStore>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file' index='24'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file' index='23'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file' index='22'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file' index='21'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file' index='20'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file' index='19'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file' index='18'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file' index='17'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file' index='16'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file' index='15'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file' index='14'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdf' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
+ <backingStore type='block'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image5.qcow'/>
+ <backingStore type='file'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/>
</source>
+ <backingStore/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<host name='mon2.example.org' port='6322'/>
<host name='mon3.example.org' port='6322'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ </backingStore>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdf' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
+ <backingStore type='block'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image5.qcow'/>
+ <backingStore type='file'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/>
</source>
+ <backingStore/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<host name='mon2.example.org' port='6322'/>
<host name='mon3.example.org' port='6322'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ </backingStore>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdf' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
+ <backingStore type='block'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file'>
+ <format type='vmdk'/>
+ <source file='/tmp/image2'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image5.qcow'/>
+ <backingStore type='file'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/>
</source>
+ <backingStore/>
<target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<host name='mon2.example.org' port='6322'/>
<host name='mon3.example.org' port='6322'/>
</source>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ </backingStore>
<target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.1484071880'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071877'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071876'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1484071872'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483615252'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605924'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483605920'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483546244'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545901'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483545313'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.1483536402'/>
+ <backingStore type='file'>
+ <format type='qcow2'/>
+ <source file='/var/lib/libvirt/images/rhel7.qcow2'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
<target dev='vdf' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest2'/>
+ <backingStore/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/tmp/data.img'/>
+ <backingStore/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/tmp/logs.img'/>
+ <backingStore/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest2'/>
+ <backingStore/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/tmp/data.img'/>
+ <backingStore/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/tmp/logs.img'/>
+ <backingStore/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>