Juan Hernandez has uploaded a new change for review.
Change subject: restapi: Set cloud-init user name
......................................................................
restapi: Set cloud-init user name
Before version 3.5 we used to add a "user: root" line to the generated
cloud-init file if the caller provided a password for the "root" user. For
example, if the caller sent something like this:
<action>
<vm>
<initialization>
<cloud_init>
<users>
<user>
<user_name>root</user_name>
<password>mypass</password>
</user>
</users>
</cloud_init>
</initialization>
</vm>
</action>
We used to generate this cloud-init file:
#cloud-config
ssh_pwauth: true
disable_root: 0
output:
all: '>> /var/log/cloud-init-output.log'
user: root
password: mypass
...
But starting with 3.5 we no longer generate the "user:root" line. This means
that cloud-init will assume that it has to change the password for its default
user, as defined in "/etc/cloud/cloud.cfg". For Fedora it is "fedora" and for
CentOS and RHEL it is "cloud-user".
The net result is that where we used to change the "root" password we now
change the "fedora" or "cloud-init" password.
To avoid this issue this patch restores the old behaviour.
Change-Id: Id18d614612c7143a81c3d14894c9fce88de41601
Bug-Url: https://bugzilla.redhat.com/1156155
Signed-off-by: Juan Hernandez <[email protected]>
(cherry picked from commit 76da3d76cf65b4f3a98f90fa1e65661409b93f3d)
---
M
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/34539/1
diff --git
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
index f885983..92bdb51 100644
---
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
+++
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
@@ -1350,7 +1350,14 @@
if (model.isSetUsers()) {
for (User user : model.getUsers().getUsers()) {
- entity.setRootPassword(user.getPassword());
+ String userName = user.getUserName();
+ if (StringUtils.equals(userName, "root")) {
+ entity.setUserName(userName);
+ String userPassword = user.getPassword();
+ if (userPassword != null) {
+ entity.setRootPassword(userPassword);
+ }
+ }
}
}
--
To view, visit http://gerrit.ovirt.org/34539
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id18d614612c7143a81c3d14894c9fce88de41601
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches