← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1882421] Re: inject_password fails with python3

 

** Changed in: nova/victoria
       Status: Fix Committed => Fix Released

** Also affects: nova/wallaby
   Importance: Undecided
       Status: New

** Changed in: nova/wallaby
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1882421

Title:
  inject_password fails with python3

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) train series:
  New
Status in OpenStack Compute (nova) ussuri series:
  New
Status in OpenStack Compute (nova) victoria series:
  Fix Released
Status in OpenStack Compute (nova) wallaby series:
  Fix Released

Bug description:
  Originally reported in #openstack-nova:

  14:44 < lvdombrkr>  hello guys, trying to inject admin_password (inject_password=true ) into  image but when creating instance get this error in nova-compute.log
  14:45 < lvdombrkr>  2020-06-06 14:53:50.188 6 WARNING nova.virt.disk.api [req-94f485ca-944c-40e9-bf14-c8b8dbe09a7b 052d02306e6746a4a3e7e5449de49f8c 
                     413a4cadf9734fca9ec3e5e6192a446f - default default] Ignoring error injecting admin_password into image (a bytes-like object is required, not 'str')
  14:45 < lvdombrkr> Train + Centos8

  Can reproduce on master on devstack by installing python3-guestfs and
  setting

  [libvirt]
  inject_partition = -1
  inject_password = true

  in nova-cpu.conf. Backtrace after adding a hard "raise" into
  inject_data_into_fs():

  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.virt.libvirt.driver [None req-47214a25-b56a-4135-83bb-7c5ff4c86ca6 demo demo] [instance: 5604d60c-61c9-49b5-8786-ff5144817863] Error injecting data into image 4b3e63a6-b3c4-4de5-b515-cc286e7d5c48 (a bytes-like object is required, not 'str')
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [None req-47214a25-b56a-4135-83bb-7c5ff4c86ca6 demo demo] [instance: 5604d60c-61c9-49b5-8786-ff5144817863] Instance failed to spawn: TypeError: a bytes-like object is required, not 'str'
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863] Traceback (most recent call last):
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/compute/manager.py", line 2614, in _build_resources
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     yield resources
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/compute/manager.py", line 2374, in _build_and_run_instance
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     self.driver.spawn(context, instance, image_meta,
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3604, in spawn
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     created_instance_dir, created_disks = self._create_image(
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3991, in _create_image
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     created_disks = self._create_and_inject_local_root(
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 4119, in _create_and_inject_local_root
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     self._inject_data(backend, instance, injection_info)
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3894, in _inject_data
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     LOG.error('Error injecting data into image '
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     self.force_reraise()
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     six.reraise(self.type_, self.value, self.tb)
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/usr/local/lib/python3.8/dist-packages/six.py", line 703, in reraise
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     raise value
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3887, in _inject_data
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     disk_api.inject_data(disk.get_model(self._conn),
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/disk/api.py", line 368, in inject_data
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     return inject_data_into_fs(fs, key, net, metadata, admin_password,
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/disk/api.py", line 461, in inject_data_into_fs
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     inject_func(inject_val, fs)
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/disk/api.py", line 597, in _inject_admin_password_into_fs
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     new_shadow_data = _set_passwd(admin_user, admin_passwd,
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]   File "/opt/stack/nova/nova/virt/disk/api.py", line 644, in _set_passwd
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]     p_file = passwd_data.split("\n")
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863] TypeError: a bytes-like object is required, not 'str'
  Jun 06 15:48:39 jh-devstack-focal-01a nova-compute[2983293]: ERROR nova.compute.manager [instance: 5604d60c-61c9-49b5-8786-ff5144817863]

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1882421/+subscriptions


References