** Description changed:

  [ Impact ]
  
-  * virt-install's `--cloud-init user-data=...` option is silently ignored
-    when invoked without an accompanying `meta-data=...` argument. This is a
-    regression introduced upstream in virt-manager 5.1.0 by the cloud-init
-    config-file refactor (commit 5b2d0997a1d2d213b17c227169da64e2fa7d09a6).
+  * if meta-data is not specified, virt-install generates the cloudinit ISO 
+    without the meta-data configuration file. Since this file is mandatory
+    , the cloud-init ISO is ignored.
  
   * This affects any user relying on the common, documented invocation
     `virt-install --cloud-init user-data=<file>` without also specifying
     `meta-data=`, and results in newly provisioned guests silently not
     receiving the cloud-init configuration.
  
   * Fixed upstream in commit ea71cf9a8a4161ce6e19eacf5f0d86d40ab74f23.
  
  [ Test Plan ]
  
-  * On the affected release, install/upgrade to the virt-manager package
-    containing the fix.
- 
   * Prepare a non-empty `user-data` file: /tmp/user-data.yaml
       #cloud-config
       write_files:
         - path: /tmp/sru-test
           content: hello
  
   * Run virt-install without a meta-data argument, e.g.:
-      virt-install --connect qemu:///system --name sru-test --memory 1024 
--disk size=5 --import --os-variant ubuntu24.04 --cloud-init 
user-data=/tmp/user-data.yaml --noautoconsole
  
-  * Inspect the generated cloud-init config ISO (path logged by virt-install,
-    or find it under the libvirt image pool) and confirm it now contains
-    BOTH a `user-data` and a `meta-data` file:
-      isoinfo -i <cloudinit>.iso -l
+ $ virt-install --connect qemu:///system --name sru-test --memory 1024
+ --disk size=2 --import --os-variant ubuntu24.04 --cloud-init user-
+ data="/tmp/user-data" --noautoconsole --dry-run --debug 2>&1 | grep
+ Injecting
  
-  * Boot the guest and confirm cloud-init applied the user-data, e.g. check
-    for /tmp/sru-test inside the guest, or `cloud-init status --long` shows
-    no "NoCloud" datasource detection failure.
+ WITHOUT THE FIX:
  
-  * Before the fix: the meta-data file is absent from the ISO and the
-    user-data is never applied to the guest. After the fix: both files are
-    present and the user-data is applied as expected.
+ ... Injecting src=/var/lib/libvirt/boot/virtinst-fdioq2hu-user-data
+ dst=user-data into
+ media=/var/lib/libvirt/boot/virtinst-74dp2v2w-cloudinit.iso
+ 
+ WITH THE FIX:
+ 
+ ... Injecting src=/var/lib/libvirt/boot/virtinst-z8wgbnoc-meta-data 
dst=meta-data into media=/var/lib/libvirt/boot/virtinst-j_387822-cloudinit.iso
+ ... Injecting src=/var/lib/libvirt/boot/virtinst-rgt4t_mj-user-data 
dst=user-data into media=/var/lib/libvirt/boot/virtinst-j_387822-cloudinit.iso
+ 
+ We can see that without the fix, only user-data file is created in the
+ cloud-init ISO.
  
  [ Where problems could occur ]
  
   * The fix changes a single predicate in `_CloudInitConfig._create_file()`
     from `if not content:` to `if content is None:`. This only changes
     behaviour for the previously-mishandled case where the generated content
     is an empty string (empty meta-data) — that case now correctly produces
     a (empty) file instead of being skipped. All other cases (user-data,
     vendor-data, network-config, or meta-data with actual content) continue
     to return non-empty strings and are unaffected by this change.
  
   * Low regression risk: the change cannot affect guests that were already
     working (non-empty content paths are untouched)
  
  [ Other Info ]
  
   * Upstream fix: 
https://github.com/virt-manager/virt-manager/commit/ea71cf9a8a4161ce6e19eacf5f0d86d40ab74f23
   * Upstream issue: https://github.com/virt-manager/virt-manager/issues/975
   * Regression introduced by: 
https://github.com/virt-manager/virt-manager/commit/5b2d0997a1d2d213b17c227169da64e2fa7d09a6
 (virt-manager 5.1.0)
  
  ----
  Since virt-manager 5.1.0, cloud-init's user-data gets ignored when passing 
the following option:
  
    --cloud-init user-data=xxx
  
  without specifying a meta-data=xxx argument.
  
  There is an upstream bug report: https://github.com/virt-manager/virt-
  manager/issues/975
  
  with a fix that we can backport.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171406

Title:
  virt-install --cloud-init user-data=... ignored when no meta-data is
  specified

To manage notifications about this bug go to:
https://bugs.launchpad.net/virt-manager/+bug/2171406/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to