summaryrefslogtreecommitdiffstats
path: root/nova/scheduler/manager.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge "New select_destinations scheduler call"Jenkins2013-07-011-1/+12
|\
| * New select_destinations scheduler callAndrew Laski2013-06-281-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Moves scheduler.manager._set_vm_state_and_notify to scheduler.utilsTiago Mello2013-06-281-52/+3
|/ | | | | | | | | | | | This method is required by the scheduler.manager.prep_resize method which is being moved to conductor.manager. We move it to scheduler.utils until we completely move migrations logic out of scheduler.manager. Partially implements bp cold-migrations-to-conductor Change-Id: I8203577fc26da5cc1039815e31fb8fe356d1f7d6
* Merge "Allow scheduler manager NoValidHost exception to pass over RPC"Jenkins2013-06-251-0/+1
|\
| * Allow scheduler manager NoValidHost exception to pass over RPCHans Lindgren2013-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Calls to scheduler.manager.select_hosts are expected to throw NoValidHost exceptions if no hosts match such requests. For the exception to be passed over RPC, the method must be decorated with: @rpc_common.client_exceptions(exception.NoValidHost) Resolves bug 1192693. Change-Id: If9d1f15ff1239e422067893f9d837c41e5f5474d
* | Extract live-migration scheduler logic from the scheduler driverJohn Garbutt2013-06-241-3/+10
| | | | | | | | | | | | | | | | | | | | | | 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
* | Remove usage of locals() for formatting from nova.scheduler.*Changbin Liu2013-06-191-3/+4
|/ | | | | | | | | | | | 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
* Merge "Fix and enable H403 tests"Jenkins2013-06-131-2/+3
|\
| * Fix and enable H403 testsDirk Mueller2013-06-121-2/+3
| | | | | | | | | | | | Multi-line doc-strings should end on a new, separate line. Change-Id: I4cf0cfe92b634ef77971863a4df41ef43531bc20
* | Put VM UUID to live migration error notificationJay Lau2013-06-091-1/+4
|/ | | | | | | | | | | | | | | | If live migration encounter some exception before nova scheduler cast message to nova compute, nova scheduler will set the VM state to ERROR and send notification, but the notification do not include VM UUID, this might cause some problem if some components want to handle the notification since those components will not able to know the VM UUID about the notification. The solution is add UUID to live migration error notification so other components can get the related notification correctly. Fix bug 1182117 Change-Id: Id101f9e2a689a02d1604c12cd7677e0975bd7428
* Deprecate show_host_resources() in scheduler managerHans Lindgren2013-05-021-3/+1
| | | | | | | | | | This method does not at all belong in the scheduler. Its only use is from being remotely called by nova-manage to whom it returns data fetched from the db. I think nova-manage is better of fetching this data on its own instead of making this extra round trip to the scheduler. Change-Id: I435300cdd15bdd041cbe5718ae064b98cec4cceb
* Reset migrating task state for MigrationError exceptionsHans Lindgren2013-05-011-1/+11
| | | | | | | | | | | | | | | | | 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
* Update to using oslo periodic tasks implementation.Michael Still2013-05-011-1/+2
| | | | | | | Convert nova to using the oslo periodic tasks implementation. There are no functional changes in this review. Change-Id: I767e0ad17781d5f9d5e987e0a4ad65796243ae5c
* Move get_backdoor_port to base rpc API.Russell Bryant2013-04-241-0/+2
| | | | | | | | | | | | | Each service implemented the get_backdoor_port method individually. This patch moves the implementation of this method to the base rpc API instead, and removes the now unnecessary code from each of the services. The server side method was left on all of the managers for rpc backwards copmatibility. They can be removed on the next major rpc version bump of those APIs. Part of blueprint base-rpc-api. Change-Id: Ia8838fafd80eb86a1c2d66f5e97370042d8d8c53
* Add an rpc API common to all services.Russell Bryant2013-04-231-1/+2
| | | | | | | | | | | | | | | | | | | | This patch adds an rpc API that is exposed by all services. The methods in this API exist in their own namespace and are versioned independently of the main API for the service. The first method for this API is a simple ping() method. This method exists in the conductor rpc API already, and could be more generally useful. Other methods will be added in later patches. The base rpc API will be exposed from all services automatically unless they override the create_rpc_dispatcher method in the base manager class. All services need to pass a service_name into the base manager constructor. Some services already did this, but now it's needed for all of them. Implements blueprint base-rpc-api. Change-Id: I02ab1970578bc53ba26461b533d06d1055c2d88e
* Catch NoValidHost exception during live-migrationHans Lindgren2013-04-091-1/+2
| | | | | | | | | | To avoid leaving the instance state as MIGRATING if scheduling of a target host fails, add this exception to the list of exceptions for which the instance task state is reset to None. Resolves bug 1166771. Change-Id: I23343091725051624c0eb0b82e9f03a7f9d5f4f4
* Reset migrating task state for more ExceptionsAndrew Laski2013-03-151-1/+3
| | | | | | | | | | | | There are a number of exceptions that can occur during pre live-migration checks, and they should reset the task state to None when they occur since they prevent the migration from beginning. This adds two more exceptions to the list of exceptions that just need to reset the task state rather than set the instance to error. Bug 1100462 Change-Id: I95e09f49908fbc3a79f5d2eb490d5a0b3296a6ed
* Merge "Fixes instance task_state being left as migrating"Jenkins2013-03-151-1/+4
|\
| * Fixes instance task_state being left as migratingFei Long Wang2013-03-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a cross-hypervisor environment, such as KVM + Hyper-v. After negative test which live migrate a KVM instance to Hyper-v host, there will be an exception InvalidHypervisorType. As a result, the instance task_state is being left as migrating. That leaves the instance in a broken state and most of the requests on the instance will fail. Actually, there are some other exceptions will cause this issue as well, such as UnableToMigrateToSelf, DestinationHypervisorTooOld. All of them are thrown from the driver of scheduler during live migration. But obviously, if the live migration fails at the schedule stage, the task_state of the target instance should be updated to None. Fixes Bug: 1153283 Change-Id: Ide4b48653268c8dbe31de6964814830d2e82a5ba
* | Fix: Managers that incorrectly derive from SchedulerDependentManagerHans Lindgren2013-03-121-5/+4
|/ | | | | | | | | | Change conductor and network managers to be ordinary managers. Also remove some unnecessary imports from managers already declared with base manager classes in nova/manager.py. Resolves bug 1154070. Change-Id: I6b87cd5d7d5ef66425d084db667a6eff247cf0b1
* 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
* Ensure rpc result is primitive types.Russell Bryant2013-02-181-1/+2
| | | | | | | | This new rpc method was not ensuring that the result was converted to primitive types. This would cause it to break when using an rpc backend other than impl_kombu. Change-Id: I0a21b559d12ff7d0c96341fcec887b2436753eda
* Add select_hosts to scheduler manager rpcDavid Scannell2013-02-181-1/+8
| | | | | | | | | | | | 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-0/+11
|\
| * Handle compute node not available for live migrationJian Wen2013-01-311-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Record instance actions and eventsAndrew Laski2013-02-011-35/+42
|/ | | | | | | | | | | | | | | | | | Record when an action is initiated on an instance, and the underlying events related to completing that action. Actions will typically occur at the API level and should match what a user intended to do with an instance. Events will typically track what happens behind the scenes and may include things that would be unclear for a user if exposed, but should be beneficial to an admin/deployer. Adds a new wrapper to the compute manager. The wrapper will record when an event begins and finishes from the point of view of the compute manager. It will also record errors if they occur. Blueprint instance-actions Change-Id: I801f3e796d091e146413f84c2ccfab95ad2e1af4
* 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
* 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-4/+3
| | | | | | | | | | | | | | 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
* 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
* Add get_backdoor_port to scheduler.Matthew Treinish2012-12-191-1/+4
| | | | | | | | This adds a get_backdoor_port function to the scheduler service which enables returning the eventlet_backdoor port from rpc for the service. Change-Id: Ib88e2a9e709d5240722027c94e6762b4a3bd918c
* Make update_service_capabilities() accept a list of capabilitiesMana Kaneko2012-12-031-5/+8
| | | | | | This makes it possible to send multiple capabilites by single RPC. Change-Id: I7c1b75eada17181c4fe08c55992b34d66276f498
* Remove nova.config.CONFMark McLoughlin2012-11-201-2/+1
| | | | | | | | | | | | | | | 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
* Switch from FLAGS to CONF in nova.schedulerMark McLoughlin2012-11-041-3/+4
| | | | | | | | | | | 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
* Merge "Add some hooks for managers when service starts"Jenkins2012-11-021-3/+8
|\
| * Add some hooks for managers when service startsChris Behrens2012-11-011-3/+8
| | | | | | | | | | | | | | Adds pre_start_hook() and post_start_hook() and fixes a couple of hard coded binary name checks in service.py Change-Id: I062790a88ed7f15a6f28961d6ddc1f230e19e0cb
* | Remove nova-volume scheduling supportJoe Gordon2012-10-311-10/+4
|/ | | | | | | | | | | | | | | | | 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
* Let scheduler know services' capabilities at startupArata Notsu2012-10-281-0/+4
| | | | | | | | | | | | | | | | | | Fixes bug 1071254. Changes: * Add new rpc-api(fanout) of compute "publish_service_capabilities" This rpc-api urges services to send its capabilites to the scheduler. * Scheduler calls publish_service_capabilities right after the start By them, the scheduler get to know the capabilities earlier. Now we can expect that the scheduler always holds the capabilities. So it is reasonable to change HostManager to ignore hosts whose capabilities are "None" since it becomes a rare case; this will make scheduling more reliable. This will achieved by Another patch. Change-Id: If6582765011fd5e1b794bfdc068e17630ba381cb
* Set volume status to error if scheduling fails.Russell Bryant2012-09-211-3/+3
| | | | | | | | | | | | | | Fix bug 1053931. When scheduling volume creation fails, the volume was left with a status of 'creating'. This patch changes the scheduler manager to set the status to 'error' if scheduling fails. This matches the behavior of the cinder scheduler manager in this case. This particular issue was addressed in Cinder as a part of commit f758bde47439be52a743b2b4181d4900f2c1bc8a. Change-Id: Ieb453ab05b3b84de53f72323c536a9567555df1e
* Cleanup unused import in manager.pyNewptone2012-09-191-2/+0
| | | | Change-Id: I86be592fc0ee8ddb81417b737702c4201442d0df
* Merge "Improve error handling of scheduler"Jenkins2012-09-191-31/+38
|\
| * Improve error handling of schedulerVishvananda Ishaya2012-09-171-31/+38
| | | | | | | | | | | | | | | | | | Modifies scheduler errors to report instance faults and to set instance_state back to None on failure. Related to bug 1051066 Change-Id: Id9f36a75370849db7baf3fe24ce96c6f4284255d
* | Update quota when deleting volume that failed to be scheduledZhiteng Huang2012-09-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Update scheduler rpc API version.Russell Bryant2012-09-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit de09c1866b9138610914ddaaebb9b030884d1e28 updated the scheduler rpc API but did not account for rpc API versioning. This patch fixes it up. It updates the manager to reflect that it implements '2.1' and is now backwards compatible with the old method signature. The client side rpcapi now indicates that it requires '2.1' when sending the new image_id argument. Fix bug 1052670. Change-Id: Ide541f38d3d0129809da56baffe95bc3faab0569
* | Adds new volume API extensionsUnmesh Gurjar2012-09-181-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove scheduler RPC API version 1.xMark McLoughlin2012-08-291-151/+11
| | | | | | | | | | | | | | Like with the compute RPC API, we're unlikely to still work well with RPC client using older 1.x version because of DB schema changes. In that case, we may as well remove 1.x support in Folsom and rip out the potentially buggy backwards compat code. This should also make backporting fixes from Grizzly easier. Deployers following trunk can upgrade all their nodes to use the version 2.0 API before deploying this commit. Change-Id: Iee099751bda9637da5e134357d28e89d5fba9895
* Add version 2.0 of the scheduler RPC APIMark McLoughlin2012-08-291-0/+74
| | | | | | | | Like we did for the compute RPC API, add version 2.0 of the scheduler API while still retaining 1.x support. This allows all services to be updated with 2.0 support before 1.x support is removed. Change-Id: If438d5b6f521ea4c487d1490d4b8cf6547ba5c72
* Stop using scheduler RPC API magicMark McLoughlin2012-08-291-1/+27
| | | | | | | | | | | | | | | | | | | | | | | If a scheduler RPC message isn't handled directly by a SchedulerManager method, the __getattr__() fallback passes the message to a driver method in the form of schedule_${method}() and, if that doesn't exist, instead calls the schedule() method supplying the topic and method args. This is pretty bizarre stuff and we appear to only use it in two cases: 1) live_migration - this is how the schedule_live_migration() method in the driver gets called, but the side-effect is that we require the client to pass a topic argument which is never used. This would be much more sanely handled with an explicit SchedulerManager.live_migration() method. 2) create_volume - the volume API asks the scheduler to pick a target host for create_volume() using this method. This would be easily handled with an SchedulerManager.create_volume() method. Change-Id: I1047489d85ac51d8d36fea1c4eb858df638ce349