As new python-keystoneclient 0.6.0 was released, change
https://review.openstack.org/61247 was merged to it. This commit
changed work with keystoneclient adding session to request
processing from the very beginning, that caused empty self.auth
for this session. In fact that led to no auth-token header passed
to Keystone and unauthorised exception from it.
Change-Id: I67baecacde6f9c94152cd34aae03ba59a0a7a580
Closes-Bug: #1281487
is_admin should not be exlicitely accessed from code. Policies should be
used to check if it's set and context.elevated() to run something in
admin context.
Change-Id: I27754a378073844c3e24d94038a5d24f9a3c6dc3
Increasing UT coverage by adding tests on the SQLAlchemyDBApiTestCase
suite (most of them, related to allocation and reservation)
Adding test for event_get_all_sorted_by_filters and
host_allocation_get_all_by_values (including both sorting types)
Change-Id: Ibbf1ada814b38bdb8b12249f9e9f0b854feea4fe
Closes-Bug: #1259559
As oslo.messaging 1.3.0.a7 was released, there was change
https://review.openstack.org/62931 merged to it. It caused
intersection issue between openstack.common.service.Service
and oslo.messaging.MessageHandlingServer classes both used
in Climate (no periodic tasks running as symptom here).
This change fixes that, working both with oslo.messaging 1.3.0.a7
and previous versions.
Change-Id: Icb7d88d4a0cb1ed568b731ca9716982eb8ffb092
Closes-Bug: #1281521
Added the event_get_first_sorted_by_filters method to the DB API.
The idea of this method is to only return the first event that
satisfies the sorting criteria and all the filters.
In the ManagerService class, replaced the use of
event_get_all_sorted_by_filters method for
event_get_first_sorted_by_filters in order to reduce the use of memory and
improve the performace.
Change-Id: I54491bae9dafb3ecf2adb29aae6bb8139c8751b4
Closes-Bug: #1279459
* Remove openstack.common.rpc module and implement oslo.messaging
usage instead of that.
* Remove openstack.common.notifier (except api) as it is part of
oslo.messaging now.
* Remove zmq_receiver as a part of oslo.messaging too.
Implements: blueprint oslo-messaging
Change-Id: I4855826b2435b96bcf22ada239d17fa6d0837184
Historically, there was a RPC service for scheduling. The code is
currently dead, so I'm removing it until we create a fresh new
Scheduler service with necessary code.
Change-Id: If0d5a0dfc0c2fcb475d8d89d66ed247d2dba253e
The ValueError exception raised by datetime.datetime.strptime was
replaced by a new Climate exception: InvalidDate
Added a new unit test to check that an exception is raised when a
lease_create is called with an start date before the actual date.
Change-Id: Iac95373c59bd154fcc162f0665edf0ea8487a8b1
Closes-Bug: #1252704
Manager is raising Exceptions that are not catched by API
due to self.cast() which always returns None.
Change-Id: I7db40bcf5c445e8a4ca1605ee410957c3092d905
Closes-Bug: #1274476
This commit implements basic VM management plugin for Climate.
As decided we use nova shelved instances to support our reservation
model. The only one thing we do for "on_start" lease action -
'unshelve' instance. As decided we support configurable opts for
"on_end" lease action, by default it set to snapshot and delete VM.
Implements bp:basic-vm-plugin
Change-Id: Ia34e16c636d1fa8d200873334f55b9868866f97f
Use specialized manager's exception the service and
add 2 new exception PluginConfigurationError and EventError.
In API error handler try to resolve errors from climate.Exception
at last chance.
Change-Id: I633a56996e5ffdfa041da132bca34fefb8e06810
Endpoint arg was missing when creating a Keystone client, and
authenticate() method had to be used as it's now lazy authn
Change-Id: Iaab491a8d7ea43814ac19b245e3dfdd886a978b3
Closes-Bug: #1271959
Add utils to do basic actions with nova and keystone.
We decide to store in utils/openstack/%service_name.py service
specific clients in classes named like Climate%service_name%Client.
In this classes we define service client with specific variables.
Also, we redefine __getattr__ like this:
def __getattr__(self, name):
fn = getattr(self.%service_name, name)
return fn
Change-Id: I47e0d8689f1d8ca8aba0372eb5e7a4a80f2f9be5
Currently, DB queries don't filter on project_id, so any user can
request all DB entries.
The proposal here is to filter if the table does support tenant_id
in it and if the user is not admin (based on Nova/Cinder/Oslo)
In order to automatically provide the correct is_admin flag, now
when creating the context we check if policy defines the user as
admin.
Closes-Bug: #1256117
Change-Id: I85c404f5a3365c6a9c575af52f1a116f8350f426
add_computehost returns HostNotInFreepool if UUID is given for host
because freepool.hosts only contains names of hosts
Change-Id: I7ea9b240fa7beb60c532175794da2f30a551a985
Closes-Bug: #1261788
Service user used by Climate should not create objects such as
host aggregates. Consequently, until we migrate the code by using
trusts, we need to use a dedicated user for operations
Change-Id: I35878e178dea7eb10a52ad2419e191d8d683b35c
Closes-bug: #1270765
Implements policies in Climate with unittests based on Oslo.
Tight integration with Context as it will populate to Context
if user is admin or not based on policy.json
In order to make that work, please add policy.json to /etc/climate
Decorator @policy.authorize allows enforcing policy checks on
controllers.
Implements bp:climate-policy
Change-Id: I94e8fa142e5c5d830b0bea9278e5a47f9904db4c
Manager Exceptions were not properly catched by API, so consequently
placed them all in one global Manager exceptions file and parsing
it for knowing if it's a Climate Exception
Also partially fixes #1257204
Closes-Bug: #1263116
Partial-Bug: #1257204
Change-Id: Ic488ceab6ea6bed1ae2b1528e08810edfffde5be
Implements: bp:
API extensions are provided using a RPC dispatcher
We need to explicitly mention plugin:method when calling.
If not, it will stick to core methods for ManagerService.
Implements bp:host-provisioning-api
Change-Id: Ice5a07eef54664651c22b6b1185be38062c7296e
Proxy interface for managing AZs or Pclouds in the
next future
Implements bp:host-reservation-pool
Change-Id: Ife4949896c1679c941df5b7059a8fbcbf55ec287
As per our design doc for Hosts reservations [1], Climate needs to be
added three new models called ComputeHost, ComputeHostExtraCapabilities
and ComputeHostReservation
* ComputeHost will store all info concerning hosts managed by Climate
and will keep tracability on if they are free for a lease or not
* ComputeHostExtraCapabilities will allow admin user to add extra info
for each host to add to Climate like GPU or SSD which are not yet
visible thru Nova-Compute
* ComputeHostReservation will store all reservation details when
creating a lease, needed by Manager when starting the leases
Implements bp:host-db-api
[1] : https://docs.google.com/drawings/d/1-_DOB65LsSGR4JUaPN525bWAg1yhvEv3KNcHfmuLvYw/edit
Change-Id: Ib8f289064a9621372908be1d44db92f3719b24e1
As discussed, let's remove all headers for files containing no
code but the copyright headers.
Implements bp:remove-empty-copyrights
Change-Id: I276a346360e27df70093241676576995f8e298d8
Initial release of Host Reservation Admin API by adding new classes
to the current Lease API mapped to /os-hosts/ context.
The goal of this API is to be admin-only, defining CRUD methods for
adding a host to Compute, aiming to dedicate it for lease management.
As a result, the added host won't be available for booting VMs on it
unless Climate specifically picks it from a specific freepool to the
user' pcloud associated with the host reservation.
For testing, please patch RPC methods like this :
call = lambda *args, **kwargs: True
cast = lambda *args, **kwargs: True
TODO :
- Add @policy.authorize() to climate.api.oshosts.service controllers
once review 57200 (Policy mgmt) is merged
Implements bp:host-provisioning-api
Change-Id: I58d986fe8344b9578b2f15399ec19f7649cc3035