Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lxc): allow container disk size 0 for lxc zfs/brfs subvols #1737

Merged
merged 2 commits into from
Feb 1, 2025

Conversation

h3krn
Copy link
Contributor

@h3krn h3krn commented Jan 31, 2025

Contributor's Note

The proxmox pct command allows for disk size = 0 to create containers backed by ZFS or BTRFS subvolumes. (Note that this is still not allowed by the GUI.) This would allow the provider to use this feature as well.

https://pve.proxmox.com/pve-docs/pct.1.html

Storage Backed Mount Points

    Directories: passing size=0 triggers a special case where instead of a raw image a directory is created.
  • I have added / updated documentation in /docs for any user-facing features or additions.
  • I have added / updated acceptance tests in /fwprovider/tests for any new or updated resources / data sources.
  • I have ran make example to verify that the change works as expected.

Proof of Work

# tofu show
# proxmox_virtual_environment_container.k3s-controller[0]:
resource "proxmox_virtual_environment_container" "k3s-controller" {
    id             = "134"
    node_name      = "pve-host"
    protection     = false
    start_on_boot  = true
    started        = true
    tags           = [
        "k3s-controller",
    ]
    template       = false
    timeout_clone  = 1800
    timeout_create = 1800
    timeout_delete = 60
    timeout_start  = 300
    timeout_update = 1800
    unprivileged   = false
    vm_id          = 134

    cpu {
        architecture = "amd64"
        cores        = 2
        units        = 1024
    }

    disk {
        datastore_id = "local-btrfs"
        size         = 0
    }

    features {
        fuse    = false
        keyctl  = false
        mount   = []
        nesting = true
    }

    initialization {
        hostname = "k3s-controller-01"

        ip_config {
            ipv4 {
                address = "dhcp"
            }
        }

        user_account {
            keys = [
                "<SNIP>",
            ]
        }
    }

    memory {
        dedicated = 4096
        swap      = 0
    }

    network_interface {
        bridge      = "vmbr0"
        enabled     = true
        firewall    = false
        mac_address = "BC:24:11:93:9B:B9"
        mtu         = 0
        name        = "eth0"
        rate_limit  = 0
        vlan_id     = 0
    }

    operating_system {
        template_file_id = "local-btrfs:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
        type             = "debian"
    }
}

pve-host:~# btrfs subvolume list / | grep 134
ID 13885 gen 4345930 top level 256 path var/lib/pve/local-btrfs/images/134/subvol-134-disk-0.subvol

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #0000 | Relates #0000

Harm Kroon added 2 commits January 31, 2025 22:20
Signed-off-by: Harm Kroon <harm.kroon@hotmail.com>
Signed-off-by: Harm Kroon <harm.kroon@hotmail.com>
@h3krn h3krn changed the title fix: allow container disk size 0 for lxc zfs/brfs subvols fix(container): allow container disk size 0 for lxc zfs/brfs subvols Jan 31, 2025
@bpg bpg changed the title fix(container): allow container disk size 0 for lxc zfs/brfs subvols fix(lxc): allow container disk size 0 for lxc zfs/brfs subvols Feb 1, 2025
Copy link
Owner

@bpg bpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @h3krn!

LGTM! 🚀

@bpg bpg merged commit 2925ae6 into bpg:main Feb 1, 2025
7 checks passed
@bpg
Copy link
Owner

bpg commented Feb 1, 2025

@all-contributors please add @h3krn for code

Copy link
Contributor

@bpg

I've put up a pull request to add @h3krn! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants