On 03/08/2014 02:27 AM, Aline Manera wrote:

So when starting kimchi we just need to make sure the default network/storage pool are active.
And activate them if needed.
For nested virtualization, the default network will fail to activate as the address is already in use.
In this case, we can get the properly error and automatically edit the default network for the user to get an unused address.

So the steps to close issue #302 are:
1) Check if libvirt creates the default network/storage pool by default
    1.1) If so, remove this code from kimchi code

Actually,  there are 2 issues about "default" network/storage pool on git hub.
https://github.com/kimchi-project/kimchi/issues/56
https://github.com/kimchi-project/kimchi/issues/24

Here is some history about these bugs:
From adam:
Recently I have found that some distributions (Fedora 17+) separate the network config into another package. On Fedora it's libvirt-daemon-config-network. Can you just check if adding that as a package dependency will resolve the problem? If so, let's find out if the same solution will resolve the problem of the missing default storage pool.

From BingBu:
'libvirt-daemon-config-network' package is in the libvirt deplist, so if you installed the libvirt, the libvirt-daemon-config-network is installed as as well. I don't think we should add it to the dependency.

From Aline:
I've already gotten an error about the network default was not active.
It should be good to know which networks are available and active.

I also send a patch to fix this patch.
[project-kimchi] [PATCH] bug fix: Add a default network if no network exists

But I give up for:
1. as Bingbu comments:
we should avoid hard code.
2. as Bingbu investigation:
'libvirt-daemon-config-network' package is in the libvirt deplist
3. we can make use the network REST API,  networks_create method.

But later another similar patch was sent and merged, it introduce hard code.
[project-kimchi] [PATCH 4/4] Create default network if it does not exist
commit 71a3a88.

I really do not know why this patch was merged, though some of us do not think this patch is well.
So here I just fixed the #302 introduce by 71a3a88, remove the hard code to avoid some bugs.

2) On Kimchi start up, make sure default network/storage pool are active.
    2.1) If network activate fails because of the address is already in use, kimchi automatically update the network address and start it.



-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center