Add extra `smp' & `mem' sysprep params in Windows
authorNikos Skalkotos <skalkoto@grnet.gr>
Wed, 8 Jan 2014 08:19:37 +0000 (10:19 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Wed, 8 Jan 2014 08:19:37 +0000 (10:19 +0200)
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
image_creator/os_type/windows.py

index 166bb42..ce84130 100644 (file)
@@ -255,7 +255,7 @@ class OSBase(object):
             return
 
         for name, param in self.needed_sysprep_params.items():
             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)"))
                             (param.description, name,
                              self.sysprep_params[name] if name in
                              self.sysprep_params else "(none)"))
index b758e03..2890c62 100644 (file)
@@ -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)
         '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)
     @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([
         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,
             '-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,