]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: backup: Allow configuration of names exported via NBD
authorPeter Krempa <pkrempa@redhat.com>
Fri, 20 Dec 2019 10:37:40 +0000 (11:37 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2020 12:40:48 +0000 (13:40 +0100)
If users wish to use different name for exported disks or bitmaps
the new fields allow to do so. Additionally they also document the
current settings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
docs/formatbackup.html.in
docs/schemas/domainbackup.rng
src/conf/backup_conf.c
src/conf/backup_conf.h
tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
tests/domainbackupxml2xmlout/backup-pull-seclabel.xml

index 1c690901c7fd52e9026a2d6a77b707a7eaa1af91..543d9130728673f92c6607d0e44536f8a704b533 100644 (file)
               <dd>Setting this attribute to <code>yes</code>(default) specifies
                 that the disk should take part in the backup and using
                 <code>no</code> excludes the disk from the backup.</dd>
+              <dt><code>exportname</code></dt>
+              <dd>Allows modification of the NBD export name for the given disk.
+                By default equal to disk target.
+                Valid only for pull mode backups.</dd>
+              <dt><code>exportbitmap</code></dt>
+              <dd>Allows modification of the name of the bitmap describing dirty
+                blocks for an incremental backup exported via NBD export name
+                for the given disk.
+                Valid only for pull mode backups.</dd>
               <dt><code>type</code></dt>
               <dd>A mandatory attribute to describe the type of the
                 disk, except when <code>backup='no'</code> is
index c1e4d803028fcdc3a152e69fe3b49aa97b8ffca5..395ea841f904bbb18d1fe005bbd2627e37ee0167 100644 (file)
             <attribute name='name'>
               <ref name='diskTarget'/>
             </attribute>
+            <optional>
+              <attribute name='exportname'>
+                <text/>
+              </attribute>
+              <attribute name='exportbitmap'>
+                <text/>
+              </attribute>
+            </optional>
             <choice>
               <group>
                 <attribute name='backup'>
index 61dc8cd4b2f9d05cd55e838be4ea638c749e5596..b370b686f1a0b0b16cd6c1db6e2881216089ee99 100644 (file)
@@ -71,6 +71,8 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
         virDomainBackupDiskDefPtr disk = def->disks + i;
 
         g_free(disk->name);
+        g_free(disk->exportname);
+        g_free(disk->exportbitmap);
         virObjectUnref(disk->store);
     }
 
@@ -124,6 +126,11 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
     if (def->backup == VIR_TRISTATE_BOOL_NO)
         return 0;
 
+    if (!push) {
+        def->exportname = virXMLPropString(node, "exportname");
+        def->exportbitmap = virXMLPropString(node, "exportbitmap");
+    }
+
     if (internal) {
         if (!(state = virXMLPropString(node, "state")) ||
             (tmp = virDomainBackupDiskStateTypeFromString(state)) < 0) {
@@ -333,6 +340,9 @@ virDomainBackupDiskDefFormat(virBufferPtr buf,
     if (disk->backup == VIR_TRISTATE_BOOL_YES) {
         virBufferAsprintf(&attrBuf, " type='%s'", virStorageTypeToString(disk->store->type));
 
+        virBufferEscapeString(&attrBuf, " exportname='%s'", disk->exportname);
+        virBufferEscapeString(&attrBuf, " exportbitmap='%s'", disk->exportbitmap);
+
         if (disk->store->format > 0)
             virBufferEscapeString(&childBuf, "<driver type='%s'/>\n",
                                   virStorageFileFormatTypeToString(disk->store->format));
index 7cf44245d4fb94a369fdd32dc6c2e9c429f7a5c4..672fd52ee7541f15f574d7363343dcba79b8aa28 100644 (file)
@@ -51,6 +51,8 @@ typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr;
 struct _virDomainBackupDiskDef {
     char *name;     /* name matching the <target dev='...' of the domain */
     virTristateBool backup; /* whether backup is requested */
+    char *exportname; /* name of the NBD export for pull mode backup */
+    char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */
 
     /* details of target for push-mode, or of the scratch file for pull-mode */
     virStorageSourcePtr store;
index a00d8758bb72677870a935ea88fa6d052ab838cd..4e6e602c193eb0d6c238978316bb5e5d57001856 100644 (file)
@@ -2,7 +2,7 @@
   <incremental>1525889631</incremental>
   <server transport='tcp' name='localhost' port='10809'/>
   <disks>
-    <disk name='vda' type='file'>
+    <disk name='vda' type='file' exportname='test-vda' exportbitmap='blah'>
       <driver type='qcow2'/>
       <scratch file='/path/to/file'>
         <seclabel model='dac' relabel='no'/>
index c631c9b979ac5fd70cb44a3a033dc043706b929e..450f007d3ade82b3b6ae6f0f5ef0d220b6566a46 100644 (file)
@@ -2,7 +2,7 @@
   <incremental>1525889631</incremental>
   <server transport='tcp' name='localhost' port='10809'/>
   <disks>
-    <disk name='vda' backup='yes' type='file'>
+    <disk name='vda' backup='yes' type='file' exportname='test-vda' exportbitmap='blah'>
       <driver type='qcow2'/>
       <scratch file='/path/to/file'>
         <seclabel model='dac' relabel='no'/>