Giter Site home page Giter Site logo

Comments (2)

muhlba91 avatar muhlba91 commented on June 12, 2024 1

i do believe this is a limitation of Proxmox itself.

looking at https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/lxc/{vmid}/clone you can see the parameters Proxmox accepts for a container clone, which doesn't contain any disk related parameters (except for the datastore).
hence, Proxmox will take the existing container and clone it as is. for containers, there's one note in the full property which i can't interpret so far saying that by default a linked clone is created. maybe that will solve the problem of it going into a loop?

apart from that, you can see the same in the upstream code:
https://github.com/bpg/terraform-provider-proxmox/blob/main/proxmoxtf/resource/container.go#L796 is the code that creates the request parameters, and https://github.com/bpg/terraform-provider-proxmox/blob/main/proxmox/nodes/containers/containers.go#L20 performs the request itself. since you set the clone parameter you are calling this method chain in https://github.com/bpg/terraform-provider-proxmox/blob/main/proxmoxtf/resource/container.go#L790.

from pulumi-proxmoxve.

pcuci avatar pcuci commented on June 12, 2024

Oh well, it was worth a try 😸

I went for re-cloning the template and resizing its disk against the destination datastoreId, then I clone this clone to get the container.

https://gitlab.com/home.cloud/infra/cloud/-/blob/main/src/ct/index.ts?ref_type=heads#L95-157

create: pulumi.interpolate`
  # Check for non-existence of preclone
  while pct list | grep -q "^${tempCloneId} "; do
    echo "Temporary clone ID ${tempCloneId} is in use. Waiting..."
    sleep 5
  done

  # Perform clone and resize
  pct clone ${template.id} ${tempCloneId} --full --storage ${datastoreId} &&
  pct resize ${tempCloneId} rootfs ${size}G
`

As I'm creating multiple containers and Proxmox locks the template while it's cloning it, we need to serialize everything. It looks pretty bad, but seems to work. A better design would be to create a higher level ProxmoxVE Dynamic Provider (haha) to hide away all these remote.Commands and bypass this limitation:

image

Thanks for helping me understand what's going on under the hood!

from pulumi-proxmoxve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.