[pve-devel] [PATCH v3 qemu-server 0/7] cloudinit pending behaviour change

Alexandre Derumier aderumier at odiso.com
Wed Jun 9 13:54:10 CEST 2021


Hi,

This is an attempt to cleanup current behaviour of cloudinit online changes.

Currently, we setup cloudinit options as pending, until we generate the config drive.

This is not 100% true, because some option like vm name, nic mac address can be changed,
without going to pending, so user can't known if it need to regenerated it.

Also custom config can be done with snippets file, without any pending state.

Also, some can are very difficult to handle, if you hotplug a nic but it's failing,so pending,
then you defined an ipconfig, and then you revert hotplug.

(This will be really usefull with ipam implementation, where ipconfig pending state is really
 needed, as we need to follow the pending state of the netX interface)

So, instead of setting cloudinit values in pending,
this patch serie extract the current config from the cloudinit drive and compare it to vm config (pending config).

(Currently the vm config is simply copied inside the iso at generation, but we could implemented
 configdrive format parsers) 

A new specific cloudinit config api is added too, merging ipaddrX && netX mac
in same field, and displaying the diff between current and generated config.
(we could implemented read config from custom snippet too later)


Changelog V1:

- use [special:cloudinit] instead [CLOUDINIT] for section
- delete config section on drive removal
- config api: move code to new PVE::QemuServer::Cloudinit::get_pending_config
- config api: add "qm cloudinit pending" cli
- add update api to regenerate drive with 1 api call
- add cloudinit hotplug option

Changelog v2:

- fix trailing whitespace in first patch
- revert previous "cloudinit" check in snapshot name (":" character is already forbidden)

Changelog v3:

- extract the current conf from cloudinit drive instead write the special cloudinit section


Alexandre Derumier (7):
  cloudinit: add vm config to cloudinit drive
  cloudinit: generate cloudinit drive on offline plug
  cloudinit: make cloudnit options fastplug
  api2: add cloudinit config api
  cloudinit : add extract_cloudinit_config
  api2: add cloudinit_update
  add cloudinit hotplug

 PVE/API2/Qemu.pm            | 118 ++++++++++++++++++++++++++++++++++
 PVE/CLI/qm.pm               |   2 +
 PVE/QemuServer.pm           |  81 ++++++++++++++---------
 PVE/QemuServer/Cloudinit.pm | 125 ++++++++++++++++++++++++++++++++++++
 4 files changed, 296 insertions(+), 30 deletions(-)

-- 
2.20.1





More information about the pve-devel mailing list