提交 6efa07e7 编写于 作者: F Fabiano Fidêncio 提交者: John Ferlan

xen_common: Change xenParseCharDev to use virConfGetValueStringList

Signed-off-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 1bb379ad
...@@ -768,11 +768,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def) ...@@ -768,11 +768,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
static int static int
xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat) xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
{ {
virConfValuePtr value = NULL; VIR_AUTOPTR(virString) serials = NULL;
virDomainChrDefPtr chr = NULL; virDomainChrDefPtr chr = NULL;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) { if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
VIR_AUTOFREE(char *) parallel = NULL; VIR_AUTOFREE(char *) parallel = NULL;
int rc;
if (xenConfigGetString(conf, "parallel", &parallel, NULL) < 0) if (xenConfigGetString(conf, "parallel", &parallel, NULL) < 0)
goto cleanup; goto cleanup;
if (parallel && STRNEQ(parallel, "none") && if (parallel && STRNEQ(parallel, "none") &&
...@@ -790,8 +792,8 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat) ...@@ -790,8 +792,8 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
} }
/* Try to get the list of values to support multiple serial ports */ /* Try to get the list of values to support multiple serial ports */
value = virConfGetValue(conf, "serial"); if ((rc = virConfGetValueStringList(conf, "serial", false, &serials)) == 1) {
if (value && value->type == VIR_CONF_LIST) { virString *entries;
int portnum = -1; int portnum = -1;
if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) { if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
...@@ -800,18 +802,12 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat) ...@@ -800,18 +802,12 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
goto cleanup; goto cleanup;
} }
value = value->list; for (entries = serials; *entries; entries++) {
while (value) { virString port = *entries;
char *port = NULL;
if ((value->type != VIR_CONF_STRING) || (value->str == NULL))
goto cleanup;
port = value->str;
portnum++; portnum++;
if (STREQ(port, "none")) { if (STREQ(port, "none"))
value = value->next;
continue; continue;
}
if (!(chr = xenParseSxprChar(port, NULL))) if (!(chr = xenParseSxprChar(port, NULL)))
goto cleanup; goto cleanup;
...@@ -819,11 +815,13 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat) ...@@ -819,11 +815,13 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
chr->target.port = portnum; chr->target.port = portnum;
if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0) if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0)
goto cleanup; goto cleanup;
value = value->next;
} }
} else { } else {
VIR_AUTOFREE(char *) serial = NULL; VIR_AUTOFREE(char *) serial = NULL;
if (xenHandleConfGetValueStringListErrors(rc) < 0)
goto cleanup;
/* If domain is not using multiple serial ports we parse data old way */ /* If domain is not using multiple serial ports we parse data old way */
if (xenConfigGetString(conf, "serial", &serial, NULL) < 0) if (xenConfigGetString(conf, "serial", &serial, NULL) < 0)
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册