|
|
fbe740 |
From 100ae962cd0f4dbfd5270bc2d61f05ec1c524c0a Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <100ae962cd0f4dbfd5270bc2d61f05ec1c524c0a@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Tue, 4 Feb 2020 15:07:40 +0100
|
|
|
fbe740 |
Subject: [PATCH] conf: backup: Allow configuration of names exported via NBD
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
If users wish to use different name for exported disks or bitmaps
|
|
|
fbe740 |
the new fields allow to do so. Additionally they also document the
|
|
|
fbe740 |
current settings.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
fbe740 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 12ccd8d4db12d71a270d903701a8edb83d41f127)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
|
|
|
fbe740 |
Message-Id: <8043f75d8d4b4ae7e7ae3671d71407f733e6a3cf.1580824112.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
docs/formatbackup.html.in | 9 +++++++++
|
|
|
fbe740 |
docs/schemas/domainbackup.rng | 8 ++++++++
|
|
|
fbe740 |
src/conf/backup_conf.c | 10 ++++++++++
|
|
|
fbe740 |
src/conf/backup_conf.h | 2 ++
|
|
|
fbe740 |
tests/domainbackupxml2xmlin/backup-pull-seclabel.xml | 2 +-
|
|
|
fbe740 |
tests/domainbackupxml2xmlout/backup-pull-seclabel.xml | 2 +-
|
|
|
fbe740 |
6 files changed, 31 insertions(+), 2 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/docs/formatbackup.html.in b/docs/formatbackup.html.in
|
|
|
fbe740 |
index 1c690901c7..543d913072 100644
|
|
|
fbe740 |
--- a/docs/formatbackup.html.in
|
|
|
fbe740 |
+++ b/docs/formatbackup.html.in
|
|
|
fbe740 |
@@ -85,6 +85,15 @@
|
|
|
fbe740 |
Setting this attribute to yes (default) specifies
|
|
|
fbe740 |
that the disk should take part in the backup and using
|
|
|
fbe740 |
no excludes the disk from the backup.
|
|
|
fbe740 |
+ exportname
|
|
|
fbe740 |
+ Allows modification of the NBD export name for the given disk.
|
|
|
fbe740 |
+ By default equal to disk target.
|
|
|
fbe740 |
+ Valid only for pull mode backups.
|
|
|
fbe740 |
+ exportbitmap
|
|
|
fbe740 |
+ Allows modification of the name of the bitmap describing dirty
|
|
|
fbe740 |
+ blocks for an incremental backup exported via NBD export name
|
|
|
fbe740 |
+ for the given disk.
|
|
|
fbe740 |
+ Valid only for pull mode backups.
|
|
|
fbe740 |
type
|
|
|
fbe740 |
A mandatory attribute to describe the type of the
|
|
|
fbe740 |
disk, except when backup='no' is
|
|
|
fbe740 |
diff --git a/docs/schemas/domainbackup.rng b/docs/schemas/domainbackup.rng
|
|
|
fbe740 |
index c1e4d80302..395ea841f9 100644
|
|
|
fbe740 |
--- a/docs/schemas/domainbackup.rng
|
|
|
fbe740 |
+++ b/docs/schemas/domainbackup.rng
|
|
|
fbe740 |
@@ -165,6 +165,14 @@
|
|
|
fbe740 |
<attribute name='name'>
|
|
|
fbe740 |
<ref name='diskTarget'/>
|
|
|
fbe740 |
</attribute>
|
|
|
fbe740 |
+ <optional>
|
|
|
fbe740 |
+ <attribute name='exportname'>
|
|
|
fbe740 |
+ <text/>
|
|
|
fbe740 |
+ </attribute>
|
|
|
fbe740 |
+ <attribute name='exportbitmap'>
|
|
|
fbe740 |
+ <text/>
|
|
|
fbe740 |
+ </attribute>
|
|
|
fbe740 |
+ </optional>
|
|
|
fbe740 |
<choice>
|
|
|
fbe740 |
<group>
|
|
|
fbe740 |
<attribute name='backup'>
|
|
|
fbe740 |
diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
|
|
|
fbe740 |
index 61dc8cd4b2..b370b686f1 100644
|
|
|
fbe740 |
--- a/src/conf/backup_conf.c
|
|
|
fbe740 |
+++ b/src/conf/backup_conf.c
|
|
|
fbe740 |
@@ -71,6 +71,8 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
|
|
|
fbe740 |
virDomainBackupDiskDefPtr disk = def->disks + i;
|
|
|
fbe740 |
|
|
|
fbe740 |
g_free(disk->name);
|
|
|
fbe740 |
+ g_free(disk->exportname);
|
|
|
fbe740 |
+ g_free(disk->exportbitmap);
|
|
|
fbe740 |
virObjectUnref(disk->store);
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -124,6 +126,11 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
|
|
|
fbe740 |
if (def->backup == VIR_TRISTATE_BOOL_NO)
|
|
|
fbe740 |
return 0;
|
|
|
fbe740 |
|
|
|
fbe740 |
+ if (!push) {
|
|
|
fbe740 |
+ def->exportname = virXMLPropString(node, "exportname");
|
|
|
fbe740 |
+ def->exportbitmap = virXMLPropString(node, "exportbitmap");
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
if (internal) {
|
|
|
fbe740 |
if (!(state = virXMLPropString(node, "state")) ||
|
|
|
fbe740 |
(tmp = virDomainBackupDiskStateTypeFromString(state)) < 0) {
|
|
|
fbe740 |
@@ -333,6 +340,9 @@ virDomainBackupDiskDefFormat(virBufferPtr buf,
|
|
|
fbe740 |
if (disk->backup == VIR_TRISTATE_BOOL_YES) {
|
|
|
fbe740 |
virBufferAsprintf(&attrBuf, " type='%s'", virStorageTypeToString(disk->store->type));
|
|
|
fbe740 |
|
|
|
fbe740 |
+ virBufferEscapeString(&attrBuf, " exportname='%s'", disk->exportname);
|
|
|
fbe740 |
+ virBufferEscapeString(&attrBuf, " exportbitmap='%s'", disk->exportbitmap);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
if (disk->store->format > 0)
|
|
|
fbe740 |
virBufferEscapeString(&childBuf, "<driver type='%s'/>\n",
|
|
|
fbe740 |
virStorageFileFormatTypeToString(disk->store->format));
|
|
|
fbe740 |
diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h
|
|
|
fbe740 |
index 7cf44245d4..672fd52ee7 100644
|
|
|
fbe740 |
--- a/src/conf/backup_conf.h
|
|
|
fbe740 |
+++ b/src/conf/backup_conf.h
|
|
|
fbe740 |
@@ -51,6 +51,8 @@ typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr;
|
|
|
fbe740 |
struct _virDomainBackupDiskDef {
|
|
|
fbe740 |
char *name; /* name matching the
|
|
|
fbe740 |
virTristateBool backup; /* whether backup is requested */
|
|
|
fbe740 |
+ char *exportname; /* name of the NBD export for pull mode backup */
|
|
|
fbe740 |
+ char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */
|
|
|
fbe740 |
|
|
|
fbe740 |
/* details of target for push-mode, or of the scratch file for pull-mode */
|
|
|
fbe740 |
virStorageSourcePtr store;
|
|
|
fbe740 |
diff --git a/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml b/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
|
|
|
fbe740 |
index a00d8758bb..4e6e602c19 100644
|
|
|
fbe740 |
--- a/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
|
|
|
fbe740 |
+++ b/tests/domainbackupxml2xmlin/backup-pull-seclabel.xml
|
|
|
fbe740 |
@@ -2,7 +2,7 @@
|
|
|
fbe740 |
<incremental>1525889631</incremental>
|
|
|
fbe740 |
<server transport='tcp' name='localhost' port='10809'/>
|
|
|
fbe740 |
<disks>
|
|
|
fbe740 |
- <disk name='vda' type='file'>
|
|
|
fbe740 |
+ <disk name='vda' type='file' exportname='test-vda' exportbitmap='blah'>
|
|
|
fbe740 |
<driver type='qcow2'/>
|
|
|
fbe740 |
<scratch file='/path/to/file'>
|
|
|
fbe740 |
<seclabel model='dac' relabel='no'/>
|
|
|
fbe740 |
diff --git a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
|
|
|
fbe740 |
index c631c9b979..450f007d3a 100644
|
|
|
fbe740 |
--- a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
|
|
|
fbe740 |
+++ b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
|
|
|
fbe740 |
@@ -2,7 +2,7 @@
|
|
|
fbe740 |
<incremental>1525889631</incremental>
|
|
|
fbe740 |
<server transport='tcp' name='localhost' port='10809'/>
|
|
|
fbe740 |
<disks>
|
|
|
fbe740 |
- <disk name='vda' backup='yes' type='file'>
|
|
|
fbe740 |
+ <disk name='vda' backup='yes' type='file' exportname='test-vda' exportbitmap='blah'>
|
|
|
fbe740 |
<driver type='qcow2'/>
|
|
|
fbe740 |
<scratch file='/path/to/file'>
|
|
|
fbe740 |
<seclabel model='dac' relabel='no'/>
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|