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

Re: [libvirt] [PATCH 5/9] Implement controller hotplugging



On Fri, Sep 18, 2009 at 05:26:12PM +0200, Wolfgang Mauerer wrote:
> This enables to hot-add disk controllers without attached
> disks into the system. Previously, it was only possible to
> (implicitly) add disk controllers in the static machine
> configuration.
> 
> Notice that the actual functionality is only available
> for qemu at present, but other emulators can be extended
> likewise.

Any idea what we can do about initial startup? eg, if we start
a guest with 1 SCSI controller and 1 disk, and then we've then
hotplugged a 2nd controller, and 1 disk.  When we later boot
or migrate the same guest, we need to have suitable QEMU command
line args to make sure we get 2 controllers each with the same
disk, rather than 1 controller with 2 disks. I'm not sure how
we do this in QEMU, hopefully the existing args support it in
some way I've not realized, or failing that the new qdev -device
args might help us.

> Signed-off-by: Wolfgang Mauerer <wolfgang mauerer siemens com>
> Signed-off-by: Jan Kiszka <jan kiszka siemens com>
> ---
>  src/domain_conf.c        |   26 +++++++++++++++++++++++---
>  src/domain_conf.h        |    2 ++
>  src/libvirt_private.syms |    1 +
>  src/qemu_driver.c        |   21 +++++++++++++++++----
>  4 files changed, 43 insertions(+), 7 deletions(-)
> 
> diff --git a/src/domain_conf.c b/src/domain_conf.c
> index d0fda64..ea51fda 100644
> --- a/src/domain_conf.c
> +++ b/src/domain_conf.c
> @@ -647,7 +647,6 @@ void virDomainRemoveInactive(virDomainObjListPtr doms,
>  
>  }
>  
> -
>  /* Parse the XML definition for a disk
>   * @param node XML nodeset to parse for disk definition
>   */
> @@ -2554,6 +2553,27 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
>  #endif
>  
>  
> +static int virDomainControllerCompare(virDomainControllerDefPtr a,
> +                                      virDomainControllerDefPtr b) {
> +    if (a->pci_addr.bus == b->pci_addr.bus) {
> +        if (a->pci_addr.domain == b->pci_addr.domain) 
> +            return a->pci_addr.slot - b->pci_addr.slot;
> +
> +        return a->pci_addr.domain - b->pci_addr.domain;
> +    }
> +
> +    return a->pci_addr.bus - b->pci_addr.bus;
> +}
> +
> +
> +int virDomainControllerQSort(const void *a, const void *b)
> +{
> +    const virDomainControllerDefPtr *da = a;
> +    const virDomainControllerDefPtr *db = b;
> +
> +    return virDomainControllerCompare(*da, *db);
> +}
> +

I know we used todo this for disk devices, but I'd recommand not
going a qsort of devices when hotplugging/unplugging. For hotplug
always append to the list, for unplug just shuffle down later 
devices in the list to fill the hole.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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