swap size not change after instance resized

Bug #1447977 reported by Eric Xie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Low
Noel Nelson Dsouza

Bug Description

1. My environment:
nova: 2014.1, icehouse-stable
hypervisor: libvirt 1.2.1, + kvm

2. Relevant log files:
no

3. Reproduce steps:
* Launch one instance with default flavor m1.tiny which swap size is 0MB
* Resize instance from m1.tiny to flv_5_root_2_eph_1_swap which swap's size is 1MB,
and get swap info with 'virsh' commands
virsh # domblklist 30
vdc /var/lib/nova/instances/fa13d27f-3ddd-48a5-86a8-aeaf04c2046d/disk.swap
virsh # domblkinfo 30 vdc
Capacity: 1048576
* Resize instance from flv_5_root_2_eph_1_swap to flv_40_root_5_eph_4_swap,
and get swap info with 'virsh' commands

Expected results:
*virsh # domblkinfo 5 vdc
  Capacity: 4194304

Actual result:
* virsh # domblkinfo 5 vdc
Capacity: 1048576

4. Reason maybe:
nova.virt.libvirt.driver.py
def _create_image(self, context, instance,
                      disk_mapping, suffix='',
                      disk_images=None, network_info=None,
                      block_device_info=None, files=None,
                      admin_pass=None, inject_files=True,
                      fallback_from_host=None):
...
        if 'disk.swap' in disk_mapping:
            mapping = disk_mapping['disk.swap']
            swap_mb = 0

            swap = driver.block_device_info_get_swap(block_device_info)
            if driver.swap_is_usable(swap):
                swap_mb = swap['swap_size'] # use inst_type['swap']?
            elif (inst_type['swap'] > 0 and
                  not block_device.volume_in_mapping(
                    mapping['dev'], block_device_info)):
                swap_mb = inst_type['swap']

Tags: libvirt
Changed in nova:
assignee: nobody → Noel Nelson Dsouza (noelnelson)
tags: added: libvirt
Changed in nova:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Noel Nelson Dsouza (noelnelson) wrote :
Download full text (3.6 KiB)

Eric Xie_TECS,

I am not able to reproduce your bug. ( As i know you are using Ice-house version)

My Environment
I am using Juno version of devstack.

Steps I used to reproduce the bug.

a) Creating instance with flavor : m1.tiny
nova boot --image cirros-0.3.4-x86_64-uec --flavor 1 vm1

b) Creating new flavor with id 8 and swap size is 1MB
nova flavor-create --ephemeral 1 --swap 1 --rxtx-factor 1.0 --is-public True flv_5_root_2_eph_1_swap 8 1024 4 2

c) Resizing instance vm1 with flavor 8
nova resize --poll vm1 8

Output of Virsh command for the instance vm1.

virsh # domblklist 3
Target Source
------------------------------------------------
vda /opt/stack/data/nova/instances/fc40d5ca-3a23-417c-9dfc-f25860822534/disk
vdb /opt/stack/data/nova/instances/fc40d5ca-3a23-417c-9dfc-f25860822534/disk.local
vdc /opt/stack/data/nova/instances/fc40d5ca-3a23-417c-9dfc-f25860822534/disk.swap
hdd /opt/stack/data/nova/instances/fc40d5ca-3a23-417c-9dfc-f25860822534/disk.config

virsh # domblkinfo 3 vdc
Capacity: 1048576
Allocation: 200704
Physical: 200704

-----------------------------------------------------------------------------------------------------------------------------------------------------

Follow the above same steps with instance vm2.

a) Creating instance with flavor : m1.tiny
 nova boot --image cirros-0.3.4-x86_64-uec --flavor 1 vm2

b) Creating new flavor with id 40 and swap size is 4MB
 nova flavor-create --ephemeral 1 --swap 4 --rxtx-factor 1.0 --is-public True flv_40_root_2_eph_4_swap 40 512 4 2

c) Resizing instance vm1 with flavor 8
 nova resize --poll vm2 40

Output of Virsh command for the instance vm2.

virsh # domblklist 5
Target Source
------------------------------------------------
vda /opt/stack/data/nova/instances/5d515c7a-cc80-46ed-b883-31919a0aceff/disk
vdb /opt/stack/data/nova/instances/5d515c7a-cc80-46ed-b883-31919a0aceff/disk.local
vdc /opt/stack/data/nova/instances/5d515c7a-cc80-46ed-b883-31919a0aceff/disk.swap
hdd /opt/stack/data/nova/instances/5d515c7a-cc80-46ed-b883-31919a0aceff/disk.config

virsh # domblkinfo 5 vdc
Capacity: 4194304
Allocation: 200704
Physical: 200704

Nova list output:

stack@onecloud-Standard-PC-i440FX-PIIX-1996:~/devstack$ nova list
+--------------------------------------+------+---------------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+---------------+------------+-------------+------------------+
| fc40d5ca-3a23-417c-9dfc-f25860822534 | vm1 | VERIFY_RESIZE | - | Running | private=10.0.0.2 |
| 5d515c7a-cc80-46ed-b883-31919a0aceff | vm2 | VERIFY_RESIZE | - | Running | private=10.0.0.3 |
+--------------------------------------+------+---------------+------------+-------------+------------------+

Tried on resized instance twice time to resize. ( vm1 resized already)
After that i used below statement again

Resize instance from flv_8_root_2_eph_1_swap to flv_40_root_5_eph_4_swap

stack@onecloud-Standard-PC-i440F...

Read more...

Revision history for this message
Eric Xie (mark-xiett) wrote :

Hi Neol, thanks for your reproduce try. You can try it as below.
1) create one instance with flavorA that the size of swap is 2;
2) resize the instance above with flavorB that the size of swap is 5.

The reason of error for your resizing is that you should confirm the resize before you resize it again:)

Revision history for this message
Noel Nelson Dsouza (noelnelson) wrote :

Eric Xie_TECS,

Thank you for your quick feedback. I have gone with 3 scenario's to reproduce your bug.
Looks like in Juno it has fixed. i failed in all the scenario to reproduce.

Scenario 1 : Check my previous reply in bug Thread.

Scenario 2 : As you suggested,
             1) create one instance with flavorA that the size of swap is 2;
             2) resize the instance above with flavorB that the size of swap is 5.

Instance created with swap size 1 ( you suggested swap size 2, i think it doesn't matter)
virsh # domblkinfo 5 vdc
Capacity: 1048576
Allocation: 200704
Physical: 200704

After resizing instance with swap size 4 ( you suggested swap size 5, i think doesn't matter)
virsh # domblklist 6
Target Source
------------------------------------------------
vda /opt/stack/data/nova/instances/cff61e0e-8182-4ab6-83d2-31be58ec29fc/disk
vdb /opt/stack/data/nova/instances/cff61e0e-8182-4ab6-83d2-31be58ec29fc/disk.local
vdc /opt/stack/data/nova/instances/cff61e0e-8182-4ab6-83d2-31be58ec29fc/disk.swap
hdd /opt/stack/data/nova/instances/cff61e0e-8182-4ab6-83d2-31be58ec29fc/disk.config

virsh # domblkinfo 6 vdc
Capacity: 4194304
Allocation: 200704
Physical: 200704

Scenario 3:

Followed the scenario 1 only. But only one difference is
   1) Created instance with flavor tiny and swap size 0
   2) Resized the above instance with swap size 1
   3) Confirmed the resize
   4) Again resized the confirmed resized instance.

In all 3 scenario i got same output which i mentioned in scenario 2. Please do check it.

Based on your feedback i will move further or make it as invalid.

Regards
Noel

Revision history for this message
Eric Xie (mark-xiett) wrote :

Hi Noel,
Thanks for reply.
I checked the juno release and fount this issue has already been fixed.
You can make it as invalid.

Changed in nova:
status: Triaged → Invalid
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.