[libvirt] [PATCH 0/1] pushed the following trivial patch

I just pushed the following trivial patch to fix a problem with indentation in the domain XML. The problem was reported as: https://bugzilla.redhat.com/show_bug.cgi?id=573908 Dave David Allan (1): Properly indent encryption tags src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)

* Fix for the bug reported at: https://bugzilla.redhat.com/show_bug.cgi?id=573908 --- src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index ed71688..7f68d67 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -228,7 +228,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, } virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr); + virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr); return 0; } @@ -245,14 +245,14 @@ virStorageEncryptionFormat(virBufferPtr buf, "%s", _("unexpected encryption format")); return -1; } - virBufferVSprintf(buf, " <encryption format='%s'>\n", format); + virBufferVSprintf(buf, " <encryption format='%s'>\n", format); for (i = 0; i < enc->nsecrets; i++) { if (virStorageEncryptionSecretFormat(buf, enc->secrets[i]) < 0) return -1; } - virBufferAddLit(buf, " </encryption>\n"); + virBufferAddLit(buf, " </encryption>\n"); return 0; } -- 1.7.0.1

On 04/22/2010 12:32 PM, David Allan wrote:
* Fix for the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=573908 --- src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index ed71688..7f68d67 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -228,7 +228,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, }
virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr); + virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr);
This patch breaks tests/storagevolxml2xmltest, which needs a corresponding change to the expected alignment. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Fri, Apr 23, 2010 at 08:41:54AM -0600, Eric Blake wrote:
On 04/22/2010 12:32 PM, David Allan wrote:
* Fix for the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=573908 --- src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index ed71688..7f68d67 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -228,7 +228,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, }
virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr); + virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr);
This patch breaks tests/storagevolxml2xmltest, which needs a corresponding change to the expected alignment.
Actually I think the problem here is that the encryption XML is used from two different places - the domain XML and the storage volume XML. The usage in each of these two XML docs needs a different indentation. There is no one-size-fits-all solution. We should make the caller pass in a suitable const char *indent = " "; string to match their use context. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Apr 23, 2010 at 03:52:41PM +0100, Daniel P. Berrange wrote:
On Fri, Apr 23, 2010 at 08:41:54AM -0600, Eric Blake wrote:
On 04/22/2010 12:32 PM, David Allan wrote:
* Fix for the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=573908 --- src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index ed71688..7f68d67 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -228,7 +228,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, }
virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr); + virBufferVSprintf(buf, " <secret type='%s' uuid='%s'/>\n", type, uuidstr);
This patch breaks tests/storagevolxml2xmltest, which needs a corresponding change to the expected alignment.
Actually I think the problem here is that the encryption XML is used from two different places - the domain XML and the storage volume XML. The usage in each of these two XML docs needs a different indentation. There is no one-size-fits-all solution. We should make the caller pass in a suitable const char *indent = " "; string to match their use context.
Ugh, sorry about that. The const char *indent approach seems like the right one to me. I'll fix that right now. Dave

On 04/23/2010 11:00 AM, Dave Allan wrote:
On Fri, Apr 23, 2010 at 03:52:41PM +0100, Daniel P. Berrange wrote:
On Fri, Apr 23, 2010 at 08:41:54AM -0600, Eric Blake wrote:
On 04/22/2010 12:32 PM, David Allan wrote:
* Fix for the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=573908 --- src/conf/storage_encryption_conf.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index ed71688..7f68d67 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -228,7 +228,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, }
virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, "<secret type='%s' uuid='%s'/>\n", type, uuidstr); + virBufferVSprintf(buf, "<secret type='%s' uuid='%s'/>\n", type, uuidstr);
This patch breaks tests/storagevolxml2xmltest, which needs a corresponding change to the expected alignment.
Actually I think the problem here is that the encryption XML is used from two different places - the domain XML and the storage volume XML. The usage in each of these two XML docs needs a different indentation. There is no one-size-fits-all solution. We should make the caller pass in a suitable const char *indent = " "; string to match their use context.
Ugh, sorry about that. The const char *indent approach seems like the right one to me. I'll fix that right now.
I haven't looked at the code throughtly, but if there's a possibility that the caller is already indented, so doesn't know just how much indentation to send to the subordinate function (or that it might happen in the future), you could pass around an "int indent" instead of a char*, and reference it in the printf like this: virBufferVSprintf(buf, "%*s<secret type='%s' uuid='%s'/>\n", indent*2, type, uuidstr); similar to what I did in interface_conf.c:virInterfaceDefDevFormat() (I called it "level", but same idea). (Of course, I needed something that could be called recursively, while your usage probably doesn't need that.)
participants (5)
-
Daniel P. Berrange
-
Dave Allan
-
David Allan
-
Eric Blake
-
Laine Stump