From cecdeba45f90f931a6dd7f6a248cdf3cfe31d75b Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 11 Aug 2013 19:46:18 +0200 Subject: [PATCH] Remove virtio special case Adding it later, once I figure out wth it is. --- common/tasks/filesystem.py | 2 -- providers/virtualbox/manifest.py | 1 + providers/virtualbox/tasks/boot.py | 26 +------------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/common/tasks/filesystem.py b/common/tasks/filesystem.py index 81094d4..529d03d 100644 --- a/common/tasks/filesystem.py +++ b/common/tasks/filesystem.py @@ -122,8 +122,6 @@ class ModifyFstab(Task): fstab_path = os.path.join(info.root, 'etc/fstab') device = '/dev/sda1' - if info.manifest.virtualization == 'virtio': - device = '/dev/vda1' if info.manifest.virtualization == 'pvm': device = '/dev/xvda1' with open(fstab_path, 'a') as fstab: diff --git a/providers/virtualbox/manifest.py b/providers/virtualbox/manifest.py index 428a374..8e5bb11 100644 --- a/providers/virtualbox/manifest.py +++ b/providers/virtualbox/manifest.py @@ -10,6 +10,7 @@ class Manifest(base.Manifest): def parse(self, data): super(Manifest, self).parse(data) + self.virtualization = None self.image = data['image'] if 'loopback_dir' not in self.volume: self.volume['loopback_dir'] = '/tmp' diff --git a/providers/virtualbox/tasks/boot.py b/providers/virtualbox/tasks/boot.py index 928e999..6ccaa8d 100644 --- a/providers/virtualbox/tasks/boot.py +++ b/providers/virtualbox/tasks/boot.py @@ -1,6 +1,5 @@ from base import Task from common import phases -import os class ConfigureGrub(Task): @@ -8,32 +7,9 @@ class ConfigureGrub(Task): phase = phases.system_modification def run(self, info): - import stat - rwxr_xr_x = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IXGRP | - stat.S_IROTH | stat.S_IXOTH) - x_all = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH - - grubd = os.path.join(info.root, 'etc/grub.d') - for cfg in [os.path.join(grubd, f) for f in os.listdir(grubd)]: - os.chmod(cfg, os.stat(cfg).st_mode & ~ x_all) - - from shutil import copy - script_src = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/grub.d/40_custom')) - script_dst = os.path.join(info.root, 'etc/grub.d/40_custom') - copy(script_src, script_dst) - os.chmod(script_dst, rwxr_xr_x) - - if info.manifest.virtualization == 'virtio': - modules_path = os.path.join(info.root, 'etc/initramfs-tools/modules') - with open(modules_path, 'a') as modules: - modules.write("\nvirtio_pci\nvirtio_blk\n") - from common.tools import log_check_call - log_check_call(['/usr/sbin/chroot', info.root, 'ln', '-s', '/boot/grub/grub.cfg', '/boot/grub/menu.lst']) - log_check_call(['/usr/sbin/chroot', info.root, 'update-initramfs', '-u']) - log_check_call(['grub-install', + log_check_call(['/usr/sbin/grub-install', '--boot-directory='+info.root+"/boot/", info.bootstrap_device['path']])