Anatoly Litovsky has uploaded a new change for review. Change subject: Reinstall will now overpower major version mismatch ......................................................................
Reinstall will now overpower major version mismatch Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1162445 Change-Id: I435113d4dcf69121e1956acc653344d1b052edb9 Signed-off-by: Tolik Litovsky <[email protected]> --- M src/ovirt/node/installer/core/welcome_page.py M src/ovirt/node/utils/system.py 2 files changed, 45 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/03/35403/1 diff --git a/src/ovirt/node/installer/core/welcome_page.py b/src/ovirt/node/installer/core/welcome_page.py index 0d439fc..2e2b918 100644 --- a/src/ovirt/node/installer/core/welcome_page.py +++ b/src/ovirt/node/installer/core/welcome_page.py @@ -21,6 +21,7 @@ from ovirt.node import plugins, ui, utils from ovirt.node.utils import virt, system import os +from ovirt.node.utils.system import is_reinstall """ Welcome page of the installer @@ -92,9 +93,13 @@ media = utils.system.InstallationMedia() installed = utils.system.InstalledMedia() is_installed = installed.available() - if is_installed and (media.version_major != installed.version_major): - block_upgrade = True - elif utils.system.has_hostvg(): + + if not is_reinstall(): + if is_installed and \ + (media.version_major != installed.version_major): + block_upgrade = True + + if utils.system.has_hostvg(): has_hostvg = True if os.path.exists("/dev/disk/by-label/ROOT"): block_upgrade = True diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py index 5955a8b..406403f 100644 --- a/src/ovirt/node/utils/system.py +++ b/src/ovirt/node/utils/system.py @@ -127,6 +127,40 @@ in ["rescue", "S", "single", "1"]) +def is_reinstall(_c=None): + """is the system is in reinstalling mode + + >>> is_reinstall("foo bar reinstall z") + True + >>> is_reinstall("foo bar reinstall=1 z") + True + >>> is_reinstall("foo bar reinstall=0 z") + False + + >>> is_reinstall("foo bar firstboot") + True + >>> is_reinstall("foo bar firstboot=1 z") + True + >>> is_reinstall("foo bar firstboot=0 z") + False + + We are also conservative, if contradiction assume False: + + >>> is_reinstall("reinstall=1 firstboot=0 z") + False + + >>> is_reinstall("foo bar z") + False + """ + flags = ["firstboot", "reinstall"] + cmdline = kernel_cmdline_arguments(_c) + + is_given = any(f in cmdline for f in flags) + not_denies = all(cmdline.get(f, 1) != "0" for f in flags) + + return (is_given and not_denies) + + def node_version(): """Return the version of the ovirt-node package This is the package version at runtime @@ -207,10 +241,11 @@ return os.path.exists("/dev/HostVG") -def kernel_cmdline_arguments(): +def kernel_cmdline_arguments(cmdline=None): """Return the arguments of the currently booted kernel """ - return _parse_cmdline_args(File("/proc/cmdline").read()) + cmdline = cmdline or File("/proc/cmdline").read() + return _parse_cmdline_args(cmdline) def _parse_cmdline_args(cmdline): -- To view, visit http://gerrit.ovirt.org/35403 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I435113d4dcf69121e1956acc653344d1b052edb9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Anatoly Litovsky <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
