The shared network driver is stateful and inside the daemon so there is no need to use the networkPrivateData field to get the driver handle. Just access the global driver handle directly. Many places already directly accessed the global driver handle in any case, so the code could never work without relying on this. --- src/network/bridge_driver.c | 435 ++++++++++++++++++++------------------------ 1 file changed, 196 insertions(+), 239 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5f2e778..4c9b098 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -86,37 +86,34 @@ VIR_LOG_INIT("network.bridge_driver"); -static void networkDriverLock(virNetworkDriverStatePtr driver) +static virNetworkDriverStatePtr driver = NULL; + + +static void networkDriverLock(void) { virMutexLock(&driver->lock); } -static void networkDriverUnlock(virNetworkDriverStatePtr driver) +static void networkDriverUnlock(void) { virMutexUnlock(&driver->lock); } static int networkStateCleanup(void); -static int networkStartNetwork(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkStartNetwork(virNetworkObjPtr network); -static int networkShutdownNetwork(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkShutdownNetwork(virNetworkObjPtr network); -static int networkStartNetworkVirtual(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkStartNetworkVirtual(virNetworkObjPtr network); -static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkShutdownNetworkVirtual(virNetworkObjPtr network); -static int networkStartNetworkExternal(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkStartNetworkExternal(virNetworkObjPtr network); -static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver, - virNetworkObjPtr network); +static int networkShutdownNetworkExternal(virNetworkObjPtr network); -static void networkReloadFirewallRules(virNetworkDriverStatePtr driver); -static void networkRefreshDaemons(virNetworkDriverStatePtr driver); +static void networkReloadFirewallRules(void); +static void networkRefreshDaemons(void); static int networkPlugBandwidth(virNetworkObjPtr net, virDomainNetDefPtr iface); @@ -126,18 +123,16 @@ static int networkUnplugBandwidth(virNetworkObjPtr net, static void networkNetworkObjTaint(virNetworkObjPtr net, virNetworkTaintFlags taint); -static virNetworkDriverStatePtr driverState = NULL; static virNetworkObjPtr networkObjFromNetwork(virNetworkPtr net) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network; char uuidstr[VIR_UUID_STRING_BUFLEN]; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virUUIDFormat(net->uuid, uuidstr); @@ -211,7 +206,7 @@ networkDnsmasqLeaseFileNameDefault(const char *netname) char *leasefile; ignore_value(virAsprintf(&leasefile, "%s/%s.leases", - driverState->dnsmasqStateDir, netname)); + driver->dnsmasqStateDir, netname)); return leasefile; } @@ -224,7 +219,7 @@ networkDnsmasqLeaseFileNameCustom(const char *bridge) char *leasefile; ignore_value(virAsprintf(&leasefile, "%s/%s.status", - driverState->dnsmasqStateDir, bridge)); + driver->dnsmasqStateDir, bridge)); return leasefile; } @@ -234,7 +229,7 @@ networkDnsmasqConfigFileName(const char *netname) char *conffile; ignore_value(virAsprintf(&conffile, "%s/%s.conf", - driverState->dnsmasqStateDir, netname)); + driver->dnsmasqStateDir, netname)); return conffile; } @@ -254,14 +249,13 @@ networkRadvdConfigFileName(const char *netname) char *configfile; ignore_value(virAsprintf(&configfile, "%s/%s-radvd.conf", - driverState->radvdStateDir, netname)); + driver->radvdStateDir, netname)); return configfile; } /* do needed cleanup steps and remove the network from the list */ static int -networkRemoveInactive(virNetworkDriverStatePtr driver, - virNetworkObjPtr net) +networkRemoveInactive(virNetworkObjPtr net) { char *leasefile = NULL; char *customleasefile = NULL; @@ -276,7 +270,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, /* remove the (possibly) existing dnsmasq and radvd files */ if (!(dctx = dnsmasqContextNew(def->name, - driverState->dnsmasqStateDir))) { + driver->dnsmasqStateDir))) { goto cleanup; } @@ -296,7 +290,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, goto cleanup; if (!(statusfile - = virNetworkConfigFile(driverState->stateDir, def->name))) + = virNetworkConfigFile(driver->stateDir, def->name))) goto cleanup; /* dnsmasq */ @@ -307,7 +301,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, /* radvd */ unlink(radvdconfigfile); - virPidFileDelete(driverState->pidDir, radvdpidbase); + virPidFileDelete(driver->pidDir, radvdpidbase); /* remove status file */ unlink(statusfile); @@ -356,7 +350,7 @@ networkBridgeDummyNicName(const char *brname) * according to external conditions on the host (i.e. anything that * isn't stored directly in each network's state file). */ static void -networkUpdateAllState(virNetworkDriverStatePtr driver) +networkUpdateAllState(void) { size_t i; @@ -402,14 +396,14 @@ networkUpdateAllState(virNetworkDriverStatePtr driver) if (obj->active && obj->def->ips && (obj->def->nips > 0)) { char *radvdpidbase; - ignore_value(virPidFileReadIfAlive(driverState->pidDir, + ignore_value(virPidFileReadIfAlive(driver->pidDir, obj->def->name, &obj->dnsmasqPid, dnsmasqCapsGetBinaryPath(driver->dnsmasqCaps))); radvdpidbase = networkRadvdPidfileBasename(obj->def->name); if (!radvdpidbase) break; - ignore_value(virPidFileReadIfAlive(driverState->pidDir, + ignore_value(virPidFileReadIfAlive(driver->pidDir, radvdpidbase, &obj->radvdPid, RADVD)); VIR_FREE(radvdpidbase); @@ -425,7 +419,7 @@ networkUpdateAllState(virNetworkDriverStatePtr driver) virNetworkObjLock(obj); if (!obj->persistent && !obj->active) { - networkRemoveInactive(driver, obj); + networkRemoveInactive(obj); continue; } @@ -436,7 +430,7 @@ networkUpdateAllState(virNetworkDriverStatePtr driver) static void -networkAutostartConfigs(virNetworkDriverStatePtr driver) +networkAutostartConfigs(void) { size_t i; @@ -444,7 +438,7 @@ networkAutostartConfigs(virNetworkDriverStatePtr driver) virNetworkObjLock(driver->networks.objs[i]); if (driver->networks.objs[i]->autostart && !virNetworkObjIsActive(driver->networks.objs[i])) { - if (networkStartNetwork(driver, driver->networks.objs[i]) < 0) { + if (networkStartNetwork(driver->networks.objs[i]) < 0) { /* failed to start but already logged */ } } @@ -455,17 +449,15 @@ networkAutostartConfigs(virNetworkDriverStatePtr driver) #if HAVE_FIREWALLD static DBusHandlerResult firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED, - DBusMessage *message, void *user_data) + DBusMessage *message, void *user_data ATTRIBUTE_UNUSED) { - virNetworkDriverStatePtr _driverState = user_data; - if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged") || dbus_message_is_signal(message, "org.fedoraproject.FirewallD1", "Reloaded")) { VIR_DEBUG("Reload in bridge_driver because of firewalld."); - networkReloadFirewallRules(_driverState); + networkReloadFirewallRules(); } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -473,7 +465,7 @@ firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED, #endif static int -networkMigrateStateFiles(virNetworkDriverStatePtr driver) +networkMigrateStateFiles(void) { /* Due to a change in location of network state xml beginning in * libvirt 1.2.4 (from /var/lib/libvirt/network to @@ -564,31 +556,31 @@ networkStateInitialize(bool privileged, DBusConnection *sysbus = NULL; #endif - if (VIR_ALLOC(driverState) < 0) + if (VIR_ALLOC(driver) < 0) goto error; - if (virMutexInit(&driverState->lock) < 0) { - VIR_FREE(driverState); + if (virMutexInit(&driver->lock) < 0) { + VIR_FREE(driver); goto error; } - networkDriverLock(driverState); + networkDriverLock(); /* configuration/state paths are one of * ~/.config/libvirt/... (session/unprivileged) * /etc/libvirt/... && /var/(run|lib)/libvirt/... (system/privileged). */ if (privileged) { - if (VIR_STRDUP(driverState->networkConfigDir, + if (VIR_STRDUP(driver->networkConfigDir, SYSCONFDIR "/libvirt/qemu/networks") < 0 || - VIR_STRDUP(driverState->networkAutostartDir, + VIR_STRDUP(driver->networkAutostartDir, SYSCONFDIR "/libvirt/qemu/networks/autostart") < 0 || - VIR_STRDUP(driverState->stateDir, + VIR_STRDUP(driver->stateDir, LOCALSTATEDIR "/run/libvirt/network") < 0 || - VIR_STRDUP(driverState->pidDir, + VIR_STRDUP(driver->pidDir, LOCALSTATEDIR "/run/libvirt/network") < 0 || - VIR_STRDUP(driverState->dnsmasqStateDir, + VIR_STRDUP(driver->dnsmasqStateDir, LOCALSTATEDIR "/lib/libvirt/dnsmasq") < 0 || - VIR_STRDUP(driverState->radvdStateDir, + VIR_STRDUP(driver->radvdStateDir, LOCALSTATEDIR "/lib/libvirt/radvd") < 0) goto error; @@ -596,7 +588,7 @@ networkStateInitialize(bool privileged, * privileged mode - unprivileged mode directories haven't * changed location. */ - if (networkMigrateStateFiles(driverState) < 0) + if (networkMigrateStateFiles() < 0) goto error; } else { configdir = virGetUserConfigDirectory(); @@ -604,48 +596,48 @@ networkStateInitialize(bool privileged, if (!(configdir && rundir)) goto error; - if ((virAsprintf(&driverState->networkConfigDir, + if ((virAsprintf(&driver->networkConfigDir, "%s/qemu/networks", configdir) < 0) || - (virAsprintf(&driverState->networkAutostartDir, + (virAsprintf(&driver->networkAutostartDir, "%s/qemu/networks/autostart", configdir) < 0) || - (virAsprintf(&driverState->stateDir, + (virAsprintf(&driver->stateDir, "%s/network/lib", rundir) < 0) || - (virAsprintf(&driverState->pidDir, + (virAsprintf(&driver->pidDir, "%s/network/run", rundir) < 0) || - (virAsprintf(&driverState->dnsmasqStateDir, + (virAsprintf(&driver->dnsmasqStateDir, "%s/dnsmasq/lib", rundir) < 0) || - (virAsprintf(&driverState->radvdStateDir, + (virAsprintf(&driver->radvdStateDir, "%s/radvd/lib", rundir) < 0)) { goto error; } } - if (virFileMakePath(driverState->stateDir) < 0) { + if (virFileMakePath(driver->stateDir) < 0) { virReportSystemError(errno, _("cannot create directory %s"), - driverState->stateDir); + driver->stateDir); goto error; } /* if this fails now, it will be retried later with dnsmasqCapsRefresh() */ - driverState->dnsmasqCaps = dnsmasqCapsNewFromBinary(DNSMASQ); + driver->dnsmasqCaps = dnsmasqCapsNewFromBinary(DNSMASQ); - if (virNetworkLoadAllState(&driverState->networks, - driverState->stateDir) < 0) + if (virNetworkLoadAllState(&driver->networks, + driver->stateDir) < 0) goto error; - if (virNetworkLoadAllConfigs(&driverState->networks, - driverState->networkConfigDir, - driverState->networkAutostartDir) < 0) + if (virNetworkLoadAllConfigs(&driver->networks, + driver->networkConfigDir, + driver->networkAutostartDir) < 0) goto error; - networkUpdateAllState(driverState); - networkReloadFirewallRules(driverState); - networkRefreshDaemons(driverState); + networkUpdateAllState(); + networkReloadFirewallRules(); + networkRefreshDaemons(); - driverState->networkEventState = virObjectEventStateNew(); + driver->networkEventState = virObjectEventStateNew(); - networkDriverUnlock(driverState); + networkDriverUnlock(); #ifdef HAVE_FIREWALLD if (!(sysbus = virDBusGetSystemBus())) { @@ -669,7 +661,7 @@ networkStateInitialize(bool privileged, ",member='Reloaded'", NULL); dbus_connection_add_filter(sysbus, firewalld_dbus_filter_bridge, - driverState, NULL); + NULL, NULL); } #endif @@ -680,8 +672,8 @@ networkStateInitialize(bool privileged, return ret; error: - if (driverState) - networkDriverUnlock(driverState); + if (driver) + networkDriverUnlock(); networkStateCleanup(); goto cleanup; } @@ -694,12 +686,12 @@ networkStateInitialize(bool privileged, static void networkStateAutoStart(void) { - if (!driverState) + if (!driver) return; - networkDriverLock(driverState); - networkAutostartConfigs(driverState); - networkDriverUnlock(driverState); + networkDriverLock(); + networkAutostartConfigs(); + networkDriverUnlock(); } /** @@ -711,19 +703,19 @@ networkStateAutoStart(void) static int networkStateReload(void) { - if (!driverState) + if (!driver) return 0; - networkDriverLock(driverState); - virNetworkLoadAllState(&driverState->networks, - driverState->stateDir); - virNetworkLoadAllConfigs(&driverState->networks, - driverState->networkConfigDir, - driverState->networkAutostartDir); - networkReloadFirewallRules(driverState); - networkRefreshDaemons(driverState); - networkAutostartConfigs(driverState); - networkDriverUnlock(driverState); + networkDriverLock(); + virNetworkLoadAllState(&driver->networks, + driver->stateDir); + virNetworkLoadAllConfigs(&driver->networks, + driver->networkConfigDir, + driver->networkAutostartDir); + networkReloadFirewallRules(); + networkRefreshDaemons(); + networkAutostartConfigs(); + networkDriverUnlock(); return 0; } @@ -736,29 +728,29 @@ networkStateReload(void) static int networkStateCleanup(void) { - if (!driverState) + if (!driver) return -1; - networkDriverLock(driverState); + networkDriverLock(); - virObjectEventStateFree(driverState->networkEventState); + virObjectEventStateFree(driver->networkEventState); /* free inactive networks */ - virNetworkObjListFree(&driverState->networks); + virNetworkObjListFree(&driver->networks); - VIR_FREE(driverState->networkConfigDir); - VIR_FREE(driverState->networkAutostartDir); - VIR_FREE(driverState->stateDir); - VIR_FREE(driverState->pidDir); - VIR_FREE(driverState->dnsmasqStateDir); - VIR_FREE(driverState->radvdStateDir); + VIR_FREE(driver->networkConfigDir); + VIR_FREE(driver->networkAutostartDir); + VIR_FREE(driver->stateDir); + VIR_FREE(driver->pidDir); + VIR_FREE(driver->dnsmasqStateDir); + VIR_FREE(driver->radvdStateDir); - virObjectUnref(driverState->dnsmasqCaps); + virObjectUnref(driver->dnsmasqCaps); - networkDriverUnlock(driverState); - virMutexDestroy(&driverState->lock); + networkDriverUnlock(); + virMutexDestroy(&driver->lock); - VIR_FREE(driverState); + VIR_FREE(driver); return 0; } @@ -1301,8 +1293,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, } static int -networkStartDhcpDaemon(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkStartDhcpDaemon(virNetworkObjPtr network) { virCommandPtr cmd = NULL; char *pidfile = NULL; @@ -1315,25 +1306,25 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver, goto cleanup; } - if (virFileMakePath(driverState->pidDir) < 0) { + if (virFileMakePath(driver->pidDir) < 0) { virReportSystemError(errno, _("cannot create directory %s"), - driverState->pidDir); + driver->pidDir); goto cleanup; } - if (!(pidfile = virPidFileBuildPath(driverState->pidDir, + if (!(pidfile = virPidFileBuildPath(driver->pidDir, network->def->name))) goto cleanup; - if (virFileMakePath(driverState->dnsmasqStateDir) < 0) { + if (virFileMakePath(driver->dnsmasqStateDir) < 0) { virReportSystemError(errno, _("cannot create directory %s"), - driverState->dnsmasqStateDir); + driver->dnsmasqStateDir); goto cleanup; } - dctx = dnsmasqContextNew(network->def->name, driverState->dnsmasqStateDir); + dctx = dnsmasqContextNew(network->def->name, driver->dnsmasqStateDir); if (dctx == NULL) goto cleanup; @@ -1362,7 +1353,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver, * pid */ - ret = virPidFileRead(driverState->pidDir, network->def->name, + ret = virPidFileRead(driver->pidDir, network->def->name, &network->dnsmasqPid); if (ret < 0) goto cleanup; @@ -1383,8 +1374,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver, * Returns 0 on success, -1 on failure. */ static int -networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkRefreshDhcpDaemon(virNetworkObjPtr network) { int ret = -1; size_t i; @@ -1397,11 +1387,11 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver, /* if there's no running dnsmasq, just start it */ if (network->dnsmasqPid <= 0 || (kill(network->dnsmasqPid, 0) < 0)) - return networkStartDhcpDaemon(driver, network); + return networkStartDhcpDaemon(network); VIR_INFO("Refreshing dnsmasq for network %s", network->def->bridge); if (!(dctx = dnsmasqContextNew(network->def->name, - driverState->dnsmasqStateDir))) { + driver->dnsmasqStateDir))) { goto cleanup; } @@ -1451,8 +1441,7 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver, * Returns 0 on success, -1 on failure. */ static int -networkRestartDhcpDaemon(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkRestartDhcpDaemon(virNetworkObjPtr network) { /* if there is a running dnsmasq, kill it */ if (network->dnsmasqPid > 0) { @@ -1461,7 +1450,7 @@ networkRestartDhcpDaemon(virNetworkDriverStatePtr driver, network->dnsmasqPid = -1; } /* now start dnsmasq if it should be started */ - return networkStartDhcpDaemon(driver, network); + return networkStartDhcpDaemon(network); } static char radvd1[] = " AdvOtherConfigFlag off;\n\n"; @@ -1588,8 +1577,7 @@ networkRadvdConfWrite(virNetworkObjPtr network, char **configFile) } static int -networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, - virNetworkObjPtr network) +networkStartRadvd(virNetworkObjPtr network) { char *pidfile = NULL; char *radvdpidbase = NULL; @@ -1619,23 +1607,23 @@ networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, goto cleanup; } - if (virFileMakePath(driverState->pidDir) < 0) { + if (virFileMakePath(driver->pidDir) < 0) { virReportSystemError(errno, _("cannot create directory %s"), - driverState->pidDir); + driver->pidDir); goto cleanup; } - if (virFileMakePath(driverState->radvdStateDir) < 0) { + if (virFileMakePath(driver->radvdStateDir) < 0) { virReportSystemError(errno, _("cannot create directory %s"), - driverState->radvdStateDir); + driver->radvdStateDir); goto cleanup; } /* construct pidfile name */ if (!(radvdpidbase = networkRadvdPidfileBasename(network->def->name))) goto cleanup; - if (!(pidfile = virPidFileBuildPath(driverState->pidDir, radvdpidbase))) + if (!(pidfile = virPidFileBuildPath(driver->pidDir, radvdpidbase))) goto cleanup; if (networkRadvdConfWrite(network, &configfile) < 0) @@ -1661,7 +1649,7 @@ networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, if (virCommandRun(cmd, NULL) < 0) goto cleanup; - if (virPidFileRead(driverState->pidDir, radvdpidbase, &network->radvdPid) < 0) + if (virPidFileRead(driver->pidDir, radvdpidbase, &network->radvdPid) < 0) goto cleanup; ret = 0; @@ -1674,8 +1662,7 @@ networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, } static int -networkRefreshRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, - virNetworkObjPtr network) +networkRefreshRadvd(virNetworkObjPtr network) { char *radvdpidbase; @@ -1688,7 +1675,7 @@ networkRefreshRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, network->def->name) >= 0) && ((radvdpidbase = networkRadvdPidfileBasename(network->def->name)) != NULL)) { - virPidFileDelete(driverState->pidDir, radvdpidbase); + virPidFileDelete(driver->pidDir, radvdpidbase); VIR_FREE(radvdpidbase); } network->radvdPid = -1; @@ -1697,7 +1684,7 @@ networkRefreshRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, /* if there's no running radvd, just start it */ if (network->radvdPid <= 0 || (kill(network->radvdPid, 0) < 0)) - return networkStartRadvd(driver, network); + return networkStartRadvd(network); if (!virNetworkDefGetIpByIndex(network->def, AF_INET6, 0)) { /* no IPv6 addresses, so we don't need to run radvd */ @@ -1713,8 +1700,7 @@ networkRefreshRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, #if 0 /* currently unused, so it causes a build error unless we #if it out */ static int -networkRestartRadvd(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkRestartRadvd(virNetworkObjPtr network) { char *radvdpidbase; @@ -1728,7 +1714,7 @@ networkRestartRadvd(virNetworkDriverStatePtr driver, network->def->name) >= 0) && ((radvdpidbase = networkRadvdPidfileBasename(network->def->name)) != NULL)) { - virPidFileDelete(driverState->pidDir, radvdpidbase); + virPidFileDelete(driver->pidDir, radvdpidbase); VIR_FREE(radvdpidbase); } network->radvdPid = -1; @@ -1742,7 +1728,7 @@ networkRestartRadvd(virNetworkDriverStatePtr driver, * This should be called when libvirtd is restarted. */ static void -networkRefreshDaemons(virNetworkDriverStatePtr driver) +networkRefreshDaemons(void) { size_t i; @@ -1762,15 +1748,15 @@ networkRefreshDaemons(virNetworkDriverStatePtr driver) * dnsmasq and/or radvd, or restart them if they've * disappeared. */ - networkRefreshDhcpDaemon(driver, network); - networkRefreshRadvd(driver, network); + networkRefreshDhcpDaemon(network); + networkRefreshRadvd(network); } virNetworkObjUnlock(network); } } static void -networkReloadFirewallRules(virNetworkDriverStatePtr driver) +networkReloadFirewallRules(void) { size_t i; @@ -1959,8 +1945,7 @@ networkAddRouteToBridge(virNetworkObjPtr network, } static int -networkStartNetworkVirtual(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkStartNetworkVirtual(virNetworkObjPtr network) { size_t i; bool v4present = false, v6present = false; @@ -2065,11 +2050,11 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, /* start dnsmasq if there are any IP addresses (v4 or v6) */ if ((v4present || v6present) && - networkStartDhcpDaemon(driver, network) < 0) + networkStartDhcpDaemon(network) < 0) goto err3; /* start radvd if there are any ipv6 addresses */ - if (v6present && networkStartRadvd(driver, network) < 0) + if (v6present && networkStartRadvd(network) < 0) goto err4; /* DAD has happened (dnsmasq waits for it), dnsmasq is now bound to the @@ -2134,8 +2119,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, return -1; } -static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, - virNetworkObjPtr network) +static int networkShutdownNetworkVirtual(virNetworkObjPtr network) { virNetDevBandwidthClear(network->def->bridge); @@ -2145,7 +2129,7 @@ static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver ATTRIBU kill(network->radvdPid, SIGTERM); /* attempt to delete the pidfile we created */ if ((radvdpidbase = networkRadvdPidfileBasename(network->def->name))) { - virPidFileDelete(driverState->pidDir, radvdpidbase); + virPidFileDelete(driver->pidDir, radvdpidbase); VIR_FREE(radvdpidbase); } } @@ -2289,8 +2273,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef) static int -networkStartNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, - virNetworkObjPtr network) +networkStartNetworkExternal(virNetworkObjPtr network) { /* put anything here that needs to be done each time a network of * type BRIDGE, PRIVATE, VEPA, HOSTDEV or PASSTHROUGH is started. On @@ -2300,8 +2283,7 @@ networkStartNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, return networkCreateInterfacePool(network->def); } -static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, - virNetworkObjPtr network ATTRIBUTE_UNUSED) +static int networkShutdownNetworkExternal(virNetworkObjPtr network ATTRIBUTE_UNUSED) { /* put anything here that needs to be done each time a network of * type BRIDGE, PRIVATE, VEPA, HOSTDEV or PASSTHROUGH is shutdown. On @@ -2312,8 +2294,7 @@ static int networkShutdownNetworkExternal(virNetworkDriverStatePtr driver ATTRIB } static int -networkStartNetwork(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +networkStartNetwork(virNetworkObjPtr network) { int ret = -1; @@ -2343,7 +2324,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, case VIR_NETWORK_FORWARD_NONE: case VIR_NETWORK_FORWARD_NAT: case VIR_NETWORK_FORWARD_ROUTE: - if (networkStartNetworkVirtual(driver, network) < 0) + if (networkStartNetworkVirtual(network) < 0) goto cleanup; break; @@ -2352,7 +2333,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, case VIR_NETWORK_FORWARD_VEPA: case VIR_NETWORK_FORWARD_PASSTHROUGH: case VIR_NETWORK_FORWARD_HOSTDEV: - if (networkStartNetworkExternal(driver, network) < 0) + if (networkStartNetworkExternal(network) < 0) goto cleanup; break; } @@ -2367,7 +2348,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, * is setup. */ VIR_DEBUG("Writing network status to disk"); - if (virNetworkSaveStatus(driverState->stateDir, network) < 0) + if (virNetworkSaveStatus(driver->stateDir, network) < 0) goto cleanup; network->active = 1; @@ -2379,7 +2360,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, virNetworkObjUnsetDefTransient(network); virErrorPtr save_err = virSaveLastError(); int save_errno = errno; - networkShutdownNetwork(driver, network); + networkShutdownNetwork(network); virSetError(save_err); virFreeError(save_err); errno = save_errno; @@ -2387,8 +2368,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, return ret; } -static int networkShutdownNetwork(virNetworkDriverStatePtr driver, - virNetworkObjPtr network) +static int networkShutdownNetwork(virNetworkObjPtr network) { int ret = 0; char *stateFile; @@ -2398,7 +2378,7 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, if (!virNetworkObjIsActive(network)) return 0; - stateFile = virNetworkConfigFile(driverState->stateDir, + stateFile = virNetworkConfigFile(driver->stateDir, network->def->name); if (!stateFile) return -1; @@ -2411,7 +2391,7 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, case VIR_NETWORK_FORWARD_NONE: case VIR_NETWORK_FORWARD_NAT: case VIR_NETWORK_FORWARD_ROUTE: - ret = networkShutdownNetworkVirtual(driver, network); + ret = networkShutdownNetworkVirtual(network); break; case VIR_NETWORK_FORWARD_BRIDGE: @@ -2419,7 +2399,7 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, case VIR_NETWORK_FORWARD_VEPA: case VIR_NETWORK_FORWARD_PASSTHROUGH: case VIR_NETWORK_FORWARD_HOSTDEV: - ret = networkShutdownNetworkExternal(driver, network); + ret = networkShutdownNetworkExternal(network); break; } @@ -2436,13 +2416,12 @@ static int networkShutdownNetwork(virNetworkDriverStatePtr driver, static virNetworkPtr networkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; virNetworkObjPtr network; virNetworkPtr ret = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, uuid); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, "%s", _("no network with matching uuid")); @@ -2463,13 +2442,12 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn, static virNetworkPtr networkLookupByName(virConnectPtr conn, const char *name) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; virNetworkObjPtr network; virNetworkPtr ret = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByName(&driver->networks, name); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, _("no network with matching name '%s'"), name); @@ -2487,22 +2465,20 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn, return ret; } -static virDrvOpenStatus networkOpen(virConnectPtr conn, +static virDrvOpenStatus networkOpen(virConnectPtr conn ATTRIBUTE_UNUSED, virConnectAuthPtr auth ATTRIBUTE_UNUSED, unsigned int flags) { virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); - if (!driverState) + if (!driver) return VIR_DRV_OPEN_DECLINED; - conn->networkPrivateData = driverState; return VIR_DRV_OPEN_SUCCESS; } -static int networkClose(virConnectPtr conn) +static int networkClose(virConnectPtr conn ATTRIBUTE_UNUSED) { - conn->networkPrivateData = NULL; return 0; } @@ -2510,12 +2486,11 @@ static int networkConnectNumOfNetworks(virConnectPtr conn) { int nactive = 0; size_t i; - virNetworkDriverStatePtr driver = conn->networkPrivateData; if (virConnectNumOfNetworksEnsureACL(conn) < 0) return -1; - networkDriverLock(driver); + networkDriverLock(); for (i = 0; i < driver->networks.count; i++) { virNetworkObjPtr obj = driver->networks.objs[i]; virNetworkObjLock(obj); @@ -2524,20 +2499,19 @@ static int networkConnectNumOfNetworks(virConnectPtr conn) nactive++; virNetworkObjUnlock(obj); } - networkDriverUnlock(driver); + networkDriverUnlock(); return nactive; } static int networkConnectListNetworks(virConnectPtr conn, char **const names, int nnames) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; int got = 0; size_t i; if (virConnectListNetworksEnsureACL(conn) < 0) return -1; - networkDriverLock(driver); + networkDriverLock(); for (i = 0; i < driver->networks.count && got < nnames; i++) { virNetworkObjPtr obj = driver->networks.objs[i]; virNetworkObjLock(obj); @@ -2551,12 +2525,12 @@ static int networkConnectListNetworks(virConnectPtr conn, char **const names, in } virNetworkObjUnlock(obj); } - networkDriverUnlock(driver); + networkDriverUnlock(); return got; cleanup: - networkDriverUnlock(driver); + networkDriverUnlock(); for (i = 0; i < got; i++) VIR_FREE(names[i]); return -1; @@ -2566,12 +2540,11 @@ static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) { int ninactive = 0; size_t i; - virNetworkDriverStatePtr driver = conn->networkPrivateData; if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0) return -1; - networkDriverLock(driver); + networkDriverLock(); for (i = 0; i < driver->networks.count; i++) { virNetworkObjPtr obj = driver->networks.objs[i]; virNetworkObjLock(obj); @@ -2580,20 +2553,19 @@ static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) ninactive++; virNetworkObjUnlock(obj); } - networkDriverUnlock(driver); + networkDriverUnlock(); return ninactive; } static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; int got = 0; size_t i; if (virConnectListDefinedNetworksEnsureACL(conn) < 0) return -1; - networkDriverLock(driver); + networkDriverLock(); for (i = 0; i < driver->networks.count && got < nnames; i++) { virNetworkObjPtr obj = driver->networks.objs[i]; virNetworkObjLock(obj); @@ -2607,11 +2579,11 @@ static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const na } virNetworkObjUnlock(obj); } - networkDriverUnlock(driver); + networkDriverUnlock(); return got; cleanup: - networkDriverUnlock(driver); + networkDriverUnlock(); for (i = 0; i < got; i++) VIR_FREE(names[i]); return -1; @@ -2622,7 +2594,6 @@ networkConnectListAllNetworks(virConnectPtr conn, virNetworkPtr **nets, unsigned int flags) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; int ret = -1; virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1); @@ -2630,11 +2601,11 @@ networkConnectListAllNetworks(virConnectPtr conn, if (virConnectListAllNetworksEnsureACL(conn) < 0) goto cleanup; - networkDriverLock(driver); + networkDriverLock(); ret = virNetworkObjListExport(conn, driver->networks, nets, virConnectListAllNetworksCheckACL, flags); - networkDriverUnlock(driver); + networkDriverUnlock(); cleanup: return ret; @@ -2648,7 +2619,6 @@ networkConnectNetworkEventRegisterAny(virConnectPtr conn, void *opaque, virFreeCallback freecb) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; int ret = -1; if (virConnectNetworkEventRegisterAnyEnsureACL(conn) < 0) @@ -2667,7 +2637,6 @@ static int networkConnectNetworkEventDeregisterAny(virConnectPtr conn, int callbackID) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; int ret = -1; if (virConnectNetworkEventDeregisterAnyEnsureACL(conn) < 0) @@ -2724,8 +2693,7 @@ static int networkIsPersistent(virNetworkPtr net) static int -networkValidate(virNetworkDriverStatePtr driver, - virNetworkDefPtr def, +networkValidate(virNetworkDefPtr def, bool check_active) { size_t i; @@ -2891,13 +2859,12 @@ networkValidate(virNetworkDriverStatePtr driver, static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; virNetworkDefPtr def; virNetworkObjPtr network = NULL; virNetworkPtr ret = NULL; virObjectEventPtr event = NULL; - networkDriverLock(driver); + networkDriverLock(); if (!(def = virNetworkDefParseString(xml))) goto cleanup; @@ -2905,7 +2872,7 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) if (virNetworkCreateXMLEnsureACL(conn, def) < 0) goto cleanup; - if (networkValidate(driver, def, true) < 0) + if (networkValidate(def, true) < 0) goto cleanup; /* NB: even though this transient network hasn't yet been started, @@ -2916,7 +2883,7 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) goto cleanup; def = NULL; - if (networkStartNetwork(driver, network) < 0) { + if (networkStartNetwork(network) < 0) { virNetworkRemoveInactive(&driver->networks, network); network = NULL; @@ -2937,20 +2904,19 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) virObjectEventStateQueue(driver->networkEventState, event); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml) { - virNetworkDriverStatePtr driver = conn->networkPrivateData; virNetworkDefPtr def = NULL; bool freeDef = true; virNetworkObjPtr network = NULL; virNetworkPtr ret = NULL; virObjectEventPtr event = NULL; - networkDriverLock(driver); + networkDriverLock(); if (!(def = virNetworkDefParseString(xml))) goto cleanup; @@ -2958,7 +2924,7 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml) if (virNetworkDefineXMLEnsureACL(conn, def) < 0) goto cleanup; - if (networkValidate(driver, def, false) < 0) + if (networkValidate(def, false) < 0) goto cleanup; if (!(network = virNetworkAssignDef(&driver->networks, def, false))) @@ -2995,20 +2961,19 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml) virNetworkDefFree(def); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } static int networkUndefine(virNetworkPtr net) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network; int ret = -1; bool active = false; virObjectEventPtr event = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { @@ -3037,7 +3002,7 @@ networkUndefine(virNetworkPtr net) VIR_INFO("Undefining network '%s'", network->def->name); if (!active) { - if (networkRemoveInactive(driver, network) < 0) { + if (networkRemoveInactive(network) < 0) { network = NULL; goto cleanup; } @@ -3057,7 +3022,7 @@ networkUndefine(virNetworkPtr net) virObjectEventStateQueue(driver->networkEventState, event); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } @@ -3069,7 +3034,6 @@ networkUpdate(virNetworkPtr net, const char *xml, unsigned int flags) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network = NULL; int isActive, ret = -1; size_t i; @@ -3082,7 +3046,7 @@ networkUpdate(virNetworkPtr net, VIR_NETWORK_UPDATE_AFFECT_CONFIG, -1); - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { @@ -3174,7 +3138,7 @@ networkUpdate(virNetworkPtr net, /* these sections all change things on the dnsmasq commandline, * so we need to kill and restart dnsmasq. */ - if (networkRestartDhcpDaemon(driver, network) < 0) + if (networkRestartDhcpDaemon(network) < 0) goto cleanup; } else if (section == VIR_NETWORK_SECTION_IP_DHCP_HOST) { @@ -3195,8 +3159,8 @@ networkUpdate(virNetworkPtr net, } if ((newDhcpActive != oldDhcpActive && - networkRestartDhcpDaemon(driver, network) < 0) || - networkRefreshDhcpDaemon(driver, network) < 0) { + networkRestartDhcpDaemon(network) < 0) || + networkRefreshDhcpDaemon(network) < 0) { goto cleanup; } @@ -3207,7 +3171,7 @@ networkUpdate(virNetworkPtr net, * can just update the config files and send SIGHUP to * dnsmasq. */ - if (networkRefreshDhcpDaemon(driver, network) < 0) + if (networkRefreshDhcpDaemon(network) < 0) goto cleanup; } @@ -3216,12 +3180,12 @@ networkUpdate(virNetworkPtr net, /* only a change in IP addresses will affect radvd, and all of radvd's * config is stored in the conf file which will be re-read with a SIGHUP. */ - if (networkRefreshRadvd(driver, network) < 0) + if (networkRefreshRadvd(network) < 0) goto cleanup; } /* save current network state to disk */ - if ((ret = virNetworkSaveStatus(driverState->stateDir, + if ((ret = virNetworkSaveStatus(driver->stateDir, network)) < 0) { goto cleanup; } @@ -3230,18 +3194,17 @@ networkUpdate(virNetworkPtr net, cleanup: if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } static int networkCreate(virNetworkPtr net) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network; int ret = -1; virObjectEventPtr event = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { @@ -3253,7 +3216,7 @@ static int networkCreate(virNetworkPtr net) if (virNetworkCreateEnsureACL(net->conn, network->def) < 0) goto cleanup; - ret = networkStartNetwork(driver, network); + ret = networkStartNetwork(network); event = virNetworkEventLifecycleNew(network->def->name, network->def->uuid, @@ -3265,18 +3228,17 @@ static int networkCreate(virNetworkPtr net) virObjectEventStateQueue(driver->networkEventState, event); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } static int networkDestroy(virNetworkPtr net) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network; int ret = -1; virObjectEventPtr event = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { @@ -3295,7 +3257,7 @@ static int networkDestroy(virNetworkPtr net) goto cleanup; } - if ((ret = networkShutdownNetwork(driver, network)) < 0) + if ((ret = networkShutdownNetwork(network)) < 0) goto cleanup; event = virNetworkEventLifecycleNew(network->def->name, @@ -3304,7 +3266,7 @@ static int networkDestroy(virNetworkPtr net) 0); if (!network->persistent) { - if (networkRemoveInactive(driver, network) < 0) { + if (networkRemoveInactive(network) < 0) { network = NULL; ret = -1; goto cleanup; @@ -3317,7 +3279,7 @@ static int networkDestroy(virNetworkPtr net) virObjectEventStateQueue(driver->networkEventState, event); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } @@ -3398,12 +3360,11 @@ static int networkGetAutostart(virNetworkPtr net, static int networkSetAutostart(virNetworkPtr net, int autostart) { - virNetworkDriverStatePtr driver = net->conn->networkPrivateData; virNetworkObjPtr network; char *configFile = NULL, *autostartLink = NULL; int ret = -1; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { @@ -3461,7 +3422,7 @@ static int networkSetAutostart(virNetworkPtr net, VIR_FREE(autostartLink); if (network) virNetworkObjUnlock(network); - networkDriverUnlock(driver); + networkDriverUnlock(); return ret; } @@ -3724,7 +3685,6 @@ int networkAllocateActualDevice(virDomainDefPtr dom, virDomainNetDefPtr iface) { - virNetworkDriverStatePtr driver = driverState; virDomainNetType actualType = iface->type; virNetworkObjPtr network = NULL; virNetworkDefPtr netdef = NULL; @@ -3742,9 +3702,9 @@ networkAllocateActualDevice(virDomainDefPtr dom, virDomainActualNetDefFree(iface->data.network.actual); iface->data.network.actual = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByName(&driver->networks, iface->data.network.name); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, _("no network with matching name '%s'"), @@ -4128,7 +4088,6 @@ int networkNotifyActualDevice(virDomainDefPtr dom, virDomainNetDefPtr iface) { - virNetworkDriverStatePtr driver = driverState; virDomainNetType actualType = virDomainNetGetActualType(iface); virNetworkObjPtr network; virNetworkDefPtr netdef; @@ -4139,9 +4098,9 @@ networkNotifyActualDevice(virDomainDefPtr dom, if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) return 0; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByName(&driver->networks, iface->data.network.name); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, _("no network with matching name '%s'"), @@ -4318,7 +4277,6 @@ int networkReleaseActualDevice(virDomainDefPtr dom, virDomainNetDefPtr iface) { - virNetworkDriverStatePtr driver = driverState; virDomainNetType actualType = virDomainNetGetActualType(iface); virNetworkObjPtr network; virNetworkDefPtr netdef; @@ -4329,9 +4287,9 @@ networkReleaseActualDevice(virDomainDefPtr dom, if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) return 0; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByName(&driver->networks, iface->data.network.name); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, _("no network with matching name '%s'"), @@ -4480,7 +4438,6 @@ int networkGetNetworkAddress(const char *netname, char **netaddr) { int ret = -1; - virNetworkDriverStatePtr driver = driverState; virNetworkObjPtr network; virNetworkDefPtr netdef; virNetworkIpDefPtr ipdef; @@ -4489,9 +4446,9 @@ networkGetNetworkAddress(const char *netname, char **netaddr) char *dev_name = NULL; *netaddr = NULL; - networkDriverLock(driver); + networkDriverLock(); network = virNetworkFindByName(&driver->networks, netname); - networkDriverUnlock(driver); + networkDriverUnlock(); if (!network) { virReportError(VIR_ERR_NO_NETWORK, _("no network with matching name '%s'"), @@ -4705,7 +4662,7 @@ networkPlugBandwidth(virNetworkObjPtr net, /* update sum of 'floor'-s of attached NICs */ net->floor_sum += ifaceBand->in->floor; /* update status file */ - if (virNetworkSaveStatus(driverState->stateDir, net) < 0) { + if (virNetworkSaveStatus(driver->stateDir, net) < 0) { ignore_value(virBitmapClearBit(net->class_id, class_id)); net->floor_sum -= ifaceBand->in->floor; iface->data.network.actual->class_id = 0; @@ -4756,7 +4713,7 @@ networkUnplugBandwidth(virNetworkObjPtr net, ignore_value(virBitmapClearBit(net->class_id, iface->data.network.actual->class_id)); /* update status file */ - if (virNetworkSaveStatus(driverState->stateDir, net) < 0) { + if (virNetworkSaveStatus(driver->stateDir, net) < 0) { net->floor_sum += ifaceBand->in->floor; ignore_value(virBitmapSetBit(net->class_id, iface->data.network.actual->class_id)); -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list