mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +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;
|
int ret = -1;
|
||||||
const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
|
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 *address = virXMLPropString(node, "address");
|
||||||
g_autofree char *network = virXMLPropString(node, "network");
|
g_autofree char *network = virXMLPropString(node, "network");
|
||||||
g_autofree char *socketPath = virXMLPropString(node, "socket");
|
g_autofree char *socketPath = virXMLPropString(node, "socket");
|
||||||
g_autofree char *fromConfig = virXMLPropString(node, "fromConfig");
|
|
||||||
g_autofree char *autoGenerated = virXMLPropString(node, "autoGenerated");
|
g_autofree char *autoGenerated = virXMLPropString(node, "autoGenerated");
|
||||||
g_autofree char *addressCompat = NULL;
|
g_autofree char *addressCompat = NULL;
|
||||||
g_autofree char *socketCompat = NULL;
|
g_autofree char *socketCompat = NULL;
|
||||||
@ -12548,18 +12545,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
|
|||||||
socketCompat = virXMLPropString(parent, "socket");
|
socketCompat = virXMLPropString(parent, "socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!type) {
|
if (virXMLPropEnum(node, "type", virDomainGraphicsListenTypeFromString,
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
VIR_XML_PROP_REQUIRED, &def->type) < 0)
|
||||||
_("graphics listen type must be specified"));
|
|
||||||
goto error;
|
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) {
|
switch (def->type) {
|
||||||
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
|
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
|
||||||
@ -12639,14 +12627,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
|
|||||||
def->socket = g_steal_pointer(&socketPath);
|
def->socket = g_steal_pointer(&socketPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromConfig &&
|
if (flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
|
||||||
flags & VIR_DOMAIN_DEF_PARSE_STATUS) {
|
int tmp;
|
||||||
if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) {
|
if (virXMLPropInt(node, "fromConfig", 10, VIR_XML_PROP_NONE, &tmp) < 0)
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
return -1;
|
||||||
_("Invalid fromConfig value: %s"),
|
|
||||||
fromConfig);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
def->fromConfig = tmp != 0;
|
def->fromConfig = tmp != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user