[libvirt] [PATCH v2 1/4] qemu: delete methods which are no longer supported

Daniel P. Berrangé berrange at redhat.com
Thu Jun 27 09:06:02 UTC 2019


The public API entry points will report VIR_ERR_NO_SUPPORT to the
caller when a driver does not provide an implementation of a particular
method.

When deleting methods, leaving the driver API entry point explicitly
set to NULL with an version range comment, allows the hvsupport.html
page to document when the AP was removed.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 docs/hvsupport.pl      | 25 +++++++++++++++----------
 docs/libvirt.css       |  2 +-
 src/qemu/qemu_driver.c | 33 ++-------------------------------
 3 files changed, 18 insertions(+), 42 deletions(-)

diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl
index 2ea245e83a..6023aab222 100755
--- a/docs/hvsupport.pl
+++ b/docs/hvsupport.pl
@@ -234,17 +234,22 @@ foreach my $src (@srcs) {
             }
 
         } else {
-            if ($line =~ m!\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*(?:/\*\s*(\d+\.\d+\.\d+)\s*(?:\(deprecated:\s*(\d+\.\d+\.\d+)\))?\s*\*/\s*)?$!) {
+            if ($line =~ m!\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*(?:/\*\s*(\d+\.\d+\.\d+)\s*(?:-\s*(\d+\.\d+\.\d+))?\s*\*/\s*)?$!) {
                 my $api = $1;
                 my $meth = $2;
                 my $vers = $3;
-                my $depre = $4;
+                my $deleted = $4;
 
                 next if $api eq "no" || $api eq "name";
 
-                die "Method $meth in $src is missing version" unless defined $vers || $api eq "connectURIProbe";
+                if ($meth eq "NULL" && !defined $deleted) {
+                    die "Method impl for $api is NULL, but no deleted version is provided";
+                }
+                if ($meth ne "NULL" && defined $deleted) {
+                    die "Method impl for $api is non-NULL, but deleted version is provided";
+                }
 
-                die "Driver method for $api is NULL in $src" if $meth eq "NULL";
+                die "Method $meth in $src is missing version" unless defined $vers || $api eq "connectURIProbe";
 
                 if (!exists($groups{$ingrp}->{apis}->{$api})) {
                     next if $api =~ /\w(Open|Close|URIProbe)/;
@@ -254,7 +259,7 @@ foreach my $src (@srcs) {
 
                 $groups{$ingrp}->{drivers}->{$impl}->{$api} = {};
                 $groups{$ingrp}->{drivers}->{$impl}->{$api}->{vers} = $vers;
-                $groups{$ingrp}->{drivers}->{$impl}->{$api}->{depre}  = $depre;
+                $groups{$ingrp}->{drivers}->{$impl}->{$api}->{deleted}  = $deleted;
                 if ($api eq "domainMigratePrepare" ||
                     $api eq "domainMigratePrepare2" ||
                     $api eq "domainMigratePrepare3") {
@@ -351,9 +356,9 @@ print <<EOF;
 <p>
 This page documents which <a href="html/">libvirt calls</a> work on
 which libvirt drivers / hypervisors, and which version the API appeared
-in. If a hypervisor driver deprecated the API, the version when it
-was removed is also mentioned (highlighted in
-<span class="deprecatedhv">dark red</span>).
+in. If a hypervisor driver later dropped support for the API, the version
+when it was removed is also mentioned (highlighted in
+<span class="deletedhv">dark red</span>).
 </p>
 
 EOF
@@ -411,8 +416,8 @@ EOF
                 if ($groups{$grp}->{drivers}->{$drv}->{$field}->{vers}) {
                     print $groups{$grp}->{drivers}->{$drv}->{$field}->{vers};
                 }
-                if ($groups{$grp}->{drivers}->{$drv}->{$field}->{depre}) {
-                    print " - <span class=\"deprecatedhv\">", $groups{$grp}->{drivers}->{$drv}->{$field}->{depre}, "</span>";
+                if ($groups{$grp}->{drivers}->{$drv}->{$field}->{deleted}) {
+                    print " - <span class=\"deletedhv\">", $groups{$grp}->{drivers}->{$drv}->{$field}->{deleted}, "</span>";
                 }
             }
             print "</td>\n";
diff --git a/docs/libvirt.css b/docs/libvirt.css
index 6639b1df64..8309f7a386 100644
--- a/docs/libvirt.css
+++ b/docs/libvirt.css
@@ -588,7 +588,7 @@ td.enumvalue {
     display: inline;
 }
 
-.deprecatedhv {
+.deletedhv {
     color: darkred;
 }
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d6ab134196..ef2e980216 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7316,22 +7316,6 @@ static char
 }
 
 
-static char *
-qemuConnectDomainXMLFromNative(virConnectPtr conn,
-                               const char *format ATTRIBUTE_UNUSED,
-                               const char *config ATTRIBUTE_UNUSED,
-                               unsigned int flags)
-{
-    virCheckFlags(0, NULL);
-
-    if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0)
-        return NULL;
-
-    virReportError(VIR_ERR_DEPRECATED, "%s",
-                   _("converting arbitrary QEMU command lines to libvirt domain XML is no longer supported"));
-    return NULL;
-}
-
 static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
                                           const char *format,
                                           const char *xmlData,
@@ -16772,19 +16756,6 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
 }
 
 
-static virDomainPtr
-qemuDomainQemuAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
-                     unsigned int pid_value ATTRIBUTE_UNUSED,
-                     unsigned int flags)
-{
-    virCheckFlags(0, NULL);
-
-    virReportError(VIR_ERR_DEPRECATED, "%s",
-                   _("attaching to a QEMU process started outside of libvirt is no longer supported"));
-    return NULL;
-}
-
-
 static int
 qemuDomainOpenConsole(virDomainPtr dom,
                       const char *dev_name,
@@ -22271,7 +22242,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
     .domainGetSecurityLabelList = qemuDomainGetSecurityLabelList, /* 0.10.0 */
     .nodeGetSecurityModel = qemuNodeGetSecurityModel, /* 0.6.1 */
     .domainGetXMLDesc = qemuDomainGetXMLDesc, /* 0.2.0 */
-    .connectDomainXMLFromNative = qemuConnectDomainXMLFromNative, /* 0.6.4 (deprecated: 5.5.0) */
+    .connectDomainXMLFromNative = NULL, /* 0.6.4 - 5.5.0 */
     .connectDomainXMLToNative = qemuConnectDomainXMLToNative, /* 0.6.4 */
     .connectListDefinedDomains = qemuConnectListDefinedDomains, /* 0.2.0 */
     .connectNumOfDefinedDomains = qemuConnectNumOfDefinedDomains, /* 0.2.0 */
@@ -22356,7 +22327,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
     .domainRevertToSnapshot = qemuDomainRevertToSnapshot, /* 0.8.0 */
     .domainSnapshotDelete = qemuDomainSnapshotDelete, /* 0.8.0 */
     .domainQemuMonitorCommand = qemuDomainQemuMonitorCommand, /* 0.8.3 */
-    .domainQemuAttach = qemuDomainQemuAttach, /* 0.9.4 (deprecated: 5.5.0) */
+    .domainQemuAttach = NULL, /* 0.9.4 - 5.5.0 */
     .domainQemuAgentCommand = qemuDomainQemuAgentCommand, /* 0.10.0 */
     .connectDomainQemuMonitorEventRegister = qemuConnectDomainQemuMonitorEventRegister, /* 1.2.3 */
     .connectDomainQemuMonitorEventDeregister = qemuConnectDomainQemuMonitorEventDeregister, /* 1.2.3 */
-- 
2.21.0




More information about the libvir-list mailing list