Dan Kenigsberg has uploaded a new change for review.
Change subject: Quarantine ovirt-3.0.0 network upgrade
......................................................................
Quarantine ovirt-3.0.0 network upgrade
Since ovirt-3.0.z, Vdsm uses libvirt networks (with names vdsm-*) to store
its own networks. Older Vdsms did not have those defined, and used only
Linux bridges. _syncLibvirtNetworks created a vdsm-bla network for every
bridge named bla, even if that bridge had nothing to do with ovirt.
This patch replaces _syncLibvirtNetworks with a help script that does
this conversion on the rare occasion that upgrade is needed. It
identifies this occasion by the existence of ovirtmgmt bridge
and nonexistence of a vdsm-ovirtmgmt network.
Moving the code to a separate script would make it easier to get rid of
it once ovirt-3.0.0 hosts are no longer supported.
Change-Id: Icb2ffff1715dc3b92fc6c198dbb4c49f0bbef0cb
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M debian/vdsm.install
M init/vdsmd_init_common.sh.in
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/clientIF.py
A vdsm/upgrade-3.0.0-networks
6 files changed, 63 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/20803/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index 55464a3..442ed2a 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -126,6 +126,7 @@
./usr/share/vdsm/supervdsm.py
./usr/share/vdsm/supervdsmServer
./usr/share/vdsm/tc.py
+./usr/share/vdsm/upgrade-3.0.0-networks
./usr/share/vdsm/vdsm
./usr/share/vdsm/vdsm-restore-net-config
./usr/share/vdsm/vdsm-store-net-config
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 43a86ef..8470a03 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -199,6 +199,10 @@
fi
return 0
}
+
+task_upgrade_300_nets(){
+ "@VDSMDIR(a)/upgrade-3.0.0-networks"
+}
#### pre-start tasks end ####
@@ -246,6 +250,7 @@
test_lo \
test_conflicting_conf \
restore_nets \
+ upgrade_300_nets \
"
;;
--post-stop)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 34bdc2d..3ae7102 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -833,6 +833,7 @@
%{_datadir}/%{vdsm_name}/supervdsmServer
%{_datadir}/%{vdsm_name}/vmChannels.py*
%{_datadir}/%{vdsm_name}/tc.py*
+%{_datadir}/%{vdsm_name}/upgrade-3.0.0-networks
%{_datadir}/%{vdsm_name}/vdsm
%{_datadir}/%{vdsm_name}/vdsm-restore-net-config
%{_datadir}/%{vdsm_name}/vdsm-store-net-config
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 7fd9ead..3975adf 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -85,6 +85,7 @@
get-conf-item \
set-conf-item \
supervdsmServer \
+ upgrade-3.0.0-networks \
vdsm \
vdsm-restore-net-config \
$(NULL)
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 47851b1..9e2f1b4 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -38,7 +38,6 @@
import vm
from vdsm import constants
from vdsm import utils
-from netconf import ifcfg
import caps
from vmChannels import Listener
from vm import Vm
@@ -196,27 +195,6 @@
self.log.warn("MOM is not available, fallback to KsmMonitor")
self.ksmMonitor = ksm.KsmMonitorThread(self)
-
- def _syncLibvirtNetworks(self):
- """
- function is mostly for upgrade from versions that did not
- have a libvirt network per vdsm network
- """
- # add libvirt networks
- nets = netinfo.networks()
- bridges = netinfo.bridges()
- configWriter = ifcfg.ConfigWriter()
- for bridge in bridges:
- if not bridge in nets:
- configWriter.createLibvirtNetwork(network=bridge,
- bridged=True,
- skipBackup=True)
- # remove bridged networks that their bridge not exists
- #TODO:
- # this should probably go into vdsm-restore-net script
- for network in nets:
- if nets[network]['bridged'] and network not in bridges:
- configWriter.removeLibvirtNetwork(network, skipBackup=True)
def prepareForShutdown(self):
"""
@@ -405,7 +383,6 @@
return {'status': doneCode, 'vmList': vm.status()}
def _initializingLibvirt(self):
- self._syncLibvirtNetworks()
mog = min(config.getint('vars', 'max_outgoing_migrations'),
caps.CpuTopology().cores())
vm.MigrationSourceThread.setMaxOutgoingMigrations(mog)
diff --git a/vdsm/upgrade-3.0.0-networks b/vdsm/upgrade-3.0.0-networks
new file mode 100644
index 0000000..8c3453a
--- /dev/null
+++ b/vdsm/upgrade-3.0.0-networks
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+#
+# Copyright 2011-2013 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+"""
+Since ovirt-3.0, Vdsm uses libvirt networks (with names vdsm-*) to store its
+own networks. Older Vdsms did not have those defined, and used only linux
+bridges. This script is kept as an upgrade tool for the (very few) people who
+still have such old setups running.
+"""
+
+from vdsm import netinfo
+from vdsm.constants import MANAGEMENT_NETWORK
+
+from netconf import ifcfg
+
+def upgrade():
+ nets = netinfo.networks()
+ bridges = netinfo.bridges()
+ if (MANAGEMENT_NETWORK in nets or
+ MANAGEMENT_NETWORK not in bridges):
+ # upgrade has been done or was never needed
+ return
+
+ configWriter = ifcfg.ConfigWriter()
+ for bridge in bridges:
+ if not bridge in nets:
+ configWriter.createLibvirtNetwork(network=bridge,
+ bridged=True,
+ skipBackup=True)
+
+ # remove bridged networks that their bridge not exists
+ for network in nets:
+ if nets[network]['bridged'] and network not in bridges:
+ configWriter.removeLibvirtNetwork(network, skipBackup=True)
+
+if __name__ == '__main__':
+ upgrade()
--
To view, visit
http://gerrit.ovirt.org/20803
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb2ffff1715dc3b92fc6c198dbb4c49f0bbef0cb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>