[libvirt] [RFC PATCH 3/5] qemu: driver: Remove support for native->XML conversion

Peter Krempa posted 5 patches 6 years, 7 months ago
There is a newer version of this series
[libvirt] [RFC PATCH 3/5] qemu: driver: Remove support for native->XML conversion
Posted by Peter Krempa 6 years, 7 months ago
This code is really neglected and does not at all work reliably. It
can't even be used for converting our own commandline back.

Since this was mostly useful for aiding migration from manually run qemu
to libvirt and will not work for this puspose in many cases it's not
worth having in my opinion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_driver.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bb6ba97c7a..7279b20d2e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7319,44 +7319,18 @@ static char


 static char *qemuConnectDomainXMLFromNative(virConnectPtr conn,
-                                            const char *format,
-                                            const char *config,
+                                            const char *format ATTRIBUTE_UNUSED,
+                                            const char *config ATTRIBUTE_UNUSED,
                                             unsigned int flags)
 {
-    virQEMUDriverPtr driver = conn->privateData;
-    virDomainDefPtr def = NULL;
-    char *xml = NULL;
-    virCapsPtr caps = NULL;
-
     virCheckFlags(0, NULL);

     if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
-        goto cleanup;
-
-    if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unsupported config type %s"), format);
-        goto cleanup;
-    }
-
-    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
-        goto cleanup;
-
-    def = qemuParseCommandLineString(driver->qemuCapsCache,
-                                     caps, driver->xmlopt, config,
-                                     NULL, NULL, NULL);
-    if (!def)
-        goto cleanup;
-
-    if (!def->name && VIR_STRDUP(def->name, "unnamed") < 0)
-        goto cleanup;
-
-    xml = qemuDomainDefFormatXML(driver, def, VIR_DOMAIN_XML_INACTIVE);
+        return NULL;

- cleanup:
-    virDomainDefFree(def);
-    virObjectUnref(caps);
-    return xml;
+    virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                   _("qemu driver no longer supports native to XML conversion"));
+    return NULL;
 }

 static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 3/5] qemu: driver: Remove support for native->XML conversion
Posted by Ján Tomko 6 years, 7 months ago
On Fri, Jun 14, 2019 at 03:30:25PM +0200, Peter Krempa wrote:
>This code is really neglected and does not at all work reliably. It
>can't even be used for converting our own commandline back.
>
>Since this was mostly useful for aiding migration from manually run qemu
>to libvirt and will not work for this puspose in many cases it's not

s/puspose/purpose/

>worth having in my opinion.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_driver.c | 38 ++++++--------------------------------
> 1 file changed, 6 insertions(+), 32 deletions(-)
>
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index bb6ba97c7a..7279b20d2e 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -7319,44 +7319,18 @@ static char
>
>
> static char *qemuConnectDomainXMLFromNative(virConnectPtr conn,
>-                                            const char *format,
>-                                            const char *config,
>+                                            const char *format ATTRIBUTE_UNUSED,
>+                                            const char *config ATTRIBUTE_UNUSED,
>                                             unsigned int flags)
> {
>-    virQEMUDriverPtr driver = conn->privateData;
>-    virDomainDefPtr def = NULL;
>-    char *xml = NULL;
>-    virCapsPtr caps = NULL;
>-
>     virCheckFlags(0, NULL);
>
>     if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
>-        goto cleanup;

I don't see a benefit in checking ACLs to report an error.
Either way, it should be handled consistently - you removed the check
from qemuDomainQemuAttach.

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 3/5] qemu: driver: Remove support for native->XML conversion
Posted by Peter Krempa 6 years, 7 months ago
On Fri, Jun 14, 2019 at 15:51:31 +0200, Ján Tomko wrote:
> On Fri, Jun 14, 2019 at 03:30:25PM +0200, Peter Krempa wrote:
> > This code is really neglected and does not at all work reliably. It
> > can't even be used for converting our own commandline back.
> > 
> > Since this was mostly useful for aiding migration from manually run qemu
> > to libvirt and will not work for this puspose in many cases it's not
> 
> s/puspose/purpose/
> 
> > worth having in my opinion.
> > 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> > src/qemu/qemu_driver.c | 38 ++++++--------------------------------
> > 1 file changed, 6 insertions(+), 32 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index bb6ba97c7a..7279b20d2e 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -7319,44 +7319,18 @@ static char
> > 
> > 
> > static char *qemuConnectDomainXMLFromNative(virConnectPtr conn,
> > -                                            const char *format,
> > -                                            const char *config,
> > +                                            const char *format ATTRIBUTE_UNUSED,
> > +                                            const char *config ATTRIBUTE_UNUSED,
> >                                             unsigned int flags)
> > {
> > -    virQEMUDriverPtr driver = conn->privateData;
> > -    virDomainDefPtr def = NULL;
> > -    char *xml = NULL;
> > -    virCapsPtr caps = NULL;
> > -
> >     virCheckFlags(0, NULL);
> > 
> >     if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
> > -        goto cleanup;
> 
> I don't see a benefit in checking ACLs to report an error.
> Either way, it should be handled consistently - you removed the check
> from qemuDomainQemuAttach.

The ACL check is enforced by our syntax-check. In contrast to
virDomainQemuAttach which has "qemu" in the API name, in this case other
hypervisors driver might want to implement it and thus I don't think we
should add an exemption for this API.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 3/5] qemu: driver: Remove support for native->XML conversion
Posted by Andrea Bolognani 6 years, 7 months ago
On Fri, 2019-06-14 at 15:30 +0200, Peter Krempa wrote:
[...]
> +    virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> +                   _("qemu driver no longer supports native to XML conversion"));

"Converting arbitrary QEMU command lines to libvirt domain XML is
no longer supported".

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list