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

Re: [libvirt] [PATCH 2/2] network: bridge_driver: don't lose transient networks on daemon restart



On Wed, Apr 17, 2013 at 10:40:45AM +0200, Peter Krempa wrote:
> Until now tranisent networks weren't really useful as libvirtd wasn't
> able to remember them across restarts. This patch adds support for
> loading status files of transient networks (that already were generated)
> so that the status isn't lost.
> 
> This patch chops up virNetworkObjUpdateParseFile and turns it into
> virNetworkLoadState and a few friends that will help us to load status
> XMLs and refactors the functions that are loading the configs to use
> them.
> ---
>  src/conf/network_conf.c     | 220 +++++++++++++++++++++++++++++---------------
>  src/conf/network_conf.h     |  10 +-
>  src/libvirt_private.syms    |   2 +-
>  src/network/bridge_driver.c |  51 ++++++----
>  4 files changed, 184 insertions(+), 99 deletions(-)


> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index bca6bd9..56af108 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -416,6 +421,10 @@ networkStartup(bool privileged,
>      /* if this fails now, it will be retried later with dnsmasqCapsRefresh() */
>      driverState->dnsmasqCaps = dnsmasqCapsNewFromBinary(DNSMASQ);
> 
> +    if (virNetworkLoadAllState(&driverState->networks,
> +                               NETWORK_STATE_DIR) < 0)
> +        goto error;
> +
>      if (virNetworkLoadAllConfigs(&driverState->networks,
>                                   driverState->networkConfigDir,
>                                   driverState->networkAutostartDir) < 0)
> @@ -480,6 +489,8 @@ networkReload(void) {
>          return 0;
> 
>      networkDriverLock(driverState);
> +    virNetworkLoadAllState(&driverState->networks,
> +                           NETWORK_STATE_DIR);
>      virNetworkLoadAllConfigs(&driverState->networks,
>                               driverState->networkConfigDir,
>                               driverState->networkAutostartDir);

This has broken launching of libvirtd as non-root, since you cannot
access NETWORK_STATE_DIR - it should be looking under $HOME

$ ./daemon/libvirtd
2013-05-02 15:37:09.753+0000: 14422: info : libvirt version: 1.0.5
2013-05-02 15:37:09.753+0000: 14422: error : virNetworkLoadAllState:2671 : Failed to open dir '/var/lib/libvirt/network': Permission denied
2013-05-02 15:37:09.753+0000: 14422: error : virStateInitialize:837 : Initialization of Network state driver failed
2013-05-02 15:37:09.753+0000: 14422: error : daemonRunStateInit:879 : Driver state initialization failed

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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