This should be squashed into the first patch of the previous
"eliminate hardcoded indent" series (which was ACKed but hasn't yet
been pushed):
https://www.redhat.com/archives/libvir-list/2014-March/msg00361.html
The initial patch neglected to change the functions that format
private metadata in the qemu and lxc domain xml.
I have verified that make check still passes when these changes are
squashed into the original.
---
src/conf/domain_conf.c | 2 +-
src/lxc/lxc_domain.c | 4 ++--
src/qemu/qemu_domain.c | 45 +++++++++++++++++++++++++++------------------
3 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c2d3c3d..8c4d64f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17681,13 +17681,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
for (n = 0; n < def->nseclabels; n++)
virSecurityLabelDefFormat(buf, def->seclabels[n], flags);
- virBufferAdjustIndent(buf, -2);
if (def->namespaceData && def->ns.format) {
if ((def->ns.format)(buf, def->namespaceData) < 0)
goto error;
}
+ virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</domain>\n");
if (virBufferError(buf))
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index 83c5a4e..fe64a36 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* lxc_domain.h: LXC domain helpers
@@ -53,7 +53,7 @@ static int virLXCDomainObjPrivateXMLFormat(virBufferPtr buf, void
*data)
{
virLXCDomainObjPrivatePtr priv = data;
- virBufferAsprintf(buf, " <init pid='%llu'/>\n",
+ virBufferAsprintf(buf, "<init pid='%llu'/>\n",
(unsigned long long)priv->initpid);
return 0;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c321eda..bc0b8f7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1,7 +1,7 @@
/*
* qemu_domain.c: QEMU domain private state
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -287,7 +287,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
break;
}
- virBufferEscapeString(buf, " <monitor path='%s'",
monitorpath);
+ virBufferEscapeString(buf, "<monitor path='%s'",
monitorpath);
if (priv->monJSON)
virBufferAddLit(buf, " json='1'");
virBufferAsprintf(buf, " type='%s'/>\n",
@@ -297,34 +297,38 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
if (priv->nvcpupids) {
size_t i;
- virBufferAddLit(buf, " <vcpus>\n");
+ virBufferAddLit(buf, "<vcpus>\n");
+ virBufferAdjustIndent(buf, 2);
for (i = 0; i < priv->nvcpupids; i++) {
- virBufferAsprintf(buf, " <vcpu pid='%d'/>\n",
priv->vcpupids[i]);
+ virBufferAsprintf(buf, "<vcpu pid='%d'/>\n",
priv->vcpupids[i]);
}
- virBufferAddLit(buf, " </vcpus>\n");
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</vcpus>\n");
}
if (priv->qemuCaps) {
size_t i;
- virBufferAddLit(buf, " <qemuCaps>\n");
+ virBufferAddLit(buf, "<qemuCaps>\n");
+ virBufferAdjustIndent(buf, 2);
for (i = 0; i < QEMU_CAPS_LAST; i++) {
if (virQEMUCapsGet(priv->qemuCaps, i)) {
- virBufferAsprintf(buf, " <flag
name='%s'/>\n",
+ virBufferAsprintf(buf, "<flag name='%s'/>\n",
virQEMUCapsTypeToString(i));
}
}
- virBufferAddLit(buf, " </qemuCaps>\n");
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</qemuCaps>\n");
}
if (priv->lockState)
- virBufferAsprintf(buf, " <lockstate>%s</lockstate>\n",
priv->lockState);
+ virBufferAsprintf(buf, "<lockstate>%s</lockstate>\n",
priv->lockState);
job = priv->job.active;
if (!qemuDomainTrackJob(job))
priv->job.active = QEMU_JOB_NONE;
if (priv->job.active || priv->job.asyncJob) {
- virBufferAsprintf(buf, " <job type='%s'
async='%s'",
+ virBufferAsprintf(buf, "<job type='%s' async='%s'",
qemuDomainJobTypeToString(priv->job.active),
qemuDomainAsyncJobTypeToString(priv->job.asyncJob));
if (priv->job.phase) {
@@ -337,16 +341,18 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
priv->job.active = job;
if (priv->fakeReboot)
- virBufferAddLit(buf, " <fakereboot/>\n");
+ virBufferAddLit(buf, "<fakereboot/>\n");
if (priv->qemuDevices && *priv->qemuDevices) {
char **tmp = priv->qemuDevices;
- virBufferAddLit(buf, " <devices>\n");
+ virBufferAddLit(buf, "<devices>\n");
+ virBufferAdjustIndent(buf, 2);
while (*tmp) {
- virBufferAsprintf(buf, " <device alias='%s'/>\n",
*tmp);
+ virBufferAsprintf(buf, "<device alias='%s'/>\n",
*tmp);
tmp++;
}
- virBufferAddLit(buf, " </devices>\n");
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</devices>\n");
}
return 0;
@@ -651,18 +657,21 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf,
if (!cmd->num_args && !cmd->num_env)
return 0;
- virBufferAddLit(buf, " <qemu:commandline>\n");
+ virBufferAddLit(buf, "<qemu:commandline>\n");
+ virBufferAdjustIndent(buf, 2);
+
for (i = 0; i < cmd->num_args; i++)
- virBufferEscapeString(buf, " <qemu:arg
value='%s'/>\n",
+ virBufferEscapeString(buf, "<qemu:arg value='%s'/>\n",
cmd->args[i]);
for (i = 0; i < cmd->num_env; i++) {
- virBufferAsprintf(buf, " <qemu:env name='%s'",
cmd->env_name[i]);
+ virBufferAsprintf(buf, "<qemu:env name='%s'",
cmd->env_name[i]);
if (cmd->env_value[i])
virBufferEscapeString(buf, " value='%s'",
cmd->env_value[i]);
virBufferAddLit(buf, "/>\n");
}
- virBufferAddLit(buf, " </qemu:commandline>\n");
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</qemu:commandline>\n");
return 0;
}
--
1.8.5.3