mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
event-test: Use switch instead of if/else if chains for lifecycle event translation
This commit is contained in:
parent
f3f01f771b
commit
5ffc742c17
@ -91,21 +91,31 @@ eventDetailToString(int event,
|
|||||||
const char *ret = "";
|
const char *ret = "";
|
||||||
switch ((virDomainEventType) event) {
|
switch ((virDomainEventType) event) {
|
||||||
case VIR_DOMAIN_EVENT_DEFINED:
|
case VIR_DOMAIN_EVENT_DEFINED:
|
||||||
if (detail == VIR_DOMAIN_EVENT_DEFINED_ADDED)
|
switch ((virDomainEventDefinedDetailType) detail) {
|
||||||
|
case VIR_DOMAIN_EVENT_DEFINED_ADDED:
|
||||||
ret = "Added";
|
ret = "Added";
|
||||||
else if (detail == VIR_DOMAIN_EVENT_DEFINED_UPDATED)
|
break;
|
||||||
|
case VIR_DOMAIN_EVENT_DEFINED_UPDATED:
|
||||||
ret = "Updated";
|
ret = "Updated";
|
||||||
else if (detail == VIR_DOMAIN_EVENT_DEFINED_RENAMED)
|
break;
|
||||||
|
case VIR_DOMAIN_EVENT_DEFINED_RENAMED:
|
||||||
ret = "Renamed";
|
ret = "Renamed";
|
||||||
else if (detail == VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT)
|
break;
|
||||||
|
case VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT:
|
||||||
ret = "Snapshot";
|
ret = "Snapshot";
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case VIR_DOMAIN_EVENT_UNDEFINED:
|
case VIR_DOMAIN_EVENT_UNDEFINED:
|
||||||
if (detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
|
switch ((virDomainEventUndefinedDetailType) detail) {
|
||||||
|
case VIR_DOMAIN_EVENT_UNDEFINED_REMOVED:
|
||||||
ret = "Removed";
|
ret = "Removed";
|
||||||
else if (detail == VIR_DOMAIN_EVENT_UNDEFINED_RENAMED)
|
break;
|
||||||
|
case VIR_DOMAIN_EVENT_UNDEFINED_RENAMED:
|
||||||
ret = "Renamed";
|
ret = "Renamed";
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case VIR_DOMAIN_EVENT_STARTED:
|
case VIR_DOMAIN_EVENT_STARTED:
|
||||||
switch ((virDomainEventStartedDetailType) detail) {
|
switch ((virDomainEventStartedDetailType) detail) {
|
||||||
case VIR_DOMAIN_EVENT_STARTED_BOOTED:
|
case VIR_DOMAIN_EVENT_STARTED_BOOTED:
|
||||||
|
Loading…
Reference in New Issue
Block a user