[node-patches] Change in ovirt-node[master]: sync missed patch in upstream

hadong0720 at gmail.com hadong0720 at gmail.com
Tue Jul 15 12:03:07 UTC 2014


hadong has uploaded a new change for review.

Change subject: sync missed patch in upstream
......................................................................

sync missed patch in upstream

The follow three patches in downstream were missed in upstream:
https://code.engineering.redhat.com/gerrit/#/c/18401/
https://code.engineering.redhat.com/gerrit/#/c/18511/
https://code.engineering.redhat.com/gerrit/#/c/18455/
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1119620
Change-Id: Idb68943d07f8324d70be6a1599a810c8f2bf7f04
Signed-off-by: hadong <hadong at redhat.com>
---
M scripts/ovirt-auto-install.py
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
M src/ovirt/node/utils/system.py
7 files changed, 48 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/94/30094/1

diff --git a/scripts/ovirt-auto-install.py b/scripts/ovirt-auto-install.py
index 287b7da..8d9b5c5 100755
--- a/scripts/ovirt-auto-install.py
+++ b/scripts/ovirt-auto-install.py
@@ -35,6 +35,13 @@
 import time
 
 
+class PrepareInstallation(Transaction.Element):
+    title = "Prepare installation"
+
+    def commit(self):
+        defaults.ConfigVersion().set_to_current()
+
+
 class ConfigureNetworking(Transaction.Element):
     title = "Configuring network"
 
@@ -214,6 +221,8 @@
 
     tx = Transaction("Automatic Installation")
 
+    tx.append(PrepareInstallation())
+
     # setup network before storage for iscsi installs
     if is_iscsi_install():
         tx.append(ConfigureNetworking())
diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index b4c7560..d6bc533 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -1166,6 +1166,15 @@
     _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 49cc2dc..d5227ca 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -182,8 +182,6 @@
 from ovirtnode.install import Install
 install = Install()
 install.ovirt_boot_setup()
-from ovirt.node.config import migrate
-migrate.MigrateConfigs().translate_all()
 EOP
                 fi
             fi
@@ -1226,7 +1224,7 @@
 install = Install()
 install.ovirt_boot_setup()
 from ovirt.node.config import migrate
-migrate.MigrateConfigs().translate_all()
+migrate.ConfigMigrationRunner().run_if_necessary()
 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..54d35c3 100755
--- a/scripts/ovirt-node-upgrade.py
+++ b/scripts/ovirt-node-upgrade.py
@@ -255,9 +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")
diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 01c21c3..04a1a6f 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -201,6 +201,22 @@
         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
+
+    def set_to_current(self):
+        curver = system.node_version()
+        self.logger.debug("Setting config version to: %s" % curver)
+        self.update(curver)
+
+
 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..17dbff8 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)]
@@ -228,6 +227,9 @@
 
             kbd = defaults.Keyboard()
             kbd.update(self.config["keyboard.layout"])
+
+            vercfg = defaults.ConfigVersion()
+            vercfg.set_to_current()
 
         def commit(self):
             pass
@@ -295,15 +297,6 @@
             tx = model.transaction()
             tx()
 
-    class MigrateConfigs(utils.Transaction.Element):
-        title = "Migrating configuration data"
-
-        def __init__(self):
-            super(InstallerThread.MigrateConfigs, self).__init__()
-
-        def commit(self):
-            from ovirt.node.config import migrate
-            migrate.MigrateConfigs().translate_all()
 
     class ClearNetworkConfig(utils.Transaction.Element):
         title = "Resetting network configuration"
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 53cbd0e..214673c 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -115,6 +115,13 @@
                in ["rescue", "S", "single", "1"])
 
 
+def node_version():
+    """Return the version of the ovirt-node package
+    This is the package version at runtime
+    """
+    return RpmPackage("ovirt-node").nvr().version
+
+
 def _parse_lscpu(data):
     """Parse the lines of the lscpu output
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb68943d07f8324d70be6a1599a810c8f2bf7f04
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list