[libvirt] [PATCH 1/3] conf: backup: Allow configuration of names exported via NBD
Daniel Henrique Barboza
danielhb413 at gmail.com
Thu Jan 9 19:07:23 UTC 2020
On 1/9/20 3:31 PM, Peter Krempa wrote:
> 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 at redhat.com>
> ---
> docs/formatbackup.html.in | 9 +++++++++
> docs/schemas/domainbackup.rng | 8 ++++++++
> src/conf/backup_conf.c | 11 +++++++++++
> src/conf/backup_conf.h | 2 ++
> tests/domainbackupxml2xmlin/backup-pull-seclabel.xml | 2 +-
> tests/domainbackupxml2xmlout/backup-pull-seclabel.xml | 2 +-
> 6 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/docs/formatbackup.html.in b/docs/formatbackup.html.in
> index 1c690901c7..7d2c6f1599 100644
> --- a/docs/formatbackup.html.in
> +++ b/docs/formatbackup.html.in
> @@ -85,6 +85,15 @@
> <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 to modify 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 to modify 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
> diff --git a/docs/schemas/domainbackup.rng b/docs/schemas/domainbackup.rng
> index c1e4d80302..395ea841f9 100644
> --- a/docs/schemas/domainbackup.rng
> +++ b/docs/schemas/domainbackup.rng
> @@ -165,6 +165,14 @@
> <attribute name='name'>
> <ref name='diskTarget'/>
> </attribute>
> + <optional>
> + <attribute name='exportname'>
> + <text/>
> + </attribute>
> + <attribute name='exportbitmap'>
> + <text/>
> + </attribute>
> + </optional>
> <choice>
> <group>
> <attribute name='backup'>
> diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c
> index aa11967d2a..a4b87baa55 100644
> --- a/src/conf/backup_conf.c
> +++ b/src/conf/backup_conf.c
> @@ -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) {
> @@ -165,6 +172,7 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
> storageSourceParseFlags, xmlopt) < 0)
> return -1;
>
> +
Is this an unintended newline?
Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> if ((driver = virXPathString("string(./driver/@type)", ctxt))) {
> def->store->format = virStorageFileFormatTypeFromString(driver);
> if (def->store->format <= 0) {
> @@ -333,6 +341,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));
More information about the libvir-list
mailing list