[node-patches] Change in ovirt-node[master]: Add system.Filesystem.by_partlabel
rbarry at redhat.com
rbarry at redhat.com
Fri Nov 7 04:32:12 UTC 2014
Ryan Barry has uploaded a new change for review.
Change subject: Add system.Filesystem.by_partlabel
......................................................................
Add system.Filesystem.by_partlabel
UEFI+iSCSI booting requires finding a partition by partlabel
instead of label in order to find the grub config. Add a
convenience method.
Change-Id: I531adfce70f1a0f4977d454d8447315f2e2bea46
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/utils/system.py
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/12/34912/1
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 0d6a11d..6622a5b 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -838,6 +838,26 @@
LOGGER.debug("Failed to resolve disks: %s" % e.cmd, exc_info=True)
return fs
+ @staticmethod
+ def by_partlabel(partlabel):
+ """Determines whether a filesystem with a given partlabel is present on
+ this system
+ """
+ fs = None
+ try:
+ Filesystem._flush()
+ with open(os.devnull, 'wb') as DEVNULL:
+ device = process.check_output(["blkid", "-c", "/dev/null",
+ "-l", "-t",
+ "PARTLABEL=%s" % label],
+ stderr=DEVNULL).strip()
+
+ fs = Filesystem(device)
+
+ except process.CalledProcessError as e:
+ LOGGER.debug("Failed to resolve disks: %s" % e.cmd, exc_info=True)
+ return fs
+
def _tokens(self):
tokens = process.check_output(["blkid", "-o", "export", self.device])
return parse_varfile(tokens)
--
To view, visit http://gerrit.ovirt.org/34912
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I531adfce70f1a0f4977d454d8447315f2e2bea46
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