Re: [PATCH 2/3] Remove dead code from qemuDomainAttachControllerDevice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/09/2015 12:08 PM, Ján Tomko wrote:
> We only support hotplugging SCSI controllers,
> USB and virtio-serial related code is useless here.
> ---
>  src/conf/domain_addr.c   | 21 ---------------------
>  src/conf/domain_addr.h   |  4 ----
>  src/libvirt_private.syms |  1 -
>  src/qemu/qemu_hotplug.c  | 18 ------------------
>  4 files changed, 44 deletions(-)

Perhaps helpful to add a bit of history:

This reverts commit id 'ee0d97a77', part of '16db8d2e', and part of
commit id 'd6d54cd1'.  Although for that last one, if one goes and
checks out the history - there's no way the code ever have been called
since the only way into the function where it was added is if the
controller type is VIR_DOMAIN_CONTROLLER_TYPE_SCSI

> 
> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
> index ca5803e..c7eab0c 100644
> --- a/src/conf/domain_addr.c
> +++ b/src/conf/domain_addr.c
> @@ -884,27 +884,6 @@ virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSetPtr addrs
>      return 0;
>  }
>  
> -/* virDomainVirtioSerialAddrSetRemoveController
> - *
> - * Removes a virtio serial controller from the address set.
> - */
> -void
> -virDomainVirtioSerialAddrSetRemoveController(virDomainVirtioSerialAddrSetPtr addrs,
> -                                             virDomainControllerDefPtr cont)
> -{
> -    ssize_t pos;
> -
> -    if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
> -        return;
> -
> -    VIR_DEBUG("Removing virtio serial controller index %u "
> -              "from the address set", cont->idx);
> -
> -    pos = virDomainVirtioSerialAddrFindController(addrs, cont->idx);
> -
> -    if (pos >= 0)
> -        VIR_DELETE_ELEMENT(addrs->controllers, pos, addrs->ncontrollers);
> -}
>  
>  void
>  virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs)
> diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
> index 2220a79..74f414e 100644
> --- a/src/conf/domain_addr.h
> +++ b/src/conf/domain_addr.h
> @@ -209,10 +209,6 @@ int
>  virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSetPtr addrs,
>                                            virDomainControllerDefPtr cont)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> -void
> -virDomainVirtioSerialAddrSetRemoveController(virDomainVirtioSerialAddrSetPtr addrs,
> -                                             virDomainControllerDefPtr cont)
> -    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  int
>  virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSetPtr addrs,
>                                             virDomainDefPtr def)
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 63d8618..536acab 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -115,7 +115,6 @@ virDomainVirtioSerialAddrSetAddController;
>  virDomainVirtioSerialAddrSetAddControllers;
>  virDomainVirtioSerialAddrSetCreate;
>  virDomainVirtioSerialAddrSetFree;
> -virDomainVirtioSerialAddrSetRemoveController;
>  
>  
>  # conf/domain_audit.h
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index eae5418..9bd4238 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -442,7 +442,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
>      char *devstr = NULL;
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      bool releaseaddr = false;
> -    bool addedToAddrSet = false;
>  
>      if (controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
>          virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> @@ -484,20 +483,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
>          if (qemuAssignDeviceControllerAlias(vm->def, priv->qemuCaps, controller) < 0)
>              goto cleanup;
>  
> -        if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
> -            controller->model == -1 &&
> -            !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
> -            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                           _("USB controller hotplug unsupported in this QEMU binary"));
> -            goto cleanup;
> -        }
> -
> -        if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL &&
> -            virDomainVirtioSerialAddrSetAddController(priv->vioserialaddrs,
> -                                                      controller) < 0)
> -            goto cleanup;
> -        addedToAddrSet = true;
> -
>          if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL)))
>              goto cleanup;
>      }
> @@ -526,9 +511,6 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
>      }
>  
>   cleanup:
> -    if (ret != 0 && addedToAddrSet)
> -        virDomainVirtioSerialAddrSetRemoveController(priv->vioserialaddrs,
> -                                                     controller);
>      if (ret != 0 && releaseaddr)
>          qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL);
>  
> 

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]