block device isn't resized after swap to larger volume

Bug #1341459 reported by Alex Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Alex Xu

Bug Description

libvirt support swap volume. But if the new volume is larger than the old one, the block device isn't resized. The instance can't see the extra space.

$ nova show vm3
+--------------------------------------+----------------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | AUTO |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | os3 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | os3 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000039 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2014-07-14T01:43:31.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2014-07-14T01:43:23Z |
| flavor | m1.nano (42) |
| hostId | c8e8cab21e9e22dbc3779fd171e77f44940ba1c81161dc114ba4ad85 |
| id | ccda09b7-6c50-40b0-ba7c-0c5c3f0cbb7e |
| image | cirros-0.3.2-x86_64-uec (da82a342-aeac-407a-bf9d-cf28bf68dc6b) |
| key_name | - |
| metadata | {} |
| name | vm3 |
| net1 network | 10.0.0.66 |
| os-extended-volumes:volumes_attached | [{"id": "756d0869-2ef2-4537-90c8-66df9657135f"}] |
| progress | 0 |
| security_groups | sg1, default |
| status | ACTIVE |
| tenant_id | fdbb1e8f23eb40c89f3a677e2621b95c |
| updated | 2014-07-14T06:34:57Z |
| user_id | 158d3c971e244f479593c86ff751bf8f |
+--------------------------------------+----------------------------------------------------------------+

$ cinder list
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| 13097504-5b0c-4581-b1a5-9e05f616b89d | available | vol3 | 2 | None | false | |
| 756d0869-2ef2-4537-90c8-66df9657135f | in-use | vol1 | 1 | None | false | ccda09b7-6c50-40b0-ba7c-0c5c3f0cbb7e |
| f0da7609-486d-49b1-bdf3-029bcbe56268 | available | vol2 | 1 | None | false | |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+

Then login guest OS:

$ sudo fdisk -l

.....

Disk /dev/vdc: 1073 MB, 1073741824 bytes
9 heads, 8 sectors/track, 29127 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd6091017

   Device Boot Start End Blocks Id System
/dev/vdc1 2048 2097151 1047552 83 Linux

Swap the volume to larger one.
$ nova volume-update vm3 756d0869-2ef2-4537-90c8-66df9657135f 13097504-5b0c-4581-b1a5-9e05f616b89d

vm3 attached with the vol3
$ cinder list
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| 13097504-5b0c-4581-b1a5-9e05f616b89d | in-use | vol3 | 2 | None | false | ccda09b7-6c50-40b0-ba7c-0c5c3f0cbb7e |
| 756d0869-2ef2-4537-90c8-66df9657135f | available | vol1 | 1 | None | false | |
| f0da7609-486d-49b1-bdf3-029bcbe56268 | available | vol2 | 1 | None | false | |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+

Check the guest again:

$ sudo fdisk -l

....

Disk /dev/vdc: 1073 MB, 1073741824 bytes
9 heads, 8 sectors/track, 29127 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd6091017

   Device Boot Start End Blocks Id System
/dev/vdc1 2048 2097151 1047552 83 Linux

The device size isn't changed.

Tags: libvirt
Alex Xu (xuhj)
Changed in nova:
assignee: nobody → Alex Xu (xuhj)
tags: added: libvirt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/106698

Changed in nova:
status: New → In Progress
Alex Xu (xuhj)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/106698
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=916aec717c2c1a6096e2f1884e4ad81a30ae70e6
Submitter: Jenkins
Branch: master

commit 916aec717c2c1a6096e2f1884e4ad81a30ae70e6
Author: He Jie Xu <email address hidden>
Date: Mon Jul 14 15:18:46 2014 +0800

    Resize block device after swap to larger volume

    After swap to larger volume, instance's block device should be
    resized. Otherwise, the guest can't utilize the extra space.

    This patch make the libvirt driver resize block device after mirror
    the volume. And add new parameter 'resize_to' to virt driver, that
    is used to indicate the new size.

    Change-Id: Ib4d65e8812c7d3c28100155124218c75a94e16e7
    Closes-Bug: #1341459

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 2014.2
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.