[node-patches] Change in ovirt-node[master]: The installer should run in dry mode as a normal user

rbarry at redhat.com rbarry at redhat.com
Wed Jul 23 04:31:38 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: The installer should run in dry mode as a normal user
......................................................................

The installer should run in dry mode as a normal user

Don't call commands which require root permissions in dry mode.
If we're not root, fake it.

Change-Id: I6fc6bcaad5f6c9e5ba3ba3c027981d7d8bbb0ba6
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/installer/core/storage_vol_page.py
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/10/30610/1

diff --git a/src/ovirt/node/installer/core/storage_vol_page.py b/src/ovirt/node/installer/core/storage_vol_page.py
index d001e9d..15ab9fe 100644
--- a/src/ovirt/node/installer/core/storage_vol_page.py
+++ b/src/ovirt/node/installer/core/storage_vol_page.py
@@ -21,7 +21,7 @@
 """
 Storage Volume page of the installer
 """
-
+import os
 from ovirt.node import plugins, ui, valid
 from ovirt.node.utils import process
 from ovirt.node.exceptions import InvalidData
@@ -160,9 +160,14 @@
 
     def __get_default_sizes(self):
         if self.application.args.dry:
-            cmd = "blockdev --getsize64 /dev/[sv]da"
-            stdout = process.check_output(cmd, shell=True)
-            self._drive_size = int(stdout) / 1024 / 1024
+            if os.geteuid() == 0:
+                cmd = "blockdev --getsize64 /dev/[sv]da"
+                stdout = process.check_output(cmd, shell=True)
+                self._drive_size = int(stdout) / 1024 / 1024
+            else:
+                # If we're not root and can't query the drive,
+                # pretend it's 5G
+                self._drive_size = 5242880
             return {"storage.efi_size": "%s" % presets.BOOT_SIZE,
                     "storage.root_size": "%s" % presets.ROOT_SIZE,
                     "storage.swap_size": "0",


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

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



More information about the node-patches mailing list