← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1427060] Re: Unnecessary bdm entry is created if same volume is attached twice to an instance

 

Repeat this process, there is no such problem in the current branch,
invalid bug.

[root@localhost ~]# cinder list
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| ID                                   | Status | Name | Size | Volume Type | Bootable | Attached to                          |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| df191675-0ac1-4101-a590-7ad2f7607e89 | in-use |      | 1    | lvmdriver-1 | true     | ec939a46-9e1e-4126-8214-6ceb3b95676a |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+

[root@localhost ~]# nova volume-attach ec939a46-9e1e-4126-8214-6ceb3b95676a df191675-0ac1-4101-a590-7ad2f7607e89
ERROR (BadRequest): Invalid volume: volume df191675-0ac1-4101-a590-7ad2f7607e89 already attached (HTTP 400) (Request-ID: req-cb0d0d98-8035-4a9e-b055-ef515235e8aa)

MariaDB [nova_cell1]> select volume_id,volume_size,device_name,attachment_id,deleted_at from block_device_mapping where instance_uuid='ec939a46-9e1e-4126-8214-6ceb3b95676a';
+--------------------------------------+-------------+-------------+---------------+------------+
| volume_id                            | volume_size | device_name | attachment_id | deleted_at |
+--------------------------------------+-------------+-------------+---------------+------------+
| df191675-0ac1-4101-a590-7ad2f7607e89 |           1 | /dev/vda    | NULL          | NULL       |
+--------------------------------------+-------------+-------------+---------------+------------+
1 row in set (0.00 sec)


** Changed in: nova
       Status: In Progress => Invalid

-- 
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/1427060

Title:
  Unnecessary bdm entry is created if same volume is attached twice to
  an instance

Status in OpenStack Compute (nova):
  Invalid

Bug description:
  When we try to attach an already attached volume to an instance it
  raises InvalidVolume exception but creates an entry in
  block_device_mapping table with deleted flag set to true. Ideally when
  attach volume fails it should not create any entries in database.

  Steps to reproduce:

  1. Created an instance named test_vm_1.
  2. Created a volume named test_volume_1.
  3. Verified that instance is in active state and volume is in available state.
  4. Attach volume using below command:
      $ nova volume-attach <instance_id> <volume_id>.
  5. Confirmed that volume is in 'in-use' status using below command:
      $ cinder list.
  6. Execute volume-attach command again with same volume_id.
      $ nova volume-attach <instance_id> <volume_id>.
     
  After executing step 6 it raises "Invalid volume" exception and attached volume can be used normally which is correct. But when you check  block_device_mapping table using below sql query, you will find an additional bdm entry which should not be created.

  select * from block_device_mapping where instance_uuid='ee94830b-
  5d39-42a7-b8c2-6175bb77563a';

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


References