mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
conf: Convert 'protocol' field of TCP char device backend to proper type
Use virDomainChrTcpProtocol as type, convert the parser to use virXMLPropEnum and fix one switch statement in the VMX driver. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2256466f70
commit
3778964207
@ -10282,18 +10282,13 @@ static int
|
|||||||
virDomainChrSourceDefParseProtocol(virDomainChrSourceDef *def,
|
virDomainChrSourceDefParseProtocol(virDomainChrSourceDef *def,
|
||||||
xmlNodePtr protocol)
|
xmlNodePtr protocol)
|
||||||
{
|
{
|
||||||
g_autofree char *prot = NULL;
|
|
||||||
|
|
||||||
if (def->type != VIR_DOMAIN_CHR_TYPE_TCP)
|
if (def->type != VIR_DOMAIN_CHR_TYPE_TCP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((prot = virXMLPropString(protocol, "type")) &&
|
if (virXMLPropEnum(protocol, "type",
|
||||||
(def->data.tcp.protocol =
|
virDomainChrTcpProtocolTypeFromString,
|
||||||
virDomainChrTcpProtocolTypeFromString(prot)) < 0) {
|
VIR_XML_PROP_NONE, &def->data.tcp.protocol) < 0)
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("Unknown protocol '%1$s'"), prot);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1339,7 +1339,7 @@ struct _virDomainChrSourceDef {
|
|||||||
char *host;
|
char *host;
|
||||||
char *service;
|
char *service;
|
||||||
bool listen;
|
bool listen;
|
||||||
int protocol;
|
virDomainChrTcpProtocol protocol;
|
||||||
bool tlscreds;
|
bool tlscreds;
|
||||||
virTristateBool haveTLS;
|
virTristateBool haveTLS;
|
||||||
bool tlsFromConfig;
|
bool tlsFromConfig;
|
||||||
|
@ -4203,10 +4203,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDef *def,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
case VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST:
|
||||||
_("Unsupported character device TCP protocol '%1$s'"),
|
virReportEnumRangeError(virDomainChrTcpProtocol,
|
||||||
virDomainChrTcpProtocolTypeToString(
|
def->source->data.tcp.protocol);
|
||||||
def->source->data.tcp.protocol));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user