[node-patches] Change in ovirt-node[master]: migration: Move migration script to boot

fabiand at redhat.com fabiand at redhat.com
Fri Jul 18 15:48:51 UTC 2014


Fabian Deutsch has uploaded a new change for review.

Change subject: migration: Move migration script to boot
......................................................................

migration: Move migration script to boot

We reduce the config migration to one point - during boot.
The script is run once, this is ensure by only running this script if
OVIRT_CONFIG_VERSION is not present in /etc/default/ovirt.
In future we need to enhance this logic.

The previous calls to the migration script were removed to simplify the
testing.

Change-Id: Id3dce11ce0005ddc12d9fd2fec2792ff1e87513c
Signed-off-by: Fabian Deutsch <fabiand at redhat.com>
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirt-functions.in
M scripts/ovirt-init-functions.sh.in
M scripts/ovirt-node-upgrade.py
M src/ovirt/node/config/defaults.py
M src/ovirt/node/installer/core/progress_page.py
5 files changed, 25 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/41/30441/1

diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index b4c7560..435678e 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -1166,6 +1166,16 @@
     _pyovirtfunctions "create_minimal_etc_hosts_file()"
 }
 
+migrate_node_config ()
+{
+    python <<EOP
+from ovirt.node.config import migrate
+m = migrate.ConfigMigrationRunner()
+m.run_if_necessary()
+EOP
+}
+
+
 load_keyboard_config ()
 {
     python <<EOP
diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index a68026f..36c691f 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -183,7 +183,7 @@
 install = Install()
 install.ovirt_boot_setup()
 from ovirt.node.config import migrate
-migrate.MigrateConfigs().translate_all()
+migrate.ConfigMigrationRunner().run_if_necessary()
 EOP
                 fi
             fi
@@ -1225,8 +1225,6 @@
 from ovirtnode.install import Install
 install = Install()
 install.ovirt_boot_setup()
-from ovirt.node.config import migrate
-migrate.MigrateConfigs().translate_all()
 EOP
         fi
         if [ $? -ne 0 ]; then
@@ -1367,6 +1365,9 @@
         umount ${logsync_TMPDIR}/squash
         rm -rf ${logsync_TMPDIR}
 
+        # Migrate config files if needed
+        migrate_node_config
+
         # Re-load keyboard settings
         load_keyboard_config
 
diff --git a/scripts/ovirt-node-upgrade.py b/scripts/ovirt-node-upgrade.py
index bc354f1..fc668ef 100755
--- a/scripts/ovirt-node-upgrade.py
+++ b/scripts/ovirt-node-upgrade.py
@@ -255,10 +255,6 @@
         if not upgrade.ovirt_boot_setup():
             raise RuntimeError("Bootloader Installation Failed")
 
-        sys.path.append(self._python_lib + "/site-packages/")
-        from ovirt.node.config import migrate
-        migrate.MigrateConfigs().translate_all()
-
     def _cleanup(self):
         self._logger.info("Cleaning up temporary directory")
         try:
diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 01c21c3..4ed9f9a 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -201,6 +201,17 @@
         return wrapper
 
 
+class ConfigVersion(NodeConfigFileSection):
+    """Keep the ovirt-node version in the config for which this config is
+    intended
+    """
+    keys = ("OVIRT_CONFIG_VERSION", )
+
+    @NodeConfigFileSection.map_and_update_defaults_decorator
+    def update(self, ver):
+        pass
+
+
 class Network(NodeConfigFileSection):
     """Sets network stuff
     - OVIRT_BOOTIF
diff --git a/src/ovirt/node/installer/core/progress_page.py b/src/ovirt/node/installer/core/progress_page.py
index 05e4869..4eeda6f 100644
--- a/src/ovirt/node/installer/core/progress_page.py
+++ b/src/ovirt/node/installer/core/progress_page.py
@@ -175,7 +175,6 @@
             tx.title = "Update"
             tx += [self.InstallImageAndBootloader()]
             tx += [self.SetKeyboardLayout(cfg["keyboard.layout"])]
-            tx += [self.MigrateConfigs()]
             new_password = cfg.get("upgrade.password", None)
             if new_password:
                 tx += [self.SetPassword(new_password)]


-- 
To view, visit http://gerrit.ovirt.org/30441
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3dce11ce0005ddc12d9fd2fec2792ff1e87513c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list