[libvirt] [PATCH 0/2] A few cleanups related to qemuDomainDefFormat*

Jiri Denemark (2): qemu: Fix error checking in qemuDomainDefFormatXMLInternal qemu: Use qemuDomainDefFormatXML in qemuDomainDefCopy src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) -- 2.14.1

virDomainDefFormatInternal (called by qemuDomainDefFormatXMLInternal) already checks for buffer errors and properly resets the buffer on failure. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_domain.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e09d848db6..689dbdb043 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4719,16 +4719,8 @@ qemuDomainDefFormatXMLInternal(virQEMUDriverPtr driver, { virBuffer buf = VIR_BUFFER_INITIALIZER; - if (qemuDomainDefFormatBufInternal(driver, def, origCPU, flags, &buf) < 0) { - virBufferFreeAndReset(&buf); + if (qemuDomainDefFormatBufInternal(driver, def, origCPU, flags, &buf) < 0) return NULL; - } - - if (virBufferError(&buf)) { - virReportOOMError(); - virBufferFreeAndReset(&buf); - return NULL; - } return virBufferContentAndReset(&buf); } -- 2.14.1

Because qemuDomainDefCopy needs a string representation of a domain definition, there's no reason for calling the lower level qemuDomainDefFormatBuf API. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_domain.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 689dbdb043..3325300da8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4536,14 +4536,12 @@ qemuDomainDefCopy(virQEMUDriverPtr driver, virDomainDefPtr src, unsigned int flags) { - virBuffer buf = VIR_BUFFER_INITIALIZER; virDomainDefPtr ret = NULL; - char *xml = NULL; + char *xml; - if (qemuDomainDefFormatBuf(driver, src, flags, &buf) < 0) + if (!(xml = qemuDomainDefFormatXML(driver, src, flags))) return NULL; - xml = virBufferContentAndReset(&buf); ret = qemuDomainDefFromXML(driver, xml); VIR_FREE(xml); -- 2.14.1

On Thu, Sep 21, 2017 at 15:23:06 +0200, Jiri Denemark wrote:
Jiri Denemark (2): qemu: Fix error checking in qemuDomainDefFormatXMLInternal qemu: Use qemuDomainDefFormatXML in qemuDomainDefCopy
src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
It looks like the issue you were trying to fix by this series was addressed in [1] which was pushed an hour ago. Jirka [1] https://www.redhat.com/archives/libvir-list/2017-September/msg00517.html

On 21.09.2017 17:34, Jiri Denemark wrote:
On Thu, Sep 21, 2017 at 15:23:06 +0200, Jiri Denemark wrote:
Jiri Denemark (2): qemu: Fix error checking in qemuDomainDefFormatXMLInternal qemu: Use qemuDomainDefFormatXML in qemuDomainDefCopy
src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
It looks like the issue you were trying to fix by this series was addressed in [1] which was pushed an hour ago.
Jirka
[1] https://www.redhat.com/archives/libvir-list/2017-September/msg00517.html
Looks like this one is addressed to me and somehow I ran across this message ) True, [1] fixes issues I address in my series. But still please check out the first patch of that series. Nikolay

On Thu, Sep 21, 2017 at 16:34:24 +0200, Jiri Denemark wrote:
On Thu, Sep 21, 2017 at 15:23:06 +0200, Jiri Denemark wrote:
Jiri Denemark (2): qemu: Fix error checking in qemuDomainDefFormatXMLInternal qemu: Use qemuDomainDefFormatXML in qemuDomainDefCopy
src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
It looks like the issue you were trying to fix by this series was addressed in [1] which was pushed an hour ago.
Jirka
[1] https://www.redhat.com/archives/libvir-list/2017-September/msg00517.html
Oops, this was supposed to be a reply to "qemu: don't update cpu unconditionally for migratable flag" :-) Jirka

On Thu, Sep 21, 2017 at 03:23:06PM +0200, Jiri Denemark wrote:
Jiri Denemark (2): qemu: Fix error checking in qemuDomainDefFormatXMLInternal qemu: Use qemuDomainDefFormatXML in qemuDomainDefCopy
src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
ACK series Jan
participants (3)
-
Jiri Denemark
-
Ján Tomko
-
Nikolay Shirokovskiy