Bug 1287122
| Summary: | [REST-API] [cloud init] Can't set user different than 'root' in RunOnce | ||
|---|---|---|---|
| Product: | [oVirt] ovirt-engine | Reporter: | Israel Pinto <ipinto> |
| Component: | BLL.Virt | Assignee: | Shahar Havivi <shavivi> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Israel Pinto <ipinto> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 3.6.0.3 | CC: | bugs, juan.hernandez, shavivi, s.kieske, tjelinek |
| Target Milestone: | ovirt-3.6.2 | Flags: | michal.skrivanek:
ovirt-3.6.z?
rule-engine: planning_ack? tjelinek: devel_ack+ rule-engine: testing_ack+ |
| Target Release: | 3.6.2 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-02-18 11:11:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Virt | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
NOTE: This scenario works via GUI.
One more scenario that relate to this issue is all via Rest API:
1. Create VM with cloud init configuration, start VM and stop it.
The VM configuration includes user different then 'root',
user name = cloud_user.
2. Edit vm and update user name to cloud_user_2
3. Run VM in RunOnce mode with cloud_init enable.
Results:
Can't login to VM with new and old user name.
Rest requests and payload:
payload:
cat /mnt/openstack/latest/user_data
#cloud-config
ssh_pwauth: true
disable_root: 0
output:
all: '>> /var/log/cloud-init-output.log'
chpasswd:
expire: false
runcmd:
- 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list:
["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'
cat /mnt/openstack/latest/meta_data.json
{
"launch_index" : "0",
"availability_zone" : "nova",
"uuid" : "eec64bcb-9a9f-4a75-a36d-72ca72c28d5e",
"meta" : {
"essential" : "false",
"role" : "server",
"dsmode" : "local"
}
Create VM with cloud init:
2015-12-06 10:16:12,561 - MainThread - vms - DEBUG - CREATE request content is -- url:https://jenkins-vm-09.scl.lab.tlv.redhat.com/api/vms body:<vm>
<name>cloud_init_vm</name>
<description>cloud_init_vm</description>
.....
.....
<template id="9f8f335f-f65b-4f2d-8844-415d999e2441"/>
<initialization>
<host_name>cloud_init</host_name>
<timezone>NZ</timezone>
<dns_servers>1.2.3.4</dns_servers>
<dns_search>foo.test.com</dns_search>
<nic_configurations>
<nic_configuration>
<name>eth4</name>
<boot_protocol>dhcp</boot_protocol>
<on_boot>true</on_boot>
</nic_configuration>
</nic_configurations>
<root_password>1234</root_password>
<custom_script>write_files:
- content: test_cloud_init
path: /tmp/test.txt
permissions: '0644'</custom_script>
<user_name>cloud_user</user_name>
</initialization>
</vm>
Update VM:
2015-12-06 10:16:59,819 - MainThread - vms - DEBUG - PUT request content is -- url:/api/vms/d9a54ea9-25b5-4447-852b-f7b66373c868 body:<vm>
<initialization>
<host_name>cloud_init</host_name>
<timezone>NZ</timezone>
<dns_servers>1.2.3.4</dns_servers>
<dns_search>foo.test.com</dns_search>
<nic_configurations>
<nic_configuration>
<name>eth4</name>
<boot_protocol>dhcp</boot_protocol>
<on_boot>true</on_boot>
</nic_configuration>
</nic_configurations>
<root_password>1234</root_password>
<custom_script>write_files:
- content: test_cloud_init
path: /tmp/test.txt
permissions: '0644'</custom_script>
<user_name>cloud_user_2</user_name>
</initialization>
</vm>
Start VM with RunOnce:
2015-12-06 10:17:12,347 - MainThread - vms - DEBUG - Action request content is -- url:/api/vms/d9a54ea9-25b5-4447-852b-f7b66373c868/start body:<action>
<async>false</async>
<grace_period>
<expiry>10</expiry>
</grace_period>
<vm/>
<use_cloud_init>true</use_cloud_init>
</action>
oVirt 3.6.2 RC1 has been released for testing, moving to ON_QA Verify with: RHEVM Version: 3.6.2-0.1.el6 vdsm: vdsm-4.17.15-0.el7ev libvirt: libvirt-1.2.17-13.el7_2.2 |
Description of problem: Can't set user different then root user in RunOnce since it only support root user. Workaround: Edit VM with cloud init , set user and start vm via RunOnce use Cloud init. with <use_cloud_init>true</use_cloud_init> Version-Release number of selected component (if applicable): RHEVM Version: 3.6.0.3-0.1.el6 VDSM: vdsm-4.17.10.1-0.el7ev libvirt: libvirt-1.2.17-13.el7 cloud init version: cloud-init-0.7.6-6.el7.x86_64 cloud-utils-growpart-0.27-13.el7.noarch VM: rhel-guest-image-7.2 OS: Red Hat Enterprise Linux Server release 7.2 (Maipo) How reproducible: All the time Steps to Reproduce: 1. Import rhel-guest-image as template 2. Create VM from template 3. Send request via REST. see request details below. Actual results: Can't login with user Expected results: Login with new user Additional info: Rest request: https://<engine adderss>/ovirt-engine/api/vms/<VM id>/start <action> <async>false</async> <grace_period> <expiry>10</expiry> </grace_period> <vm> <initialization> <cloud_init> <network_configuration> <nics> <nic> <interface>eth4</interface> </nic> </nics> <dns> <servers> <host> <address>1.2.3.4</address> </host> </servers> <search_domains> <host> <address>foo.test.com</address> </host> </search_domains> </dns> </network_configuration> <timezone>NZ</timezone> <users> <user> <user_name>cloud_user</user_name> <password>123</password> </user> </users> </cloud_init> </initialization> </vm> <use_cloud_init>true</use_cloud_init> </action>