summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2013-07-02 08:10:17 +0000
committerTiago Gomes <tiago.gomes@codethink.co.uk>2013-07-02 08:10:17 +0000
commit0e5cf8fbc1a9a24f12d63d69e6cf095878b7d814 (patch)
treedcf3b898c3acfcfaeefbd87fa0c7a61901bc7c7a
parent7efdaa1487bf39867d21fa19634c35e830940ca7 (diff)
parent429f08e8cbddd4f108ab125b44c5eb7b7bba3e09 (diff)
downloaddefinitions-0e5cf8fbc1a9a24f12d63d69e6cf095878b7d814.tar.gz
Merge branch 'baserock/tiagogomes/vcpu'
Reviewed by Lars Wirzenius
-rwxr-xr-xmorphlib/exts/kvm.write7
-rwxr-xr-xmorphlib/exts/virtualbox-ssh.write5
-rw-r--r--morphlib/writeexts.py4
3 files changed, 13 insertions, 3 deletions
diff --git a/morphlib/exts/kvm.write b/morphlib/exts/kvm.write
index 67ac40e7..9a6be135 100755
--- a/morphlib/exts/kvm.write
+++ b/morphlib/exts/kvm.write
@@ -113,8 +113,11 @@ class KvmPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
ram_mebibytes = str(self.get_ram_size() / (1024**2))
- cmdline = ['virt-install', '--connect', 'qemu:///system', '--import',
- '--name', vm_name, '--vnc', '--ram=%s' % ram_mebibytes,
+ vcpu_count = str(self.get_vcpu_count())
+
+ cmdline = ['virt-install', '--connect', 'qemu:///system',
+ '--import', '--name', vm_name, '--vnc',
+ '--ram', ram_mebibytes, '--vcpus', vcpu_count,
'--disk', 'path=%s,bus=ide' % vm_path] + attach_opts
if not autostart:
cmdline += ['--noreboot']
diff --git a/morphlib/exts/virtualbox-ssh.write b/morphlib/exts/virtualbox-ssh.write
index 3ee2eae0..1abe233e 100755
--- a/morphlib/exts/virtualbox-ssh.write
+++ b/morphlib/exts/virtualbox-ssh.write
@@ -113,12 +113,15 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
ram_mebibytes = str(self.get_ram_size() / (1024**2))
+ vcpu_count = str(self.get_vcpu_count())
+
hostonly_iface = self.get_host_interface(ssh_host)
commands = [
['createvm', '--name', vm_name, '--ostype', 'Linux26_64',
'--register'],
- ['modifyvm', vm_name, '--ioapic', 'on', '--memory', ram_mebibytes,
+ ['modifyvm', vm_name, '--ioapic', 'on',
+ '--memory', ram_mebibytes, '--cpus', vcpu_count,
'--nic1', 'hostonly', '--hostonlyadapter1', hostonly_iface,
'--nic2', 'nat', '--natnet2', 'default'],
['storagectl', vm_name, '--name', '"SATA Controller"',
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index 410b8c9f..2a54d757 100644
--- a/morphlib/writeexts.py
+++ b/morphlib/writeexts.py
@@ -124,6 +124,10 @@ class WriteExtension(cliapp.Application):
'''Parse RAM size from environment.'''
return self._parse_size_from_environment('RAM_SIZE', '1G')
+ def get_vcpu_count(self):
+ '''Parse the virtual cpu count from environment.'''
+ return self._parse_size_from_environment('VCPUS', '1')
+
def create_state(self, real_root):
'''Create the state subvolumes that are shared between versions'''