[node-patches] Change in ovirt-node[node-3.0]: Move "yes | lvcreate" and umounting to 3.4

rbarry at redhat.com rbarry at redhat.com
Fri Oct 24 17:52:13 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Move "yes | lvcreate" and umounting to 3.4
......................................................................

Move "yes | lvcreate" and umounting to 3.4

lvcreate prompting appears to have been moved into 6.6, so answer
the prompt. Additionally, pre-emptively umount before creating in
case the changes from EL7 which require doing so make it back.

Change-Id: I1e7ed8172d891f3dab764e524624a5cf7cd32003
Signed-off-by: Ryan Barry <rbarry at rbarry.phresus.priv>
---
M src/ovirtnode/storage.py
1 file changed, 13 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/54/34454/1

diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py
index f37ef40..72c7f72 100644
--- a/src/ovirtnode/storage.py
+++ b/src/ovirtnode/storage.py
@@ -508,7 +508,7 @@
             drv_count = drv_count + 1
         if self.SWAP_SIZE > 0:
             logger.info("Creating swap partition")
-            _functions.system("lvcreate --name Swap --size " + \
+            _functions.system("yes | lvcreate --name Swap --size " +
                               str(self.SWAP_SIZE) + "M /dev/HostVG")
             _functions.system("mkswap -L \"SWAP\" /dev/HostVG/Swap")
             _functions.system_closefds("echo \"/dev/HostVG/Swap swap swap " +
@@ -520,15 +520,15 @@
                                 "\" >> /etc/ovirt-crypttab")
         if self.CONFIG_SIZE > 0:
             logger.info("Creating config partition")
-            _functions.system("lvcreate --name Config --size " +
-                    str(self.CONFIG_SIZE) + "M /dev/HostVG")
+            _functions.system("yes | lvcreate --name Config --size " +
+                              str(self.CONFIG_SIZE) + "M /dev/HostVG")
             _functions.system("mke2fs -j -t ext4 /dev/HostVG/Config " + \
                               "-L \"CONFIG\"")
             _functions.system("tune2fs -c 0 -i 0 /dev/HostVG/Config")
         if self.LOGGING_SIZE > 0:
             logger.info("Creating log partition")
-            _functions.system("lvcreate --name Logging --size " +
-                    str(self.LOGGING_SIZE) + "M /dev/HostVG")
+            _functions.system("yes | lvcreate --name Logging --size " +
+                              str(self.LOGGING_SIZE) + "M /dev/HostVG")
             _functions.system("mke2fs -j -t ext4 /dev/HostVG/Logging " + \
                               "-L \"LOGGING\"")
             _functions.system("tune2fs -c 0 -i 0 /dev/HostVG/Logging")
@@ -538,11 +538,12 @@
         use_data = 1
         if self.DATA_SIZE == -1:
             logger.info("Creating data partition with remaining free space")
-            _functions.system("lvcreate --name Data -l 100%FREE /dev/HostVG")
+            _functions.system("yes | lvcreate --name Data -l "
+                              "100%FREE /dev/HostVG")
             use_data = 0
         elif self.DATA_SIZE > 0:
             logger.info("Creating data partition")
-            _functions.system("lvcreate --name Data --size " + \
+            _functions.system("yes | lvcreate --name Data --size " +
                               str(self.DATA_SIZE) + "M /dev/HostVG")
             use_data = 0
         if use_data == 0:
@@ -673,7 +674,7 @@
 
         if self.SWAP2_SIZE > 0:
             logger.info("Creating swap2 partition")
-            lv_cmd = ("lvcreate --name Swap2 --size \"" +
+            lv_cmd = ("yes | lvcreate --name Swap2 --size \"" +
                       str(self.SWAP2_SIZE) + "M\" /dev/AppVG")
             logger.debug(lv_cmd)
             _functions.system(lv_cmd)
@@ -690,11 +691,11 @@
         use_data = "1"
         if self.DATA2_SIZE == -1:
             logger.info("Creating data2 partition with remaining free space")
-            _functions.system("lvcreate --name Data2 -l 100%FREE /dev/AppVG")
+            _functions.system("yes | lvcreate --name Data2 -l 100%FREE /dev/AppVG")
             use_data = 0
         elif self.DATA2_SIZE > 0:
             logger.info("Creating data2 partition")
-            _functions.system("lvcreate --name Data2 --size " + \
+            _functions.system("yes | lvcreate --name Data2 --size " + \
                               str(self.DATA2_SIZE) +
                    "M /dev/AppVG")
             use_data = 0
@@ -882,10 +883,12 @@
             if not os.path.exists(partroot):
                 partroot = self.ROOTDRIVE + "p2"
                 partrootbackup = self.ROOTDRIVE + "p3"
+            _functions.system("umount -l " + partroot)
             _functions.system("mke2fs \"" + partroot + "\" -L Root")
             _functions.system("tune2fs -c 0 -i 0 \"" + partroot + "\"")
             _functions.system("ln -snf \"" + partrootbackup +
                    "\" /dev/disk/by-label/RootBackup")
+            _functions.system("umount -l " + partrootbackup)
             _functions.system("mke2fs \"" + partrootbackup + \
                               "\" -L RootBackup")
             _functions.system("tune2fs -c 0 -i 0 \"" + partrootbackup + "\"")


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e7ed8172d891f3dab764e524624a5cf7cd32003
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list