Proxmox set number of cores for vm/ct (#25901)

* Proxmox set number of cores for vm/ct

Argument to limit the number of assigned core to a vm/ct

* version_added & pep8

* default to 1
This commit is contained in:
Quentin Dawans 2017-07-15 11:51:13 +02:00 committed by John R Barker
parent 023bdf8494
commit 613690bd46

View file

@ -92,6 +92,12 @@ options:
- hard disk size in GB for instance - hard disk size in GB for instance
default: 3 default: 3
required: false required: false
cores:
description:
- Specify number of cores per socket.
required: false
default: 1
version_added: 2.4
cpus: cpus:
description: description:
- numbers of allocated cpus for instance - numbers of allocated cpus for instance
@ -265,6 +271,18 @@ EXAMPLES = '''
ostemplate: local:vztmpl/ubuntu-14.04-x86_64.tar.gz' ostemplate: local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
mounts: '{"mp0":"local:8,mp=/mnt/test/"}' mounts: '{"mp0":"local:8,mp=/mnt/test/"}'
# Create new container with minimal options defining a cpu core limit
- proxmox:
vmid: 100
node: uk-mc02
api_user: root@pam
api_password: 1q2w3e
api_host: node1
password: 123456
hostname: example.org
ostemplate: local:vztmpl/ubuntu-14.04-x86_64.tar.gz'
cores: 2
# Start container # Start container
- proxmox: - proxmox:
vmid: 100 vmid: 100
@ -445,6 +463,7 @@ def main():
hostname=dict(), hostname=dict(),
ostemplate=dict(), ostemplate=dict(),
disk=dict(type='str', default='3'), disk=dict(type='str', default='3'),
cores=dict(type='int', default=1),
cpus=dict(type='int', default=1), cpus=dict(type='int', default=1),
memory=dict(type='int', default=512), memory=dict(type='int', default=512),
swap=dict(type='int', default=0), swap=dict(type='int', default=0),
@ -524,6 +543,7 @@ def main():
% (module.params['ostemplate'], node, template_store)) % (module.params['ostemplate'], node, template_store))
create_instance(module, proxmox, vmid, node, disk, storage, cpus, memory, swap, timeout, create_instance(module, proxmox, vmid, node, disk, storage, cpus, memory, swap, timeout,
cores=module.params['cores'],
pool=module.params['pool'], pool=module.params['pool'],
password=module.params['password'], password=module.params['password'],
hostname=module.params['hostname'], hostname=module.params['hostname'],