Bug 2094202

Summary: Cloud-init username field should have hint
Product: Container Native Virtualization (CNV) Reporter: Leon Kladnitsky <lkladnit>
Component: User ExperienceAssignee: Matan Schatzman <mschatzm>
Status: CLOSED ERRATA QA Contact: Leon Kladnitsky <lkladnit>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.11.0CC: cnv-qe-bugs, gouyang, yzamir
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-14 19:35:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
cloud init modal none

Description Leon Kladnitsky 2022-06-07 06:11:08 UTC
Created attachment 1887373 [details]
cloud init modal

Created attachment 1887373 [details]
cloud init modal

Description of problem: If the template doesn’t have a cloud-init user, the username input field should be empty and have descriptive text: “User: default cloud init is cloud-user”. Otherwise the input should be pre-populated with value from template.  


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Start customized VM creation flow
2. Open Scripts tab
3. Click Edit in Cloud-init section

Actual results:


Expected results:


Additional info:

Comment 1 Guohua Ouyang 2022-06-17 05:25:06 UTC
Regarding the text: Default cloudinit username is 'cloud-user'
1. If the template has no username set in cloud-init data, we can say the default cloudinit username is 'cloud-user'.
2. If the template has username set, such as for Fedora/Centos template, the text should be:
- fedora: Default cloudinit username is 'fedora'
- centos: Default cloudinit username is 'centos'

Comment 2 Yaacov Zamir 2022-06-21 09:56:42 UTC
hi all
the fix in https://github.com/kubevirt-ui/kubevirt-plugin/pull/617 add a help message:
""" Default cloudinit username is 'cloud-user' """

In comment#1 we suggested to guess the default user name using the OS name, but this is also not correct, because
a. we have no documentation we can relay on that the source image will always use this default user name if the OS is known.
b. the boot source we use may not have the same username as the one we guess

IMHO best solution will be to send users to the image creator for information about the default user name if it's not available, for example:
""" The user's login name, if left empty the default username defined by the boot source image will be used  """
or
""" The user's login name, default username will be used if left empty, for RHEL8 default user name is 'cloud-user' learn more [2] """

RHEL9 does not document a default username [3], so we should not assume it's the same as in RHEL8

Guohua WDYT ?

[1] https://cloudinit.readthedocs.io/en/latest/topics/examples.html?highlight=username#including-users-and-groups
[2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_cloud-init_for_rhel_8/index#changing-a-default-user-name-with-cloud-init_configuring-cloud-init
[3] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_and_managing_cloud-init_for_rhel_9/introduction-to-cloud-init_cloud-content#cloud-init-configuration_introduction-to-cloud-init

Comment 3 Guohua Ouyang 2022-06-21 10:15:09 UTC
(In reply to Yaacov Zamir from comment #2)
> hi all
> the fix in https://github.com/kubevirt-ui/kubevirt-plugin/pull/617 add a
> help message:
> """ Default cloudinit username is 'cloud-user' """
> 
> In comment#1 we suggested to guess the default user name using the OS name,
> but this is also not correct, because
> a. we have no documentation we can relay on that the source image will
> always use this default user name if the OS is known.
> b. the boot source we use may not have the same username as the one we guess
> 
> IMHO best solution will be to send users to the image creator for
> information about the default user name if it's not available, for example:
> """ The user's login name, if left empty the default username defined by the
> boot source image will be used  """
> or
> """ The user's login name, default username will be used if left empty, for
> RHEL8 default user name is 'cloud-user' learn more [2] """
> 
> RHEL9 does not document a default username [3], so we should not assume it's
> the same as in RHEL8
> 
> Guohua WDYT ?

As we synced on slack, let's removing the hint and make the username field required, thanks!

> 
> [1]
> https://cloudinit.readthedocs.io/en/latest/topics/examples.
> html?highlight=username#including-users-and-groups
> [2]
> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/
> html-single/configuring_and_managing_cloud-init_for_rhel_8/index#changing-a-
> default-user-name-with-cloud-init_configuring-cloud-init
> [3]
> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/
> html/configuring_and_managing_cloud-init_for_rhel_9/introduction-to-cloud-
> init_cloud-content#cloud-init-configuration_introduction-to-cloud-init

Comment 4 Yaacov Zamir 2022-06-21 12:15:49 UTC
I agree, so to fix this BZ:

a - remove the hint
b - make the field required
c - in places the UI assume a username and it's missing, we will show some "Not available" or empty as needed
    ( do not guess it's "cloud-user", if missing )

Comment 5 Guohua Ouyang 2022-07-27 03:53:53 UTC
verified on v4.12.0-88

Comment 9 errata-xmlrpc 2022-09-14 19:35:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Virtualization 4.11.0 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:6526