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

Re: [libvirt] [PATCH v12 03/11] qemu_hostdev: move COLD_BOOT as a flag



On 02/17/2014 08:32 AM, Chunyan Liu wrote:
> For extracting hostdev codes from qemu_hostdev.c to common library, change qemu
> specific COLD_BOOT handling to be a flag, and pass it to hostdev functions.
>
> Signed-off-by: Chunyan Liu <cyliu suse com>
> ---
>  src/qemu/qemu_hostdev.c |    6 +++---
>  src/qemu/qemu_hostdev.h |    2 +-
>  src/qemu/qemu_process.c |    4 +++-
>  3 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index 0d313c0..ce5012d 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -992,7 +992,7 @@ out:
>  static int
>  qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
>                            virDomainDefPtr def,
> -                          bool coldBoot)
> +                          unsigned int flags)
>  {
>      size_t i;
>      int ret = -1;
> @@ -1000,6 +1000,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
>      virUSBDevicePtr tmp;
>      virDomainHostdevDefPtr *hostdevs = def->hostdevs;
>      int nhostdevs = def->nhostdevs;
> +    bool coldBoot = !!(flags & VIR_COLD_BOOT);
>  
>      /* To prevent situation where USB device is assigned to two domains
>       * we need to keep a list of currently assigned USB devices.
> @@ -1189,7 +1190,6 @@ int
>  qemuPrepareHostDevices(virQEMUDriverPtr driver,
>                         virDomainDefPtr def,
>                         virQEMUCapsPtr qemuCaps,
> -                       bool coldBoot,
>                         unsigned int flags)
>  {
>      if (!def->nhostdevs)
> @@ -1200,7 +1200,7 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
>                                       qemuCaps, flags) < 0)
>          return -1;
>  
> -    if (qemuPrepareHostUSBDevices(driver, def, coldBoot) < 0)
> +    if (qemuPrepareHostUSBDevices(driver, def, flags) < 0)
>          return -1;
>  
>      if (qemuPrepareHostdevSCSIDevices(driver, def->name,
> diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
> index ab7fb9f..710867d 100644
> --- a/src/qemu/qemu_hostdev.h
> +++ b/src/qemu/qemu_hostdev.h
> @@ -29,6 +29,7 @@
>  
>  typedef enum {
>       VIR_STRICT_ACS_CHECK     = (1 << 0), /* strict acs check */
> +     VIR_COLD_BOOT                   = (1 << 1), /* cold boot */


I think these flags need a less generic preface - maybe VIR_HOSTDEV_* or
VIR_HOSTDEV_FLAG_*.


>  } qemuHostdevFlag;
>  
>  int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
> @@ -59,7 +60,6 @@ int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
>  int qemuPrepareHostDevices(virQEMUDriverPtr driver,
>                             virDomainDefPtr def,
>                             virQEMUCapsPtr qemuCaps,
> -                           bool coldBoot,
>                             unsigned int flags);
>  void qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
>                                         const char *name,
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index c0f0719..f1fe35e 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3688,8 +3688,10 @@ int qemuProcessStart(virConnectPtr conn,
>      VIR_DEBUG("Preparing host devices");
>      if (!cfg->relaxedACS)
>          hostdev_flags |= VIR_STRICT_ACS_CHECK;
> +    if (!migrateFrom)
> +        hostdev_flags |= VIR_COLD_BOOT;
>      if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps,
> -                               !migrateFrom, hostdev_flags) < 0)
> +                                                    hostdev_flags) < 0)
>          goto cleanup;
>  
>      VIR_DEBUG("Preparing chr devices");


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