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'/>
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" opt/stack/ data/nova/ instances/ 63c4ddd7- baf8-43a7- b282-3690a0c72d 0a/disk' /> disk0'/ > disk/by- path/ip- 10.239. 47.37:3260- iscsi-iqn. 2010-10. org.openstack: volume- 35e63899- 617b-405a- 952f-f2a12b527d 40-lun- 1'/> serial> 35e63899- 617b-405a- 952f-f2a12b527d 40</serial> disk1'/ > 'fa:16: 3e:56:e4: 92'/> 'qbr42f2dab5- 68'/> 5-68'/>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/
<target dev='vda' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
--
<driver name='qemu' type='raw' cache='none'/>
<source dev='/dev/
<target dev='vdb' bus='virtio'/>
<
<alias name='virtio-
--
<mac address=
<source bridge=
<target dev='tap42f2dab
<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: opt/stack/ data/nova/ instances/ 9bddc01e- b3a3-4cad- 9861-132c4e4c6e 1e/disk' /> disk0'/ > opt/stack/ data/nova/ instances/ 9bddc01e- b3a3-4cad- 9861-132c4e4c6e 1e/disk. swap'/> disk1'/ > 'fa:16: 3e:31:51: a5'/> 'qbr23992767- 81'/> 7-81'/>
ubuntu@node-01:~$ virsh dumpxml 8 | grep -C 2 "target dev"
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/
<target dev='vda' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
--
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/
<target dev='vdb' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
--
<mac address=
<source bridge=
<target dev='tap2399276
<model type='virtio'/>
<alias name='net0'/>