summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2018-04-02 13:33:39 -0600
committerChad Smith <chad.smith@canonical.com>2018-04-02 13:33:39 -0600
commitc436e173c4162c940523a2978799193672ff9cd3 (patch)
tree55c043231e24fa05389a6099f3801f578a30ec6e /cloudinit/util.py
parenta510726d622b9d1768b5417d09277d5cc786e952 (diff)
downloadvyos-cloud-init-c436e173c4162c940523a2978799193672ff9cd3.tar.gz
vyos-cloud-init-c436e173c4162c940523a2978799193672ff9cd3.zip
cc_resizefs, util: handle no /dev/zfs
The zfs/zpool commands will hang for 10 seconds if /dev/zfs is not present (bug 1760173). This is a common occurence for containers using zfs as rootfs. Additionally handle missing zpool command or other errors that may occur while executing the zpool command.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 0ab2c484..acdc0d85 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2249,7 +2249,15 @@ def get_mount_info_freebsd(path):
def get_device_info_from_zpool(zpool):
- (zpoolstatus, err) = subp(['zpool', 'status', zpool])
+ # zpool has 10 second timeout waiting for /dev/zfs LP: #1760173
+ if not os.path.exists('/dev/zfs'):
+ LOG.debug('Cannot get zpool info, no /dev/zfs')
+ return None
+ try:
+ (zpoolstatus, err) = subp(['zpool', 'status', zpool])
+ except ProcessExecutionError as err:
+ LOG.warning("Unable to get zpool status of %s: %s", zpool, err)
+ return None
if len(err):
return None
r = r'.*(ONLINE).*'