The parameter "--admin-pass" of the nova client does not work when an instance is launched using a bootable volume

Bug #1626961 reported by Anatolii Neliubin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Won't Fix
Medium
MOS Nova
8.0.x
Won't Fix
Medium
MOS Nova
9.x
Won't Fix
Medium
MOS Nova

Bug Description

Detailed bug description:
  The parameter --admin-pass is intended for injection of a root password to the newly launched machines. When a VM is launched from an image, root password is changed and an user can login to the machine using ssh and a root password. When a VM is launched from a bootable volume, the root's password is not changed.
Steps to reproduce:
root@node-7:~# nova boot --flavor m1.micro --image TestVM --nic net-id=dd05323d-9430-4267-a6af-e51f58404044 --admin-pass r00tme myInstanceFromImage
SKIPPED FLOATING IP ASSOCIATION
root@node-7:~# ssh root@172.16.100.171
The authenticity of host '172.16.100.171 (172.16.100.171)' can't be established.
RSA key fingerprint is 45:63:3e:27:e2:5f:ec:9e:b4:11:43:7e:86:a1:d3:08.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.100.171' (RSA) to the list of known hosts.
root@172.16.100.171's password:
#
# Connection to 172.16.100.171 closed.
root@node-7:~# cinder create --image-id 2310a281-dd58-45ac-b251-133d2518eb9b --display_name=bootable_volume 1
root@node-7:~# nova boot --flavor m1.micro --block-device source=volume,id=21f1597b-db6a-46c5-b80d-691c4a49cf3e,dest=volume,size=1,shutdown=preserve,bootindex=0 --nic net-id=dd05323d-9430-4267-a6af-e51f58404044 --admin-pass r00tme myInstanceFromVolume
SKIPPED FLOATING IP ASSOCIATION
root@node-7:~# ssh root@172.16.100.172
The authenticity of host '172.16.100.172 (172.16.100.172)' can't be established.
RSA key fingerprint is 93:cd:62:8f:99:15:2f:76:fc:29:ed:2f:e6:f1:51:5e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.100.172' (RSA) to the list of known hosts.
root@172.16.100.172's password:
Permission denied, please try again.
root@172.16.100.172's password:
Permission denied, please try again.
root@172.16.100.172's password:
root@node-7:~# nova list
+--------------------------------------+----------------------+--------+------------+-------------+--------------------------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------------+--------+------------+-------------+--------------------------------------------------+
| 3764e98d-26f5-4a9f-af5f-1c8a588c8110 | myInstanceFromImage | ACTIVE | - | Running | admin_internal_net=192.168.111.8, 172.16.100.171 |
| 3a71f426-50a6-4f8a-8737-538584d96deb | myInstanceFromVolume | ACTIVE | - | Running | admin_internal_net=192.168.111.9, 172.16.100.172 |
+--------------------------------------+----------------------+--------+------------+-------------+--------------------------------------------------+
root@node-7:~# cinder list
+--------------------------------------+--------+------------------+-----------------+------+-------------+----------+-------------+--------------------------------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+--------------------------------------+--------+------------------+-----------------+------+-------------+----------+-------------+--------------------------------------+
| 21f1597b-db6a-46c5-b80d-691c4a49cf3e | in-use | - | bootable_volume | 1 | - | true | False | 3a71f426-50a6-4f8a-8737-538584d96deb |
+--------------------------------------+--------+------------------+-----------------+------+-------------+----------+-------------+--------------------------------------+
root@node-7:~# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 2310a281-dd58-45ac-b251-133d2518eb9b | TestVM |
+--------------------------------------+--------+
root@node-7:~#

Expected results:
The password must be injected into the virtual machine, whether it is launched from an image or from a bootable volume.
Actual result:
User root cannot login to the newly launched VM.
Workaround:
To login as a different user or using ssh key and changing the root's password.
Description of the environment:
Mirantis OpenStack 8.0
Additional information:

tags: added: area-nova
removed: nova
Revision history for this message
Roman Podoliaka (rpodolyaka) wrote :

Anatolii,

For this feature to work a few conditions must be met:

1) inject_password option in [libvirt] section of nova.conf must be set to True on compute nodes (False by default)

2-a) file injection must be enabled in nova.conf (note, that it does not work for ephemerals stored in Ceph and VMs *booted from volumes*)

or, alternatively

2-b) an instance must be booted with a config drive enabled (obviously, you'll need cloud-init inside a guest image)

Note, ^ is only about injecting a user password on boot. To change it via libvirt there are additional conditions to be met:

3) libvirt version must be 1.2.16+ (we ship 1.2.9 in 8.0 - http://mirror.fuel-infra.org/mos-repos/ubuntu/8.0/pool/main/libv/libvirt/)

4) qemu agent must be running inside a guest OS (http://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetUserPassword)

^ currently (9.x) we ship libvirt 1.2.9 and this does not seem to be important enough to change that.

The preferred method of logging in to VMs is via public keys. Password injection must work if you enable it in the config file and make sure file injection is possible (e.g. via config drive for volume-backed instances + cloud-init inside guest images).

Having said that, I don't think it's worth it to change the defaults we have right now (i.e. inject_password=False): whoever needs this can as well reconfigure nova-compute's. Also you could try to set admin password by the means of cloud-init putting it to user-data script (http://cloudinit.readthedocs.io/en/latest/topics/examples.html#yaml-examples , http://docs.openstack.org/user-guide/cli-provide-user-data-to-instances.html)

Changed in mos:
milestone: none → 9.2
assignee: nobody → MOS Nova (mos-nova)
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.