lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.82k stars 225 forks source link

`limits.cpu.nodes: balanced` can cause invalid config value for `volatile.cpu.nodes` #1425

Closed gibmat closed 3 days ago

gibmat commented 3 days ago

Required information

Issue description

When limits.cpu.nodes: balanced is set in a config, Incus can set the value of volatile.cpu.nodes to "0" when creating an instance. However, this triggers a validation error when later attempting to edit an instance's config. Might be related to 676ba92cfceff9c71b3dee70eb983a14540e890f; I don't remember seeing this prior to the Incus 6.7 release.

Steps to reproduce

  1. Add limits.cpu.nodes: balanced to a profile:

    $ incus profile show default
    config:
    limits.cpu.nodes: balanced
    description: Default Incus profile
    devices:
    eth0:
    name: eth0
    network: incusbr0
    type: nic
    root:
    path: /
    pool: default
    type: disk
    name: default
  2. Create and start a new VM:

    $ incus create --vm images:ubuntu/24.04
    Creating the instance
    Instance name is: dynamic-yak
    $ incus start dynamic-yak
  3. View the config for this pristine VM:

    $ incus config show dynamic-yak
    architecture: x86_64
    config:
    image.architecture: amd64
    image.description: Ubuntu noble amd64 (20241126_07:42)
    image.os: Ubuntu
    image.release: noble
    image.requirements.cgroup: v2
    image.serial: "20241126_07:42"
    image.type: disk-kvm.img
    image.variant: default
    volatile.base_image: 09fd1be534aed9b11b5c3a8306619b13a542acbd74d376570e51774f90b405f1
    volatile.cloud-init.instance-id: dfdd1d5a-e0f2-4b8e-8774-7c7ddc3df08c
    volatile.cpu.nodes: "0"
    volatile.eth0.host_name: tap5d9590ac
    volatile.eth0.hwaddr: 00:16:3e:b1:91:d5
    volatile.last_state.power: RUNNING
    volatile.uuid: fd0d1c15-b074-4883-877c-f9289842cecc
    volatile.uuid.generation: fd0d1c15-b074-4883-877c-f9289842cecc
    volatile.vsock_id: "917373356"
    devices: {}
    ephemeral: false
    profiles:
    - default
    stateful: false
    description: ""
  4. Open the config in an editor, and close without making any changes:

    $ incus config edit dynamic-yak
    Config parsing error: Invalid config: Invalid cpuset value: 0
    Press enter to open the editor again or ctrl+c to abort change
    ^C
stgraber commented 3 days ago

That's already been fixed :)