Resize to a flavor with swap doesn't create the swap device if a volume is attached

Bug #1471307 reported by Salvo Davide Rapisarda
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Zhenzan Zhou

Bug Description

1.
ii nova-common 1:2014.2-fuel6.0~mira19 OpenStack Compute - common files
ii nova-compute 1:2014.2-fuel6.0~mira19 OpenStack Compute - compute node base
ii nova-compute-kvm 1:2014.2-fuel6.0~mira19 OpenStack Compute - compute node (KVM)
ii nova-compute-libvirt 1:2014.2-fuel6.0~mira19 OpenStack Compute - compute node libvirt

I'm using RBD storage.

3.

* I have a VM instance created with a default flavor i.e. named "m1.medium" and a volume attached in /dev/vdb.
* Then I create a new flavor "m1.medium.swap" with swap field populated
* Then I resize the previous VM instance to this new flavor.

Expected result:

* When I restart the VM instance I found the swap disk and the volume attached (/dev/vdb).

Actual result:

* When I restart the VM instance and volume attached (/dev/vdb) but I cannot found the swap disk.

thanks,

Salvo.

Revision history for this message
jichenjc (jichenjc) wrote :

can you nova flavor-show the flavor you created? along with the nova compute log in debug mode so it might be helpful ? thanks

Revision history for this message
Salvo Davide Rapisarda (sdrapisarda) wrote :

OK.

I forgot to say that i'm using rbd (CEPH) storage.

description: updated
Revision history for this message
Timofey Durakov (tdurakov) wrote :

@sdrapisarda, i've tried to reproduce this issue, but in my case swap disk was created.
Could you provide concrete cli commands that cause this issue? Please provide xml dump of instance which failed to resize correctly.
Moving bug in incomplete state until.

Changed in nova:
status: New → Incomplete
Revision history for this message
Salvo Davide Rapisarda (sdrapisarda) wrote :

@tdurakov, I'v tried to reproduce the bug again and I'm right with you that if I resize a VM from a flavor without swap to a flavor with swap, the swap disk was created.

I forgot to specify that, before the resize, the VM have a volume attached at "vdb" virtual device.
In this case the swap volume was not attached correctly to VM.

Salvo.

summary: - Resize from flavor without a swap to a flavor with swap doesn't create
- the swap disk
+ Resize to a flavor with swap doesn't create the swap device if a volume
+ is attached
description: updated
Changed in nova:
status: Incomplete → New
Revision history for this message
Zhenzan Zhou (zhenzan-zhou) wrote :

Tried with latest code, if VM is booting from volume, with another volume attached as /dev/vdb, resize from a flavor without swap to a flavor with swap, no swap disk is created.

Changed in nova:
assignee: nobody → Zhenzan Zhou (zhenzan-zhou)
Revision history for this message
Zhenzan Zhou (zhenzan-zhou) wrote :

Tried other two cases:

1. boot from image without swap, then attach a volume to vdb, then resize to a flavor with swap, no swap disk created:

ubuntu@node-01:~$ virsh dumpxml 6 | grep -C 2 "target dev"
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/stack/data/nova/instances/63c4ddd7-baf8-43a7-b282-3690a0c72d0a/disk'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
--
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/disk/by-path/ip-10.239.47.37:3260-iscsi-iqn.2010-10.org.openstack:volume-35e63899-617b-405a-952f-f2a12b527d40-lun-1'/>
      <target dev='vdb' bus='virtio'/>
      <serial>35e63899-617b-405a-952f-f2a12b527d40</serial>
      <alias name='virtio-disk1'/>
--
      <mac address='fa:16:3e:56:e4:92'/>
      <source bridge='qbr42f2dab5-68'/>
      <target dev='tap42f2dab5-68'/>
      <model type='virtio'/>
      <alias name='net0'/>

2. boot from image without swap, then resize to a flavor with swap, swap disk was created and attached:
ubuntu@node-01:~$ virsh dumpxml 8 | grep -C 2 "target dev"
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/stack/data/nova/instances/9bddc01e-b3a3-4cad-9861-132c4e4c6e1e/disk'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
--
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/stack/data/nova/instances/9bddc01e-b3a3-4cad-9861-132c4e4c6e1e/disk.swap'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
--
      <mac address='fa:16:3e:31:51:a5'/>
      <source bridge='qbr23992767-81'/>
      <target dev='tap23992767-81'/>
      <model type='virtio'/>
      <alias name='net0'/>

Revision history for this message
Zhenzan Zhou (zhenzan-zhou) wrote :

The root cause is that it doesn't consider pre-assigned volume dev names when looking for a dev name for swap. So even it gets a dev name 'vdb', it's ignored later since 'vdb' is pre-assigned for attached volume.
I am now working on a fix.

Changed in nova:
status: New → In Progress
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/214419

Eli Qiao (taget-9)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c1715485f9a636913562e3c93cd9e38a3a98cb8b
Author: Zhenzan Zhou <email address hidden>
Date: Wed Aug 19 10:03:26 2015 +0800

    filter pre_assigned_dev_names when finding disk dev

    when finding disk dev we should filter pre_assigned_dev_names,
    otherwise it returns the used dev name and then causing not creating
    new disk dev.

    Change-Id: I5f7ed979284c5e6e3569e9b503cb8c93c3e47ab3
    Closes-Bug: #1471307

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