mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 21:45:21 +00:00
virDomainNetGetActualType: Return type is virDomainNetType
This function for some weird reason returns integer instead of virDomainNetType type. It is important to return the correct type so that we know what values we can expect. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
94a10de26b
commit
507032d98d
@ -52,7 +52,7 @@ bhyveBuildNetArgStr(const virDomainDef *def,
|
||||
char macaddr[VIR_MAC_STRING_BUFLEN];
|
||||
char *realifname = NULL;
|
||||
char *brname = NULL;
|
||||
int actualType = virDomainNetGetActualType(net);
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||
if (VIR_STRDUP(brname, virDomainNetGetActualBridgeName(net)) < 0)
|
||||
|
@ -77,7 +77,7 @@ bhyveNetCleanup(virDomainObjPtr vm)
|
||||
|
||||
for (i = 0; i < vm->def->nnets; i++) {
|
||||
virDomainNetDefPtr net = vm->def->nets[i];
|
||||
int actualType = virDomainNetGetActualType(net);
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||
if (net->ifname) {
|
||||
|
@ -20840,7 +20840,7 @@ virDomainActualNetDefContentsFormat(virBufferPtr buf,
|
||||
bool inSubelement,
|
||||
unsigned int flags)
|
||||
{
|
||||
int actualType = virDomainNetGetActualType(def);
|
||||
virDomainNetType actualType = virDomainNetGetActualType(def);
|
||||
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
||||
if (virDomainHostdevDefFormatSubsys(buf, virDomainNetGetActualHostdev(def),
|
||||
@ -20920,7 +20920,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
|
||||
virDomainNetDefPtr def,
|
||||
unsigned int flags)
|
||||
{
|
||||
unsigned int type;
|
||||
virDomainNetType type;
|
||||
const char *typeStr;
|
||||
|
||||
if (!def)
|
||||
@ -21075,7 +21075,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
||||
char *prefix,
|
||||
unsigned int flags)
|
||||
{
|
||||
unsigned int actualType = virDomainNetGetActualType(def);
|
||||
virDomainNetType actualType = virDomainNetGetActualType(def);
|
||||
bool publicActual = false;
|
||||
int sourceLines = 0;
|
||||
const char *typeStr;
|
||||
@ -24817,7 +24817,7 @@ virDomainStateReasonFromString(virDomainState state, const char *reason)
|
||||
* otherwise return the value from the NetDef.
|
||||
*/
|
||||
|
||||
int
|
||||
virDomainNetType
|
||||
virDomainNetGetActualType(virDomainNetDefPtr iface)
|
||||
{
|
||||
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
|
||||
|
@ -2816,7 +2816,7 @@ int virDomainGraphicsListenAppendSocket(virDomainGraphicsDefPtr def,
|
||||
const char *socket)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virDomainNetGetActualType(virDomainNetDefPtr iface);
|
||||
virDomainNetType virDomainNetGetActualType(virDomainNetDefPtr iface);
|
||||
const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
|
||||
int virDomainNetGetActualBridgeMACTableManager(virDomainNetDefPtr iface);
|
||||
const char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
|
||||
|
@ -937,7 +937,7 @@ libxlNetworkPrepareDevices(virDomainDefPtr def)
|
||||
|
||||
for (i = 0; i < def->nnets; i++) {
|
||||
virDomainNetDefPtr net = def->nets[i];
|
||||
int actualType;
|
||||
virDomainNetType actualType;
|
||||
|
||||
/* If appropriate, grab a physical device from the configured
|
||||
* network's pool of devices, or resolve bridge device name
|
||||
|
@ -3328,7 +3328,7 @@ libxlDomainAttachNetDevice(libxlDriverPrivatePtr driver,
|
||||
virDomainNetDefPtr net)
|
||||
{
|
||||
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
|
||||
int actualType;
|
||||
virDomainNetType actualType;
|
||||
libxl_device_nic nic;
|
||||
int ret = -1;
|
||||
char mac[VIR_MAC_STRING_BUFLEN];
|
||||
|
@ -3943,7 +3943,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
|
||||
{
|
||||
virLXCDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = -1;
|
||||
int actualType;
|
||||
virDomainNetType actualType;
|
||||
virNetDevBandwidthPtr actualBandwidth;
|
||||
char *veth = NULL;
|
||||
|
||||
@ -4030,6 +4030,10 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
|
||||
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||
ignore_value(virNetDevMacVLanDelete(veth));
|
||||
break;
|
||||
|
||||
default:
|
||||
/* no-op */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4430,7 +4434,8 @@ static int
|
||||
lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
|
||||
virDomainDeviceDefPtr dev)
|
||||
{
|
||||
int detachidx, actualType, ret = -1;
|
||||
int detachidx, ret = -1;
|
||||
virDomainNetType actualType;
|
||||
virDomainNetDefPtr detach = NULL;
|
||||
virNetDevVPortProfilePtr vport = NULL;
|
||||
|
||||
|
@ -7869,7 +7869,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
size_t vhostfdSize = 0;
|
||||
char **tapfdName = NULL;
|
||||
char **vhostfdName = NULL;
|
||||
int actualType = virDomainNetGetActualType(net);
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
virNetDevBandwidthPtr actualBandwidth;
|
||||
size_t i;
|
||||
|
@ -927,7 +927,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
||||
int vlan;
|
||||
bool releaseaddr = false;
|
||||
bool iface_connected = false;
|
||||
int actualType;
|
||||
virDomainNetType actualType;
|
||||
virNetDevBandwidthPtr actualBandwidth;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
virDomainCCWAddressSetPtr ccwaddrs = NULL;
|
||||
@ -2373,7 +2373,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
||||
virDomainNetDefPtr newdev = dev->data.net;
|
||||
virDomainNetDefPtr *devslot = NULL;
|
||||
virDomainNetDefPtr olddev;
|
||||
int oldType, newType;
|
||||
virDomainNetType oldType, newType;
|
||||
bool needReconnect = false;
|
||||
bool needBridgeChange = false;
|
||||
bool needFilterChange = false;
|
||||
|
@ -4676,7 +4676,7 @@ qemuProcessNetworkPrepareDevices(virDomainDefPtr def)
|
||||
|
||||
for (i = 0; i < def->nnets; i++) {
|
||||
virDomainNetDefPtr net = def->nets[i];
|
||||
int actualType;
|
||||
virDomainNetType actualType;
|
||||
|
||||
/* If appropriate, grab a physical device from the configured
|
||||
* network's pool of devices, or resolve bridge device name
|
||||
@ -6086,6 +6086,17 @@ void qemuProcessStop(virQEMUDriverPtr driver,
|
||||
ignore_value(virNetDevTapDelete(net->ifname, net->backend.tap));
|
||||
#endif
|
||||
break;
|
||||
case VIR_DOMAIN_NET_TYPE_USER:
|
||||
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||
case VIR_DOMAIN_NET_TYPE_MCAST:
|
||||
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
|
||||
case VIR_DOMAIN_NET_TYPE_UDP:
|
||||
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||
/* No special cleanup procedure for these types. */
|
||||
break;
|
||||
}
|
||||
/* release the physical device (or any other resources used by
|
||||
* this interface in the network driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user