-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement: add password to configdrive vendor_data.json #10061
base: 4.20
Are you sure you want to change the base?
Conversation
Good |
@blueorangutan package |
@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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #10061 +/- ##
============================================
+ Coverage 16.03% 16.13% +0.10%
- Complexity 12814 12988 +174
============================================
Files 5637 5637
Lines 493506 497550 +4044
Branches 59831 61561 +1730
============================================
+ Hits 79129 80303 +1174
- Misses 405601 408349 +2748
- Partials 8776 8898 +122
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11752 |
@blueorangutan test |
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
@phsm
|
Hi Wei, I tested what you've asked and a bit more on the top of it. Test 1: change the password, and rebooting the VM
Test 2: Stop and start the VM after the test 1
Test 3: Change password from Cloudstack UI/API
A bit more details about the Test 3: |
thanks @phsm for the testing Test1 and Test2 look fine. |
[SF] Trillian test result (tid-11866)
|
@phsm , does this apply to 4.19 as well? If so, can you rebase onto the 4.19 branch? |
@DaanHoogland I can try. How shall I do it: as a separate PR to the 4.19 branch? |
no, you can rebase your current branch. It is not good practice to name your branch main, but it doesn't hurt and you can still base it on 4.19. We do not need separate PRs as we usually merge older fixes forward to newer branches. |
I checked the state of 4.19 branch: this code can't be easily merged into it, as it depends on the changes from PR #9329 that is about network configuration support for the config drive. Of course, it can be ported to the code at its v4.19 state (its just injecting the right text into a file), but having a working password while the network is not working seems to not add any value. Thus, perhaps its better to rebase it to 4.20 branch? |
agree @phsm |
Done, rebased to 4.20. |
thanks @phsm @blueorangutan package |
@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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11783 |
@blueorangutan test |
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-11887)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
I know some users use the cloudstack script in the vm template at some points I think the script may be better
|
I specifically left the old functionality, so the users can choose whether to use the script you mentioned, or the cloud-init's native functionality. So this code will not break the script functionality. Regarding the "the username can be changed in the script (by default it uses root)": cloud-init supports custom usernames too, it is a separate parameter in the cloud.cfg that is set to "ubuntu" in Ubuntu cloud image. I think the main issue with the cloud-init |
@phsm your PR is against branch 4.20 but seems to contain main. Can you have a look? |
It seems your own code is actually not in here anymore. |
Apologies, Next time I will create a different branch for my PRs. |
Description
This PR adds the VM password to the vendor_data.json generated when ConfigDrive is used.
This way the ConfigDrive can be used as a full substitute for Virtual Router-based metadata servers, and it works with the ConfigDrive datasource of cloud-init. The existing password file
cloudstack/password/vm-password.txt
is left for compatibility.writeVendorEmptyJsonFile()
towriteVendorDataJsonFile()
as it is not always empty anymorewriteVendorDataJsonFile()
is called with the password, then it generates the vendor data containing a cloud-init snippet that contains the password, just as described here: https://cloudinit.readthedocs.io/en/latest/reference/datasources/openstack.html#vendor-data , https://cloudinit.readthedocs.io/en/latest/reference/modules.html#set-passwordswriteVendorDataJsonFile()
is only called with password when the password "file" is found in the vmData array.Fixes: #9404
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Downloaded a standard Ubuntu qcow2 image, that already has the cloud-init with ConfigDrive datasource in it: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
The network configuration, the hostname, ssh key work, as well as the password for the user "ubuntu" is set to the Cloudstack-generated one.
How did you try to break this feature and the system with this change?
I don't see how it can be broken, I specifically made sure the
writeVendorEmptyJsonFile()
is only called with the password when it was found among the vmData fields. However, if you have suggestions how to test it, then I can perform those tests.