Implement mounts in proxmox module (#2426)

* Implement mounts in proxmox module

mounts in proxmox are the additionnal disk devices set in a guests.
We handle the mounts the same way that netif devices, using a
dictionnary with keys being mp0, mp1,…

* Add version_added

Seems to be a requirement but I didn't see that anywhere.
Hope it'll fix the travis-ci issue
This commit is contained in:
Baptiste Mille-Mathias 2016-06-17 14:50:15 +02:00 committed by René Moser
parent 07ed6bbd56
commit 6cb6829384

View file

@ -99,6 +99,13 @@ options:
default: null
required: false
type: A hash/dictionary defining interfaces
mounts:
description:
- specifies additional mounts (separate disks) for the container
default: null
required: false
type: A hash/dictionary defining mount points
version_added: "2.2"
ip_address:
description:
- specifies the address the container will be assigned
@ -174,6 +181,9 @@ EXAMPLES = '''
# Create new container with minimal options defining network interface with dhcp
- 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' netif='{"net0":"name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0"}'
# Create new container with minimal options defining a mount
- 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' mounts='{"mp0":"local:8,mp=/mnt/test/"}'
# Start container
- proxmox: vmid=100 api_user='root@pam' api_password='1q2w3e' api_host='node1' state=started
@ -219,6 +229,9 @@ def create_instance(module, proxmox, vmid, node, disk, storage, cpus, memory, sw
if 'netif' in kwargs:
kwargs.update(kwargs['netif'])
del kwargs['netif']
if 'mounts' in kwargs:
kwargs.update(kwargs['mounts'])
del kwargs['mounts']
else:
kwargs['cpus']=cpus
kwargs['disk']=disk
@ -298,6 +311,7 @@ def main():
memory = dict(type='int', default=512),
swap = dict(type='int', default=0),
netif = dict(type='dict'),
mounts = dict(type='dict'),
ip_address = dict(),
onboot = dict(type='bool', default='no'),
storage = dict(default='local'),
@ -359,6 +373,7 @@ def main():
hostname = module.params['hostname'],
ostemplate = module.params['ostemplate'],
netif = module.params['netif'],
mounts = module.params['mounts'],
ip_address = module.params['ip_address'],
onboot = int(module.params['onboot']),
cpuunits = module.params['cpuunits'],