From 4f08cd0b5ee77bb4992fafd10109a872e008e7ae Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Wed, 8 Jan 2014 10:19:37 +0200 Subject: [PATCH] Add extra `smp' & `mem' sysprep params in Windows Those parameter can be used to control how many CPUs and how much RAM the Windows VM should have during the configuration --- image_creator/os_type/__init__.py | 2 +- image_creator/os_type/windows.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/image_creator/os_type/__init__.py b/image_creator/os_type/__init__.py index 166bb42..ce84130 100644 --- a/image_creator/os_type/__init__.py +++ b/image_creator/os_type/__init__.py @@ -255,7 +255,7 @@ class OSBase(object): return for name, param in self.needed_sysprep_params.items(): - self.out.output("\t%s (%s): %s" % + self.out.output("\t%s [%s]: %s" % (param.description, name, self.sysprep_params[name] if name in self.sysprep_params else "(none)")) diff --git a/image_creator/os_type/windows.py b/image_creator/os_type/windows.py index b758e03..2890c62 100644 --- a/image_creator/os_type/windows.py +++ b/image_creator/os_type/windows.py @@ -119,6 +119,10 @@ class Windows(OSBase): 'boot_timeout', int, 300, "Boot Timeout (seconds)", _POSINT) @add_sysprep_param( 'connection_retries', int, 5, "Connection Retries", _POSINT) + @add_sysprep_param( + 'smp', int, 1, "Number of CPUs for the helper VM", _POSINT) + @add_sysprep_param( + 'mem', int, 1024, "Virtual RAM size for the helper VM (MiB)", _POSINT) @add_sysprep_param('password', str, None, 'Image Administrator Password') def __init__(self, image, **kargs): super(Windows, self).__init__(image, **kargs) @@ -800,8 +804,8 @@ class _VM(object): args.extend(needed_args) args.extend([ - '-smp', '1', '-m', '1024', '-drive', - 'file=%s,format=raw,cache=unsafe,if=virtio' % self.disk, + '-smp', str(self.params['smp']), '-m', str(self.params['mem']), + '-drive', 'file=%s,format=raw,cache=unsafe,if=virtio' % self.disk, '-netdev', 'type=user,hostfwd=tcp::445-:445,id=netdev0', '-device', 'virtio-net-pci,mac=%s,netdev=netdev0' % random_mac(), '-vnc', ':%d' % self.display, '-serial', 'file:%s' % self.serial, -- 1.7.10.4