mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
virDomainGraphicsListenDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b45ba35e35
commit
0b20fd3754
@ -12533,12 +12533,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
|
||||
{
|
||||
int ret = -1;
|
||||
const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
|
||||
int tmp, typeVal;
|
||||
g_autofree char *type = virXMLPropString(node, "type");
|
||||
g_autofree char *address = virXMLPropString(node, "address");
|
||||
g_autofree char *network = virXMLPropString(node, "network");
|
||||
g_autofree char *socketPath = virXMLPropString(node, "socket");
|
||||
g_autofree char *fromConfig = virXMLPropString(node, "fromConfig");
|
||||
g_autofree char *autoGenerated = virXMLPropString(node, "autoGenerated");
|
||||
g_autofree char *addressCompat = NULL;
|
||||
g_autofree char *socketCompat = NULL;
|
||||
@ -12548,18 +12545,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
|
||||
socketCompat = virXMLPropString(parent, "socket");
|
||||
}
|
||||
|
||||
if (!type) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("graphics listen type must be specified"));
|
||||
if (virXMLPropEnum(node, "type", virDomainGraphicsListenTypeFromString,
|
||||
VIR_XML_PROP_REQUIRED, &def->type) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((typeVal = virDomainGraphicsListenTypeFromString(type)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown graphics listen type '%s'"), type);
|
||||
goto error;
|
||||
}
|
||||
def->type = typeVal;
|
||||
|
||||
switch (def->type) {
|
||||
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
|
||||
@ -12639,14 +12627,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
|
||||
def->socket = g_steal_pointer(&socketPath);
|
||||
}
|
||||
|
||||
if (fromConfig &&
|
||||
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
|
||||
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid fromConfig value: %s"),
|
||||
fromConfig);
|
||||
goto error;
|
||||
}
|
||||
if (flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
|
||||
int tmp;
|
||||
if (virXMLPropInt(node, "fromConfig", 10, VIR_XML_PROP_NONE, &tmp) < 0)
|
||||
return -1;
|
||||
def->fromConfig = tmp != 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user