vishesh92 opened a new pull request, #11654: URL: https://github.com/apache/cloudstack/pull/11654
### Description This PR adds support for specifying user data (cloud-init) for system VMs via Zone Scoped global settings. We set the user data from the global setting in `/var/cache/cloud/cmdline`, and use the [NoCloud datasource](https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html) to process user data. cloud-init service is still disabled in the system VMs and it's executed as part of the `cloud-postinit` service which executes the `postinit.sh` script. Added global settings: `systemvm.userdata.enabled` - Disabled by default. Needs to be enabled to utilize the feature. `consoleproxy.userdata` - User data to be used for Console Proxy `secstorage.userdata` - User data to be used for Secondary Storage VM `router.userdata` - User data to be used for Virtual Routers <details><summary>Generated summary</summary> <p> This pull request introduces support for providing user data to system VMs (Console Proxy VM, Secondary Storage VM, and Virtual Router) via global settings, enabling cloud-init configuration through user-supplied data. The changes include new configuration keys, logic to inject user data into VM boot arguments (encoded in base64), and updates to the system VM template to better support cloud-init. **System VM user data support:** * Added `systemvm.userdata.enabled` config key to globally enable user data for system VMs, and made it available in the `VirtualMachineManager` and related implementations. [[1]](diffhunk://#diff-d361a4b0aac89240a0f06961abce7650e80d3d14ccee1f06e25dcef950d6fdadR109-R111) [[2]](diffhunk://#diff-c6161dd221f494ea2570714cfa2a5e86557a8c30a79fc36e8ecfcb94a09c268aL5124-R5124) * Introduced new config keys for user data: * `consoleproxy.userdata` for Console Proxy VMs * `secstorage.userdata` for Secondary Storage VMs * `router.userdata` for Virtual Routers * Updated `getConfigKeys()` methods in relevant managers to include the new config keys. [[1]](diffhunk://#diff-83d8d4dd27757aa0ff1364c3d156e2396e79f043073acffdddfeb37b1790a8c7L1630-R1642) [[2]](diffhunk://#diff-b4fae8c899ae9aa8aa78ec0ef9ee3c8e764e8aec911ef7809763d9e3a2a3907dL3420-R3431) [[3]](diffhunk://#diff-89565ee501e0c9f0b93790fd2ba596474d0b0c11cbff71a21183f7934fbb79cfL1532-R1543) **User data injection logic:** * In each system VM manager (`ConsoleProxyManagerImpl`, `SecondaryStorageManagerImpl`, `VirtualNetworkApplianceManagerImpl`), added logic to: * Check if user data is enabled for the zone and, if so, retrieve and base64-encode the configured user data string. * Inject the encoded user data into the VM's boot arguments as `userdata=...`. [[1]](diffhunk://#diff-83d8d4dd27757aa0ff1364c3d156e2396e79f043073acffdddfeb37b1790a8c7R1328-R1336) [[2]](diffhunk://#diff-b4fae8c899ae9aa8aa78ec0ef9ee3c8e764e8aec911ef7809763d9e3a2a3907dR2142-R2149) [[3]](diffhunk://#diff-89565ee501e0c9f0b93790fd2ba596474d0b0c11cbff71a21183f7934fbb79cfR1232-R1240) **System VM template / cloud-init configuration:** * Updated `configure_systemvm_services.sh` to change the default cloud-init configuration, switching the data source to `NoCloud` and disabling automatic cloud-init services to allow manual control by CloudStack. These changes collectively enable administrators to inject custom cloud-init user data into system VMs via global settings, improving flexibility and automation for system VM initialization. </p> </details> <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> #### How did you try to break this feature and the system with this change? <!-- see how your change affects other areas of the code, etc. --> <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
