diff options
author | 2011-12-05 13:59:13 +0100 | |
---|---|---|
committer | 2011-12-05 17:35:29 +0100 | |
commit | 9bfa132c7078f8574765534a45af18e11212deed (patch) | |
tree | a0711b4d0f5b6781d159dcdec310a1238726e170 /examples | |
parent | Fix incorrect symbols for virtime.h module breaking Mingw32 (diff) | |
download | libvirt-9bfa132c7078f8574765534a45af18e11212deed.tar.gz libvirt-9bfa132c7078f8574765534a45af18e11212deed.tar.bz2 libvirt-9bfa132c7078f8574765534a45af18e11212deed.zip |
examples: Update event tests for shutdown event
Diffstat (limited to 'examples')
-rw-r--r-- | examples/domain-events/events-c/event-test.c | 22 | ||||
-rw-r--r-- | examples/domain-events/events-python/event-test.py | 6 |
2 files changed, 20 insertions, 8 deletions
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 648e6eaef..f4938c438 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -40,7 +40,7 @@ void usage(const char *pname); const char *eventToString(int event) { const char *ret = ""; - switch(event) { + switch ((virDomainEventType) event) { case VIR_DOMAIN_EVENT_DEFINED: ret ="Defined"; break; @@ -59,13 +59,16 @@ const char *eventToString(int event) { case VIR_DOMAIN_EVENT_STOPPED: ret ="Stopped"; break; + case VIR_DOMAIN_EVENT_SHUTDOWN: + ret = "Shutdown"; + break; } return ret; } static const char *eventDetailToString(int event, int detail) { const char *ret = ""; - switch(event) { + switch ((virDomainEventType) event) { case VIR_DOMAIN_EVENT_DEFINED: if (detail == VIR_DOMAIN_EVENT_DEFINED_ADDED) ret = "Added"; @@ -77,7 +80,7 @@ static const char *eventDetailToString(int event, int detail) { ret = "Removed"; break; case VIR_DOMAIN_EVENT_STARTED: - switch (detail) { + switch ((virDomainEventStartedDetailType) detail) { case VIR_DOMAIN_EVENT_STARTED_BOOTED: ret = "Booted"; break; @@ -93,7 +96,7 @@ static const char *eventDetailToString(int event, int detail) { } break; case VIR_DOMAIN_EVENT_SUSPENDED: - switch (detail) { + switch ((virDomainEventSuspendedDetailType) detail) { case VIR_DOMAIN_EVENT_SUSPENDED_PAUSED: ret = "Paused"; break; @@ -115,7 +118,7 @@ static const char *eventDetailToString(int event, int detail) { } break; case VIR_DOMAIN_EVENT_RESUMED: - switch (detail) { + switch ((virDomainEventResumedDetailType) detail) { case VIR_DOMAIN_EVENT_RESUMED_UNPAUSED: ret = "Unpaused"; break; @@ -128,7 +131,7 @@ static const char *eventDetailToString(int event, int detail) { } break; case VIR_DOMAIN_EVENT_STOPPED: - switch (detail) { + switch ((virDomainEventStoppedDetailType) detail) { case VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN: ret = "Shutdown"; break; @@ -152,6 +155,13 @@ static const char *eventDetailToString(int event, int detail) { break; } break; + case VIR_DOMAIN_EVENT_SHUTDOWN: + switch ((virDomainEventShutdownDetailType) detail) { + case VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED: + ret = "Finished"; + break; + } + break; } return ret; } diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py index 60a9c34b5..0c750914e 100644 --- a/examples/domain-events/events-python/event-test.py +++ b/examples/domain-events/events-python/event-test.py @@ -430,7 +430,8 @@ def eventToString(event): "Started", "Suspended", "Resumed", - "Stopped" ); + "Stopped", + "Shutdown" ); return eventStrings[event]; def detailToString(event, detail): @@ -440,7 +441,8 @@ def detailToString(event, detail): ( "Booted", "Migrated", "Restored", "Snapshot" ), ( "Paused", "Migrated", "IOError", "Watchdog" ), ( "Unpaused", "Migrated"), - ( "Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", "Failed", "Snapshot") + ( "Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", "Failed", "Snapshot"), + ( "Finished" ) ) return eventStrings[event][detail] |