@@ -452,7 +452,12 @@ VIR_ENUM_IMPL(virDomainNetModel, VIR_DOMAIN_NET_MODEL_LAST,
"vlance",
"vmxnet",
"vmxnet2",
- "vmxnet3")
+ "vmxnet3",
+ "Am79C970A",
+ "Am79C973",
+ "82540EM",
+ "82545EM",
+ "82543GC")
VIR_ENUM_IMPL(virDomainNetBackend, VIR_DOMAIN_NET_BACKEND_TYPE_LAST,
"default",
@@ -29884,16 +29889,6 @@ virDomainNetSetModelString(virDomainNetDefPtr iface,
return 0;
}
-int
-virDomainNetStrcaseeqModelString(const virDomainNetDef *iface,
- const char *model)
-{
- if (iface->model)
- return STRCASEEQ(virDomainNetModelTypeToString(iface->model),
- model);
- return iface->modelstr && STRCASEEQ(iface->modelstr, model);
-}
-
bool
virDomainNetHasVirtioModel(const virDomainNetDef *iface)
{
@@ -978,6 +978,11 @@ typedef enum {
VIR_DOMAIN_NET_MODEL_VMXNET,
VIR_DOMAIN_NET_MODEL_VMXNET2,
VIR_DOMAIN_NET_MODEL_VMXNET3,
+ VIR_DOMAIN_NET_MODEL_AM79C970A,
+ VIR_DOMAIN_NET_MODEL_AM79C973,
+ VIR_DOMAIN_NET_MODEL_82540EM,
+ VIR_DOMAIN_NET_MODEL_82545EM,
+ VIR_DOMAIN_NET_MODEL_82543GC,
VIR_DOMAIN_NET_MODEL_LAST
} virDomainNetModelType;
@@ -3297,8 +3302,6 @@ bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
const char *virDomainNetGetModelString(const virDomainNetDef *iface);
int virDomainNetSetModelString(virDomainNetDefPtr iface,
const char *model);
-int virDomainNetStrcaseeqModelString(const virDomainNetDef *iface,
- const char *model);
bool virDomainNetHasVirtioModel(const virDomainNetDef *iface);
int virDomainNetAppendIPAddress(virDomainNetDefPtr def,
const char *address,
@@ -484,7 +484,6 @@ virDomainNetRemoveHostdev;
virDomainNetResolveActualType;
virDomainNetSetDeviceImpl;
virDomainNetSetModelString;
-virDomainNetStrcaseeqModelString;
virDomainNetTypeFromString;
virDomainNetTypeSharesHostView;
virDomainNetTypeToString;
@@ -1309,7 +1309,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
macaddrvbox[VIR_MAC_STRING_BUFLEN - 6] = '\0';
VIR_DEBUG("NIC(%zu): Type: %d", i, def->nets[i]->type);
- VIR_DEBUG("NIC(%zu): Model: %s", i, virDomainNetGetModelString(def->nets[i]));
+ VIR_DEBUG("NIC(%zu): Model: %s", i, virDomainNetModelTypeToString(def->nets[i]->model));
VIR_DEBUG("NIC(%zu): Mac: %s", i, macaddr);
VIR_DEBUG("NIC(%zu): ifname: %s", i, def->nets[i]->ifname);
if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
@@ -1338,19 +1338,19 @@ vboxAttachNetwork(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
gVBoxAPI.UINetworkAdapter.SetEnabled(adapter, 1);
- if (virDomainNetGetModelString(def->nets[i])) {
- if (virDomainNetStrcaseeqModelString(def->nets[i], "Am79C970A")) {
+ if (def->nets[i]->model) {
+ if (def->nets[i]->model == VIR_DOMAIN_NET_MODEL_AM79C970A) {
adapterType = NetworkAdapterType_Am79C970A;
- } else if (virDomainNetStrcaseeqModelString(def->nets[i], "Am79C973")) {
+ } else if (def->nets[i]->model == VIR_DOMAIN_NET_MODEL_AM79C973) {
adapterType = NetworkAdapterType_Am79C973;
- } else if (virDomainNetStrcaseeqModelString(def->nets[i], "82540EM")) {
+ } else if (def->nets[i]->model == VIR_DOMAIN_NET_MODEL_82540EM) {
adapterType = NetworkAdapterType_I82540EM;
- } else if (virDomainNetStrcaseeqModelString(def->nets[i], "82545EM")) {
+ } else if (def->nets[i]->model == VIR_DOMAIN_NET_MODEL_82545EM) {
adapterType = NetworkAdapterType_I82545EM;
- } else if (virDomainNetStrcaseeqModelString(def->nets[i], "82543GC")) {
+ } else if (def->nets[i]->model == VIR_DOMAIN_NET_MODEL_82543GC) {
adapterType = NetworkAdapterType_I82543GC;
} else if (gVBoxAPI.APIVersion >= 3000051 &&
- virDomainNetStrcaseeqModelString(def->nets[i], "virtio")) {
+ def->nets[i]->model == VIR_DOMAIN_NET_MODEL_VIRTIO) {
/* Only vbox 3.1 and later support NetworkAdapterType_Virto */
adapterType = NetworkAdapterType_Virtio;
}
@@ -3687,7 +3687,6 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
{
PRUint32 attachmentType = NetworkAttachmentType_Null;
PRUint32 adapterType = NetworkAdapterType_Null;
- const char *model = NULL;
PRUnichar *utf16 = NULL;
char *utf8 = NULL;
virDomainNetDefPtr net = NULL;
@@ -3742,28 +3741,26 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter)
gVBoxAPI.UINetworkAdapter.GetAdapterType(adapter, &adapterType);
switch (adapterType) {
case NetworkAdapterType_Am79C970A:
- model = "Am79C970A";
+ net->model = VIR_DOMAIN_NET_MODEL_AM79C970A;
break;
case NetworkAdapterType_Am79C973:
- model = "Am79C973";
+ net->model = VIR_DOMAIN_NET_MODEL_AM79C973;
break;
case NetworkAdapterType_I82540EM:
- model = "82540EM";
+ net->model = VIR_DOMAIN_NET_MODEL_82540EM;
break;
case NetworkAdapterType_I82545EM:
- model = "82545EM";
+ net->model = VIR_DOMAIN_NET_MODEL_82545EM;
break;
case NetworkAdapterType_I82543GC:
- model = "82543GC";
+ net->model = VIR_DOMAIN_NET_MODEL_82543GC;
break;
case NetworkAdapterType_Virtio:
/* Only vbox 3.1 and later support NetworkAdapterType_Virto */
if (gVBoxAPI.APIVersion >= 3000051)
- model = "virtio";
+ net->model = VIR_DOMAIN_NET_MODEL_VIRTIO;
break;
}
- if (virDomainNetSetModelString(net, model) < 0)
- goto error;
gVBoxAPI.UINetworkAdapter.GetMACAddress(adapter, &utf16);
VBOX_UTF16_TO_UTF8(utf16, &utf8);
Convert the vbox driver to net model enum, which requires adding enum values for Am79C970A, Am79C973, 82540EM, 82545EM, 82543GC Similar to the vmx driver, case insensitive handling of the model passed in via the XML is lost. I don't know if we care Remove the now unused virDomainNetStrcaseeqModelString Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/conf/domain_conf.c | 17 ++++++----------- src/conf/domain_conf.h | 7 +++++-- src/libvirt_private.syms | 1 - src/vbox/vbox_common.c | 31 ++++++++++++++----------------- 4 files changed, 25 insertions(+), 31 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list