openmainframeproject / feilong

Feilong is a open source z/VM cloud connector project under the Open Mainframe Project umbrella that will accelerate the z/VM adoption, extending its ecosystem and its user experience. It provides a set of APIs to operate z/VM including guest, image, network, volume etc.
https://www.openmainframeproject.org/projects/feilong
Apache License 2.0
35 stars 70 forks source link

"admin_password" parameter in config disk's meta_data.json is ignored #819

Open Bischoff opened 3 months ago

Bischoff commented 3 months ago

I would like to set up root's password at deployment time.

Looking at the code of nova zvm connector, they pass it via admin_pass in the metadata file of the config disk. So I tried to do the same:

 {
   "uuid": "NAME",
+  "admin_pass": "ADMIN_PASS",
   "public_keys": {
     "Public Key": "PUBLIC_KEY"
   },
(...)

I'd like to contribute a fix to this problem, but there's something I do not understand. When I call the "Deploy Guest" API call, it uploads the "transport file" and then sends it to the VM's punch. Then it's used by cloud-init inside the Linux guest. But I could not find the code that manages this option.

bjhuangr commented 3 months ago

@SeanHQF do you know the details in this area?

Bischoff commented 3 months ago

It's a known issue:

https://github.com/canonical/cloud-init/issues/2402

There are hacks out there to work around it:

http://madorn.com/cloud-init-admin-pass.html

So it was never going to work.

Actions

  1. If you'd like me to remove this (unrelated) dead code, just ask me:

    def get_change_passwd_command(self, admin_password):
        """construct change password command
    
        :admin_password: the password to be changed to
        """
        return "echo 'root:%s' | chpasswd" % admin_password

    (in zvmsdk/dist.py), plus the testing code in zvmsdk/tests/fvt/test_guest.py:

            f.write('{"admin_pass": "sMcTNh8b65dM",\
  2. Also, feel free to remove that option from the zvm nova driver.

  3. Feel free to close this issue.