Public bug reported: Description ===========
Current nova api documentation states the following about disk=0 in flavor: The size of the root disk that will be created in GiB. If 0 the root disk will be set to exactly the size of the image used to deploy the instance. [1] However scheduler does not check the actual image size during select destintation and also resource tracker does not calculate the used space properly. [1] https://github.com/openstack/nova/blob/master/api-ref/source/parameters.yaml#L1548-L1555 Steps to reproduce ================== 1. Create a sizeable image. e.g. 8GB +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | bde0b00c072a8b5ab28ac58a3b8ea6ed | | container_format | bare | | created_at | 2016-07-07T09:25:33Z | | disk_format | qcow2 | | id | ea14a784-252a-4193-9129-a311f64c01f4 | | min_disk | 0 | | min_ram | 0 | | name | my_image | | owner | 0878b2a9a9fa4c538931df5d67708b51 | | protected | False | | size | 8591507456 | | status | active | | tags | [] | | updated_at | 2016-07-07T09:29:35Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ 2. Check the current host-describe output to see the available and used space vagrant@controller:~$ nova host-describe controller +------------+----------------------------------+-----+-----------+---------+ | HOST | PROJECT | cpu | memory_mb | disk_gb | +------------+----------------------------------+-----+-----------+---------+ | controller | (total) | 8 | 7794 | 39 | | controller | (used_now) | 0 | 512 | 0 | | controller | (used_max) | 0 | 64 | 0 | +------------+----------------------------------+-----+-----------+---------+ 3. boot a vm with a flavor disk=0 vagrant@controller:/opt/stack/nova/nova/scheduler/filters$ nova flavor-list +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | | 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True | | c1 | cirros256 | 256 | 0 | 0 | | 1 | 1.0 | True | | d1 | ds512M | 512 | 5 | 0 | | 1 | 1.0 | True | | d2 | ds1G | 1024 | 10 | 0 | | 1 | 1.0 | True | | d3 | ds2G | 2048 | 10 | 0 | | 2 | 1.0 | True | | d4 | ds4G | 4096 | 20 | 0 | | 4 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ vagrant@controller:~$ nova boot --image ea14a784-252a-4193-9129-a311f64c01f4 --flavor 42 vm2 --poll +--------------------------------------+-------------------------------------------------+ | Property | Value | +--------------------------------------+-------------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-SRV-ATTR:host | - | | OS-EXT-SRV-ATTR:hostname | vm2 | | OS-EXT-SRV-ATTR:hypervisor_hostname | - | | OS-EXT-SRV-ATTR:instance_name | instance-00000002 | | OS-EXT-SRV-ATTR:kernel_id | | | OS-EXT-SRV-ATTR:launch_index | 0 | | OS-EXT-SRV-ATTR:ramdisk_id | | | OS-EXT-SRV-ATTR:reservation_id | r-5c032r0o | | OS-EXT-SRV-ATTR:root_device_name | - | | OS-EXT-SRV-ATTR:user_data | - | | OS-EXT-STS:power_state | 0 | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | - | | OS-SRV-USG:terminated_at | - | | accessIPv4 | | | accessIPv6 | | | adminPass | MmVFaJr7B5Rp | | config_drive | | | created | 2016-07-07T09:32:14Z | | description | - | | flavor | m1.nano (42) | | hostId | | | host_status | | | id | 16c2e302-62f9-4ce3-b603-e8c98115fd13 | | image | my_image (ea14a784-252a-4193-9129-a311f64c01f4) | | key_name | - | | locked | False | | metadata | {} | | name | vm2 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tags | [] | | tenant_id | 0878b2a9a9fa4c538931df5d67708b51 | | updated | 2016-07-07T09:32:14Z | | user_id | d2046b30b0e6459ebe02b67aba2b11d4 | +--------------------------------------+-------------------------------------------------+ Server building... 0% complete Server building... 0% complete Server building... 100% complete Finished vagrant@controller:~$ 4. Check the host-describe output again. vagrant@controller:~$ nova host-describe controller +------------+----------------------------------+-----+-----------+---------+ | HOST | PROJECT | cpu | memory_mb | disk_gb | +------------+----------------------------------+-----+-----------+---------+ | controller | (total) | 8 | 7794 | 39 | | controller | (used_now) | 1 | 576 | 0 | | controller | (used_max) | 1 | 64 | 0 | | controller | 0878b2a9a9fa4c538931df5d67708b51 | 1 | 64 | 0 | +------------+----------------------------------+-----+-----------+---------+ To see the data used by the scheduler decision you shall add an extra log line to the disk_filter.py vagrant@controller:/opt/stack/nova$ git diff diff --git a/nova/scheduler/filters/disk_filter.py b/nova/scheduler/filters/disk_filter.py index 3476ace..d16dcbf 100644 --- a/nova/scheduler/filters/disk_filter.py +++ b/nova/scheduler/filters/disk_filter.py @@ -37,6 +37,8 @@ class DiskFilter(filters.BaseHostFilter): spec_obj.ephemeral_gb) + spec_obj.swap) + LOG.error('requested_disk' + str(requested_disk)) + free_disk_mb = host_state.free_disk_mb total_usable_disk_mb = host_state.total_usable_disk_gb * 1024 Then in the scheduler log you will see that during the boot the requested_disk is 0 and not 8G as expected based on the documentation. 2016-07-07 09:19:18.480 ERROR nova.scheduler.filters.disk_filter [req-c7410319-c65f-4274-88b8-a0c68e0bc7ff admin admin] requested_disk0 Expected result =============== The documentation correctly states that disk=0 means that the scheduler will not select the host based on image size. Environment =========== Devstack on master. vagrant@controller:/opt/stack/nova$ git log -1 commit 2d551ce83d186ad70ca69b1a6f9454906b4b3448 Merge: 94c96f2 7451862 Author: Jenkins <jenk...@review.openstack.org> Date: Mon Jul 4 15:40:25 2016 +0000 Merge "Improve the help text for configdrive options" ** Affects: nova Importance: Undecided Status: New -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1599787 Title: The documentation of disk=0 in flavor is misleading Status in OpenStack Compute (nova): New Bug description: Description =========== Current nova api documentation states the following about disk=0 in flavor: The size of the root disk that will be created in GiB. If 0 the root disk will be set to exactly the size of the image used to deploy the instance. [1] However scheduler does not check the actual image size during select destintation and also resource tracker does not calculate the used space properly. [1] https://github.com/openstack/nova/blob/master/api-ref/source/parameters.yaml#L1548-L1555 Steps to reproduce ================== 1. Create a sizeable image. e.g. 8GB +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | bde0b00c072a8b5ab28ac58a3b8ea6ed | | container_format | bare | | created_at | 2016-07-07T09:25:33Z | | disk_format | qcow2 | | id | ea14a784-252a-4193-9129-a311f64c01f4 | | min_disk | 0 | | min_ram | 0 | | name | my_image | | owner | 0878b2a9a9fa4c538931df5d67708b51 | | protected | False | | size | 8591507456 | | status | active | | tags | [] | | updated_at | 2016-07-07T09:29:35Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ 2. Check the current host-describe output to see the available and used space vagrant@controller:~$ nova host-describe controller +------------+----------------------------------+-----+-----------+---------+ | HOST | PROJECT | cpu | memory_mb | disk_gb | +------------+----------------------------------+-----+-----------+---------+ | controller | (total) | 8 | 7794 | 39 | | controller | (used_now) | 0 | 512 | 0 | | controller | (used_max) | 0 | 64 | 0 | +------------+----------------------------------+-----+-----------+---------+ 3. boot a vm with a flavor disk=0 vagrant@controller:/opt/stack/nova/nova/scheduler/filters$ nova flavor-list +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | | 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True | | c1 | cirros256 | 256 | 0 | 0 | | 1 | 1.0 | True | | d1 | ds512M | 512 | 5 | 0 | | 1 | 1.0 | True | | d2 | ds1G | 1024 | 10 | 0 | | 1 | 1.0 | True | | d3 | ds2G | 2048 | 10 | 0 | | 2 | 1.0 | True | | d4 | ds4G | 4096 | 20 | 0 | | 4 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ vagrant@controller:~$ nova boot --image ea14a784-252a-4193-9129-a311f64c01f4 --flavor 42 vm2 --poll +--------------------------------------+-------------------------------------------------+ | Property | Value | +--------------------------------------+-------------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-SRV-ATTR:host | - | | OS-EXT-SRV-ATTR:hostname | vm2 | | OS-EXT-SRV-ATTR:hypervisor_hostname | - | | OS-EXT-SRV-ATTR:instance_name | instance-00000002 | | OS-EXT-SRV-ATTR:kernel_id | | | OS-EXT-SRV-ATTR:launch_index | 0 | | OS-EXT-SRV-ATTR:ramdisk_id | | | OS-EXT-SRV-ATTR:reservation_id | r-5c032r0o | | OS-EXT-SRV-ATTR:root_device_name | - | | OS-EXT-SRV-ATTR:user_data | - | | OS-EXT-STS:power_state | 0 | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | - | | OS-SRV-USG:terminated_at | - | | accessIPv4 | | | accessIPv6 | | | adminPass | MmVFaJr7B5Rp | | config_drive | | | created | 2016-07-07T09:32:14Z | | description | - | | flavor | m1.nano (42) | | hostId | | | host_status | | | id | 16c2e302-62f9-4ce3-b603-e8c98115fd13 | | image | my_image (ea14a784-252a-4193-9129-a311f64c01f4) | | key_name | - | | locked | False | | metadata | {} | | name | vm2 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tags | [] | | tenant_id | 0878b2a9a9fa4c538931df5d67708b51 | | updated | 2016-07-07T09:32:14Z | | user_id | d2046b30b0e6459ebe02b67aba2b11d4 | +--------------------------------------+-------------------------------------------------+ Server building... 0% complete Server building... 0% complete Server building... 100% complete Finished vagrant@controller:~$ 4. Check the host-describe output again. vagrant@controller:~$ nova host-describe controller +------------+----------------------------------+-----+-----------+---------+ | HOST | PROJECT | cpu | memory_mb | disk_gb | +------------+----------------------------------+-----+-----------+---------+ | controller | (total) | 8 | 7794 | 39 | | controller | (used_now) | 1 | 576 | 0 | | controller | (used_max) | 1 | 64 | 0 | | controller | 0878b2a9a9fa4c538931df5d67708b51 | 1 | 64 | 0 | +------------+----------------------------------+-----+-----------+---------+ To see the data used by the scheduler decision you shall add an extra log line to the disk_filter.py vagrant@controller:/opt/stack/nova$ git diff diff --git a/nova/scheduler/filters/disk_filter.py b/nova/scheduler/filters/disk_filter.py index 3476ace..d16dcbf 100644 --- a/nova/scheduler/filters/disk_filter.py +++ b/nova/scheduler/filters/disk_filter.py @@ -37,6 +37,8 @@ class DiskFilter(filters.BaseHostFilter): spec_obj.ephemeral_gb) + spec_obj.swap) + LOG.error('requested_disk' + str(requested_disk)) + free_disk_mb = host_state.free_disk_mb total_usable_disk_mb = host_state.total_usable_disk_gb * 1024 Then in the scheduler log you will see that during the boot the requested_disk is 0 and not 8G as expected based on the documentation. 2016-07-07 09:19:18.480 ERROR nova.scheduler.filters.disk_filter [req-c7410319-c65f-4274-88b8-a0c68e0bc7ff admin admin] requested_disk0 Expected result =============== The documentation correctly states that disk=0 means that the scheduler will not select the host based on image size. Environment =========== Devstack on master. vagrant@controller:/opt/stack/nova$ git log -1 commit 2d551ce83d186ad70ca69b1a6f9454906b4b3448 Merge: 94c96f2 7451862 Author: Jenkins <jenk...@review.openstack.org> Date: Mon Jul 4 15:40:25 2016 +0000 Merge "Improve the help text for configdrive options" To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1599787/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp