[Kimchi-devel] [PATCH V4 1/3] Fix non persistent network handling (backend)

Aline Manera alinefm at linux.vnet.ibm.com
Tue Apr 1 18:02:43 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 03/27/2014 05:35 PM, Rodrigo Trujillo wrote:
> If some network is not persistent and the user tries to stop it, it is
> going to be removed by libvirt and causes an error in Kimchi.
> This patch changes the backend in order to get persistent information.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   docs/API.md                    | 2 ++
>   src/kimchi/control/networks.py | 3 ++-
>   src/kimchi/model/networks.py   | 3 ++-
>   3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/docs/API.md b/docs/API.md
> index 65044f8..630015e 100644
> --- a/docs/API.md
> +++ b/docs/API.md
> @@ -503,6 +503,8 @@ A interface represents available interface on host.
>       * interface: The name of a bridge network interface on the host.  All traffic
>                    on this network will be bridged through the indicated interface.
>                    The interface is a bridge or ethernet/bonding device.
> +    * persistent: If 'true', network will persist after a system reboot or be stopped.
> +                  All networks created by Kimchi are persistent.
>
>   * **DELETE**: Remove the Network
>   * **POST**: *See Network Actions*
> diff --git a/src/kimchi/control/networks.py b/src/kimchi/control/networks.py
> index 95e8523..b905891 100644
> --- a/src/kimchi/control/networks.py
> +++ b/src/kimchi/control/networks.py
> @@ -45,4 +45,5 @@ class Network(Resource):
>                   'interface': self.info['interface'],
>                   'subnet': self.info['subnet'],
>                   'dhcp': self.info['dhcp'],
> -                'state': self.info['state']}
> +                'state': self.info['state'],
> +                'persistent': self.info['persistent']}
> diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
> index 7872a73..63f3136 100644
> --- a/src/kimchi/model/networks.py
> +++ b/src/kimchi/model/networks.py
> @@ -233,7 +233,8 @@ class NetworkModel(object):
>                   'vms': self._get_vms_attach_to_a_network(name),
>                   'in_use': self._is_network_in_use(name),
>                   'autostart': network.autostart() == 1,
> -                'state':  network.isActive() and "active" or "inactive"}
> +                'state':  network.isActive() and "active" or "inactive",
> +                'persistent': True if network.isPersistent() else False}
>
>       def _is_network_in_use(self, name):
>           # The network "default" is used for Kimchi proposal and should not be




More information about the Kimchi-devel mailing list