Comment 10 for bug 1370390

Revision history for this message
Stephen Finucane (stephenfinucane) wrote :

I undertook some research into this. My findings are below, but tl;dr: it appears that this now works as expected and the bug can be closed.

---

# Problem

There were reports that resizing an instance from a pinned flavor to a unpinned
one not result in the pinning being removed. The opposite is also reportedly
true.

# Steps

## Create the required flavors

    $ openstack flavor create test.unpinned --id 100 --ram 2048 --disk 0 --vcpus 2
    $ openstack flavor create test.pinned --id 101 --ram 2048 --disk 0 --vcpus 2
    $ openstack flavor set test.pinned --property "hw:cpu_policy=dedicated"

# Ensure this is available

    $ openstack flavor list
    +-----+---------------+-------+------+-----------+-------+-----------+
    | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
    +-----+---------------+-------+------+-----------+-------+-----------+
    | 1 | m1.tiny | 512 | 1 | 0 | 1 | True |
    | 101 | test.unpinned | 2048 | 0 | 0 | 2 | True |
    | 101 | test.pinned | 2048 | 0 | 0 | 2 | True |
    | 2 | m1.small | 2048 | 20 | 0 | 1 | True |
    | 3 | m1.medium | 4096 | 40 | 0 | 2 | True |
    | 4 | m1.large | 8192 | 80 | 0 | 4 | True |
    | 42 | m1.nano | 64 | 0 | 0 | 1 | True |
    | 5 | m1.xlarge | 16384 | 160 | 0 | 8 | True |
    | 84 | m1.micro | 128 | 0 | 0 | 1 | True |
    +-----+---------------+-------+------+-----------+-------+-----------+

    $ openstack image list
    +--------------------------------------+---------------------------------+--------+
    | ID | Name | Status |
    +--------------------------------------+---------------------------------+--------+
    | c44bba29-653e-4ddf-963d-442af4c33a13 | cirros-0.3.4-x86_64-uec | active |
    | 8b0284ee-ae6c-4e80-b5ee-26895d574717 | cirros-0.3.4-x86_64-uec-ramdisk | active |
    | 855c2971-aedc-4d5f-a366-73bb14707965 | cirros-0.3.4-x86_64-uec-kernel | active |
    +--------------------------------------+---------------------------------+--------+

# Boot an instance

    $ openstack server create --flavor=test.pinned \
        --image=cirros-0.3.4-x86_64-uec --wait test1

# Validate that the instance is pinned

    $ openstack server list
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | ID | Name | Status | Networks |
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | 857597cb-266b-4032-8030-e3cc76ebf0e7 | test1 | ACTIVE | private=10.0.0.3, fd2a:ec16:99e1:0:f816:3eff:fe99:df9f |
    +--------------------------------------+-------+--------+--------------------------------------------------------+

    $ sudo virsh list
     Id Name State
    ----------------------------------------------------
     1 instance-00000001 running

    $ sudo virsh dumpxml instance-00000001
    <domain type='kvm' id='1'>
      <name>instance-00000001</name>
      ...
      <vcpu placement='static'>2</vcpu>
      <cputune>
        <shares>2048</shares>
        <vcpupin vcpu='0' cpuset='1'/>
        <vcpupin vcpu='1' cpuset='21'/>
        <emulatorpin cpuset='1,21'/>
      </cputune>
      <numatune>
        <memory mode='strict' nodeset='0'/>
        <memnode cellid='0' mode='strict' nodeset='0'/>
      </numatune>
      ...
      <cpu>
        <topology sockets='1' cores='1' threads='2'/>
        <numa>
          <cell id='0' cpus='0-1' memory='2097152' unit='KiB'/>
        </numa>
      </cpu>
      ...
    </domain>

# Resize the instance to the unpinned flavor

    $ openstack server resize test1 --flavor test.unpinned --wait
    complete

    $ openstack server list
    +--------------------------------------+-------+---------------+--------------------------------------------------------+
    | ID | Name | Status | Networks |
    +--------------------------------------+-------+---------------+--------------------------------------------------------+
    | 857597cb-266b-4032-8030-e3cc76ebf0e7 | test1 | VERIFY_RESIZE | private=10.0.0.3, fd2a:ec16:99e1:0:f816:3eff:fe99:df9f |
    +--------------------------------------+-------+---------------+--------------------------------------------------------+

    $ openstack server resize test1 --confirm

# Validate that the instance is no longer pinned

    $ openstack server list
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | ID | Name | Status | Networks |
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | 857597cb-266b-4032-8030-e3cc76ebf0e7 | test1 | ACTIVE | private=10.0.0.3, fd2a:ec16:99e1:0:f816:3eff:fe99:df9f |
    +--------------------------------------+-------+--------+--------------------------------------------------------+

    $ sudo virsh list
     Id Name State
    ----------------------------------------------------
     2 instance-00000001 running

    $ sudo virsh dumpxml instance-00000001
    <domain type='kvm' id='2'>
      <name>instance-00000002</name>
      ...
      <vcpu placement='static'>2</vcpu>
      <cputune>
        <shares>2048</shares>
      </cputune>
      ...
    </domain>

# Resize the instance back to the pinned flavor

    $ openstack server resize test1 --flavor test.pinned --wait
    complete

    $ openstack server list
    +--------------------------------------+-------+---------------+--------------------------------------------------------+
    | ID | Name | Status | Networks |
    +--------------------------------------+-------+---------------+--------------------------------------------------------+
    | 857597cb-266b-4032-8030-e3cc76ebf0e7 | test1 | VERIFY_RESIZE | private=10.0.0.3, fd2a:ec16:99e1:0:f816:3eff:fe99:df9f |
    +--------------------------------------+-------+---------------+--------------------------------------------------------+

    $ openstack server resize test1 --confirm

# Validate that the instance is pinned once more

    $ openstack server list
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | ID | Name | Status | Networks |
    +--------------------------------------+-------+--------+--------------------------------------------------------+
    | 857597cb-266b-4032-8030-e3cc76ebf0e7 | test1 | ACTIVE | private=10.0.0.3, fd2a:ec16:99e1:0:f816:3eff:fe99:df9f |
    +--------------------------------------+-------+--------+--------------------------------------------------------+

    $ sudo virsh list
     Id Name State
    ----------------------------------------------------
     3 instance-00000001 running

    $ sudo virsh dumpxml instance-00000001
    <domain type='kvm' id='3'>
      <name>instance-00000001</name>
      ...
      <vcpu placement='static'>2</vcpu>
      <cputune>
        <shares>2048</shares>
        <vcpupin vcpu='0' cpuset='1'/>
        <vcpupin vcpu='1' cpuset='21'/>
        <emulatorpin cpuset='1,21'/>
      </cputune>
      <numatune>
        <memory mode='strict' nodeset='0'/>
        <memnode cellid='0' mode='strict' nodeset='0'/>
      </numatune>
      ...
      <cpu>
        <topology sockets='1' cores='1' threads='2'/>
        <numa>
          <cell id='0' cpus='0-1' memory='2097152' unit='KiB'/>
        </numa>
      </cpu>
      ...
    </domain>