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 <[email protected]> --- 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 <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
