Bug 1004829 - [Admin Portal] Run-Once|Cloud-Init does not work correctly
Summary: [Admin Portal] Run-Once|Cloud-Init does not work correctly
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-webadmin-portal
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 3.3.0
Assignee: Omer Frenkel
QA Contact: Pavel Novotny
URL:
Whiteboard: virt
Depends On:
Blocks: 3.3snap3
TreeView+ depends on / blocked
 
Reported: 2013-09-05 14:47 UTC by Jiri Belka
Modified: 2015-09-22 13:09 UTC (History)
10 users (show)

Fixed In Version: is24
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-21 22:17:43 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine.log,vdsm.log,cloud-init.log (700.68 KB, application/x-tar)
2013-09-05 14:47 UTC, Jiri Belka
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 21048 0 None None None Never
oVirt gerrit 21180 0 None None None Never
oVirt gerrit 21267 0 None None None Never
oVirt gerrit 21268 0 None None None Never

Description Jiri Belka 2013-09-05 14:47:27 UTC
Created attachment 794303 [details]
engine.log,vdsm.log,cloud-init.log

Description of problem:

cloud-init inside guest does not configure guest OS correctly, it seems engine is not passing data in valid order/format.

For example ssh public key is not passed and because cloud-init is soooo intellingent while disabling PasswordAuthentication, then ssh access is impossible :-)

I defined following data in Run-Once dialog:

* Hostname: foobar (set)
* SSH Authorized Keys: my ssh public key (wrong)
* Regenerate System SSH Keys: true (not done)
* Time Zone: hawaiian Standard Time (not done)
* Root Password: foopass (not done)

* inside guest:

# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=foobar.localdomain

# cat /root/.ssh/authorized_keys 
foobar

# ls -l /etc/ssh/ssh_host_*
-rw-------. 1 root root  672 Sep  5 14:00 /etc/ssh/ssh_host_dsa_key
-rw-r--r--. 1 root root  590 Sep  5 14:00 /etc/ssh/ssh_host_dsa_key.pub
-rw-------. 1 root root  963 Sep  5 14:00 /etc/ssh/ssh_host_key
-rw-r--r--. 1 root root  627 Sep  5 14:00 /etc/ssh/ssh_host_key.pub
-rw-------. 1 root root 1675 Sep  5 14:00 /etc/ssh/ssh_host_rsa_key
-rw-r--r--. 1 root root  382 Sep  5 14:00 /etc/ssh/ssh_host_rsa_key.pub
# uptime
 16:18:33 up 18 min,  2 users,  load average: 0.00, 0.00, 0.00

# cat /etc/sysconfig/clock 
ZONE="Europe/Prague"

# ls -l /etc/shadow
----------. 1 root root 732 Sep  5 14:00 /etc/shadow

* inspecting vm payload

# cat /mnt/openstack/latest/*
{
  "launch_index" : "0",
  "availability_zone" : "nova",
  "name" : "foobar",
  "hostname" : "foobar",
  "uuid" : "ba9cbf2d-f06f-492f-af63-dc509b1f642f",
  "public_keys" : [ "foobar" ],
  "password" : "foopass",
  "meta" : {
    "essential" : "false",
    "role" : "server",
    "dsmode" : "local"
  }
}timezone: Pacific/Honolulu
ssh_deletekeys: 'True'
output:
  all: '>> /var/log/cloud-init-output.log'
user: root
runcmd:
- 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list:
  ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'

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

is13 / cloud-init-0.7.2-2.el6.noarch

How reproducible:

100%

Steps to Reproduce:

1. install rhel6 and create a template (as described in docs)
2. create new VM
3. run-once - cloud-init - define same values as I did

Actual results:

not all values are passed correctly, ssh login is not possible because cloud-init funcionality in RHEVM messed ssh public keys :)

Expected results:

...

Additional info:

Comment 1 Michal Skrivanek 2013-09-13 07:24:21 UTC
Omer, file rhel 6 cloud-init bugs as required...
also, why is it searching for network service, shouldn't it be not used in our case?

Comment 4 Pavel Novotny 2013-11-22 13:15:14 UTC
Verified in rhevm-3.3.0-0.35.beta1.el6ev.noarch (is24).

Verified by following the reproducer in comment 0:

1. Install RHEL 6 VM (optional: install also cloud-init-0.7.2 or newer).
2. Run Once VM with Cloud-Init:
   Hostname: hostname-rhel6
   SSH Authorized Keys: cloud-init-ssh-pubkey
   Regenerate System SSH Keys: true
   Time Zone: Hawaiian Standard Time
   Root Password: 654321
3. On the host, mount the config drive CD image and inspect the generated user data and meta data.

Results:
(on the host:)
# mount -t iso9660 -o loop /var/run/vdsm/payload/d80627d0-04f4-48d5-9335-753354c2cc29.81b3df31f8697cbeb6accd60218166b7.img /mnt/cloud-init/

# cat /mnt/cloud-init/openstack/latest/meta_data.json 
{
  "launch_index" : "0",
  "availability_zone" : "nova",
  "name" : "hostname-rhel6",
  "hostname" : "hostname-rhel6",
  "uuid" : "60485b67-3532-4350-b9f2-41cac7b84c26",
  "public_keys" : [ "cloud-init-ssh-pubkey" ],
  "meta" : {
    "essential" : "false",
    "role" : "server",
    "dsmode" : "local"
  }
}

# cat /mnt/cloud-init/openstack/latest/user_data 
#cloud-config
timezone: Pacific/Honolulu
ssh_deletekeys: 'True'
output:
  all: '>> /var/log/cloud-init-output.log'
user: root
password: '654321'
runcmd:
- 'sed -i ''/^datasource_list: /d'' /etc/cloud/cloud.cfg; echo ''datasource_list:
  ["NoCloud", "ConfigDrive"]'' >> /etc/cloud/cloud.cfg'

All data look good.

Optional: verify that the values from meta data and user data are applied on the guest:

1. SSH to the guest with password '654321'.
2. Check guest hostname, time zone and autohorized SSH keys:
# cat /etc/sysconfig/clock 
ZONE=Pacific/Honolulu
# cat /root/.ssh/authorized_keys
cloud-init-ssh-pubkey
# hostname
hostname-rhel6

Comment 5 Itamar Heim 2014-01-21 22:17:43 UTC
Closing - RHEV 3.3 Released

Comment 6 Itamar Heim 2014-01-21 22:24:14 UTC
Closing - RHEV 3.3 Released


Note You need to log in before you can comment on or make changes to this bug.