to have some consistency with other domain events --- src/conf/domain_event.c | 16 ++++++----- src/conf/domain_event.h | 18 ++++++++++--- src/libvirt_private.syms | 8 +++--- src/libxl/libxl_driver.c | 18 ++++++------- src/lxc/lxc_driver.c | 16 +++++------ src/lxc/lxc_process.c | 8 +++--- src/qemu/qemu_driver.c | 66 +++++++++++++++++++++++----------------------- src/qemu/qemu_migration.c | 26 +++++++++--------- src/qemu/qemu_process.c | 22 ++++++++-------- src/remote/remote_driver.c | 2 +- src/test/test_driver.c | 46 ++++++++++++++++---------------- src/uml/uml_driver.c | 18 ++++++------- src/vbox/vbox_tmpl.c | 4 +-- src/xen/xen_inotify.c | 2 +- src/xen/xs_internal.c | 16 +++++------ 15 files changed, 149 insertions(+), 137 deletions(-) diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index a69ce11..1c5dcd3 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -786,7 +786,7 @@ static void *virDomainEventNewInternal(virClassPtr klass, return event; } -void *virDomainEventNew(int id, const char *name, +void *virDomainEventLifecycleNew(int id, const char *name, const unsigned char *uuid, int type, int detail) { @@ -806,19 +806,21 @@ void *virDomainEventNew(int id, const char *name, return event; } -void *virDomainEventNewFromDom(virDomainPtr dom, int type, int detail) +void *virDomainEventLifecycleNewFromDom(virDomainPtr dom, int type, int detail) { - return virDomainEventNew(dom->id, dom->name, dom->uuid, type, detail); + return virDomainEventLifecycleNew(dom->id, dom->name, dom->uuid, + type, detail); } -void *virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail) +void *virDomainEventLifecycleNewFromObj(virDomainObjPtr obj, int type, int detail) { - return virDomainEventNewFromDef(obj->def, type, detail); + return virDomainEventLifecycleNewFromDef(obj->def, type, detail); } -void *virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail) +void *virDomainEventLifecycleNewFromDef(virDomainDefPtr def, int type, int detail) { - return virDomainEventNew(def->id, def->name, def->uuid, type, detail); + return virDomainEventLifecycleNew(def->id, def->name, def->uuid, + type, detail); } virDomainEventPtr virDomainEventRebootNew(int id, const char *name, diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index 04b846e..2349b54 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -50,10 +50,20 @@ typedef virObjectEventQueue *virObjectEventQueuePtr; typedef struct _virObjectEventState virObjectEventState; typedef virObjectEventState *virObjectEventStatePtr; -void *virDomainEventNew(int id, const char *name, const unsigned char *uuid, int type, int detail); -void *virDomainEventNewFromDom(virDomainPtr dom, int type, int detail); -void *virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail); -void *virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail); +void *virDomainEventLifecycleNew(int id, + const char *name, + const unsigned char *uuid, + int type, + int detail); +void *virDomainEventLifecycleNewFromDom(virDomainPtr dom, + int type, + int detail); +void *virDomainEventLifecycleNewFromObj(virDomainObjPtr obj, + int type, + int detail); +void *virDomainEventLifecycleNewFromDef(virDomainDefPtr def, + int type, + int detail); virDomainEventPtr virDomainEventRebootNew(int id, const char *name, const unsigned char *uuid); virDomainEventPtr virDomainEventRebootNewFromDom(virDomainPtr dom); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a7bbc79..d098d3e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -427,10 +427,10 @@ virDomainEventIOErrorNewFromDom; virDomainEventIOErrorNewFromObj; virDomainEventIOErrorReasonNewFromDom; virDomainEventIOErrorReasonNewFromObj; -virDomainEventNew; -virDomainEventNewFromDef; -virDomainEventNewFromDom; -virDomainEventNewFromObj; +virDomainEventLifecycleNew; +virDomainEventLifecycleNewFromDef; +virDomainEventLifecycleNewFromDom; +virDomainEventLifecycleNewFromObj; virDomainEventPMSuspendDiskNewFromDom; virDomainEventPMSuspendDiskNewFromObj; virDomainEventPMSuspendNewFromDom; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index bc5f653..9a598a9 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -380,7 +380,7 @@ libxlEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) case LIBXL_SHUTDOWN_REASON_POWEROFF: case LIBXL_SHUTDOWN_REASON_CRASH: if (xl_reason == LIBXL_SHUTDOWN_REASON_CRASH) { - dom_event = virDomainEventNewFromObj(vm, + dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); reason = VIR_DOMAIN_SHUTOFF_CRASHED; @@ -675,7 +675,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback) driver->inhibitCallback(true, driver->inhibitOpaque); - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, restore_fd < 0 ? VIR_DOMAIN_EVENT_STARTED_BOOTED : VIR_DOMAIN_EVENT_STARTED_RESTORED); @@ -1324,7 +1324,7 @@ libxlDomainSuspend(virDomainPtr dom) virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } @@ -1377,7 +1377,7 @@ libxlDomainResume(virDomainPtr dom) virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } @@ -1501,7 +1501,7 @@ libxlDomainDestroyFlags(virDomainPtr dom, goto cleanup; } - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); if (libxlVmReap(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED) != 0) { @@ -1821,7 +1821,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, goto cleanup; } - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); if (libxlVmReap(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED) != 0) { @@ -2009,7 +2009,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) goto cleanup_unpause; } - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); if (!vm->persistent) { virDomainObjListRemove(driver->domains, vm); @@ -2699,7 +2699,7 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml) if (dom) dom->id = vm->def->id; - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, !oldDef ? VIR_DOMAIN_EVENT_DEFINED_ADDED : VIR_DOMAIN_EVENT_DEFINED_UPDATED); @@ -2766,7 +2766,7 @@ libxlDomainUndefineFlags(virDomainPtr dom, if (virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm) < 0) goto cleanup; - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_UNDEFINED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); if (virDomainObjIsActive(vm)) { diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 391226b..57d64b8 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -480,7 +480,7 @@ static virDomainPtr lxcDomainDefineXML(virConnectPtr conn, const char *xml) goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, !oldDef ? VIR_DOMAIN_EVENT_DEFINED_ADDED : @@ -530,7 +530,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom, vm) < 0) goto cleanup; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); @@ -932,7 +932,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, VIR_DOMAIN_RUNNING_BOOTED); if (ret == 0) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); virDomainAuditStart(vm, "booted", true); @@ -1040,7 +1040,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); virDomainAuditStart(vm, "booted", true); @@ -1288,7 +1288,7 @@ lxcDomainDestroyFlags(virDomainPtr dom, priv = vm->privateData; ret = virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); priv->doneStopEvent = true; @@ -1482,7 +1482,7 @@ static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque) if (newVM) { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_ADDED); if (event) @@ -2361,7 +2361,7 @@ static int lxcDomainSuspend(virDomainPtr dom) } virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } @@ -2411,7 +2411,7 @@ static int lxcDomainResume(virDomainPtr dom) virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 8214f62..9b5f3f2 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -71,7 +71,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom, VIR_DEBUG("Killing domain"); virLXCProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED); virDomainAuditStop(dom, "destroyed"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); priv->doneStopEvent = true; @@ -502,7 +502,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon, if (!priv->wantReboot) { virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); if (!priv->doneStopEvent) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, priv->stopReason); virDomainAuditStop(vm, "shutdown"); @@ -520,7 +520,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon, if (ret == 0) { event = virDomainEventRebootNewFromObj(vm); } else { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, priv->stopReason); if (!vm->persistent) { @@ -1395,7 +1395,7 @@ virLXCProcessAutostartDomain(virDomainObjPtr vm, err ? err->message : ""); } else { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ab6004d..b6be9a8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -879,7 +879,7 @@ static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque) if (newVM) { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_ADDED); if (event) @@ -1627,7 +1627,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event && (flags & VIR_DOMAIN_START_PAUSED)) { @@ -1636,7 +1636,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, * no matter what, but don't care about suspend events), and * those that also care about running/paused. To satisfy both * client types, we have to send two events. */ - event2 = virDomainEventNewFromObj(vm, + event2 = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } @@ -1721,7 +1721,7 @@ static int qemuDomainSuspend(virDomainPtr dom) { } if (eventDetail >= 0) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, eventDetail); } @@ -1785,7 +1785,7 @@ static int qemuDomainResume(virDomainPtr dom) { "%s", _("resume operation failed")); goto endjob; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); } @@ -2124,7 +2124,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, } qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED, 0); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); virDomainAuditStop(vm, "destroyed"); @@ -3107,7 +3107,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, /* Shut it down */ qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED, 0); virDomainAuditStop(vm, "saved"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); if (!vm->persistent) { @@ -3125,7 +3125,7 @@ endjob: QEMU_ASYNC_JOB_SAVE); if (rc < 0) { VIR_WARN("Unable to resume guest CPUs after save failure"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); } @@ -3568,7 +3568,7 @@ endjob: if ((ret == 0) && (flags & VIR_DUMP_CRASH)) { qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, 0); virDomainAuditStop(vm, "crashed"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); } @@ -3588,7 +3588,7 @@ endjob: if (resume && qemuProcessStartCPUs(driver, vm, dom->conn, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_DUMP) < 0) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); if (virGetLastError() == NULL) @@ -3835,7 +3835,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICKED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_CRASHED, VIR_DOMAIN_EVENT_CRASHED_PANICKED); @@ -3875,7 +3875,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, } qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, 0); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); @@ -5394,7 +5394,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_RESTORED); virDomainAuditStart(vm, "restored", true); @@ -5419,7 +5419,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, } else { int detail = (start_paused ? VIR_DOMAIN_EVENT_SUSPENDED_PAUSED : VIR_DOMAIN_EVENT_SUSPENDED_RESTORED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, detail); if (event) @@ -6059,13 +6059,13 @@ qemuDomainObjStart(virConnectPtr conn, virDomainAuditStart(vm, "booted", ret >= 0); if (ret >= 0) { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event) { qemuDomainEventQueue(driver, event); if (start_paused) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); if (event) @@ -6197,7 +6197,7 @@ static virDomainPtr qemuDomainDefineXML(virConnectPtr conn, const char *xml) { goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, !oldDef ? VIR_DOMAIN_EVENT_DEFINED_ADDED : @@ -6285,7 +6285,7 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (virDomainDeleteConfig(cfg->configDir, cfg->autostartDir, vm) < 0) goto cleanup; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); @@ -11700,7 +11700,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, goto cleanup; if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); @@ -11716,7 +11716,7 @@ cleanup: qemuProcessStartCPUs(driver, vm, conn, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); if (virGetLastError() == NULL) { @@ -12251,7 +12251,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { virDomainEventPtr event; - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); @@ -12271,7 +12271,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); if (event) qemuDomainEventQueue(driver, event); @@ -12285,7 +12285,7 @@ endjob: VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_SNAPSHOT) < 0) { virDomainEventPtr event = NULL; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); if (event) @@ -13081,7 +13081,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); detail = VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, detail); if (event) @@ -13101,7 +13101,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, * that user will be alerted that they are now paused. * If restore later succeeds, we might replace this. */ detail = VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, detail); if (!virDomainObjIsActive(vm)) { @@ -13133,7 +13133,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_QEMU_PROCESS_START_PAUSED); virDomainAuditStart(vm, "from-snapshot", rc >= 0); detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, detail); if (rc < 0) @@ -13150,7 +13150,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (was_stopped) { /* Transition 3, use event as-is and add event2 */ detail = VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 = virDomainEventNewFromObj(vm, + event2 = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, detail); } /* else transition 6 and 9 use event as-is */ @@ -13171,13 +13171,13 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (was_stopped) { /* Transition 2 */ detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, detail); } else if (was_running) { /* Transition 8 */ detail = VIR_DOMAIN_EVENT_RESUMED; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, detail); } @@ -13194,7 +13194,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); detail = VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, detail); } @@ -13236,12 +13236,12 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, goto endjob; } detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, detail); if (paused) { detail = VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT; - event2 = virDomainEventNewFromObj(vm, + event2 = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, detail); } @@ -13901,7 +13901,7 @@ cleanup: VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) { virDomainEventPtr event = NULL; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); if (event) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ef6f1c5..221beea 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1513,7 +1513,7 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver, if (ret == 0) { virDomainEventPtr event; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED); if (event) @@ -2422,7 +2422,7 @@ done: if (!(flags & VIR_MIGRATE_OFFLINE)) { virDomainAuditStart(vm, "migrated", true); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_MIGRATED); } @@ -2736,7 +2736,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "migrated"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_MIGRATED); } else { @@ -2757,7 +2757,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, goto cleanup; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_MIGRATED); if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) { @@ -4100,7 +4100,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_MIGRATED, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "migrated"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_MIGRATED); } @@ -4123,7 +4123,7 @@ endjob: vm->def->name); } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_MIGRATED); } @@ -4205,7 +4205,7 @@ qemuMigrationPerformPhase(virQEMUDriverPtr driver, vm->def->name); } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_MIGRATED); } @@ -4418,7 +4418,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "failed"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FAILED); goto endjob; @@ -4469,7 +4469,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, goto endjob; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, newVM ? VIR_DOMAIN_EVENT_DEFINED_ADDED : @@ -4507,7 +4507,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "failed"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FAILED); } @@ -4518,7 +4518,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, dom = virGetDomain(dconn, vm->def->name, vm->def->uuid); if (!(flags & VIR_MIGRATE_OFFLINE)) { - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_MIGRATED); if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { @@ -4526,7 +4526,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, VIR_DOMAIN_PAUSED_USER); if (event) qemuDomainEventQueue(driver, event); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); } @@ -4544,7 +4544,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "failed"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FAILED); } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a26c079..7904ee5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -316,7 +316,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED, auditReason = "failed"; } - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, eventReason); qemuProcessStop(driver, vm, stopReason, 0); @@ -589,7 +589,7 @@ qemuProcessFakeReboot(void *opaque) goto endjob; } priv->gotShutdown = false; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); @@ -672,7 +672,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjSetState(vm, VIR_DOMAIN_SHUTDOWN, VIR_DOMAIN_SHUTDOWN_UNKNOWN); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SHUTDOWN, VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED); @@ -718,7 +718,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED, vm->def->name); virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_UNKNOWN); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); @@ -766,7 +766,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); @@ -857,7 +857,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DEBUG("Transitioned guest %s to paused state due to watchdog", vm->def->name); virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_WATCHDOG); - lifecycleEvent = virDomainEventNewFromObj(vm, + lifecycleEvent = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG); @@ -939,7 +939,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED, VIR_DEBUG("Transitioned guest %s to paused state due to IO error", vm->def->name); virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_IOERROR); - lifecycleEvent = virDomainEventNewFromObj(vm, + lifecycleEvent = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_IOERROR); @@ -1156,7 +1156,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_WAKEUP); - lifecycleEvent = virDomainEventNewFromObj(vm, + lifecycleEvent = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_WAKEUP); @@ -1196,7 +1196,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, VIR_DOMAIN_PMSUSPENDED_UNKNOWN); lifecycleEvent = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_PMSUSPENDED, VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY); @@ -1268,7 +1268,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED, VIR_DOMAIN_PMSUSPENDED_UNKNOWN); lifecycleEvent = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_PMSUSPENDED, VIR_DOMAIN_EVENT_PMSUSPENDED_DISK); @@ -4648,7 +4648,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(dom, "destroyed"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index e7c319e..9d1a7c5 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4386,7 +4386,7 @@ remoteDomainBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, if (!dom) return; - event = virDomainEventNewFromDom(dom, msg->event, msg->detail); + event = virDomainEventLifecycleNewFromDom(dom, msg->event, msg->detail); virDomainFree(dom); remoteDomainEventQueue(priv, event); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 04de78b..fdd1d3e 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1638,7 +1638,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_BOOTED) < 0) goto cleanup; - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); @@ -1766,7 +1766,7 @@ static int testDomainDestroy(virDomainPtr domain) } testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_DESTROYED); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); @@ -1811,7 +1811,7 @@ static int testDomainResume(virDomainPtr domain) virDomainObjSetState(privdom, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); ret = 0; @@ -1853,7 +1853,7 @@ static int testDomainSuspend(virDomainPtr domain) } virDomainObjSetState(privdom, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); ret = 0; @@ -1896,7 +1896,7 @@ static int testDomainShutdownFlags(virDomainPtr domain, } testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_SHUTDOWN); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); @@ -1971,7 +1971,7 @@ static int testDomainReboot(virDomainPtr domain, if (virDomainObjGetState(privdom, NULL) == VIR_DOMAIN_SHUTOFF) { testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_SHUTDOWN); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); @@ -2135,7 +2135,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path, fd = -1; testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_SAVED); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); @@ -2253,7 +2253,7 @@ testDomainRestoreFlags(virConnectPtr conn, if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_RESTORED) < 0) goto cleanup; - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_RESTORED); ret = 0; @@ -2319,7 +2319,7 @@ static int testDomainCoreDump(virDomainPtr domain, if (flags & VIR_DUMP_CRASH) { testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_CRASHED); - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); if (!privdom->persistent) { @@ -2803,7 +2803,7 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn, def = NULL; dom->persistent = 1; - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_DEFINED, !oldDef ? VIR_DOMAIN_EVENT_DEFINED_ADDED : @@ -2946,7 +2946,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) { goto cleanup; domain->id = privdom->def->id; - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); ret = 0; @@ -3011,7 +3011,7 @@ static int testDomainUndefineFlags(virDomainPtr domain, * behavior here. */ } - event = virDomainEventNewFromObj(privdom, + event = virDomainEventLifecycleNewFromObj(privdom, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); privdom->hasManagedSave = false; @@ -6180,7 +6180,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags) } testDomainShutdownState(dom, vm, VIR_DOMAIN_SHUTOFF_SAVED); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); vm->hasManagedSave = true; @@ -6719,7 +6719,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain, virDomainObjIsActive(vm)) { testDomainShutdownState(domain, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT); - event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); } } @@ -6985,7 +6985,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, virResetError(err); testDomainShutdownState(snapshot->domain, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); if (event) @@ -7001,7 +7001,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, /* Create an event now in case the restore fails, so * that user will be alerted that they are now paused. * If restore later succeeds, we might replace this. */ - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); } @@ -7015,7 +7015,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (testDomainStartState(privconn, vm, VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) < 0) goto cleanup; - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); } @@ -7029,7 +7029,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_PAUSED_FROM_SNAPSHOT); if (was_stopped) { /* Transition 3, use event as-is and add event2 */ - event2 = virDomainEventNewFromObj(vm, + event2 = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); } /* else transition 6 and 9 use event as-is */ @@ -7040,12 +7040,12 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (was_stopped) { /* Transition 2 */ - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); } else if (was_running) { /* Transition 8 */ - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED); } @@ -7058,7 +7058,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, /* Transitions 4, 7 */ testDomainShutdownState(snapshot->domain, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); } @@ -7070,11 +7070,11 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (event) testDomainEventQueue(privconn, event); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT); if (paused) { - event2 = virDomainEventNewFromObj(vm, + event2 = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT); } diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index e9bc6d4..4c5bac5 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -195,7 +195,7 @@ umlAutostartDomain(virDomainObjPtr vm, vm->def->name, err ? err->message : _("unknown error")); } else { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event) @@ -347,7 +347,7 @@ reread: umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN); virDomainAuditStop(dom, "shutdown"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); if (!dom->persistent) { @@ -381,7 +381,7 @@ reread: umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_FAILED); virDomainAuditStop(dom, "failed"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FAILED); if (!dom->persistent) { @@ -394,7 +394,7 @@ reread: umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_FAILED); virDomainAuditStop(dom, "failed"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FAILED); if (!dom->persistent) { @@ -605,7 +605,7 @@ static void umlNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque) if (newVM) { virDomainEventPtr event = - virDomainEventNewFromObj(vm, + virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_ADDED); if (event) @@ -737,7 +737,7 @@ static void umlProcessAutoDestroyDom(void *payload, VIR_DEBUG("Killing domain"); umlShutdownVMDaemon(data->driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED); virDomainAuditStop(dom, "destroyed"); - event = virDomainEventNewFromObj(dom, + event = virDomainEventLifecycleNewFromObj(dom, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); @@ -1600,7 +1600,7 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml, goto cleanup; } virDomainAuditStart(vm, "booted", true); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); @@ -1685,7 +1685,7 @@ umlDomainDestroyFlags(virDomainPtr dom, umlShutdownVMDaemon(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); virDomainAuditStop(vm, "destroyed"); - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); if (!vm->persistent) { @@ -2014,7 +2014,7 @@ static int umlDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { (flags & VIR_DOMAIN_START_AUTODESTROY)); virDomainAuditStart(vm, "booted", ret >= 0); if (ret == 0) - event = virDomainEventNewFromObj(vm, + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index cfb2ca0..6e930ee 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -6985,7 +6985,7 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, detail = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN; } - ev = virDomainEventNewFromDom(dom, event, detail); + ev = virDomainEventLifecycleNewFromDom(dom, event, detail); if (ev) virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); @@ -7089,7 +7089,7 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, detail = VIR_DOMAIN_EVENT_UNDEFINED_REMOVED; } - ev = virDomainEventNewFromDom(dom, event, detail); + ev = virDomainEventLifecycleNewFromDom(dom, event, detail); if (ev) virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c index 755be8f..defbe44 100644 --- a/src/xen/xen_inotify.c +++ b/src/xen/xen_inotify.c @@ -148,7 +148,7 @@ xenInotifyDomainEventFromFile(virConnectPtr conn, if (xenInotifyDomainLookup(conn, filename, &name, uuid) < 0) return NULL; - event = virDomainEventNew(-1, name, uuid, type, detail); + event = virDomainEventLifecycleNew(-1, name, uuid, type, detail); VIR_FREE(name); return event; } diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 9748a77..c12e123 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -849,9 +849,9 @@ retry: continue; } - event = virDomainEventNew(new_domids[i], name, uuid, - VIR_DOMAIN_EVENT_STARTED, - VIR_DOMAIN_EVENT_STARTED_BOOTED); + event = virDomainEventLifecycleNew(new_domids[i], name, uuid, + VIR_DOMAIN_EVENT_STARTED, + VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event) xenUnifiedDomainEventDispatch(priv, event); @@ -919,11 +919,11 @@ retry: if (!found) { virDomainEventPtr event = - virDomainEventNew(-1, - priv->activeDomainList->doms[j]->name, - priv->activeDomainList->doms[j]->uuid, - VIR_DOMAIN_EVENT_STOPPED, - VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); + virDomainEventLifecycleNew(-1, + priv->activeDomainList->doms[j]->name, + priv->activeDomainList->doms[j]->uuid, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); if (event) xenUnifiedDomainEventDispatch(priv, event); -- 1.8.4.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list