mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: handle missing switch enum cases
Ensure all enum cases are listed in switch statements. Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
9275def594
commit
05b39a6843
@ -586,6 +586,7 @@ virDomainAuditTPM(virDomainObjPtr vm, virDomainTPMDefPtr tpm,
|
||||
"virt=%s resrc=dev reason=%s %s uuid=%s %s",
|
||||
virt, reason, vmname, uuidstr, device);
|
||||
break;
|
||||
case VIR_DOMAIN_TPM_TYPE_LAST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -11567,8 +11567,20 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->filterparams = filterparams;
|
||||
filterparams = NULL;
|
||||
break;
|
||||
default:
|
||||
case VIR_DOMAIN_NET_TYPE_USER:
|
||||
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||
case VIR_DOMAIN_NET_TYPE_MCAST:
|
||||
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
|
||||
case VIR_DOMAIN_NET_TYPE_UDP:
|
||||
break;
|
||||
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainNetType, def->type);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14703,6 +14715,12 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
|
||||
/* QEMU use 64M as the minimal video memory for qxl device */
|
||||
return 64 * 1024;
|
||||
|
||||
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_GOP:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_LAST:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -14737,6 +14755,16 @@ virDomainVideoDefaultType(const virDomainDef *def)
|
||||
return VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
||||
case VIR_DOMAIN_VIRT_BHYVE:
|
||||
return VIR_DOMAIN_VIDEO_TYPE_GOP;
|
||||
case VIR_DOMAIN_VIRT_QEMU:
|
||||
case VIR_DOMAIN_VIRT_KQEMU:
|
||||
case VIR_DOMAIN_VIRT_KVM:
|
||||
case VIR_DOMAIN_VIRT_LXC:
|
||||
case VIR_DOMAIN_VIRT_UML:
|
||||
case VIR_DOMAIN_VIRT_OPENVZ:
|
||||
case VIR_DOMAIN_VIRT_HYPERV:
|
||||
case VIR_DOMAIN_VIRT_PHYP:
|
||||
case VIR_DOMAIN_VIRT_NONE:
|
||||
case VIR_DOMAIN_VIRT_LAST:
|
||||
default:
|
||||
return VIR_DOMAIN_VIDEO_TYPE_DEFAULT;
|
||||
}
|
||||
@ -27878,7 +27906,7 @@ virDomainObjGetState(virDomainObjPtr dom, int *reason)
|
||||
void
|
||||
virDomainObjSetState(virDomainObjPtr dom, virDomainState state, int reason)
|
||||
{
|
||||
int last = -1;
|
||||
int last;
|
||||
|
||||
switch (state) {
|
||||
case VIR_DOMAIN_NOSTATE:
|
||||
@ -27905,11 +27933,8 @@ virDomainObjSetState(virDomainObjPtr dom, virDomainState state, int reason)
|
||||
case VIR_DOMAIN_PMSUSPENDED:
|
||||
last = VIR_DOMAIN_PMSUSPENDED_LAST;
|
||||
break;
|
||||
case VIR_DOMAIN_LAST:
|
||||
default:
|
||||
last = -1;
|
||||
}
|
||||
|
||||
if (last < 0) {
|
||||
VIR_ERROR(_("invalid domain state: %d"), state);
|
||||
return;
|
||||
}
|
||||
@ -28073,6 +28098,15 @@ virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface)
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
case VIR_DOMAIN_NET_TYPE_USER:
|
||||
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||
case VIR_DOMAIN_NET_TYPE_MCAST:
|
||||
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||
case VIR_DOMAIN_NET_TYPE_UDP:
|
||||
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2153,8 +2153,34 @@ virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_NONE:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_MAC:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_VLAN:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_STP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ARP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_RARP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_TCP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ICMP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_IGMP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_UDP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_UDPLITE:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ESP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_AH:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_SCTP:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ALL:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_UDPLITEoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6:
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6:
|
||||
break;
|
||||
case VIR_NWFILTER_RULE_PROTOCOL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virNWFilterRuleProtocolType, rule->prtclType);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3064,7 +3090,10 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "false");
|
||||
break;
|
||||
|
||||
case DATATYPE_IPSETNAME:
|
||||
case DATATYPE_IPSETFLAGS:
|
||||
case DATATYPE_STRING:
|
||||
case DATATYPE_LAST:
|
||||
default:
|
||||
virBufferAsprintf(buf,
|
||||
"UNSUPPORTED DATATYPE 0x%02x\n",
|
||||
|
Loading…
Reference in New Issue
Block a user