Bug 1254075

Summary: Attaching volume to iso instance is failure because of duplicate device name 'hda'.
Product: Red Hat OpenStack Reporter: Pratik Pravin Bandarkar <pbandark>
Component: openstack-novaAssignee: Lee Yarwood <lyarwood>
Status: CLOSED ERRATA QA Contact: Prasanth Anbalagan <panbalag>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0 (Juno)CC: amedeo.salvati, berrange, dasmith, eglynn, kchamart, lyarwood, ndipanov, pablo.iranzo, sbauza, sferdjao, sgordon, vromanso, yeylon
Target Milestone: z5Keywords: ZStream
Target Release: 6.0 (Juno)   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-nova-2014.2.3-49.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-22 12:32:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pratik Pravin Bandarkar 2015-08-17 06:29:24 UTC
Description of problem:
Boot instance from ISO image and try to attach cinder volume to the instance. The `nova volume-attach` command will succeed. But, the operation will fail with following error(nova-compute.log):
<snip>
[root@controller ~(keystone_admin)]# nova volume-attach rhel7_boot_from_iso 12be458a-a40c-43a8-b87b-33b3eaadc2f9 
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/hda                             |
| id       | 12be458a-a40c-43a8-b87b-33b3eaadc2f9 |
| serverId | 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba |
| volumeId | 12be458a-a40c-43a8-b87b-33b3eaadc2f9 |
+----------+--------------------------------------+



2015-08-17 19:48:00.569 19970 DEBUG nova.volume.cinder [req-05281bfc-8c50-4d18-b060-bd6756a5a016 None] Cinderclient connection created using URL: http://192.168.100.10:8776/v1/d3979f95e8c144e8a7936202a42f929e get_cinder_client_version /usr/lib/python2.7/site-packages/nova/volume/cinder.py:255
2015-08-17 19:48:00.669 19970 ERROR nova.compute.manager [req-05281bfc-8c50-4d18-b060-bd6756a5a016 None] [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba] Failed to attach 12be458a-a40c-43a8-b87b-33b3eaadc2f9 at /dev/hda
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba] Traceback (most recent call last):
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 4606, in _attach_volume
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     do_check_attach=False, do_driver_attach=True)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 46, in wrapped
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     ret_val = method(obj, context, *args, **kwargs)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 261, in attach
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     connector)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     six.reraise(self.type_, self.value, self.tb)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 252, in attach
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     device_type=self['device_type'], encryption=encryption)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1426, in attach_volume
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     self._disconnect_volume(connection_info, disk_dev)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     six.reraise(self.type_, self.value, self.tb)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1415, in attach_volume
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     virt_dom.attachDeviceFlags(conf.to_xml(), flags)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 183, in doit
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     result = proxy_call(self._autowrap, f, *args, **kwargs)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 141, in proxy_call
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     rv = execute(f, *args, **kwargs)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 122, in execute
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     six.reraise(c, e, tb)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 80, in tworker
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     rv = meth(*args, **kwargs)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 524, in attachDeviceFlags
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba]     if ret == -1: raise libvirtError ('virDomainAttachDeviceFlags() failed', dom=self)
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba] libvirtError: Requested operation is not valid: target hda already exists
2015-08-17 19:48:00.669 19970 TRACE nova.compute.manager [instance: 2e2a7ce5-6e4f-43f6-acac-b2270755b1ba] 


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


How reproducible:
100% 

Steps to Reproduce:
1. boot instance from iso image.
2. create a cinder volume.
3. try to attach the volume to iso instance.



Actual results:


Expected results:


Additional info:
upstream bz link: https://bugs.launchpad.net/nova/+bug/1379212

Comment 6 Prasanth Anbalagan 2016-02-04 02:52:34 UTC
********
Version
********

[root@server-10 ~(keystone_admin)]# yum list installed | grep openstack-nova
openstack-nova-api.noarch            2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-cert.noarch           2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-common.noarch         2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-compute.noarch        2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-conductor.noarch      2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-console.noarch        2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-novncproxy.noarch     2014.2.3-54.el7ost      @rhelosp-6.0-puddle
openstack-nova-scheduler.noarch      2014.2.3-54.el7ost      @rhelosp-6.0-puddle
[root@server-10 ~(keystone_admin)]# 


********
Logs
********

[root@server-10 ~(keystone_admin)]# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------+
| ID                                   | Name | Status | Task State | Power State | Networks            |
+--------------------------------------+------+--------+------------+-------------+---------------------+
| 2c909095-97ad-4222-8e31-2701941e7075 | vm1  | ACTIVE | -          | Running     | public=X.X.X.X |
+--------------------------------------+------+--------+------------+-------------+---------------------+
[root@server-10 ~(keystone_admin)]# nova stop vm1
[root@server-10 ~(keystone_admin)]# 
[root@server-10 ~(keystone_admin)]# 
[root@server-10 ~(keystone_admin)]# nova list
+--------------------------------------+------+---------+------------+-------------+---------------------+
| ID                                   | Name | Status  | Task State | Power State | Networks            |
+--------------------------------------+------+---------+------------+-------------+---------------------+
| 2c909095-97ad-4222-8e31-2701941e7075 | vm1  | SHUTOFF | -          | Shutdown    | public=X.X.X.X |
+--------------------------------------+------+---------+------------+-------------+---------------------+
[root@server-10 ~(keystone_admin)]# 
[root@server-10 ~(keystone_admin)]# 
[root@server-10 ~(keystone_admin)]# nova volume-attach vm1 d30d1dc1-487f-44e3-86ea-1a449290ee1f
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/hdb                             |
| id       | d30d1dc1-487f-44e3-86ea-1a449290ee1f |
| serverId | 2c909095-97ad-4222-8e31-2701941e7075 |
| volumeId | d30d1dc1-487f-44e3-86ea-1a449290ee1f |
+----------+--------------------------------------+
[root@server-10 ~(keystone_admin)]# nova list
+--------------------------------------+------+---------+------------+-------------+---------------------+
| ID                                   | Name | Status  | Task State | Power State | Networks            |
+--------------------------------------+------+---------+------------+-------------+---------------------+
| 2c909095-97ad-4222-8e31-2701941e7075 | vm1  | SHUTOFF | -          | Shutdown    | public=X.X.X.X |
+--------------------------------------+------+---------+------------+-------------+---------------------+
[root@server-10 ~(keystone_admin)]# cinder list
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status | Display Name | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| d30d1dc1-487f-44e3-86ea-1a449290ee1f | in-use |     vol1     |  1   |     None    |  false   | 2c909095-97ad-4222-8e31-2701941e7075 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
[root@server-10 ~(keystone_admin)]# nova start vm1
[root@server-10 ~(keystone_admin)]# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------+
| ID                                   | Name | Status | Task State | Power State | Networks            |
+--------------------------------------+------+--------+------------+-------------+---------------------+
| 2c909095-97ad-4222-8e31-2701941e7075 | vm1  | ACTIVE | -          | Running     | public=X.X.X.X |
+--------------------------------------+------+--------+------------+-------------+---------------------+
[root@server-10 ~(keystone_admin)]# 
[root@server-10 ~(keystone_admin)]# cinder list
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status | Display Name | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| d30d1dc1-487f-44e3-86ea-1a449290ee1f | in-use |     vol1     |  1   |     None    |  false   | 2c909095-97ad-4222-8e31-2701941e7075 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+

Comment 8 errata-xmlrpc 2016-02-22 12:32:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0283.html