diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index fbf49ee957..780c6ed4a2 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -3789,9 +3789,8 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver, } -/* XXX conn required for network -> bridge resolution */ static int -lxcDomainAttachDeviceNetLive(virConnectPtr conn, +lxcDomainAttachDeviceNetLive(virLXCDriverPtr driver, virDomainObjPtr vm, virDomainNetDefPtr net) { @@ -3852,7 +3851,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn, goto cleanup; break; case VIR_DOMAIN_NET_TYPE_DIRECT: { - if (!(veth = virLXCProcessSetupInterfaceDirect(conn, vm->def, net))) + if (!(veth = virLXCProcessSetupInterfaceDirect(driver, vm->def, net))) goto cleanup; } break; case VIR_DOMAIN_NET_TYPE_USER: @@ -4219,8 +4218,7 @@ lxcDomainAttachDeviceHostdevLive(virLXCDriverPtr driver, static int -lxcDomainAttachDeviceLive(virConnectPtr conn, - virLXCDriverPtr driver, +lxcDomainAttachDeviceLive(virLXCDriverPtr driver, virDomainObjPtr vm, virDomainDeviceDefPtr dev) { @@ -4234,7 +4232,7 @@ lxcDomainAttachDeviceLive(virConnectPtr conn, break; case VIR_DOMAIN_DEVICE_NET: - ret = lxcDomainAttachDeviceNetLive(conn, vm, + ret = lxcDomainAttachDeviceNetLive(driver, vm, dev->data.net); if (!ret) dev->data.net = NULL; @@ -4718,7 +4716,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, true) < 0) goto endjob; - if ((ret = lxcDomainAttachDeviceLive(dom->conn, driver, vm, dev_copy)) < 0) + if ((ret = lxcDomainAttachDeviceLive(driver, vm, dev_copy)) < 0) goto endjob; /* * update domain status forcibly because the domain status may be diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 3688973abf..487a085b7e 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -326,13 +326,13 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, } -char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn, - virDomainDefPtr def, - virDomainNetDefPtr net) +char * +virLXCProcessSetupInterfaceDirect(virLXCDriverPtr driver, + virDomainDefPtr def, + virDomainNetDefPtr net) { char *ret = NULL; char *res_ifname = NULL; - virLXCDriverPtr driver = conn->privateData; const virNetDevBandwidth *bw; const virNetDevVPortProfile *prof; virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver); @@ -392,9 +392,10 @@ static const char *nsInfoLocal[VIR_LXC_DOMAIN_NAMESPACE_LAST] = { [VIR_LXC_DOMAIN_NAMESPACE_SHAREUTS] = "uts", }; -static int virLXCProcessSetupNamespaceName(virConnectPtr conn, int ns_type, const char *name) +static int virLXCProcessSetupNamespaceName(virLXCDriverPtr driver, + int ns_type, + const char *name) { - virLXCDriverPtr driver = conn->privateData; int fd = -1; virDomainObjPtr vm; virLXCDomainObjPrivatePtr priv; @@ -474,7 +475,7 @@ static int virLXCProcessSetupNamespaceNet(int ns_type, const char *name) /** * virLXCProcessSetupNamespaces: - * @conn: pointer to connection + * @driver: pointer to driver structure * @def: pointer to virtual machines namespaceData * @nsFDs: out parameter to store the namespace FD * @@ -483,9 +484,10 @@ static int virLXCProcessSetupNamespaceNet(int ns_type, const char *name) * * Returns 0 on success or -1 in case of error */ -static int virLXCProcessSetupNamespaces(virConnectPtr conn, - lxcDomainDefPtr lxcDef, - int *nsFDs) +static int +virLXCProcessSetupNamespaces(virLXCDriverPtr driver, + lxcDomainDefPtr lxcDef, + int *nsFDs) { size_t i; @@ -500,7 +502,8 @@ static int virLXCProcessSetupNamespaces(virConnectPtr conn, case VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE: continue; case VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NAME: - if ((nsFDs[i] = virLXCProcessSetupNamespaceName(conn, i, lxcDef->ns_val[i])) < 0) + if ((nsFDs[i] = virLXCProcessSetupNamespaceName(driver, i, + lxcDef->ns_val[i])) < 0) return -1; break; case VIR_LXC_DOMAIN_NAMESPACE_SOURCE_PID: @@ -519,7 +522,7 @@ static int virLXCProcessSetupNamespaces(virConnectPtr conn, /** * virLXCProcessSetupInterfaces: - * @conn: pointer to connection + * @driver: pointer to driver structure * @def: pointer to virtual machine structure * @veths: string list of interface names * @@ -529,9 +532,10 @@ static int virLXCProcessSetupNamespaces(virConnectPtr conn, * * Returns 0 on success or -1 in case of error */ -static int virLXCProcessSetupInterfaces(virConnectPtr conn, - virDomainDefPtr def, - char ***veths) +static int +virLXCProcessSetupInterfaces(virLXCDriverPtr driver, + virDomainDefPtr def, + char ***veths) { int ret = -1; size_t i; @@ -585,7 +589,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, goto cleanup; break; case VIR_DOMAIN_NET_TYPE_DIRECT: - if (!(veth = virLXCProcessSetupInterfaceDirect(conn, def, net))) + if (!(veth = virLXCProcessSetupInterfaceDirect(driver, def, net))) goto cleanup; break; @@ -1344,11 +1348,11 @@ int virLXCProcessStart(virConnectPtr conn, } VIR_DEBUG("Setting up Interfaces"); - if (virLXCProcessSetupInterfaces(conn, vm->def, &veths) < 0) + if (virLXCProcessSetupInterfaces(driver, vm->def, &veths) < 0) goto cleanup; VIR_DEBUG("Setting up namespaces if any"); - if (virLXCProcessSetupNamespaces(conn, vm->def->namespaceData, nsInheritFDs) < 0) + if (virLXCProcessSetupNamespaces(driver, vm->def->namespaceData, nsInheritFDs) < 0) goto cleanup; VIR_DEBUG("Preparing to launch"); diff --git a/src/lxc/lxc_process.h b/src/lxc/lxc_process.h index 1bf359b229..383f6f714d 100644 --- a/src/lxc/lxc_process.h +++ b/src/lxc/lxc_process.h @@ -50,6 +50,6 @@ int virLXCProcessValidateInterface(virDomainNetDefPtr net); char *virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, virDomainNetDefPtr net, const char *brname); -char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn, +char *virLXCProcessSetupInterfaceDirect(virLXCDriverPtr driver, virDomainDefPtr def, virDomainNetDefPtr net);