summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-02-04 13:51:09 -0500
committerScott Moser <smoser@ubuntu.com>2011-02-04 13:51:09 -0500
commita91f183856451ed6916b512d314da7374f1af8c8 (patch)
treebfcc89b3d5a0053ec9acdbbe932e497b1c128648
parent02de945c8e8c7ac20cc7b87e01a254a85c87728b (diff)
downloadvyos-cloud-init-a91f183856451ed6916b512d314da7374f1af8c8.tar.gz
vyos-cloud-init-a91f183856451ed6916b512d314da7374f1af8c8.zip
First try to read from cdrom device before mounting
mount was taking 18 seconds when there was no media on a kvm guest. a simple read should be about as quick as we can fail. The only other thing to try would be to use cdrom.h and ioctl for CDROM_DRIVE_STATUS.
-rw-r--r--cloudinit/DataSourceOVF.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cloudinit/DataSourceOVF.py b/cloudinit/DataSourceOVF.py
index a126c8bd..a0c53c69 100644
--- a/cloudinit/DataSourceOVF.py
+++ b/cloudinit/DataSourceOVF.py
@@ -201,6 +201,15 @@ def transport_iso9660(require_iso=False):
if fullp in mounted or not cdmatch.match(dev) or os.path.isdir(fullp):
continue
+ fp = None
+ try:
+ fp = open(fullp, "rb")
+ fp.read(512)
+ fp.close()
+ except:
+ if fp: fp.close()
+ continue
+
if tmpd is None:
tmpd = tempfile.mkdtemp()
if dvnull is None: