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

Re: [libvirt] [PATCH 4/5] qemu: support starting persistent domain paused



On Thu, Jun 10, 2010 at 11:16:12AM -0600, Eric Blake wrote:
> Match earlier change for qemu pause support with virDomainCreateXML.
> 
> * src/qemu/qemu_driver.c (qemudDomainObjStart): Add parameter; all
> callers changed.
> (qemudDomainStartWithFlags): Implement flag support.
> ---
> 
> Question: should qemudDomainObjStart take an 'unsigned int flags'
> instead of 'bool start_paused', in case we want to support further
> flags in the future?
> 
>  src/qemu/qemu_driver.c |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 13a36ee..df04ea1 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -148,7 +148,8 @@ static void qemuDomainEventQueue(struct qemud_driver *driver,
> 
>  static int qemudDomainObjStart(virConnectPtr conn,
>                                 struct qemud_driver *driver,
> -                               virDomainObjPtr vm);
> +                               virDomainObjPtr vm,
> +                               bool start_paused);
> 
>  static int qemudStartVMDaemon(virConnectPtr conn,
>                                struct qemud_driver *driver,
> @@ -643,7 +644,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
>      } else {
>          if (vm->autostart &&
>              !virDomainObjIsActive(vm) &&
> -            qemudDomainObjStart(data->conn, data->driver, vm) < 0) {
> +            qemudDomainObjStart(data->conn, data->driver, vm, false) < 0) {
>              err = virGetLastError();
>              VIR_ERROR(_("Failed to autostart VM '%s': %s"),
>                        vm->def->name,
> @@ -6685,7 +6686,8 @@ static int qemudNumDefinedDomains(virConnectPtr conn) {
> 
>  static int qemudDomainObjStart(virConnectPtr conn,
>                                 struct qemud_driver *driver,
> -                               virDomainObjPtr vm)
> +                               virDomainObjPtr vm,
> +                               bool start_paused)
>  {
>      int ret = -1;
>      char *managed_save;
> @@ -6706,7 +6708,7 @@ static int qemudDomainObjStart(virConnectPtr conn,
>              goto cleanup;
>      }
> 
> -    ret = qemudStartVMDaemon(conn, driver, vm, NULL, false, -1, NULL);
> +    ret = qemudStartVMDaemon(conn, driver, vm, NULL, start_paused, -1, NULL);
>      if (ret != -1) {
>          virDomainEventPtr event =
>              virDomainEventNewFromObj(vm,
> @@ -6728,8 +6730,7 @@ qemudDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
>      virDomainObjPtr vm;
>      int ret = -1;
> 
> -    /* XXX: Support VIR_DOMAIN_START_PAUSED */
> -    virCheckFlags(0, -1);
> +    virCheckFlags(VIR_DOMAIN_START_PAUSED, -1);
> 
>      qemuDriverLock(driver);
>      vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> @@ -6751,7 +6752,8 @@ qemudDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
>          goto endjob;
>      }
> 
> -    ret = qemudDomainObjStart(dom->conn, driver, vm);
> +    ret = qemudDomainObjStart(dom->conn, driver, vm,
> +                              (flags & VIR_DOMAIN_START_PAUSED) != 0);
> 
>  endjob:
>      if (qemuDomainObjEndJob(vm) == 0)

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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]