[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 7/6] net: Fix switching of transient domains to persistent



On 10/26/2012 08:58 AM, Peter Krempa wrote:
> When assigning the new persistent definition for a transient network
> (thus making it persistent) the network needs to be marked persistent
> before actually atempting to assign the definition.
> ---
>  src/network/bridge_driver.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 22bd99b..f0dbd66 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -2833,6 +2833,13 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
>      if (networkValidate(driver, def, false) < 0)
>         goto cleanup;
>
> +    /* make the network persistent if we're defininig it */
> +    if ((network = virNetworkFindByName(&driver->networks, def->name))) {
> +        network->persistent = 1;
> +        virNetworkObjUnlock(network);
> +        network = NULL;
> +    }
> +
>      if (!(network = virNetworkAssignDef(&driver->networks, def, false)))
>          goto cleanup;
>      freeDef = false;

It's a bit bothersome that this results in two back to back calls to
virNetworkFindByName(). Is there a reasonable way to enhance
virNetworkAssignDef() to do this instead?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]