提交 cf09ef6c 编写于 作者: C Cole Robinson

conf: Set net->model earlier

So later code can more easily access def->model
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 6bf28f38
...@@ -11308,6 +11308,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -11308,6 +11308,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
/* NIC model (see -net nic,model=?). We only check that it looks
* reasonable, not that it is a supported NIC type. FWIW kvm
* supports these types as of April 2008:
* i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
* QEMU PPC64 supports spapr-vlan
*/
if (model != NULL) {
if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Model name contains invalid characters"));
goto error;
}
def->model = model;
model = NULL;
}
switch (def->type) { switch (def->type) {
case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_NETWORK:
if (network == NULL) { if (network == NULL) {
...@@ -11325,7 +11341,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -11325,7 +11341,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
break; break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
if (STRNEQ_NULLABLE(model, "virtio")) { if (STRNEQ_NULLABLE(def->model, "virtio")) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no <model> 'type' attribute " _("Wrong or no <model> 'type' attribute "
"specified with <interface type='vhostuser'/>. " "specified with <interface type='vhostuser'/>. "
...@@ -11553,22 +11569,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -11553,22 +11569,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
ifname_guest_actual = NULL; ifname_guest_actual = NULL;
} }
/* NIC model (see -net nic,model=?). We only check that it looks
* reasonable, not that it is a supported NIC type. FWIW kvm
* supports these types as of April 2008:
* i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
* QEMU PPC64 supports spapr-vlan
*/
if (model != NULL) {
if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Model name contains invalid characters"));
goto error;
}
def->model = model;
model = NULL;
}
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
STREQ_NULLABLE(def->model, "virtio")) { STREQ_NULLABLE(def->model, "virtio")) {
if (backend != NULL) { if (backend != NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册