From 6f05774d2c49f6d0afea2796a0a0150d9532e4e2 Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 15 Sep 2013 22:57:15 +0200 Subject: [PATCH] Try fixing grub, added some comments --- providers/virtualbox/tasks/boot.py | 8 ++++++++ providers/virtualbox/volume.py | 1 + 2 files changed, 9 insertions(+) diff --git a/providers/virtualbox/tasks/boot.py b/providers/virtualbox/tasks/boot.py index bf96e11..bb9a0c5 100644 --- a/providers/virtualbox/tasks/boot.py +++ b/providers/virtualbox/tasks/boot.py @@ -17,6 +17,9 @@ class ConfigureGrub(Task): grub_dir = os.path.join(boot_dir, 'grub') if isinstance(info.volume, LoopbackVolume): + # GRUB cannot deal with installing to loopback devices + # so we fake a real harddisk with dmsetup. + # Guide here: http://ebroder.net/2009/08/04/installing-grub-onto-a-disk-image/ info.volume.unmount() info.volume.unmap() info.volume.link_dm_node() @@ -45,3 +48,8 @@ class ConfigureGrub(Task): info.volume.mount_root(info.root) info.volume.mount_boot() info.volume.mount_specials() + + # Best guess right now... + device_map_path = os.path.join(grub_dir, 'device.map') + with open(device_map_path, 'w') as device_map: + device_map.write('(hd0) /dev/mapper/vda\n') diff --git a/providers/virtualbox/volume.py b/providers/virtualbox/volume.py index 3f8e6da..b6d6b0d 100644 --- a/providers/virtualbox/volume.py +++ b/providers/virtualbox/volume.py @@ -21,6 +21,7 @@ class VirtualBoxVolume(LoopbackVolume): raise VolumeError(msg) nbd_max_part = int(self._module_param('nbd', 'max_part')) if nbd_max_part < num_partitions: + # Found here: http://bethesignal.org/blog/2011/01/05/how-to-mount-virtualbox-vdi-image/ msg = ('The kernel module `nbd\' was loaded with the max_part ' 'parameter set to {max_part}, which is below ' 'the amount of partitions for this volume ({num_partitions}). '