Public bug reported:

During a cold migration the compute API resize() method checks the
instance.flavor:

https://github.com/openstack/nova/blob/53d42de9d970abc290064ab86df272b4d933abc9/nova/compute/api.py#L3587

But this results in a query to the DB:

May 16 19:46:21.368204 ubuntu-bionic-rax-dfw-0006201125 
[email protected][19505]: DEBUG nova.objects.instance [None 
req-bde576dc-5de2-4113-982d-025c65b97e8d tempest-MigrationsAdminTest-391674513 
tempest-MigrationsAdminTest-391674513] Lazy-loading 'flavor' on Instance uuid 
21c45b79-b0f4-48a8-8949-9f480beb5864 {{(pid=19507) obj_load_attr 
/opt/stack/nova/nova/objects/instance.py:1106}}
May 16 19:46:21.410776 ubuntu-bionic-rax-dfw-0006201125 
[email protected][19505]: DEBUG nova.compute.api [None 
req-bde576dc-5de2-4113-982d-025c65b97e8d tempest-MigrationsAdminTest-391674513 
tempest-MigrationsAdminTest-391674513] [instance: 
21c45b79-b0f4-48a8-8949-9f480beb5864] flavor_id is None. Assuming migration. 
{{(pid=19507) resize /opt/stack/nova/nova/compute/api.py:3700}}

This could be avoided if we join the flavor when we fetch the instance
from the DB initially:

https://github.com/openstack/nova/blob/53d42de9d970abc290064ab86df272b4d933abc9/nova/api/openstack/compute/migrate_server.py#L55

By passing expected_attrs=['flavor'] to common.get_instance.

** Affects: nova
     Importance: Low
         Status: Confirmed


** Tags: low-hanging-fruit

** Summary changed:

- avoid lazy-lodaing instance.flavor during cold migration
+ avoid lazy-loading instance.flavor during cold migration

-- 
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/1829877

Title:
  avoid lazy-loading instance.flavor during cold migration

Status in OpenStack Compute (nova):
  Confirmed

Bug description:
  During a cold migration the compute API resize() method checks the
  instance.flavor:

  
https://github.com/openstack/nova/blob/53d42de9d970abc290064ab86df272b4d933abc9/nova/compute/api.py#L3587

  But this results in a query to the DB:

  May 16 19:46:21.368204 ubuntu-bionic-rax-dfw-0006201125 
[email protected][19505]: DEBUG nova.objects.instance [None 
req-bde576dc-5de2-4113-982d-025c65b97e8d tempest-MigrationsAdminTest-391674513 
tempest-MigrationsAdminTest-391674513] Lazy-loading 'flavor' on Instance uuid 
21c45b79-b0f4-48a8-8949-9f480beb5864 {{(pid=19507) obj_load_attr 
/opt/stack/nova/nova/objects/instance.py:1106}}
  May 16 19:46:21.410776 ubuntu-bionic-rax-dfw-0006201125 
[email protected][19505]: DEBUG nova.compute.api [None 
req-bde576dc-5de2-4113-982d-025c65b97e8d tempest-MigrationsAdminTest-391674513 
tempest-MigrationsAdminTest-391674513] [instance: 
21c45b79-b0f4-48a8-8949-9f480beb5864] flavor_id is None. Assuming migration. 
{{(pid=19507) resize /opt/stack/nova/nova/compute/api.py:3700}}

  This could be avoided if we join the flavor when we fetch the instance
  from the DB initially:

  
https://github.com/openstack/nova/blob/53d42de9d970abc290064ab86df272b4d933abc9/nova/api/openstack/compute/migrate_server.py#L55

  By passing expected_attrs=['flavor'] to common.get_instance.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1829877/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to