]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: Clarify that 'xenlight' should only be used internally
authorJim Fehlig <jfehlig@suse.com>
Mon, 4 May 2020 21:20:37 +0000 (15:20 -0600)
committerJim Fehlig <jfehlig@suse.com>
Tue, 5 May 2020 20:53:37 +0000 (14:53 -0600)
The libxl driver has suffered an identity crisis since its introduction.
It took on the name 'libxl' since at the time libvirt already contained
a 'xen' driver for the old Xen toolstack implementation. 'libxl' is short
for libxenlight, which is often called xenlight. Unfortunately all forms
of the name are used in the libxl driver.

The only remaining use of the 'xenlight' form is when interacting with
the host device manager, which is difficult to change since it would
cause problems when upgrading the driver.

Rename the #define to make it clear the 'xenlight' form is internal and
add a comment describing why the name exists and that its use should be
discouraged.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/libxl/libxl_conf.h
src/libxl/libxl_domain.c
src/libxl/libxl_driver.c

index 11a922b10a2e543a53aeb30285d47983199cecf1..b057a9e4ba9bd6095649ed5b01f7979b849289ca 100644 (file)
 #include "libxl_logger.h"
 
 #define LIBXL_DRIVER_EXTERNAL_NAME "Xen"
-#define LIBXL_DRIVER_NAME "xenlight"
+/*
+ * We are stuck with the 'xenlight' name since it is used by the hostdev
+ * manager. Changing it would break management of any host devices previously
+ * managed under the name 'xenlight'.
+ */
+#define LIBXL_DRIVER_INTERNAL_NAME "xenlight"
 #define LIBXL_VNC_PORT_MIN  5900
 #define LIBXL_VNC_PORT_MAX  65535
 
index cc53a765e1749f4746e194c6c9a60f3f7dbcd9dd..d9fcde436418a47fb90d0e28da30e18a4153eb9e 100644 (file)
@@ -873,7 +873,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver,
         VIR_FREE(xml);
     }
 
-    virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    virHostdevReAttachDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                     vm->def, hostdev_flags, NULL);
 
     VIR_FREE(priv->lockState);
@@ -1370,7 +1370,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
     if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0)
         goto cleanup_dom;
 
-    if (virHostdevPrepareDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    if (virHostdevPrepareDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                        vm->def, hostdev_flags) < 0)
         goto cleanup_dom;
 
index ebeb91af3cfbeb377dfb1bba42f8b373872e37a7..63ec0a21889ae4c585cda6d3f056036f410c267a 100644 (file)
@@ -431,7 +431,7 @@ libxlReconnectDomain(virDomainObjPtr vm,
     libxlLoggerOpenFile(cfg->logger, vm->def->id, vm->def->name, NULL);
 
     /* Update hostdev state */
-    if (virHostdevUpdateActiveDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    if (virHostdevUpdateActiveDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                             vm->def, hostdev_flags) < 0)
         goto error;
 
@@ -3127,7 +3127,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
     if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
         goto cleanup;
 
-    if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                     vm->def->name, vm->def->uuid,
                                     &hostdev, 1, 0) < 0)
         goto cleanup;
@@ -3149,7 +3149,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
     goto cleanup;
 
  error:
-    virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                  vm->def->name, &hostdev, 1, NULL);
 
  cleanup:
@@ -3264,7 +3264,7 @@ libxlDomainAttachHostUSBDevice(libxlDriverPrivatePtr driver,
     if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
         goto cleanup;
 
-    if (virHostdevPrepareUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    if (virHostdevPrepareUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                     vm->def->name, &hostdev, 1, 0) < 0)
         goto cleanup;
 
@@ -3284,7 +3284,7 @@ libxlDomainAttachHostUSBDevice(libxlDriverPrivatePtr driver,
     goto cleanup;
 
  reattach:
-    virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                  vm->def->name, &hostdev, 1);
 
  cleanup:
@@ -3689,7 +3689,7 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
 
     virDomainHostdevRemove(vm->def, idx);
 
-    virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                  vm->def->name, &hostdev, 1, NULL);
 
     ret = 0;
@@ -3811,7 +3811,7 @@ libxlDomainDetachHostUSBDevice(libxlDriverPrivatePtr driver,
 
     virDomainHostdevRemove(vm->def, idx);
 
-    virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+    virHostdevReAttachUSBDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_NAME,
                                  vm->def->name, &hostdev, 1);
 
     ret = 0;