From a91f183856451ed6916b512d314da7374f1af8c8 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Feb 2011 13:51:09 -0500 Subject: 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. --- cloudinit/DataSourceOVF.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cloudinit') 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: -- cgit v1.2.3