[node-patches] Change in ovirt-node[master]: fix iscsi upgrades
jboggs at redhat.com
jboggs at redhat.com
Wed Oct 30 17:33:23 UTC 2013
Joey Boggs has uploaded a new change for review.
Change subject: fix iscsi upgrades
......................................................................
fix iscsi upgrades
rhbz#885987
Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: I66825a90f76c2bea1aec0a13c6ed02d717b0e114
---
M src/ovirtnode/install.py
M src/ovirtnode/network.py
M src/ovirtnode/ovirtfunctions.py
3 files changed, 42 insertions(+), 29 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/24/20724/1
diff --git a/src/ovirtnode/install.py b/src/ovirtnode/install.py
index 542bce6..ebc3734 100755
--- a/src/ovirtnode/install.py
+++ b/src/ovirtnode/install.py
@@ -307,6 +307,9 @@
return True
self.oldtitle=None
grub_config_file = None
+ if _functions.findfs("Boot") and _functions.is_upgrade():
+ if not _functions.connect_iscsi_root():
+ return False
_functions.mount_liveos()
if os.path.ismount("/liveos"):
if os.path.exists("/liveos/vmlinuz0") \
@@ -352,7 +355,7 @@
self.oldtitle = self.oldtitle.replace('"','').strip(" {")
_functions.system("umount /liveos/efi")
_functions.system("umount /liveos")
- if _functions.is_iscsi_install():
+ if _functions.is_iscsi_install() or _functions.findfs("Boot"):
self.boot_candidate = None
boot_candidate_names = ["BootBackup", "BootUpdate", "BootNew"]
for trial in range(1, 3):
@@ -390,30 +393,6 @@
return False
_functions.system("mount %s /boot &>/dev/null" \
% boot_candidate_dev)
-
- if os.path.exists("/boot/ovirt"):
- try:
- f = open("/boot/ovirt", 'r')
- for line in f:
- try:
- line = line.strip()
- key, value = line.split("\"", 1)
- key = key.strip("=")
- key = key.strip()
- value = value.strip("\"")
- OVIRT_VARS[key] = value
- except:
- pass
- f.close()
- iscsiadm_cmd = (("iscsiadm -p %s:%s -m discovery -t " +
- "sendtargets") % (
- OVIRT_VARS["OVIRT_ISCSI_TARGET_IP"],
- OVIRT_VARS["OVIRT_ISCSI_TARGET_PORT"]))
- _functions.system(iscsiadm_cmd)
- logger.info("Restarting iscsi service")
- _functions.system("service iscsi restart")
- except:
- pass
candidate = None
candidate_names = ["RootBackup", "RootUpdate", "RootNew"]
diff --git a/src/ovirtnode/network.py b/src/ovirtnode/network.py
index 82761ed..53b3b73 100644
--- a/src/ovirtnode/network.py
+++ b/src/ovirtnode/network.py
@@ -19,20 +19,16 @@
from glob import glob
from ovirt.node.utils import Transaction
-from ovirtnode.ovirtfunctions import OVIRT_VARS
from pipes import quote
import logging
import os
-import ovirtnode.ovirtfunctions as _functions
import subprocess
import tempfile
-
logger = logging.getLogger(__name__)
class Network:
def __init__(self):
- OVIRT_VARS = _functions.parse_defaults()
self.WORKDIR = tempfile.mkdtemp()
self.IFSCRIPTS_PATH = "/etc/sysconfig/network-scripts/ifcfg-"
self.IFCONFIG_FILE_ROOT = "/files%s" % self.IFSCRIPTS_PATH
@@ -56,6 +52,12 @@
def convert_to_biosdevname():
+ try:
+ import ovirtnode.ovirtfunctions as _functions
+ except:
+ pass
+
+ OVIRT_VARS = _functions.parse_defaults()
if not "BIOSDEVNAMES_CONVERSION" in OVIRT_VARS:
# check for appropriate bios version
cmd="dmidecode|grep SMBIOS|awk {'print $2'}"
diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index a81d642..0d91824 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -40,6 +40,8 @@
from ovirt.node.config import defaults
from ovirt.node.utils import process
import ovirt.node.utils.system as osystem
+from ovirt.node.utils.console import TransactionProgress, Transaction
+from ovirtnode.network import *
OVIRT_CONFIG="/config"
OVIRT_LOGFILE="/var/log/ovirt.log"
@@ -594,10 +596,23 @@
system_closefds("mkdir -p /boot")
system_closefds("mount LABEL=Boot /boot &>/dev/null")
+class ConfigureNetworking(Transaction.Element):
+ title = "Configuring network"
+
+ def commit(self):
+ build_network_auto_transaction().run()
+
+def enable_iscsi_networking():
+ tx = Transaction("Enable Networking")
+ tx.append(ConfigureNetworking())
+ TransactionProgress(tx, is_dry=False).run()
+
+
def connect_iscsi_root():
mount_boot()
if os.path.exists("/boot/ovirt"):
try:
+ logger.debug(os.listdir("/boot"))
f = open("/boot/ovirt", 'r')
for line in f:
try:
@@ -606,11 +621,21 @@
key = key.strip("=")
key = key.strip()
value = value.strip("\"")
+ logger.info("%s : %s" % (key,value))
if not "FIRSTBOOT" in key and not "INSTALL" in key:
OVIRT_VARS[key] = value
+ if "BOOTIF" in key:
+ augtool("set",
+ "/files/etc/default/ovirt/OVIRT_BOOTIF",
+ "\"%s\"" % value)
+ if "BOOTPROTO" in key:
+ augtool("set",
+ "/files/etc/default/ovirt/OVIRT_BOOTPROTO",
+ "\"%s\"" % value)
except:
pass
f.close()
+ enable_iscsi_networking()
if is_firstboot() or is_upgrade() or is_install() \
or not is_booted_from_local_disk():
iscsiadm_cmd = (("iscsiadm -p %s:%s -m discovery -t " +
@@ -625,9 +650,16 @@
system(login_cmd)
logger.info("Restarting iscsi service")
system("service iscsi restart")
+ system("pvscan")
+ system("vgscan")
+ system("vgchange -ay")
except:
logger.info("Unable to connect to iscsi root")
+ if not findfs("Root"):
+ return False
+ return True
+
# stop any service which keeps /var/log busy
# keep the list of services
def unmount_logging_services():
--
To view, visit http://gerrit.ovirt.org/20724
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I66825a90f76c2bea1aec0a13c6ed02d717b0e114
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>
More information about the node-patches
mailing list