Search code examples
pythonlxcproxmox

Proxmoxer : how to create LXC container specifying disk size


I'm running version 5.2 of proxmox, and 1.0.2 of proxmoxer python library. Latest as of today.

So far I didn't manage to create a LXC container specifying a disk size and will always default to 4G. I didn't find this option in Proxmox documentation...

I am using :

node.lxc.create(vmid=204,
    ostemplate='local:vztmpl/jessie-TM-v0.3.tar.gz',
    hostname='helloworld',
    storage='raid0',
    memory=2048,
    swap=2048,
    cores=2,
    password='secret',
    net0='name=eth0,bridge=vmbr0,ip=dhcp')

Adding something like rootfs='raid0:204/vm-204-disk-1.raw,size=500G' will disable disk image creation and look for an already existing image. Anyway, I don't really know where to go next. Am I supposed to create a disk image before hand? I didn't find how to do this for LXC. No problems with qemu.

Thanks for any help.


Solution

  • After some time spent on this, looking at the code of proxmox ansible module helped. So, to specify a disk size when creating a LXC container using Proxmox API, one need to simply HTTP POST :

    rootfs=10
    

    For a 10G HDD. Without anything else.