summaryrefslogtreecommitdiffstats
path: root/nova/scheduler/manager.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix spelling typosJoe Gordon2012-08-161-1/+1
| | | | | | | | | | Fixes for: * nova/*py * nova/scheduler/ * nova/compute/*py * nova/api/ec2/ Change-Id: I7bec89b3551eda84d596e55eeba9ccb9d944a5cb
* Always create the run_instance records locallyVishvananda Ishaya2012-08-161-3/+9
| | | | | | | | | | | | | | | | | | | | Currently a request for multiple instances issent to the scheduler, where it is written to the database. It appears that this was done so that more advanced schedulers could handle the request as one batch, but the result is the scheduler is sometimes slow enough that the call will timeout. Instead this converts to always creating the instance records locally and making run_instance into a casting instead of a call. This made a small change to the rpc api for run instance, so the version was bumped. Legacy messages are still handled properly. Fixes bug 1036911 Co-authored-by: Chris Behrens <cbehrens@codestud.com> Change-Id: I63bbc98c285faebec53f8e62857c01548807db68
* Enforce quota limitations for instance resize.Eoghan Glynn2012-08-141-2/+8
| | | | | | | | | | | | | | | | | | | Fixes LP 1030010. Close off a back-door allowing users to go over-quota on ram and/or cores by creating a tiny instance and then resizing to any size regardless of the remaining usage headroom. The quota management logic is distributed in the sense that the reservations are passed with the RPC casts that may fail silently, so that the rollback or commit is handled by the actor finalizing the resize/confirmation/reversion. Up-sizing requires there is sufficient quota headroom upfront to accommodate the larger size, whereas conversely down-sizing only results in a usage reduction when the resize is confirmed. Change-Id: I2b1cbb098c79e37d7ad19221fe23657eb018eae6
* Make update_db an opt arg in scheduler manager.Dan Prince2012-08-091-2/+2
| | | | | | | | | | Updates the scheduler manager so that update_db is an optional argument. This fixes issues when trying to make RPC calls with the most recent version (1.4) of the scheduler RPC API. Fixes LP Bug #1035004. Change-Id: Ib998c0465cead1b8e117a7344557f8ff496c7e40
* scheduler prep_resize should not update instance['host']Chris Behrens2012-08-081-2/+3
| | | | | | | | | | | | This is done by the manager once things are ready on the destination compute node. Fixes bug 1034593 Also removes now-unneeded update_db argument passed via rpcapi and bumps scheduler rpcapi version for prep_resize to 1.4 Change-Id: I0ac3be39877f3afcf42f5996d0da90042fe7c6e3
* Send full instance to scheduler live_migration.Russell Bryant2012-08-061-1/+1
| | | | | | | | | | Remove the instance_id parameter and send a full instance dict to the live_migration method of the scheduler manager. This cuts down on some unnecessary database access in the scheduler. Part of blueprint no-db-messaging. Change-Id: Ic45105300c967c760559df2225e59e515cea8b7b
* Remove topic from scheduler run_instance.Russell Bryant2012-08-061-4/+4
| | | | | | This argument to run_instance was unused, so just remove it. Change-Id: I42366514285a2355f647c776af140effc1618b7d
* Use explicit args in run_instance scheduler code.Russell Bryant2012-08-061-7/+7
| | | | | | | | | | | | This patch goes through code paths related to run_instance in the scheduler to use explicit arguments instead of **kwargs. I'm trying to work out exactly what data is getting passed through the system when an instance is created, so that I can make the no-db-messaging related changes. This patch helps clarify some things. Part of blueprint no-db-messaging. Change-Id: Id83fc1e399e1d5c75af6dd3c8972b8ba9d706af1
* Update args to _set_vm_state_and_notify.Russell Bryant2012-08-061-9/+10
| | | | | | | | This patch removes *args and **kwargs from _set_vm_state_and_notify. The only additional argument used was request_spec, so just list it out explicitly. Change-Id: I64590a2d79c2d303e7c936a4c3b1545eecfd0f2b
* Updates to the prep_resize scheduler rpc call.Russell Bryant2012-08-031-6/+24
| | | | | | | | | | | | | | | | | | | | | I started looking at this because of the prep_resize rpc call in the compute manager. An API server calls prep_resize on the scheduler which then calls it on a compute node. I will need to make the same changes on the compute side, but this is the first step. The prep_resize call was taking two object IDs, an instance UUID and an instance_type ID. Both of these have been converted. It now takes an instance dict and an instance_type dict, instead. It can also handle receiving the old IDs for backwards compatibility. prep_resize also took a topic argument that was unused, so it has just been removed. There are a number of changes in the scheduler code tied up in this to make it more explicit about exactly what arguments are expected instead of just using *args, **kwargs. Part of blueprint no-db-messaging. Change-Id: I4af18e5575e2bb60a410fc8edabf3d607c72aabc
* Partially revert "Remove unused scheduler functions"Russell Bryant2012-07-311-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit 2aaa3d2860eed7574c5df64a8ceeb8a6adf23460. The problem pointed out by this bug is that these changes introduce a non-backwards compatibile change to the schedulre rpc API. There are a couple of acceptable ways to deal with this: 1) Leave most of the code and only remove the client side. This means that a message sent from an earlier version will still work. This is the ideal situation for almost *all* changes to rpc APIs. We have to make a habit of this to eventually be able to support rolling upgrades. 2) Leave the manager methods, but simply have them raise an exception. This is a bit better than removing the method because the error can be made more explicit and obvious. Otherwise, the operator will get "no such method" rpc exceptions, which will seem a bit more bizzare. An example of when this option makes sense is commit cac332c39645286a11c009094a86f62d02752183. This patch refactored the live migration code is such a significant way that making it backwards compatibile seemed rather difficult to do. The old rpc methods stuck around but just raise an exception. The potential failure is just that live migration would fail, but the exception makes it obvious that an upgrade must be completed for live migration to work. The current patch implements #2 in the case of get_service_capabilities, since it hasn't been used since pre-essex. Approach #2 is taken for get_host_list() as well. It was used until fairly recently, but was broken, including being broken in Essex. The fix that went into Essex for this makes it no longer use RPC. Fix bug 1029262. Change-Id: I74c7d2a3e88b3a4f114e7da62c56f0481ee64a64
* Remove unused scheduler functionsJoe Gordon2012-07-251-8/+0
| | | | | | | | | | | | * get_service_capabilities * get_host_list * host_service_caps_stale * delete_expired_host_services The functions were introduced in d328ddcadb24d1b1961bd05a7676bc8f54b6776f but are currently unused outside of nova.tests Change-Id: I15388db5eb684a9f5cfe74f4c2a32b6c87f57894
* Switch to common notifiers.Andrew Bogott2012-07-061-1/+1
| | | | | | | | | | | - Added notifier files to openstack-common.conf, merged from common. - Import notifiers from common rather than nova. - Removed nova-specific notifier code. - Update some driver paths to refer to the new location within nova. Should be a no-op, as the common notification code is freshly copied from Nova. Change-Id: Icdf892bc3826b683fc74f22ead00939beda2859f
* Switch to common logging.Andrew Bogott2012-07-021-1/+1
| | | | | | I only just moved logging from nova to common, so behavior should remain the same. Change-Id: I1d7304ca200f9d024bb7244d25be2f9a670318fb
* Fix instance update notification publisher idBrian Elliott2012-05-301-1/+2
| | | | | | | | Fixes instance update notifications to follow the nova convention for publisher ids. The notification publisher id will now be of the format service.host (e.g. compute.somehostname). Change-Id: Ib5c4c962b9ac3e0bac90703b20465f99dfd047c0
* Added a instance state update notificationBrian Elliott2012-05-241-1/+6
| | | | | | | | | | | | | | Added a instance update notification (compute.instance.update) that will report on changes to vm_state and task_state. The goal here is to provide useful insight into instance state transitions. (e.g. BUILDING->ACTIVE) The new notification has minimial dependencies and is intended for wide use across the different layers/packages within nova. Calls in compute api/manager, scheduler, and the virt layer that modify the instance state have been instrumented with this notification. Change-Id: I223eb7eccc8aa079b782f6bb17727cd0b71d18ed
* Finish quota refactor.Kevin L. Mitchell2012-05-231-1/+7
| | | | | | | | | | | Finishes quota refactoring by making use of the new quota infrastructure. Partially implements blueprint quota-refactor (the final piece is to remove the old quota architecture). This change is fairly substantial. To make it easier to review, it has been broken up into 3 parts. This is the second part. Change-Id: I1c8b43198f0d44e9e13a45575361aa043fd0639e
* Add version to scheduler rpc API.Russell Bryant2012-05-231-0/+5
| | | | | | | | | | | | | Part of blueprint versioned-rpc-apis. One side effect of this change was that nova.scheduler.api was removed in favor of nova.scheduler.rpcapi. In this case, the api was just a direct wrapper around rpc usage. For other APIs, I've been following the pattern that the rpcapi module provides the rpc client wrapper, and if any other client-side logic is needed, that's where an api module is used. Change-Id: Ibd0292936f9afc77aeb5d040660bfa857861eed1
* Rearchitect quota checking to partially fix bug 938317.Kevin L. Mitchell2012-05-161-0/+7
| | | | | | | | | | | This is a rearchitecting/rewriting of quota handling to correct the quota atomicity issues highlighted by bug 938317. Partially implements blueprint quota-refactor as well. This change is fairly substantial. To make it easier to review, it has been broken up into 3 parts. This is the first part. Change-Id: I805f5750c08de17487e59fe33fad0bed203188a6
* Merge "Pass context to notification drivers when we can."Jenkins2012-05-031-1/+1
|\
| * Pass context to notification drivers when we can.Andrew Bogott2012-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Note that previously several notification drivers created an admin context and embedded it in their messages. Those drivers now use the passed-in context instead if it's available. For blueprint novaplugins. Change-Id: Icb89030256022d0a68db4a147611fd37fe83316a
* | Use save_and_reraise_exception() from common.Russell Bryant2012-05-021-4/+4
|/ | | | | | | | | | | | This patch common.excutils from openstack-common, which includes save_and_reraise_exception(). The patch also converts the code base to use it from there instead of nova.utils and then removes it from nova.utils. The initial motivation for this was removing another nova dependency from nova.rpc so that it can eventually be moved to openstack-common. Change-Id: I7354ca51a02aec9c709cf33f77d4abc46acc2742
* Use openstack.common.importutils.Russell Bryant2012-04-281-1/+2
| | | | | | | | | | | | | | Use import_class(), import_object(), and import_module() from openstack-common's importutils module. The equivalent functions have been removed from nova.utils. A few modules had import order cleaned up in passing, as well. My initial motivation for this was to remove some more usage of nova bits from nova.rpc as another step towards being able to move nova.rpc import openstack-common. Since I was pulling importutils into nova, I went ahead and converted the whole thing. Change-Id: I7c7786cf0001bcd06db52b9a99ff4284a3f6c6fa
* Log instance.Michael Still2012-04-201-2/+2
| | | | Change-Id: I603eaa43b784e38532e88e9d2c844183730d44e9
* Fix OpenStack CapitalizationJoe Gordon2012-03-151-1/+1
| | | | | | | Openstack => OpenStack for nova/*py Change-Id: Ibcfae4776422a515a109e59510fc84f8b63c00b9
* Merge "fix restructuredtext formatting in docstrings that show up in the ↵Jenkins2012-03-071-5/+6
|\ | | | | | | developer guide"
| * fix restructuredtext formatting in docstrings that show up in the developer ↵Doug Hellmann2012-03-051-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | guide blueprint sphinx-doc-cleanup bug 945160 - Correct parameter declarations, list formatting, cross-references, etc. - We don't need "let" in generate_autodoc_index.sh since we aren't doing math. - Change conf.py to not prefix class and function names with full namespace in generated output to save width on the screen. Change-Id: I9adc8681951913fd291d03e7142146e9d46841df
* | Reset instance to ACTIVE when no hosts foundAndrew Clay Shafer2012-03-061-29/+71
|/ | | | | | | | | | | | | | | | | | | | | | | | | bug 928521 modified nova/scheduler/manager.py to reset vm_state to ACTIVE and set task_state to None when prep_resize raises a NoHostsFound refactored run_instance and prep_resize so they don't go through _schedule and now must be implemented in driver Changed behavior to set vm_state to error on any other exception in prep_resize. Change behavior to change instance vm_state to ERROR on exceptions Added tests that the vm_state gets updated Added tests that schedule_prep_resize and schedule_run_instance have no implementation in the Driver base class Had to adjust methods and tests for Multi scheduler to reflect the new Scheduler contract Change-Id: Ibcac7ef0df3456793a2132beb7a711849510da80
* Scheduler notifications added.Sandy Walsh2012-02-211-0/+10
| | | | | | | Re-added lost fake virt hypervisor info (required for local dev). Added multiple exchange topic support to RabbitNotifier. Change-Id: I33cc9076ee35061c21852cabba3275006fc87b86
* Removed zones from api and distributed schedulerSandy Walsh2012-02-161-14/+0
| | | | | | | | | | | | | There is a new Zones implementation coming that will use AMQP-to-AMQP channels vs. the public API. This is being done for three reasons: 1. remove complications in the OpenStack API (and possibly allow EC2 Zones) 2. remove dependencies on keystone and novaclient 3. faster scheduling (fewer chances for race conditions) Learn more here: http://wiki.openstack.org/EssexSchedulerImprovements Change-Id: I6fe538923dd5ae19276afac2ac3311a285fd5c99
* Standardize logging delaration and useJason Kölker2012-02-141-1/+1
| | | | | | * Make modules use getLogger(__name__) and log to the result Change-Id: Ib6d69b4be140ec89affc86ed11e65e422d551df1
* Remove the last of the gflags shim layerMark McLoughlin2012-02-101-1/+1
| | | | | | | Make FLAGS a ConfigOpts instance and fix up all the places where we expected FlagValues behaviour. Change-Id: I8f96f42e0d8d30ba6b362d29861e717cf0fa9e89
* Backslash continuations (network, scheduler)Zhongyue Luo2012-02-081-4/+3
| | | | | | | | | Fixes bug #925281 Backslash continuations removal for packages nova.network and nova.scheduler Change-Id: I84f886d6bc179ecf5d09e57d278bfa644d5d851d
* Move cfg to nova.openstack.commonMark McLoughlin2012-02-031-1/+1
| | | | | | | | | | | | | | | Move it here so that it can be kept in sync with openstack-common using the new update.py script for code in openstack-common's incubation area. See here for more details: http://wiki.openstack.org/CommonLibrary#Incubation Note: this commit just moves the existing code in Nova with no other changes. A subsequent commit will sync it with latest openstack-common so that it is easier see the new changes. Change-Id: If88d678b1b9bad3d37117de7f7159d7fea8ab4c8
* Refactor away the flags.DEFINE_* helpersMark McLoughlin2012-01-281-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The next obvious step in porting to cfg is to define all options using cfg schemas directly rather than using the flags.DEFINE_* helpers. This is a large change, but it is almost entirely pure refactoring and does not result in any functional changes. The only change to note is that the default values for glance_host, glance_api_servers and default_publisher_id options are now using opt value interpolation i.e. -glance_host=_get_my_ip() +glance_host='$my_ip' -glance_api_servers=['%s:%d' % (FLAGS.glance_host, FLAGS.glance_port)] +glance_api_servers=['$glance_host:$glance_port'] -default_publisher_id=FLAGS.host +default_publisher_id='$host' Also note that the lower_bound check on the {report,periodic}_interval options are no more, but this has been true since cfg was first added. Change-Id: Ia58c8f0aaf61628bb55b1b8485118a2a9852ed17
* Adding live migration server actionsmasumotok2012-01-261-4/+0
| | | | Change-Id: I5e1f5dddaf45d1c6eae8666647425bff748b639e
* KVM and XEN Disk Management ParityJohannes Erdfelt2012-01-241-9/+13
| | | | | | | | | | Implements blueprint disk-configuration-parity This change splits local_gb into root_gb and ephemeral_gb. libvirt interpreted local_gb as what ephemeral_gb is now, whereas XenAPI interpreted local_gb as what root_gb is now. Change-Id: I496600991bac1e990326d4ded1607fee08209d68
* Make start_instance cast directly to compute hostChris Behrens2012-01-211-17/+15
| | | | | | | | | | | Fixes bug 918615 start_instance doesn't need to go through scheduler because it still has instance['host'] set and resources are still accounted for in the scheduler, which means there's still room to restart it on its assigned host (even though it is deleted from the virt layer) Change-Id: I3cdd73b7ad2297b57f7e36be84819ff233ac8f08
* Separate scheduler host managementChris Behrens2012-01-181-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a bit of a scheduler refactoring to support future scaling work as a part of blueprint scaling-zones. Also fixes bug 891971 (remove unused set_network_host in scheduler) With or without that blueprint work, this cleans a number of things up and paves the way for combining a lot of the schedulers by using this new 'HostManager' for filtering and weighing (future work :) On to the goodies: Introduces new HostManager, splitting code out from ZoneManager. Zone communication and management is handlded in the ZoneManager. Host filtering and weighing is handled in the HostManager. ZoneManager is removed from the SchedulerManager and direct calls to it from the SchedulerManager now occur via the scheduler driver. This simplifies a number of things. ZoneManager and HostManager classes to use are now flags. This allows one to extend the current classes and use them. HostManager uses a HostState class to keep info about hosts. This class needs to be extendable. Since it's very much tied to the HostManager, the HostState class to use is not a flag. It is, instead, a class variable in HostManager. Filtering functions now accept a single host to filter. This improves performance by not having to build a new array of hosts within every filter function. Filtering functions now accept a more generic 'filter_properties' dictionary which we can fill with information available for filtering. Adding additional data to this 'filter_properties' can be done by subclassing. Weighing functions now accept this 'filter_properties', also, although it's poorly named ATM. Will be cleaned up in a future branch when I move some weighing functions into the host manager. Filtering tests are true unit tests now. test_zones was moved from top level to under scheduler as zone_manager tests and refactored to be true unit tests. Host tests are true unit tests now. Other minor cleanups Change-Id: I0ef2acef6639b4500c400c18cf2c673cb80f0150
* First implementation of bp/live-migration-resource-calcmasumotok2012-01-131-0/+3
| | | | | | | | | | | Fix based on revewer's comment upgraded the migration version nova/db/sqlalchemy/migrate_repo/versions/069_block_migration.py rebase on master Change-Id: Ia762f8dec761c3d595bc6fcd39f127f6d92306d2
* Fix scheduler error handlerChris Behrens2011-12-151-9/+20
| | | | | | | | | | | | | | | | Fixes bug 904971 Scheduler error handler was looking for instance_id when it may or may not exist. Added the proper code for it to determine whether the instance was actually created in the DB or not and how to find its ID. Note: there's some pretty nasty stuff in here, but unavoidable without larger changes. I'd like to hold off on these larger changes, because the problem should be solved with some of the scalability work coming. Tests included. Change-Id: Ief5fde8128437c9dc257af9c4d0c2950d0962ce5
* Vm state management and error statesDavid Subiros2011-12-121-11/+19
| | | | | | | | | | | this implements the blueprint nova-vm-state-management It implements the following functionalities: - Filter compute api calls according to state of the VM (defined in compute/state_checker). - Sets error state if the scheduler cannot allocate the VM in any host - Handles the create/delete concurrency in the compute manager Change-Id: Ie6d016b7d4781f70bb5967f204fa88a6412bd727
* Refactors periodic tasks to use a decorator.Rick Harris2011-12-071-1/+2
| | | | | | | | | | | | Additional work: 1. Added support for tasks being scheduled at differing rates via the `ticks_between_runs` argument. 2. Fixed `reclaim_queued_deletes` so that it doesn't run if `FLAGS.reclaim_instance_interval` is 0. Change-Id: I18c01baf07bd06301a6fe26a7b29dc2452a4fa96
* Put instances in ERROR state when scheduler fails.Kevin L. Mitchell2011-11-211-1/+14
| | | | | | | | | | When the scheduler's selected driver method raises an exception, such as NoValidHost, any affected instance must be placed into the ERROR state. This is done by catching exceptions raised in _schedule() and, if 'instance_id' is present in kwargs, moving the identified instance to the ERROR state. This fixes bug 886289. Change-Id: I5c73549e073493701b86658569823b9bc161291d
* More spelling fixes inside of novaJoe Gordon2011-11-091-1/+1
| | | | Change-Id: I79daf7519c99cc363ac7175c85912298f273da8a
* compute_api create*() and schedulers refactoringChris Behrens2011-09-271-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 844160 Makes the servers create API call work with all schedulers, removes 'zone boot', and folds create_instance_helper back into servers controller. Notable changes: 1) compute API's create_at_all_once has been removed. It was only used by zone boot. 2) compute API's create() no longer creates Instance DB entries. The schedulers now do this. This makes sense, as only the schedulers will know where the instances will be placed. They could be placed locally or in a child zone. However, this comes at a cost. compute_api.create() now does a 'call' to the scheduler instead of a 'cast' in most cases (* see below). This is so it can receive the instance ID(s) that were created back from the scheduler. Ultimately, we probably need to figure out a way to generate UUIDs before scheduling and return only the information we know about an instance before it is actually scheduled and created. We could then revert this back to a cast. (Or maybe we always return a reservation ID instead of an instance.) 3) scheduler* calls do not return a host now. They return a value that'll be returned if the caller does an rpc.call(). The casts to hosts are now done by the scheduler drivers themselves. 4) There's been an undocumented feature in the OS API to allow multiple instances to be built. I've kept it. 5) If compute_api.create() is creating multiple instances, only a single call is made to the scheduler, vs the old way of sending many casts. All schedulers now check how many instances have been requested. 6) I've added an undocumented option 'return_reservation_id' when building. If set to True, only a reservation ID is returned to the API caller, not the instance. This essentially gives you the old 'nova zone-boot' functionality. 7) It was requested I create a stub for a zones extension, so you'll see the empty extension in here. We'll move some code to it later. 8) Fixes an unrelated bug that merged into trunk recently where zones DB calls were not being done with admin context always, anymore. 9) Scheduler calls were always done with admin context when they should elevate only when needed. 10) Moved stub_network flag so individual tests can run again. * Case #6 above doesn't wait for the scheduler response with instance IDs. It does a 'cast' instead. Change-Id: Ic040780a2e86d7330e225f14056dadbaa9fb3c7e
* Forgot to handle return valueKevin L. Mitchell2011-09-021-1/+1
|
* import filters in scheduler/host_filter.py so default_host_filter gets added ↵Kevin L. Mitchell2011-09-011-4/+6
| | | | to FLAGS; rework SchedulerManager() to only catch missing 'schedule_<method>' attribute and report other missing attributes
* Adding kvm-block-migration feature. Kei Masumoto2011-08-151-26/+28
|\ | | | | | | I wrote some description the below URL. I hope it may help for reviewing. <http://etherpad.openstack.org/kvm-block-migration>
| * merged rev1418 and fixed code so that less than 1G image can be migratedKei masumoto2011-08-131-1/+3
| |\