qemu: support starting persistent domain paused

Match earlier change for qemu pause support with virDomainCreateXML.

* src/qemu/qemu_driver.c (qemudDomainObjStart): Add parameter; all
callers changed.
(qemudDomainStartWithFlags): Implement flag support.
This commit is contained in:
Eric Blake 2010-06-10 10:04:44 -06:00
parent de3aadaa71
commit d024d2ba36

View File

@ -148,7 +148,8 @@ static void qemuDomainEventQueue(struct qemud_driver *driver,
static int qemudDomainObjStart(virConnectPtr conn, static int qemudDomainObjStart(virConnectPtr conn,
struct qemud_driver *driver, struct qemud_driver *driver,
virDomainObjPtr vm); virDomainObjPtr vm,
bool start_paused);
static int qemudStartVMDaemon(virConnectPtr conn, static int qemudStartVMDaemon(virConnectPtr conn,
struct qemud_driver *driver, struct qemud_driver *driver,
@ -643,7 +644,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
} else { } else {
if (vm->autostart && if (vm->autostart &&
!virDomainObjIsActive(vm) && !virDomainObjIsActive(vm) &&
qemudDomainObjStart(data->conn, data->driver, vm) < 0) { qemudDomainObjStart(data->conn, data->driver, vm, false) < 0) {
err = virGetLastError(); err = virGetLastError();
VIR_ERROR(_("Failed to autostart VM '%s': %s"), VIR_ERROR(_("Failed to autostart VM '%s': %s"),
vm->def->name, vm->def->name,
@ -6685,7 +6686,8 @@ static int qemudNumDefinedDomains(virConnectPtr conn) {
static int qemudDomainObjStart(virConnectPtr conn, static int qemudDomainObjStart(virConnectPtr conn,
struct qemud_driver *driver, struct qemud_driver *driver,
virDomainObjPtr vm) virDomainObjPtr vm,
bool start_paused)
{ {
int ret = -1; int ret = -1;
char *managed_save; char *managed_save;
@ -6706,7 +6708,7 @@ static int qemudDomainObjStart(virConnectPtr conn,
goto cleanup; goto cleanup;
} }
ret = qemudStartVMDaemon(conn, driver, vm, NULL, false, -1, NULL); ret = qemudStartVMDaemon(conn, driver, vm, NULL, start_paused, -1, NULL);
if (ret != -1) { if (ret != -1) {
virDomainEventPtr event = virDomainEventPtr event =
virDomainEventNewFromObj(vm, virDomainEventNewFromObj(vm,
@ -6728,8 +6730,7 @@ qemudDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
virDomainObjPtr vm; virDomainObjPtr vm;
int ret = -1; int ret = -1;
/* XXX: Support VIR_DOMAIN_START_PAUSED */ virCheckFlags(VIR_DOMAIN_START_PAUSED, -1);
virCheckFlags(0, -1);
qemuDriverLock(driver); qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@ -6751,7 +6752,8 @@ qemudDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
goto endjob; goto endjob;
} }
ret = qemudDomainObjStart(dom->conn, driver, vm); ret = qemudDomainObjStart(dom->conn, driver, vm,
(flags & VIR_DOMAIN_START_PAUSED) != 0);
endjob: endjob:
if (qemuDomainObjEndJob(vm) == 0) if (qemuDomainObjEndJob(vm) == 0)