summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2010-08-21 13:07:03 +0100
committerJustin Santa Barbara <justin@fathomdb.com>2010-08-21 13:07:03 +0100
commit759bab6059ef2e4c463a73e12fe85fe4b147eba7 (patch)
tree14ae3729ac413a1530d49eb565fe2067ab0316de /nova/compute
parentb824cfc50f793ea2caf867999cbadc61ad4a02d8 (diff)
downloadnova-759bab6059ef2e4c463a73e12fe85fe4b147eba7.tar.gz
nova-759bab6059ef2e4c463a73e12fe85fe4b147eba7.tar.xz
nova-759bab6059ef2e4c463a73e12fe85fe4b147eba7.zip
Clarified what the 'Mapped device not found' exception really means.
Fixed TODO. Some formatting to be closer to 80 chars
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/disk.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/nova/compute/disk.py b/nova/compute/disk.py
index 6099eb4ba..4ede9a7aa 100644
--- a/nova/compute/disk.py
+++ b/nova/compute/disk.py
@@ -87,7 +87,9 @@ def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None):
@defer.inlineCallbacks
-def inject_data(image, key=None, net=None, dns=None, remove_network_udev=False, partition=None, execute=None):
+def inject_data( image, key=None, net=None, dns=None,
+ remove_network_udev=False,
+ partition=None, execute=None):
"""Injects a ssh key and optionally net data into a disk image.
it will mount the image as a fully partitioned disk and attempt to inject
@@ -111,8 +113,12 @@ def inject_data(image, key=None, net=None, dns=None, remove_network_udev=False,
else:
mapped_device = device
+ # We can only loopback mount raw images. If the device isn't there,
+ # it's normally because it's a .vmdk or a .vdi etc
if not os.path.exists(mapped_device):
- raise exception.Error('Mapped device was not found: %s' % mapped_device)
+ raise exception.Error(
+ 'Mapped device was not found (we can only inject raw disk images): %s'
+ % mapped_device)
# Configure ext2fs so that it doesn't auto-check every N boots
out, err = yield execute('sudo tune2fs -c 0 -i 0 %s' % mapped_device)
@@ -172,7 +178,9 @@ def _inject_dns_into_fs(dns, fs, execute=None):
@defer.inlineCallbacks
def _remove_network_udev(fs, execute=None):
- # This is correct for Ubuntu, but might not be right for other distros
+ # TODO(justinsb): This is correct for Ubuntu, but might not be right for
+ # other distros. There is a much bigger discussion to be had about what
+ # we inject and how we inject it.
rulesfile = os.path.join(fs, 'etc', 'udev', 'rules.d', '70-persistent-net.rules')
yield execute('rm -f %s' % rulesfile)