diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index f2ad9803d7..d70d1767ab 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -615,7 +615,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, if (!disk->name) return; - virBufferEscapeString(buf, " name); + virBufferEscapeString(buf, "name); if (disk->snapshot > 0) virBufferAsprintf(buf, " snapshot='%s'", virDomainSnapshotLocationTypeToString(disk->snapshot)); @@ -626,11 +626,11 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, } virBufferAsprintf(buf, " type='%s'>\n", virDomainDiskTypeToString(type)); + virBufferAdjustIndent(buf, 2); if (disk->format > 0) - virBufferEscapeString(buf, " \n", + virBufferEscapeString(buf, "\n", virStorageFileFormatTypeToString(disk->format)); - virBufferAdjustIndent(buf, 6); virDomainDiskSourceDefFormatInternal(buf, type, disk->file, @@ -640,8 +640,8 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, disk->hosts, 0, NULL, NULL, 0); - virBufferAdjustIndent(buf, -6); - virBufferAddLit(buf, " \n"); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); } char *virDomainSnapshotDefFormat(const char *domain_uuid, @@ -658,45 +658,51 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, flags |= VIR_DOMAIN_XML_INACTIVE; virBufferAddLit(&buf, "\n"); - virBufferEscapeString(&buf, " %s\n", def->name); + virBufferAdjustIndent(&buf, 2); + virBufferEscapeString(&buf, "%s\n", def->name); if (def->description) - virBufferEscapeString(&buf, " %s\n", + virBufferEscapeString(&buf, "%s\n", def->description); - virBufferAsprintf(&buf, " %s\n", + virBufferAsprintf(&buf, "%s\n", virDomainSnapshotStateTypeToString(def->state)); if (def->parent) { - virBufferAddLit(&buf, " \n"); - virBufferEscapeString(&buf, " %s\n", def->parent); - virBufferAddLit(&buf, " \n"); + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); + virBufferEscapeString(&buf, "%s\n", def->parent); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); } - virBufferAsprintf(&buf, " %lld\n", + virBufferAsprintf(&buf, "%lld\n", def->creationTime); if (def->memory) { - virBufferAsprintf(&buf, " memory)); virBufferEscapeString(&buf, " file='%s'", def->file); virBufferAddLit(&buf, "/>\n"); } if (def->ndisks) { - virBufferAddLit(&buf, " \n"); + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); for (i = 0; i < def->ndisks; i++) virDomainSnapshotDiskDefFormat(&buf, &def->disks[i]); - virBufferAddLit(&buf, " \n"); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); } if (def->dom) { - virBufferAdjustIndent(&buf, 2); if (virDomainDefFormatInternal(def->dom, flags, &buf) < 0) { virBufferFreeAndReset(&buf); return NULL; } - virBufferAdjustIndent(&buf, -2); } else if (domain_uuid) { - virBufferAddLit(&buf, " \n"); - virBufferAsprintf(&buf, " %s\n", domain_uuid); - virBufferAddLit(&buf, " \n"); + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); + virBufferAsprintf(&buf, "%s\n", domain_uuid); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); } if (internal) - virBufferAsprintf(&buf, " %d\n", def->current); + virBufferAsprintf(&buf, "%d\n", def->current); + virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); if (virBufferError(&buf)) {