No database access by nova-compute

Registered by Russell Bryant

Make all of the necessary changes so that nova-compute no longer has direct access to the database.

Blueprint information

Status:
Complete
Approver:
Vish Ishaya
Priority:
High
Drafter:
Russell Bryant
Direction:
Approved
Assignee:
Russell Bryant
Definition:
Approved
Series goal:
Accepted for grizzly
Implementation:
Implemented
Milestone target:
milestone icon 2013.1
Started by
Russell Bryant
Completed by
Russell Bryant

Whiteboard

------------------------------------------------------

Status (as of 2013-01-25):

The following review identifies db accesses that still exist in nova-compute. Look for tracebacks in the nova-compute log for test runs against this patch:
    https://review.openstack.org/#/c/20052/

This log file is from the latest run (patch set 8)
http://logs.openstack.org/20052/8/check/gate-tempest-devstack-vm/28351/logs/screen-n-cpu.txt

There are 28 exceptions logged from db accesses. They are:

1) network api updates of the network info cache, addressed by: https://review.openstack.org/#/c/20448/

2) instance_type_get from compute_utils. This can be solved pretty easily once instance_type details are stored in the instance system_metadata table, so this depends on: https://review.openstack.org/#/c/16033/ -- fully addressed by: https://review.openstack.org/#/c/20775/ (and dependents)

3) bw_usage_get_by_uuids() called by nova.notifications. Addressed by: https://review.openstack.org/#/c/20868/

Other known db issues to address:

a) set_password() in nova.api.metadata, called from: https://github.com/openstack/nova/blob/master/nova/virt/xenapi/agent.py#L216 -- Addressed by: https://review.openstack.org/#/c/21133/

b) need to review the smokestack log for additional things it caught

-----------------------------------------------------

blog post on nova-conductor, a part of this project: http://russellbryantnet.wordpress.com/2012/11/19/a-new-nova-service-nova-conductor/

Wishlist bug on this here: https://bugs.launchpad.net/nova/+bug/823000

Gerrit topic: https://review.openstack.org/#q,topic:bp/no-db-compute,n,z

Addressed by: https://review.openstack.org/10987
    Remove db access for block devices on terminate_instance

Addressed by: https://review.openstack.org/13921
    Remove db access for block devices and network info on reboot

Addressed by: https://review.openstack.org/14610
    Remove database usage from libvirt imagecache module

Addressed by: https://review.openstack.org/14719
    Send full migration to resize_instance.

Addressed by: https://review.openstack.org/14783
    Send full migration to confirm_resize.

Addressed by: https://review.openstack.org/14784
    Send full migration data to finish_resize.

Addressed by: https://review.openstack.org/14791
    Remove database usage from libvirt check_can_live_migrate_destination

Addressed by: https://review.openstack.org/15081
    Remove redundant code from PowerVM driver

Addressed by: https://review.openstack.org/15082
    Prepare libvirt for db'ectomy

Addressed by: https://review.openstack.org/15083
    Prepare xenapi for partial db'ectomy

Addressed by: https://review.openstack.org/15084
    Remove all db.instance_update() from nova/virt

Addressed by: https://review.openstack.org/15223
    Remove db.instance_get* from nova/virt

Addressed by: https://review.openstack.org/15272
    Removes unnecessary db query for instance type

Addressed by: https://review.openstack.org/15309
    Remove unnecessary db call from xenapi/vmops

Addressed by: https://review.openstack.org/15341
    Send all migration data to revert_resize.

Addressed by: https://review.openstack.org/15342
    Send all migration data to finish_revert_resize.

Addressed by: https://review.openstack.org/15348
    Send all aggregate data to add_aggregate_host.

Addressed by: https://review.openstack.org/15428
    Look up stuck-in-rebooting instances in manager

Addressed by: https://review.openstack.org/15440
    Move host aggregate operations to VirtAPI

Addressed by: https://review.openstack.org/15444
    Send all aggregate data to remove_aggregate_host.

Addressed by: https://review.openstack.org/15449
    Remove instance_type db lookup in prep_resize.

Addressed by: https://review.openstack.org/15451
    Send instance_type to resize_instance.

Addressed by: https://review.openstack.org/15510
    Move security groups and firewall ops to VirtAPI

Addressed by: https://review.openstack.org/15588
    Add some xenapi Bittorrent tests

Addressed by: https://review.openstack.org/15589
    Avoid unnecessary system_metadata db lookup

Addressed by: https://review.openstack.org/15631
    Make instance_system_metadata load with instance

Addressed by: https://review.openstack.org/15690
    Ban db import from nova/virt

Addressed by: https://review.openstack.org/15910
    Fix a bug in XenAPISession's use of virtapi

Addressed by: https://review.openstack.org/16198
    Pass around instance instead of just uuid.

Addressed by: https://review.openstack.org/16242
    Move db lookup for block device mappings.

Addressed by: https://review.openstack.org/16243
    Send block device mappings to rebuild_instance.

Addressed by: https://review.openstack.org/16268
    Send block device mappings to run_instance.

Addressed by: https://review.openstack.org/16723
    Remove database usage from libvirt imagecache module

Addressed by: https://review.openstack.org/16937
    Remove unnecessary topic argument.

Addressed by: https://review.openstack.org/16938
    Add migration_update to conductor.

Addressed by: https://review.openstack.org/16998
    Add version to conductor migration_update message.

Addressed by: https://review.openstack.org/17007
    Make compute manager use conductor for instance_gets

Addressed by: https://review.openstack.org/17009
    Include 'hosts' and 'metadetails' in aggregate.

Addressed by: https://review.openstack.org/17075
    Add aggregate_host_add to conductor.

Addressed by: https://review.openstack.org/17223
    Split out part of compute's init_host.

Addressed by: https://review.openstack.org/17483
    Use conductor for resourcetracker instance_update.

Addressed by: https://review.openstack.org/17695
    Use conductor for migration_get()

Addressed by: https://review.openstack.org/17714
    Use conductor for bw_usage operations

Addressed by: https://review.openstack.org/17806
    Make nova/virt use aggregate['metadetails']

Addressed by: https://review.openstack.org/17813
    Fix bw_usage_update issue with conductor

Addressed by: https://review.openstack.org/17871
    Move remaining aggregate operations to conductor

Addressed by: https://review.openstack.org/17883
    Add VirtAPI tests

Gerrit topic: https://review.openstack.org/#q,topic:bp/no-db-compute-manager,n,z

Addressed by: https://review.openstack.org/18317
    Move aggregate_get() to conductor

Addressed by: https://review.openstack.org/18322
    Add expected exception to aggregate_metadata_delete()

Addressed by: https://review.openstack.org/18849
    Remove system_metadata db calls from compute manager

Addressed by: https://review.openstack.org/19013
    Add ping to conductor

Addressed by: https://review.openstack.org/18990
    Move service_get_all operations to conductor

Addressed by: https://review.openstack.org/18972
    Move vol_usage methods to conductor

Addressed by: https://review.openstack.org/18975
    Move migration_get_unconfirmed_by_dest_compute to conductor

Addressed by: https://review.openstack.org/17199
    Get instances from conductor in init_host.

Addressed by: https://review.openstack.org/19473
    Move migration_create() to conductor

Addressed by: https://review.openstack.org/19504
    Fix some conductor manager return values.

Addressed by: https://review.openstack.org/19505
    Make pinging conductor a part of conductor API.

Addressed by: https://review.openstack.org/19506
    Allow forcing local conductor.

Addressed by: https://review.openstack.org/19507
    Handle waiting for conductor in nova.service.

Addressed by: https://review.openstack.org/19508
    Add service_create to conductor.

Addressed by: https://review.openstack.org/19509
    Make nova.service get service through conductor.

Addressed by: https://review.openstack.org/19510
    Add service_destroy to conductor.

Addressed by: https://review.openstack.org/19635
    Make resource tracker use conductor for migration updates

Addressed by: https://review.openstack.org/19643
    Move migration_get_..._by_host_and_node to conductor

Addressed by: https://review.openstack.org/19644
    Make resource tracker use conductor for listing compute nodes

Addressed by: https://review.openstack.org/19651
    Make resource tracker use conductor for listing instances

Addressed by: https://review.openstack.org/19726
    Move compute node operations to conductor

Addressed by: https://review.openstack.org/19734
    Remove unused import.

Addressed by: https://review.openstack.org/19735
    Remove some db calls from db servicegroup driver.

Addressed by: https://review.openstack.org/19736
    Add service_update to conductor.

Addressed by: https://review.openstack.org/19737
    Use conductor in the servicegroup db driver.

Addressed by: https://review.openstack.org/19944
    Refactor compute_utils to avoid db lookup

Addressed by: https://review.openstack.org/19950
    Add instance_fault_create() to conductor

Addressed by: https://review.openstack.org/19975
    Move task_log functions to conductor

Addressed by: https://review.openstack.org/20265
    Ensure service's servicegroup API is created first.

Addressed by: https://review.openstack.org/20354
    Avoid db lookup in info_from_instance().

Addressed by: https://review.openstack.org/20448
    Use conductor for instance_info_cache_update.

Addressed by: https://review.openstack.org/20771
    Make system_metadata update in place

Addressed by: https://review.openstack.org/20772
    Fix up instance types in sys meta for resizes

Addressed by: https://review.openstack.org/20773
    Teach resource tracker about stashed instance types

Addressed by: https://review.openstack.org/20774
    Make cells_api fetch stashed instance_type info

Addressed by: https://review.openstack.org/20775
    Remove remaining instance_types query from compute/manager

Addressed by: https://review.openstack.org/20776
    Make get_device_name_for_instance() use stashed instance_type info

Addressed by: https://review.openstack.org/20856
    Remove remaining instance_type db fetches from compute/api

Addressed by: https://review.openstack.org/20868
    Use conductor for notifications when necessary

Addressed by: https://review.openstack.org/21133
    Refactor server password metadata to avoid direct db usage

Addressed by: https://review.openstack.org/21336
    Ban database access in nova-compute

Addressed by: https://review.openstack.org/21385
    Move security_groups refreshes to conductor

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.