You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "vishesh92 (via GitHub)" <gi...@apache.org> on 2025/09/17 08:25:06 UTC

[PR] Add support for providing userdata to system VMs [cloudstack]

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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3345554303

   <b>[SF] Trillian test result (tid-14470)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 54402 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14470-kvm-ol8.zip
   Smoke tests completed. 147 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2355015745


##########
tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh:
##########
@@ -132,15 +132,42 @@ function configure_services() {
   # Disable container services
   systemctl disable containerd
 
-  # Disable cloud init by default
-cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
-datasource_list: ['CloudStack']
-datasource:
-  CloudStack:
-    max_wait: 120
-    timeout: 50
+  # Cloud-init services will be managed by dependency ordering to run after CloudStack networking
+
+  cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
+#cloud-config
+datasource_list: ['NoCloud']
+network:
+  config: disabled
+manage_etc_hosts: false
+manage_resolv_conf: false
+users: []
+disable_root: false
+ssh_pwauth: false
+cloud_init_modules:
+ - migrator
+ - seed_random
+ - bootcmd
+ - write-files
+ - growpart
+ - resizefs
+ - disk_setup
+ - mounts
+ - rsyslog
+cloud_config_modules:
+ - locale
+ - timezone
+ - runcmd
+cloud_final_modules:
+ - scripts-per-once
+ - scripts-per-boot
+ - scripts-per-instance
+ - scripts-user
+ - final-message
+ - power-state-change
 EOF
 
+  # Disable automatic cloud-init services since we run it manually in postinit.sh

Review Comment:
   ```suggestion
     # Disable cloud-init services since we run it manually in postinit.sh if user data is available
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3343829094

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15209


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351280289

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351691807

   @vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "harikrishna-patnala (via GitHub)" <gi...@apache.org>.
harikrishna-patnala commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3315062782

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319583985

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3333196009

   @borisstoyanov a [SL] Trillian-Jenkins matrix job (EL8 mgmt + EL8 KVM, Ubuntu22 mgmt + Ubuntu22 KVM, EL8 mgmt + VMware 7.0u3, EL9 mgmt + XCP-ng 8.2 ) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3323354245

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2355013873


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -71,4 +131,7 @@ do
   systemctl disable --now --no-block $svc
 done
 
+# Execute cloud-init if user data is present

Review Comment:
   ```suggestion
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3314991675

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 15122


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351804470

   @borisstoyanov a [SL] Trillian-Jenkins matrix job (EL8 mgmt + EL8 KVM, Ubuntu22 mgmt + Ubuntu22 KVM, EL8 mgmt + VMware 7.0u3, EL9 mgmt + XCP-ng 8.2 ) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351794356

   @blueorangutan test matrix


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3306468082

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3308954672

   @weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3336470091

   <b>[SF] Trillian test result (tid-14434)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 52564 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14434-kvm-ol8.zip
   Smoke tests completed. 147 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371655992


##########
engine/userdata/src/main/java/org/apache/cloudstack/userdata/UserDataManagerImpl.java:
##########
@@ -137,7 +139,11 @@ public String validateAndGetUserDataForSystemVM(String userDataUuid) {
             return null;
         }
         if (userDataVo.getDomainId() == Domain.ROOT_DOMAIN && userDataVo.getAccountId() == User.UID_ADMIN) {
-            return userDataVo.getUserData();
+            // Decode base64 user data, compress it, then re-encode to reduce command line length

Review Comment:
   Yes. For small data, compress content will be longer.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3301905336

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3333186859

   @blueorangutan test matrix


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356201409


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   Will these commands run each time system vms are started ?
   
   



##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF

Review Comment:
   Is this file needed ?



##########
tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh:
##########
@@ -132,15 +132,41 @@ function configure_services() {
   # Disable container services
   systemctl disable containerd
 
-  # Disable cloud init by default
-cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
-datasource_list: ['CloudStack']
-datasource:
-  CloudStack:
-    max_wait: 120
-    timeout: 50
+
+  cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg

Review Comment:
   Can we not touch file ? 
   
   instead, create a file for nocloud and use it to overwrite this cloudstack.cfg only if userdata is passed to system vms ?



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2358230904


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF

Review Comment:
   makes sense, thanks for the testing @vishesh92 



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2358415419


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   it is ok to me.  thanks for explanation @vishesh92 
   maybe add a `note` in the doc for the patching



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3302767235

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 15057


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2358276049


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   @weizhouapache I am working on the docs PR. I will document this behavior and add an example as well.
   
   On patch, we execute `patch-sysvms.sh`. This just copies the new files and restarts the cloud & some other services (`haproxy`, `apache2`, `nfs-common`, etc.) depending on the type of system VM. But it never executes the `cloud-preinit`, `cloud-postinit` service.
   
   IMO, we shouldn't be executing `cloud-init` as part of the patch process since cloud-init runs only once on a VM or only on reboot depending on the configuration. If the user wants to execute it again, they should delete the VM.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3326204847

   <b>[SF] Trillian test result (tid-14426)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 54369 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14426-kvm-ol8.zip
   Smoke tests completed. 147 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3306288741

   > @vishesh92 is it a good idea to add some validations to these userdata configs, to avoid any kind of security risks ?
   
   IMO, it would be difficult to do that. Technically the user data could be a script which fetches a binary (malicious) from internet and executes it on the system VM and we won't be able to validate this.
   But since the global settings are scoped at zone level, only the operators can set the user data.
   
   I have also added a new global setting, `systemvm.userdata.enabled`, which is set to `false` by default. Unless this is set to `true`, the other global settings are ignored.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3306523786

   
   
   > > @vishesh92 is it a good idea to add some validations to these userdata configs, to avoid any kind of security risks ?
   > 
   > IMO, it would be difficult to do that. Technically the user data could be a script which fetches a binary (malicious) from internet and executes it on the system VM and we won't be able to validate this. But since the global settings are scoped at zone level, only the operators can set the user data.
   > 
   > I have also added a new global setting, `systemvm.userdata.enabled`, which is set to `false` by default. Unless this is set to `true`, the other global settings are ignored.
   
   @harikrishna-patnala's concern is very good point
   CPVM and SSVM has access to management network, SSVM can access storage network too, so we need to be careful.
   we could move the configurations to Secure category so they are not visible in global settings, or move them to non-dynamic so restarting management server is needed to make them effective.
   what if the root admin (cloudstack user) is compromised ?


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3308947704

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3322761650

   @vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319309172

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319305797

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371621996


##########
engine/userdata/src/main/java/org/apache/cloudstack/userdata/UserDataManagerImpl.java:
##########
@@ -137,7 +139,11 @@ public String validateAndGetUserDataForSystemVM(String userDataUuid) {
             return null;
         }
         if (userDataVo.getDomainId() == Domain.ROOT_DOMAIN && userDataVo.getAccountId() == User.UID_ADMIN) {
-            return userDataVo.getUserData();
+            // Decode base64 user data, compress it, then re-encode to reduce command line length

Review Comment:
   @vishesh92 
   can you maybe test some userdata and share the length of base64-encoded userdata and base64-encoded compressed userdata ? just curious about the compression rate



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3343829700

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3336693112

   <b>[SF] Trillian test result (tid-14436)</b>
   Environment: vmware-70u3 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 62221 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14436-vmware-70u3.zip
   Smoke tests completed. 145 look OK, 2 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_ssl_offloading_isolated_network | `Failure` | 803.64 | test_ssl_offloading.py
   test_02_ssl_offloading_project_vpc | `Failure` | 811.30 | test_ssl_offloading.py
   test_01_vpn_usage | `Error` | 1.11 | test_usage.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3310829218

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3343617636

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3348206975

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3354769026

   <b>[SF] Trillian test result (tid-14483)</b>
   Environment: kvm-ubuntu22 (x2), zone: Advanced Networking with Mgmt server u22
   Total time taken: 57645 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14483-kvm-ubuntu22.zip
   Smoke tests completed. 147 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_enableHumanReadableLogs | `Error` | 0.18 | test_human_readable_logs.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3309607978

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15084


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3310773043

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3306474992

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356324528


##########
tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh:
##########
@@ -132,15 +132,41 @@ function configure_services() {
   # Disable container services
   systemctl disable containerd
 
-  # Disable cloud init by default
-cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
-datasource_list: ['CloudStack']
-datasource:
-  CloudStack:
-    max_wait: 120
-    timeout: 50
+
+  cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg

Review Comment:
   I can remove my changes from this file and as part of postinit.sh when userdata is specified, I can overwrite `/etc/cloud/cloud.cfg.d/cloudstack.cfg` with the below config.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3379233891

   <b>[SF] Trillian test result (tid-14552)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 54188 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14552-kvm-ol8.zip
   Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3315703816

   <b>[SF] Trillian test result (tid-14405)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 56343 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14405-kvm-ol8.zip
   Smoke tests completed. 147 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319704932

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3322992456

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3302395371

   <b>[SF] Trillian Build Failed (tid-14364)<b/>


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3337486983

   <b>[SF] Trillian test result (tid-14437)</b>
   Environment: xcpng82 (x2), zone: Advanced Networking with Mgmt server ol9
   Total time taken: 80554 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14437-xcpng82.zip
   Smoke tests completed. 139 look OK, 8 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_events_resource | `Error` | 231.20 | test_events_resource.py
   test_01_non_strict_host_anti_affinity | `Error` | 214.08 | test_nonstrict_affinity_group.py
   test_02_non_strict_host_affinity | `Error` | 53.53 | test_nonstrict_affinity_group.py
   test_01_primary_storage_iscsi | `Error` | 0.91 | test_primary_storage.py
   test_02_ssl_offloading_project_vpc | `Failure` | 877.16 | test_ssl_offloading.py
   test_12_destroy_cpvm | `Error` | 9.39 | test_ssvm.py
   test_01_vpn_usage | `Error` | 1.12 | test_usage.py
   test_11_destroy_vm_and_volumes | `Error` | 40.53 | test_vm_life_cycle.py
   test_01_migrate_vm_strict_tags_success | `Error` | 61.63 | test_vm_strict_host_tags.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3301915188

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3303835824

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3303840857

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375943219

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "harikrishna-patnala (via GitHub)" <gi...@apache.org>.
harikrishna-patnala commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375643407

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375642742

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3311290215

   <b>[SF] Trillian Build Failed (tid-14385)<b/>


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3315063877

   @harikrishna-patnala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371711043


##########
engine/userdata/src/main/java/org/apache/cloudstack/userdata/UserDataManagerImpl.java:
##########
@@ -137,7 +139,11 @@ public String validateAndGetUserDataForSystemVM(String userDataUuid) {
             return null;
         }
         if (userDataVo.getDomainId() == Domain.ROOT_DOMAIN && userDataVo.getAccountId() == User.UID_ADMIN) {
-            return userDataVo.getUserData();
+            // Decode base64 user data, compress it, then re-encode to reduce command line length

Review Comment:
   I used an AI tool to generate some sample user data and check.
   
   <details><summary>sample user data</summary>
   <p>
   
   // Test Case 1: Basic cloud-config with package installation
               String basicCloudConfig = "#cloud-config\n" +
                   "packages:\n" +
                   "  - nginx\n" +
                   "  - docker.io\n" +
                   "  - git\n" +
                   "  - curl\n" +
                   "  - vim\n" +
                   "  - htop\n" +
                   "write_files:\n" +
                   "  - content: |\n" +
                   "      Hello World!\n" +
                   "      This is a test file.\n" +
                   "    path: /home/ubuntu/hello.txt\n" +
                   "    permissions: '0644'\n" +
                   "runcmd:\n" +
                   "  - systemctl enable nginx\n" +
                   "  - systemctl start nginx\n" +
                   "  - echo 'Setup complete' > /var/log/setup.log\n";
               results.add(new TestResult("Basic cloud-config", basicCloudConfig));
               
               // Test Case 2: Complex cloud-config with users, SSH keys, and services
               String complexCloudConfig = "#cloud-config\n" +
                   "users:\n" +
                   "  - name: devuser\n" +
                   "    groups: sudo,docker\n" +
                   "    shell: /bin/bash\n" +
                   "    sudo: ['ALL=(ALL) NOPASSWD:ALL']\n" +
                   "    ssh_authorized_keys:\n" +
                   "      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC7vbqajDhubzjWkNo6HLx4ySHp8IfEtJSVo7tP9q2RhYKzL8AzL1v7M2dKwGHGJ8EwPdMzBgU5tS+v8pEo+1nV5+VWOq0W4MtL user@example.com\n" +
                   "      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDEfGHIjKlMnOpQrStUvWxYz+TcX9mZYHdRqO8VwGtQ2r4E6z4E+1mWq8vEP2qR4zZwGhYd8fGhIjKlMnOpQrStUvWxYz admin@company.com\n" +
                   "packages:\n" +
                   "  - nginx\n" +
                   "  - docker.io\n" +
                   "  - docker-compose\n" +
                   "  - git\n" +
                   "  - curl\n" +
                   "  - wget\n" +
                   "  - vim\n" +
                   "  - nano\n" +
                   "  - htop\n" +
                   "  - tree\n" +
                   "  - jq\n" +
                   "  - unzip\n" +
                   "  - python3-pip\n" +
                   "  - nodejs\n" +
                   "  - npm\n" +
                   "write_files:\n" +
                   "  - content: |\n" +
                   "      upstream backend {\n" +
                   "          server 127.0.0.1:3000;\n" +
                   "          server 127.0.0.1:3001;\n" +
                   "      }\n" +
                   "      server {\n" +
                   "          listen 80;\n" +
                   "          location / {\n" +
                   "              proxy_pass http://backend;\n" +
                   "              proxy_set_header Host $host;\n" +
                   "              proxy_set_header X-Real-IP $remote_addr;\n" +
                   "              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n" +
                   "              proxy_set_header X-Forwarded-Proto $scheme;\n" +
                   "          }\n" +
                   "      }\n" +
                   "    path: /etc/nginx/sites-available/default\n" +
                   "    permissions: '0644'\n" +
                   "  - content: |\n" +
                   "      #!/bin/bash\n" +
                   "      # Application deployment script\n" +
                   "      set -e\n" +
                   "      cd /opt/app\n" +
                   "      git clone https://github.com/company/webapp.git .\n" +
                   "      npm install\n" +
                   "      npm run build\n" +
                   "      pm2 start ecosystem.config.js\n" +
                   "    path: /usr/local/bin/deploy-app.sh\n" +
                   "    permissions: '0755'\n" +
                   "  - content: |\n" +
                   "      version: '3.8'\n" +
                   "      services:\n" +
                   "        redis:\n" +
                   "          image: redis:alpine\n" +
                   "          ports:\n" +
                   "            - \"6379:6379\"\n" +
                   "          volumes:\n" +
                   "            - redis_data:/data\n" +
                   "        postgres:\n" +
                   "          image: postgres:13\n" +
                   "          environment:\n" +
                   "            POSTGRES_DB: myapp\n" +
                   "            POSTGRES_USER: myuser\n" +
                   "            POSTGRES_PASSWORD: mypassword\n" +
                   "          volumes:\n" +
                   "            - postgres_data:/var/lib/postgresql/data\n" +
                   "          ports:\n" +
                   "            - \"5432:5432\"\n" +
                   "      volumes:\n" +
                   "        redis_data:\n" +
                   "        postgres_data:\n" +
                   "    path: /opt/docker-compose.yml\n" +
                   "    permissions: '0644'\n" +
                   "runcmd:\n" +
                   "  - mkdir -p /opt/app\n" +
                   "  - chown devuser:devuser /opt/app\n" +
                   "  - systemctl enable nginx\n" +
                   "  - systemctl start nginx\n" +
                   "  - systemctl enable docker\n" +
                   "  - systemctl start docker\n" +
                   "  - usermod -aG docker devuser\n" +
                   "  - npm install -g pm2\n" +
                   "  - cd /opt && docker-compose up -d\n" +
                   "  - /usr/local/bin/deploy-app.sh\n" +
                   "  - echo 'Complex setup complete' > /var/log/setup.log\n" +
                   "bootcmd:\n" +
                   "  - echo 'Starting cloud-init setup' > /var/log/bootcmd.log\n" +
                   "final_message: |\n" +
                   "  Cloud-init setup completed successfully!\n" +
                   "  Services started:\n" +
                   "  - nginx\n" +
                   "  - docker\n" +
                   "  - postgresql\n" +
                   "  - redis\n" +
                   "  - webapp\n";
               results.add(new TestResult("Complex cloud-config", complexCloudConfig));
               
               // Test Case 3: Shell script userdata
               String shellScript = "#!/bin/bash\n" +
                   "# Comprehensive server setup script\n" +
                   "set -e\n" +
                   "\n" +
                   "# Update system\n" +
                   "apt-get update\n" +
                   "apt-get upgrade -y\n" +
                   "\n" +
                   "# Install essential packages\n" +
                   "apt-get install -y \\\n" +
                   "    nginx \\\n" +
                   "    docker.io \\\n" +
                   "    docker-compose \\\n" +
                   "    git \\\n" +
                   "    curl \\\n" +
                   "    wget \\\n" +
                   "    vim \\\n" +
                   "    htop \\\n" +
                   "    tree \\\n" +
                   "    jq \\\n" +
                   "    unzip \\\n" +
                   "    python3-pip \\\n" +
                   "    nodejs \\\n" +
                   "    npm \\\n" +
                   "    certbot \\\n" +
                   "    python3-certbot-nginx\n" +
                   "\n" +
                   "# Configure firewall\n" +
                   "ufw allow OpenSSH\n" +
                   "ufw allow 'Nginx Full'\n" +
                   "ufw --force enable\n" +
                   "\n" +
                   "# Create application user\n" +
                   "useradd -m -s /bin/bash appuser\n" +
                   "usermod -aG sudo,docker appuser\n" +
                   "\n" +
                   "# Setup application directory\n" +
                   "mkdir -p /opt/webapp\n" +
                   "chown appuser:appuser /opt/webapp\n" +
                   "\n" +
                   "# Configure nginx\n" +
                   "cat > /etc/nginx/sites-available/default <<'EOF'\n" +
                   "server {\n" +
                   "    listen 80;\n" +
                   "    server_name _;\n" +
                   "    \n" +
                   "    location / {\n" +
                   "        proxy_pass http://127.0.0.1:3000;\n" +
                   "        proxy_http_version 1.1;\n" +
                   "        proxy_set_header Upgrade $http_upgrade;\n" +
                   "        proxy_set_header Connection 'upgrade';\n" +
                   "        proxy_set_header Host $host;\n" +
                   "        proxy_set_header X-Real-IP $remote_addr;\n" +
                   "        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n" +
                   "        proxy_set_header X-Forwarded-Proto $scheme;\n" +
                   "        proxy_cache_bypass $http_upgrade;\n" +
                   "    }\n" +
                   "    \n" +
                   "    location /health {\n" +
                   "        access_log off;\n" +
                   "        return 200 \"healthy\\n\";\n" +
                   "        add_header Content-Type text/plain;\n" +
                   "    }\n" +
                   "}\n" +
                   "EOF\n" +
                   "\n" +
                   "# Create monitoring script\n" +
                   "cat > /usr/local/bin/monitor.sh <<'EOF'\n" +
                   "#!/bin/bash\n" +
                   "# Simple monitoring script\n" +
                   "while true; do\n" +
                   "    echo \"$(date): System status check\"\n" +
                   "    echo \"CPU: $(cat /proc/loadavg)\"\n" +
                   "    echo \"Memory: $(free -h | grep '^Mem')\"\n" +
                   "    echo \"Disk: $(df -h / | tail -n1)\"\n" +
                   "    echo \"---\"\n" +
                   "    sleep 300\n" +
                   "done\n" +
                   "EOF\n" +
                   "chmod +x /usr/local/bin/monitor.sh\n" +
                   "\n" +
                   "# Install Node.js LTS\n" +
                   "curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -\n" +
                   "apt-get install -y nodejs\n" +
                   "\n" +
                   "# Install PM2 for process management\n" +
                   "npm install -g pm2\n" +
                   "\n" +
                   "# Setup systemd service for monitoring\n" +
                   "cat > /etc/systemd/system/monitor.service <<'EOF'\n" +
                   "[Unit]\n" +
                   "Description=System Monitor\n" +
                   "After=network.target\n" +
                   "\n" +
                   "[Service]\n" +
                   "Type=simple\n" +
                   "User=root\n" +
                   "ExecStart=/usr/local/bin/monitor.sh\n" +
                   "Restart=always\n" +
                   "RestartSec=10\n" +
                   "\n" +
                   "[Install]\n" +
                   "WantedBy=multi-user.target\n" +
                   "EOF\n" +
                   "\n" +
                   "# Enable services\n" +
                   "systemctl daemon-reload\n" +
                   "systemctl enable nginx\n" +
                   "systemctl enable docker\n" +
                   "systemctl enable monitor\n" +
                   "\n" +
                   "# Start services\n" +
                   "systemctl start nginx\n" +
                   "systemctl start docker\n" +
                   "systemctl start monitor\n" +
                   "\n" +
                   "# Log completion\n" +
                   "echo \"$(date): Server setup completed successfully\" > /var/log/setup-complete.log\n" +
                   "echo \"Setup completed at $(date)\" | wall\n";
               results.add(new TestResult("Shell script userdata", shellScript));
               
               // Test Case 4: Cloud-boothook
               String cloudBoothook = "#cloud-boothook\n" +
                   "#!/bin/bash\n" +
                   "# This runs very early in the boot process\n" +
                   "echo 'Cloud-boothook executed at' $(date) >> /var/log/cloud-boothook.log\n" +
                   "\n" +
                   "# Set hostname\n" +
                   "hostnamectl set-hostname webapp-server\n" +
                   "\n" +
                   "# Configure timezone\n" +
                   "timedatectl set-timezone UTC\n" +
                   "\n" +
                   "# Disable swap\n" +
                   "swapoff -a\n" +
                   "sed -i '/ swap / s/^/#/' /etc/fstab\n" +
                   "\n" +
                   "# Kernel parameter tuning\n" +
                   "echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf\n" +
                   "echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.conf\n" +
                   "echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.conf\n" +
                   "echo 'vm.max_map_count=262144' >> /etc/sysctl.conf\n" +
                   "sysctl -p\n" +
                   "\n" +
                   "# Create directories\n" +
                   "mkdir -p /opt/app/{config,logs,data}\n" +
                   "mkdir -p /var/cache/app\n" +
                   "\n" +
                   "echo 'Cloud-boothook setup completed' >> /var/log/cloud-boothook.log\n";
               results.add(new TestResult("Cloud-boothook", cloudBoothook));
               
               // Test Case 5: MIME multipart with mixed content types
               String mimeMultipart = "Content-Type: multipart/mixed; boundary=\"===============1234567890==\"\n" +
                   "MIME-Version: 1.0\n" +
                   "\n" +
                   "--===============1234567890==\n" +
                   "Content-Type: text/cloud-config; charset=\"us-ascii\"\n" +
                   "MIME-Version: 1.0\n" +
                   "Content-Transfer-Encoding: 7bit\n" +
                   "Content-Disposition: attachment; filename=\"cloud-config\"\n" +
                   "\n" +
                   "#cloud-config\n" +
                   "packages:\n" +
                   "  - docker.io\n" +
                   "  - docker-compose\n" +
                   "write_files:\n" +
                   "  - content: |\n" +
                   "      [Unit]\n" +
                   "      Description=My Application\n" +
                   "      After=docker.service\n" +
                   "      Requires=docker.service\n" +
                   "      \n" +
                   "      [Service]\n" +
                   "      Type=oneshot\n" +
                   "      RemainAfterExit=yes\n" +
                   "      WorkingDirectory=/opt/app\n" +
                   "      ExecStart=/usr/local/bin/docker-compose up -d\n" +
                   "      ExecStop=/usr/local/bin/docker-compose down\n" +
                   "      \n" +
                   "      [Install]\n" +
                   "      WantedBy=multi-user.target\n" +
                   "    path: /etc/systemd/system/myapp.service\n" +
                   "    permissions: '0644'\n" +
                   "\n" +
                   "--===============1234567890==\n" +
                   "Content-Type: text/x-shellscript; charset=\"us-ascii\"\n" +
                   "MIME-Version: 1.0\n" +
                   "Content-Transfer-Encoding: 7bit\n" +
                   "Content-Disposition: attachment; filename=\"setup.sh\"\n" +
                   "\n" +
                   "#!/bin/bash\n" +
                   "set -e\n" +
                   "\n" +
                   "# Create application structure\n" +
                   "mkdir -p /opt/app\n" +
                   "cd /opt/app\n" +
                   "\n" +
                   "# Create docker-compose.yml\n" +
                   "cat > docker-compose.yml <<EOF\n" +
                   "version: '3.8'\n" +
                   "services:\n" +
                   "  web:\n" +
                   "    image: nginx:alpine\n" +
                   "    ports:\n" +
                   "      - \"80:80\"\n" +
                   "    volumes:\n" +
                   "      - ./html:/usr/share/nginx/html:ro\n" +
                   "  app:\n" +
                   "    image: node:16-alpine\n" +
                   "    working_dir: /app\n" +
                   "    volumes:\n" +
                   "      - ./app:/app\n" +
                   "    command: npm start\n" +
                   "    environment:\n" +
                   "      - NODE_ENV=production\n" +
                   "EOF\n" +
                   "\n" +
                   "# Create basic HTML\n" +
                   "mkdir -p html\n" +
                   "echo '<h1>Welcome to My Application</h1>' > html/index.html\n" +
                   "\n" +
                   "# Set permissions\n" +
                   "chown -R 1000:1000 /opt/app\n" +
                   "\n" +
                   "# Enable and start service\n" +
                   "systemctl daemon-reload\n" +
                   "systemctl enable myapp.service\n" +
                   "systemctl start myapp.service\n" +
                   "\n" +
                   "echo 'Application setup completed'\n" +
                   "\n" +
                   "--===============1234567890==--\n";
               results.add(new TestResult("MIME multipart", mimeMultipart));
               
               // Test Case 6: Very repetitive configuration (should compress well)
               StringBuilder repetitiveConfig = new StringBuilder("#cloud-config\n");
               repetitiveConfig.append("write_files:\n");
               for (int i = 1; i <= 50; i++) {
                   repetitiveConfig.append("  - content: |\n");
                   repetitiveConfig.append("      #!/bin/bash\n");
                   repetitiveConfig.append("      # Configuration script " + i + "\n");
                   repetitiveConfig.append("      echo 'Processing configuration " + i + "'\n");
                   repetitiveConfig.append("      mkdir -p /opt/config" + i + "\n");
                   repetitiveConfig.append("      echo 'Configuration " + i + " completed' > /opt/config" + i + "/status.txt\n");
                   repetitiveConfig.append("      chmod 755 /opt/config" + i + "\n");
                   repetitiveConfig.append("    path: /usr/local/bin/config" + i + ".sh\n");
                   repetitiveConfig.append("    permissions: '0755'\n");
               }
               repetitiveConfig.append("runcmd:\n");
               for (int i = 1; i <= 50; i++) {
                   repetitiveConfig.append("  - /usr/local/bin/config" + i + ".sh\n");
               }
   
   </p>
   </details> 
   
   Based on the compression test results, here's the detailed size comparison table:
   
   1. **Original size**: Raw userdata string length
   2. **Base64 size**: Original string → Base64 encoded 
   3. **Compressed+Base64 size**: Original string → Gzip compressed → Base64 encoded
   
   ## Userdata Compression Analysis Results
   
   | **Userdata Type** | **Original Size** | **Base64 Only** | **Gzip+Base64** | **Compression Ratio** | **Savings** |
   |-------------------|-------------------|------------------|------------------|----------------------|-------------|
   | Basic cloud-config | 321 chars | 428 chars | 304 chars | 71.03% | **29.0%** |
   | Complex cloud-config | 2,628 chars | 3,504 chars | 1,572 chars | 44.86% | **55.1%** |
   | Shell script userdata | 2,484 chars | 3,312 chars | 1,492 chars | 45.05% | **55.0%** |
   | Cloud-boothook | 732 chars | 976 chars | 520 chars | 53.28% | **46.7%** |
   | MIME multipart | 1,741 chars | 2,324 chars | 1,036 chars | 44.58% | **55.4%** |
   | Repetitive config (50 scripts) | 16,163 chars | 21,552 chars | 1,728 chars | 8.02% | **92.0%** |
   



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3311117550

   Packaging result [SF]: ✖️ el8 ✖️ el9  ✔️ debian ✖️ suse15. SL-JID 15096


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2358229959


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   ok,  I think we can let it executed each time during bootup.
   maybe add an example how to achieve one-time execution of configuration in doc, similar to what CKS does
   ```
         if [[ -f "/home/cloud/success" ]]; then
             echo "Already provisioned!"
             exit 0
         fi
   ...
         sudo touch /home/cloud/success
         echo "true" > /home/cloud/success
   ```
   
   I did not consider patch process, do we need to consider it ? @vishesh92 



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356311353


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF

Review Comment:
   Yes. I manually removed the meta-data file and ran the cloud-init commands. It didn't execute user-data.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3304123345

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15064


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3302379687

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3301929487

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/11654?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 3.62%. Comparing base ([`8089d32`](https://app.codecov.io/gh/apache/cloudstack/commit/8089d32740320171f63d3f66d0abd429f455caf5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d39656a`](https://app.codecov.io/gh/apache/cloudstack/commit/d39656af835c33a52b9d4e32322ec6607607d6cd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 12 commits behind head on main.
   > :exclamation:  There is a different number of reports uploaded between BASE (8089d32) and HEAD (d39656a). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (8089d32) | HEAD (d39656a) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #11654       +/-   ##
   =============================================
   - Coverage     17.36%    3.62%   -13.75%     
   =============================================
     Files          5888      441     -5447     
     Lines        525831    37135   -488696     
     Branches      64183     6807    -57376     
   =============================================
   - Hits          91298     1345    -89953     
   + Misses       424227    35628   -388599     
   + Partials      10306      162    -10144     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/11654/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/11654/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.62% <ø> (-0.01%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/11654/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/11654?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3307290431

   > @harikrishna-patnala's concern is very good point CPVM and SSVM has access to management network, SSVM can access storage network too, so we need to be careful. we could move the configurations to Secure category so they are not visible in global settings, or move them to non-dynamic so restarting management server is needed to make them effective. what if the root admin (cloudstack user) is compromised ?
   
   Let me make the changes to make the global setting non-dynamic & move it to Secure category.
   If the root admin is compromised, the attacker will be able to use console and access the system VMs anyway.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "harikrishna-patnala (via GitHub)" <gi...@apache.org>.
harikrishna-patnala commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3314947383

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319574376

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3355981137

   <b>[SF] Trillian test result (tid-14485)</b>
   Environment: xcpng82 (x2), zone: Advanced Networking with Mgmt server ol9
   Total time taken: 82150 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14485-xcpng82.zip
   Smoke tests completed. 142 look OK, 6 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_events_resource | `Error` | 235.80 | test_events_resource.py
   test_01_non_strict_host_anti_affinity | `Error` | 218.18 | test_nonstrict_affinity_group.py
   test_02_non_strict_host_affinity | `Error` | 82.12 | test_nonstrict_affinity_group.py
   test_01_primary_storage_iscsi | `Error` | 0.87 | test_primary_storage.py
   test_01_vpn_usage | `Error` | 1.15 | test_usage.py
   test_11_destroy_vm_and_volumes | `Error` | 26.36 | test_vm_life_cycle.py
   test_01_migrate_vm_strict_tags_success | `Error` | 73.84 | test_vm_strict_host_tags.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3355300674

   <b>[SF] Trillian test result (tid-14484)</b>
   Environment: vmware-70u3 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 69517 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14484-vmware-70u3.zip
   Smoke tests completed. 147 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_08_upgrade_kubernetes_ha_cluster | `Failure` | 3679.89 | test_kubernetes_clusters.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3322757922

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3343830679

   @vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351683674

   @blueorangutan test


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375933835

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15315


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351274394

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3351678827

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15235


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "harikrishna-patnala (via GitHub)" <gi...@apache.org>.
harikrishna-patnala merged PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356311353


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF

Review Comment:
   Yes. I manually removed the meta-data file and ran the cloud-init commands. It didn't execute user-data.
   ```
   2025-09-17 17:59:19,050 - util.py[WARNING]: No instance datasource found! Likely bad things to come!
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3310832327

   @vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3302375216

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3318367270

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319497887

   Packaging result [SF]: ✖️ el8 ✖️ el9  ✖️ debian ✖️ suse15. SL-JID 15135


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3314947913

   @harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov closed pull request #11654: Add support for providing userdata to system VMs
URL: https://github.com/apache/cloudstack/pull/11654


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3322989850

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371491435


##########
plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java:
##########
@@ -477,6 +486,24 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
         }
         String msPublicKey = _configDao.getValue("ssh.publickey");
         buf.append(" authorized_key=").append(VirtualMachineGuru.getEncodedMsPublicKey(msPublicKey));
+
+        if (SystemVmEnableUserData.valueIn(dc.getId())) {
+            String userDataUuid = RouterUserData.valueIn(dc.getId());
+            try {
+                String userData = userDataManager.validateAndGetUserDataForSystemVM(userDataUuid);

Review Comment:
   can it be extracted to a method in userDataManager ?



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371717061


##########
engine/userdata/src/main/java/org/apache/cloudstack/userdata/UserDataManagerImpl.java:
##########
@@ -137,7 +139,11 @@ public String validateAndGetUserDataForSystemVM(String userDataUuid) {
             return null;
         }
         if (userDataVo.getDomainId() == Domain.ROOT_DOMAIN && userDataVo.getAccountId() == User.UID_ADMIN) {
-            return userDataVo.getUserData();
+            // Decode base64 user data, compress it, then re-encode to reduce command line length

Review Comment:
   looks promising
   
   thanks @vishesh92 



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3323341808

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15145


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3336527402

   <b>[SF] Trillian test result (tid-14435)</b>
   Environment: kvm-ubuntu22 (x2), zone: Advanced Networking with Mgmt server u22
   Total time taken: 55564 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14435-kvm-ubuntu22.zip
   Smoke tests completed. 147 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov closed pull request #11654: Add support for providing userdata to system VMs
URL: https://github.com/apache/cloudstack/pull/11654


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3354727983

   <b>[SF] Trillian test result (tid-14482)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 55364 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11654-t14482-kvm-ol8.zip
   Smoke tests completed. 147 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_enableHumanReadableLogs | `Error` | 0.32 | test_human_readable_logs.py
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3343612302

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3302262854

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15055


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356313501


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   If we don't want the user-data to get executed each time, we can remove `cloud-init clean --logs` on L92.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2356303886


##########
systemvm/debian/opt/cloud/bin/setup/postinit.sh:
##########
@@ -47,6 +47,66 @@ fi
 
 CMDLINE=/var/cache/cloud/cmdline
 TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
+
+# Execute cloud-init manually if user data is present
+run_cloud_init() {
+  if [ ! -f "$CMDLINE" ]; then
+    log_it "No cmdline file found, skipping cloud-init execution"
+    return 0
+  fi
+
+  local encoded_userdata=$(grep -Po 'userdata=\K[^[:space:]]*' "$CMDLINE" || true)
+  if [ -z "$encoded_userdata" ]; then
+    log_it "No user data found in cmdline, skipping cloud-init execution"
+    return 0
+  fi
+
+  log_it "User data detected, setting up and running cloud-init manually"
+
+  # Set up user data files (reuse the function from init.sh)
+  mkdir -p /var/lib/cloud/seed/nocloud
+
+  # Decode and potentially decompress user data
+  local decoded_userdata
+  decoded_userdata=$(echo "$encoded_userdata" | base64 -d 2>/dev/null)
+  if [ $? -ne 0 ] || [ -z "$decoded_userdata" ]; then
+    log_it "ERROR: Failed to decode base64 user data"
+    return 1
+  fi
+
+  # Write user data
+  echo "$decoded_userdata" > /var/lib/cloud/seed/nocloud/user-data
+  chmod 600 /var/lib/cloud/seed/nocloud/user-data
+
+  # Create meta-data
+  local instance_name=$(grep -Po 'name=\K[^[:space:]]*' "$CMDLINE" || hostname)
+  cat > /var/lib/cloud/seed/nocloud/meta-data << EOF
+instance-id: $instance_name
+local-hostname: $instance_name
+EOF
+  chmod 644 /var/lib/cloud/seed/nocloud/meta-data
+
+  log_it "User data files created, executing cloud-init..."
+
+  # Clean any previous cloud-init state
+  cloud-init clean --logs
+
+  # Run cloud-init stages manually

Review Comment:
   yes. On reboot, the user data gets executed again. On patching, it doesn't.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2355018085


##########
tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh:
##########
@@ -132,15 +132,41 @@ function configure_services() {
   # Disable container services
   systemctl disable containerd
 
-  # Disable cloud init by default
-cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
-datasource_list: ['CloudStack']
-datasource:
-  CloudStack:
-    max_wait: 120
-    timeout: 50
+
+  cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
+#cloud-config
+datasource_list: ['NoCloud']
+network:
+  config: disabled
+manage_etc_hosts: false
+manage_resolv_conf: false
+users: []
+disable_root: false
+ssh_pwauth: false
+cloud_init_modules:
+ - migrator
+ - seed_random
+ - bootcmd
+ - write-files
+ - growpart
+ - resizefs
+ - disk_setup
+ - mounts
+ - rsyslog
+cloud_config_modules:
+ - locale
+ - timezone
+ - runcmd
+cloud_final_modules:
+ - scripts-per-once
+ - scripts-per-boot
+ - scripts-per-instance
+ - scripts-user
+ - final-message
+ - power-state-change

Review Comment:
   The indentation in the cloud-init configuration is inconsistent. Lines 147-155 use single space indentation while lines 157-166 use single space indentation as well, but the YAML structure should use consistent 2-space indentation for proper formatting.
   ```suggestion
     - migrator
     - seed_random
     - bootcmd
     - write-files
     - growpart
     - resizefs
     - disk_setup
     - mounts
     - rsyslog
   cloud_config_modules:
     - locale
     - timezone
     - runcmd
   cloud_final_modules:
     - scripts-per-once
     - scripts-per-boot
     - scripts-per-instance
     - scripts-user
     - final-message
     - power-state-change
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2355012991


##########
tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh:
##########
@@ -132,15 +132,42 @@ function configure_services() {
   # Disable container services
   systemctl disable containerd
 
-  # Disable cloud init by default
-cat <<EOF > /etc/cloud/cloud.cfg.d/cloudstack.cfg
-datasource_list: ['CloudStack']
-datasource:
-  CloudStack:
-    max_wait: 120
-    timeout: 50
+  # Cloud-init services will be managed by dependency ordering to run after CloudStack networking

Review Comment:
   ```suggestion
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3306797198

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15079


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3310771501

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3307392764

   > If the root admin is compromised, the attacker will be able to use console and access the system VMs anyway.
   
   oh, yes, it is true, they do not need the userdata to attack the system. so forget it
   
   


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3311481359

   <b>[SF] Trillian Build Failed (tid-14388)<b/>


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on code in PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#discussion_r2371562664


##########
plugins/network-elements/elastic-loadbalancer/src/main/java/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java:
##########
@@ -477,6 +486,24 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl
         }
         String msPublicKey = _configDao.getValue("ssh.publickey");
         buf.append(" authorized_key=").append(VirtualMachineGuru.getEncodedMsPublicKey(msPublicKey));
+
+        if (SystemVmEnableUserData.valueIn(dc.getId())) {
+            String userDataUuid = RouterUserData.valueIn(dc.getId());
+            try {
+                String userData = userDataManager.validateAndGetUserDataForSystemVM(userDataUuid);

Review Comment:
   yes. Makes sense. I will get the encodedUserData from the UserDatamanager.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3319694524

   @blueorangutan package


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3320086163

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15138


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3323361164

   @borisstoyanov a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3318110152

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375649414

   @harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add support for providing userdata to system VMs [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11654:
URL: https://github.com/apache/cloudstack/pull/11654#issuecomment-3375946044

   @vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org