Cole Robinson wrote:
We aren't setting the persistent bit when a network is defined,
so
'destroy' makes them disappear (though they will reappear later since
their persistent config is never removed).
Attached patch fixes this.
Hi Cole,
Looks like you're on the right track.
My reflex was to test for it...
What before/after behavior change should I see?
I tried this:
cat <<EOF > net.xml
<network>
<name>N</name>
<ip address="192.168.199.1"
netmask="255.255.255.0"></ip>
</network>
EOF
qemud/libvirtd &
src/virsh 'net-define net.xml; net-destroy N; net-list'
Then net-dumpxml N shows it's still there, as it should be.
Of course, net-undefine does get rid of it for good, but you mentioned
"destroy" above.
Did I miss something?
diff --git a/src/network_conf.c b/src/network_conf.c
index e19f0fe..6ad0d01 100644
--- a/src/network_conf.c
+++ b/src/network_conf.c
@@ -747,6 +747,7 @@ virNetworkObjPtr virNetworkLoadConfig(virConnectPtr conn,
goto error;
net->autostart = autostart;
+ net->persistent = 1;
VIR_FREE(configFile);
VIR_FREE(autostartLink);
diff --git a/src/network_driver.c b/src/network_driver.c
index 3c765c8..4b9c666 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -1153,6 +1153,8 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char
*xml) {
goto cleanup;
def = NULL;
+ network->persistent = 1;
+
if (virNetworkSaveConfig(conn,
driver->networkConfigDir,
network->newDef ? network->newDef : network->def)
< 0) {