summaryrefslogtreecommitdiffstats
path: root/nova/scheduler/driver.py
Commit message (Collapse)AuthorAgeFilesLines
* New select_destinations scheduler callAndrew Laski2013-06-281-0/+9
| | | | | | | | | | | | select_destinations returns a list of (host, node) tuples that satisfy the request_spec and filter_properties passed to it. This will allow the conductor to get a list of destinations for workflows such as creating or resizing an instance and then handle the orchestration itself. part of bp query-scheduler Change-Id: I1a42cea64dbad67562d7efe8d759e6efb5ec8121
* Extract live-migration scheduler logic from the scheduler driverJohn Garbutt2013-06-241-192/+0
| | | | | | | | | | | Before moving the control of live-migration into the conductor, extract the live-migration control logic into a separate class. The callback to select_hosts will be replaced by a new scheduler rpc method in a later changeset. Part of blueprint live-migration-to-conductor Change-Id: I6de33ada6dc377e20f8df07da92244f2c150b9fe
* Revert "Initial scheduler support for instance_groups"Russell Bryant2013-06-201-18/+8
| | | | | | | | | | | This reverts commit b2c17ae891b12118b9d11bf0ecc44e77956715c8. While reviewing merged changes, I came across this one. It's using the conductor in a way that it shouldn't. The scheduler has db access, so there's no need to add the extra conductor overhead. The best thing to do here is to just revert for now, IMO. Change-Id: Iaa0d67df7bb84913784d925cffebcd5f252249ea
* Merge "Initial scheduler support for instance_groups"Jenkins2013-06-201-8/+18
|\
| * Initial scheduler support for instance_groupsGary Kotton2013-06-161-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scheduler support for blueprint instance-group-api-extension The patch set adds the following: 1. conductor support for getting instances via the instance_group uuid 2. conductor support for removing an instance from the instance_group members In addition to this it replaces the 'group' hint with 'instance_group'. DocImpact Change-Id: I4a4febc2e85d4ffc8b1579d2673fa107171a3c5b
* | Remove usage of locals() for formatting from nova.scheduler.*Changbin Liu2013-06-191-3/+5
|/ | | | | | | | | | | | Using of locals() for formatting string is a nasty thing because: 1) It is not so clear as using explicit dicts 2) It could produce hidden errors during refactoring 3) Changing name of variable causes change in message 4) Creating a lot of unused variables fixes bug #1171936 Change-Id: I7639631846a9145c3a18f2a704b71184ec781f45
* Rename functions in nova.compute.flavors from instance_typeJoe Gordon2013-06-111-1/+1
| | | | | | | | | | | Second step in removing references to instance_types. Remove all references to instance_type in nova.compute.flavors. Also update compute devref to reflect changed name. Partially implements bp flavor-instance-type-dedup renamed: nova/tests/test_instance_types.py -> test_flavors.py Change-Id: I7413bf832c61d04ab90ec8b1370d3f01372c4172
* Pass None to image if booted from volume in live migrationDongdong Zhou2013-05-081-1/+5
| | | | | | | | | | | The destination check in live migration will fetch the image information from glance and it will throw ImageNotFound if the instance is booted from volume since there is no image id on the instance Fix bug 1170596 Change-Id: Ie683a3ca5d6430c52ead77b41f98fbcb4114ea1e
* Rename nova.compute.instance_types to flavorsJoe Gordon2013-05-071-2/+2
| | | | | | | | | | | | | First step in removing references to instance_types. Rename instnace_types.py and update references to it. We currently use instance_type and flavor as synonyms, to reduce confusion we are picking one. We are going with our own terminology, flavors. renamed: nova/compute/instance_types.py -> nova/compute/flavors.py Partially implements bp flavor-instance-type-dedup Change-Id: I9dc04cf311aa8813be4f5329f23729d2c43cae6d
* Reset migrating task state for MigrationError exceptionsHans Lindgren2013-05-011-1/+1
| | | | | | | | | | | | | | | | | Create an exception type for pre-check errors and add it to the list of exceptions for which instance task state is reset to ACTIVE to avoid cases where an instance get stuck in MIGRATING state. Convert existing instances of raise MigrationError in scheduler and driver pre-checks to have them raise the new MigrationPreCheckError exception instead. In addition, also make sure that expected exceptions are passed over RPC silently. Resolves bug 1171526. Change-Id: I00fa0962e555f895dd98861684ec7767fed3b37b
* Remove unnecessary db call in scheduler driver live-migration codeHans Lindgren2013-04-111-2/+2
| | | | | | | | | | | When the scheduler selects a destination host for live-migration, a db call is made to get instance_type info for the instance. To avoid the db call, this should instead call instance_types.extract_instance_type on the instance. Resolves bug 1167811. Change-Id: I2025fdf1d34e70158360ff71e8545c8e3bc6bc80
* Don't use instance['instance_type'] for scheduler filters in migrationDan Smith2013-02-281-1/+3
| | | | | | | | | Instead, pull a fresh copy from the database, which has the proper extra_specs cleanup which everyone downstream of us expects. Fixes bug 1136430 Change-Id: Ifcb9feff8291096eed7c198b8e7a35c3c38ca93e
* Update OpenStack LLC to FoundationKurt Taylor2013-02-261-1/+1
| | | | | | Update all references of "LLC" to "Foundation". Change-Id: I009e86784ef4dcf38882d64b0eff484576e04efe
* Use oslo-config-2013.1b4Mark McLoughlin2013-02-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The cfg API is now available via the oslo-config library, so switch to it and remove the copied-and-pasted version. Add the 2013.1b4 tarball to tools/pip-requires - this will be changed to 'oslo-config>=2013.1' when oslo-config is published to pypi. This will happen in time for grizzly final. Add dependency_links to setup.py so that oslo-config can be installed from the tarball URL specified in pip-requires. Remove the 'deps = pep8==1.3.3' from tox.ini as it means all the other deps get installed with easy_install which can't install oslo-config from the URL. Make tools/hacking.py include oslo in IMPORT_EXCEPTIONS like it already does for paste. It turns out imp.find_module() doesn't correct handle namespace packages. Retain dummy cfg.py file until keystoneclient middleware has been updated (I18c450174277c8e2d15ed93879da6cd92074c27a). Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
* Live migration with an auto selection of destHans Lindgren2013-02-191-12/+52
| | | | | | | Add ability to let scheduler decide on target host during live migration. Implements: blueprint live-migration-scheduling Change-Id: Id596fa3a0ef2b1b5faf854e4b4557b3c4b413e39
* Add select_hosts to scheduler manager rpcDavid Scannell2013-02-181-0/+5
| | | | | | | | | | | | This adds a select_hosts(...) method to the scheduler manager rpc that allows other services to query it for the best suited host instead of relying on it to proxy its messages. This can be used by extensions that need the scheduler to determine the best-fit host but want to prepare and send their own messages to that host. Change-Id: I5b4760114dfcdb0464fac8ea81f46f7532ac0580
* Merge "Handle compute node not available for live migration"Jenkins2013-02-131-1/+4
|\
| * Handle compute node not available for live migrationJian Wen2013-01-311-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | This patch handles exception.ComputeServiceUnavailable by restoring instance's vm_state and instance's task_state after live migration failure caused by unavailable source/dest compute node. Raises detailed HTTPBadRequest explanation for this exception. Fixes bug 973393 and bug 1051881 Change-Id: If825b61fad9c4e3030f2e6c5002907255eaf3661
* | Support for scheduler hints for VM groupsGary Kotton2013-02-081-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the blueprint vm-ensembles. The patch introduces the group as a scheduler hint. The patch set adds group support for multi-VM deployment. This is achieved as follows: 1. A new hint is added: group. This will contain the name and type for the group. At the moment only anti-affinity is supported. In the future we will add network proximity. It will be extended to <name>:<type> 2. In order to ensure that group policy will be honored for future VM deployments, the group is stored as system_metadata. 3. The anti affinity is implemented by a new filter called GroupAntiAffinityFilter. DocImpact Change-Id: I6ea2af5770b5ac4ff082b2a021d323ee38282205
* | Merge "Add support for memory overcommit in live-migration"Jenkins2013-02-061-8/+1
|\ \ | |/ |/|
| * Add support for memory overcommit in live-migrationHans Lindgren2013-01-221-8/+1
| | | | | | | | | | | | | | | | | | | | Override the live-migration memory check in FilterScheduler and make it use RamFilter for checking available memory on target host. Resolves bug 1068258. Change-Id: I3002b8330e595ce71e2718b2091d3b0b99747707
* | Make scheduler modules pass conductor to add_instance_faultDan Smith2013-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The add_instance_fault_from_exc() method was recently changed to take a conductor to avoid direct database access. The scheduler was not updated for this, and thus was not passing it in a couple of cases. This makes those calls pass a conductor LocalAPI, resulting in direct database access (which is desired from the scheduler). The tests that one might have thought would catch this didn't because they mock out the method itself. This fixes those and adds two tests that exercise the add_instance_fault path all the way down to the DB API, which would have caught it in the first place. Fixes bug 1110808 Change-Id: If1c2988487d408a39fdf4080541f58f6bdac216c
* | Remove compute api from scheduler driverHans Lindgren2013-01-231-2/+0
|/ | | | | | | Remove unused instance of compute api and belonging import statement from scheduler driver. Change-Id: Ice0c3e7555cf4fb00a387c6cc9789515569bea9c
* Add host to instance_faults table.Rick Harris2013-01-171-2/+2
| | | | | | | | Instances can be rescheduled or migrated to different hosts; so, to make troubleshooting easier, it's convenient to store the host in which the failure occured with the instance fault record. Change-Id: Ib2b9a5bab5d95739b730f0eab15884c2db33a782
* Fix uses of service_get_all_compute_by_hostChris Behrens2013-01-141-6/+5
| | | | | | | | | | | | | | There should never be more than 1 service entry for the same topic and host, however this method returns a list of services. All callers of this method except for 1 already account for there being only 1 service entry for a particular 'compute' host and only use the first entry in the return list. This patch renames the DB API call to be 'service_get_by_compute_host' and returns a single entry. All uses of the old method are adjusted accordingly. Change-Id: I0e0ef62f5d2e71efe756940d9fdd98aa02fef216
* Remove more unused opts from nova.scheduler.driverMark McLoughlin2013-01-111-2/+0
| | | | | | | | libvirt_type is unused here since 5b85997 instances_path is unused here since 30aec4a Change-Id: Ic32775be84b3f46b1d4f117701ebb6e352f1f93c
* Remove unused opt import in scheduler.driverMark McLoughlin2013-01-091-1/+0
| | | | | | Reported by Joe Gordon. Change-Id: I8d48cad8f7f1548d20f0c3c0d8a4b11dcc351cf4
* Merge "fix N402 for nova/scheduler"Jenkins2013-01-091-1/+1
|\
| * fix N402 for nova/schedulerSean Dague2013-01-091-1/+1
| | | | | | | | | | | | | | fixes N402 (single line docstrings should end in period) for nova/scheduler files. Change-Id: I8e7b6a93df53fcd5c9491f533cadd093f4b802e0
* | Move compute_topic into nova.compute.rpcapiMark McLoughlin2013-01-091-1/+1
|/ | | | | | | | Even though the compute_topic opt is used outside nova.compute.rpcapi, it makes sense for the RPC module to "own" the topic option. blueprint: scope-config-opts Change-Id: I453951825481b9a5ba1865f6bf1223f7b1e25f98
* Removed unused imports.Chuck Short2012-12-211-2/+0
| | | | | | | Removed a bunch of unused imports based on pyflakes. Change-Id: I00952371200cb4531ddf163447433da756582a21 Signed-off-by: Chuck Short <chuck.short@canonical.com>
* Clean up unused methods in scheduler/driverZhiteng Huang2012-11-271-29/+0
| | | | | | | | The cast_to_volume_host() and cast_to_host() methods have not been used since compute RPC API is introduced. This patch removes these methods and the coresponding tests as well. Change-Id: Icd2b4b2245cc7662c8dcb6fd35d6c33b77d0429b
* Add pluggable ServiceGroup monitoring APIsYun Mao2012-11-261-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: * provide a pluggable ServiceGroup monitoring API * refactor the old DB-based implementation to the new API Currently nova compute nodes periodically write to the database (every 10 seconds by default) to report their liveness. This implementation factors out this functionality and make it a set of abstract internal APIs with a pluggable backend implementation. Currently it's named as ServiceGroup APIs. With this effort, we are hopeful to see the following benefits: * We expect to see more backend implementations in addition to the default database-based one, such as ZooKeeper (as described in blueprint zk-service-heartbeat) or rabbitmq heartbeat based. * We expect the code to live in openstack-common so projects other than Nova can take advantage of the internal APIs. * Lay the foundations to use lower overhead heartbeat mechanisms which scale better. * Other than reporting whether a node in a service group is up or down, the code may also be used to query for members. Other parts of the code could also take advantage of the new APIs. One noteable example is the MatchMaker in the rpc library, which may even become redundant. We have been working with Eric at Cloudscaling to see how this fits with the matchmaker. It is likely that this code will need to be used, at least by the peer-to-peer based RPC mechanisms, to implement the new create_worker method. DocImpact: new config options Co-authored-by: Pavel Kravchenco <kpavel@il.ibm.com> Co-authored-by: Alexey Roytman <roytman@il.ibm.com> Change-Id: I51645687249c75e7776a684f19529a1e78f33a41
* Cleanup compute multi-node assignment of nodeBrian Elliott2012-11-251-11/+2
| | | | | | | | Move assignment of the node field on the instance to the compute host to be more consistent with how the host field is assigned and handled by the resource tracker. Change-Id: Id3086585a99350abbab387932e689825b33ab6b5
* Use CONF.import_opt() for nova.config optsMark McLoughlin2012-11-201-3/+1
| | | | | | | | | | | | | The only reason for importing nova.config now is where one of the options defined in that file is needed. Rather than importing nova.config using an import statement, use CONF.import_opt() so that it is clear which option we actually require. In future, we will move many options out of nova.config so many of these import_opt() calls will either go away or cause a module other than nova.config to be imported. Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
* Remove nova.config.CONFMark McLoughlin2012-11-201-2/+2
| | | | | | | | | | | | | | | Modules import nova.config for two reasons right now - firstly, to reference nova.config.CONF and, secondly, if they use one of the options defined in nova.config. Often modules import nova.openstack.common.cfg and nova.config which is a bit pointless since they could just use cfg.CONF if they just want to nova.config in order to reference CONF. Let's just use cfg.CONF everywhere and we can explicitly state where we actually require options defined in nova.config. Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
* Remove nova.flags imports from scheduler codeChris Behrens2012-11-151-1/+0
| | | | | | | | | nova.flags is no longer needed. nova.config is now used. Removes FLAGS and LOG from baremetal_host_manager completely, which doesn't use them. Change-Id: Ia1a4597e28e8ebb8adc5a77b8b006aabe354ac15
* Updated scheduler and compute for multiple capabilities.Mikyung Kang2012-11-101-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part 1 of 6: blueprint general-bare-metal-provisioning-framework. This patch includes updates on scheduler and compute codes for multiple capabilities. This feature is needed in bare-metal provisioning which is implemented in later patches --- a bare-metal nova-compute manages multiple bare-metal nodes where instances are provisioned. Nova DB's compute_nodes entry needs to be created for each bare-metal node, and a scheduler can choose an appropriate bare-metal node to provision an instance. With this patch, one service entry with multiple compute_node entries can be registered by nova-compute. Distinct 'node name' is given for each node and is stored at compute_node['hypervisor_hostname']. And we added a new column "node" to "instances" table in Nova DB to associate instances with compute_node. FilterScheduler puts <nodename> to the column when it provisions the instance. And nova-computes respect <nodename> when run/stop instances and when calculate resources. Also, 'capability’ is extended from a dictionary to a list of dictionaries to describe the multiple capabilities of the multiple nodes. Change-Id: I527febe4dbd887b2e6596ce7226c1ae3386e2ae6 Co-authored-by: Mikyung Kang <mkkang@isi.edu> Co-authored-by: David Kang <dkang@isi.edu> Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp> Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
* Switch from FLAGS to CONF in nova.schedulerMark McLoughlin2012-11-041-5/+5
| | | | | | | | | | | Use the global CONF variable instead of FLAGS. This is purely a cleanup since FLAGS is already just another reference to CONF. We leave the nova.flags imports until a later cleanup commit since removing them may cause unpredictable problems due to config options not being registered. Change-Id: Ia3f66aec300fd88e91cef926da735f9e95aa2cc2
* Remove flags.DECLAREMark McLoughlin2012-11-041-2/+4
| | | | | | The cfg.ConfigOpts class has an equivalent method, so lets use that. Change-Id: I5860230336d00d7531a0ffd255c766ff77661625
* Remove nova-volume scheduling supportJoe Gordon2012-10-311-5/+0
| | | | | | | | | | | | | | | | | Continuation of I0b540e54dbabd26901a7530035a38583bb521fda * delete scheduler.simple * modify scheduler.multi instead of delete to continue supporting I753e87fc8979fd0b62529974f00cf11fa55b3d63 * update scheduler.multi docstring * scheduler.rpcapi bumped to 2.3 * change default scheduler to scheduler.filter_scheduler DocImpact part of bp delete-nova-volume Change-Id: Ie9d9b46742b2d92cd1e9ffe982ef658907a1d411
* removes the nova-volume code from novaVishvananda Ishaya2012-10-281-18/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the majority of the nova-volume code from the codebase. It updates relevent config options to default to cinder. It updates a number of existing tests that were depending on code that was removed. A few things still need to be removed: * volume/driver.py & volume/iscsi.py These files are used by the libvirt volume driver tests. These tests should be updated to mock the relevant calls. * scheduler/simple.py & scheduler/multi.py These files should no longer be necessary so they can be removed in a subsequent patch * exception.py cleanup Once the above files are removed there are a number of unused exceptions which can be removed * database calls and database tables The database calls have not been removed and the tables have not been dropped. This can be done in a separate migration * additional config options and nova.conf.sample There may be a few extra config options that can be removed and the conf sample can be regenerated Implements bp delete-nova-volume Change-Id: I0b540e54dbabd26901a7530035a38583bb521fda
* Fix check for memory_mbDavanum Srinivas2012-10-271-1/+1
| | | | | | | | | | assert_compute_node_has_enough_memory should check memory_mb is None or not _assert_dest_node_has_enough_disk should check available_mb as well Fixes bug 884842 Change-Id: Ieaa33efd50bb84f1b475c437b26af1302fdfd19f
* Fix hardcoded topic strings with constants.Michael H Wilson2012-10-251-4/+4
| | | | | | | | Replace hardcoded topic strings like 'volume' or 'compute' with config constants like FLAGS.volume_topic, etc. See bug #1057831 and bug #1061628. Change-Id: I817ecc3cbe3245b51a0c047be58d17edfec8a838
* Remove cast_to_network from scheduler.Russell Bryant2012-10-091-11/+1
| | | | | | | | This patch removes some dead code from the scheduler. rpc casting to network hosts has been unused in the scheduler since commit d328ddcadb24d1b1961bd05a7676bc8f54b6776f. Change-Id: I0ba49d0e9f7e9476f84b5d389c06b7fc43cf0438
* Set instance host field after resource claimBrian Elliott2012-10-081-4/+4
| | | | | | | | | | | | | | Set the 'host' field on the instance after the resource tracker on the compute node has accepted the build. The field is set after resources are confirmed to be available while the COMPUTE_RESOURCES_SEMAPHORE is held. The semaphore ensures the resources usage values will be consistent even if the update_available_resource periodic task audit runs. bug 1060255 Change-Id: I92105ec14924960ac8ef7ca8c810783085314e10
* Update quota when deleting volume that failed to be scheduledZhiteng Huang2012-09-181-2/+2
| | | | | | | | | | | | | | | If one volume was failed to get scheduled, removing such volume should also clean up reservation. Also when create_volume is ready to send to scheduler, reservation should be committed no matter backend can successfully create that volume or not since deleting volume call will do a minus reservation even on volume with 'error' status. This change updates RPC API to version 2.2 Fix bug 1052052 Change-Id: Ia632a0e49318d534f0acbd3df5c9f6bb86eefa2a
* Adds new volume API extensionsUnmesh Gurjar2012-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds following extensions: 1. Create volume from image 2. Copy volume to image Added unit tests. Implements: blueprint create-volume-from-image Conflicts: cinder/api/openstack/volume/contrib/volume_actions.py cinder/tests/api/openstack/fakes.py cinder/tests/api/openstack/volume/contrib/test_volume_actions.py cinder/tests/policy.json nova/api/openstack/volume/volumes.py nova/flags.py nova/tests/api/openstack/volume/test_volumes.py nova/tests/test_volume.py nova/utils.py nova/volume/api.py nova/volume/manager.py This is based on a cherry-pick of cinder commit 2f5360753308eb8b10581fc3c026c1b66f42ebdc with bug fixes 8c30edff982042d2533a810709308b586267c0e9 and ffe5036fa0e63ccde2d19aa0f425ec43de338dd7 squashed in. Change-Id: I9c73bd3fa2fa2e0648c01ff3f4fc66f757d7bc3f
* Fixes error handling during schedule_run_instanceVishvananda Ishaya2012-09-171-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | If there are not enough hosts available during a multi-instance launch, every failing instance should be updated to error state, instead of just the first instance. Currently only the first instance is set to Error and the rest stay in building. This patch makes a number of fixes to error handling during scheduling. * Moves instance faults into compute utils so they can be created from the scheduler. * Moves error handling into the driver so that each instance can be updated separately. * Sets an instance fault for failed scheduling * Sets task state back to none if there is a scheduling failure * Modifies chance scheduler to stop returning a list of instances as it is not used. * Modifies tests to check for these states. In addition to the included tests, the code was manually verified on a devstack install Fixes bug 1051066 Fixes bug 1019017 Change-Id: I49267ce4a21e2f7cc7a996fb2ed5d625f6794730
* Avoid live migrate overwriting the other task_stateJian Wen2012-09-131-10/+1
| | | | | | | | | | | | | | | | | As commit 4082c8375a6ae7e7e67c7ad2e263be2d5fc3dd1f says, one ordinary task is running, so that task_state is set. The live_migrate task is accepted at API, and will change task_state to MIGRATING. However the first task may continue to update task_state or set it to None as it finishes. This patch avoids it by updating task_state in compute.api.live_migrate level with expected_task_state=None. Add test case for compute.api.live_migrate. Fixes bug 1049533 Change-Id: Ida8cef4797de421a7e356c9f5e882fe926535639