83 Commits

Author SHA1 Message Date
Jenkins
0608e60236 Merge "Remove direct assignments of context attributes" 2014-02-21 11:46:41 +00:00
Jenkins
0cf418a5ca Merge "Remove explicit access to is_admin in context" 2014-02-21 11:46:13 +00:00
Jenkins
4632f34d8d Merge "Fix issue with new python-keystoneclient" 2014-02-20 11:56:06 +00:00
Dina Belova
c4aa9bfc2b Fix issue with new python-keystoneclient
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
2014-02-20 15:16:08 +04:00
Jenkins
60e892ee40 Merge "Adding tests for sqlalchemy class" 2014-02-20 08:46:27 +00:00
Yuriy Taraday
485f8a1606 Remove direct assignments of context attributes
Context attributes should be set by its __init__ only.

Change-Id: I7c5b0b21e27384adec7049a6f5bb8454fa81ffb8
2014-02-19 17:05:59 +04:00
Yuriy Taraday
573fb0cc1f Remove explicit access to is_admin in context
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
2014-02-19 17:05:41 +04:00
Christian Martinez
5427241ec9 Adding tests for sqlalchemy class
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
2014-02-18 12:35:55 -03:00
Dina Belova
6b687b039d Fix issue with new oslo.messaging
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
2014-02-18 17:18:00 +04:00
Jenkins
3aee9239e6 Merge "Improve memory/performace in ManagerService" 2014-02-17 10:30:02 +00:00
Dmitriy Dyachkov
8babc9d053 Fix pylint errors
Deleted the copy of _get_fake_phys_lease_values function.
Added missing whitespaces.
Deleted excess tabulations.

Change-Id: I30a0b109e2bcfa57e1a0b0ec31557e40a60e50ef
Closes-bug: #1255983
2014-02-14 20:02:46 +04:00
Pablo Andres Fuente
210286402e Improve memory/performace in ManagerService
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
2014-02-14 11:44:18 -03:00
Dina Belova
34778799f4 Port to oslo.messaging
* 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
2014-02-13 08:55:51 +04:00
Sylvain Bauza
fee60f1898 Remove old Scheduler RPC Service
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
2014-02-11 11:03:09 +01:00
Pablo Andres Fuente
fe9c660f54 lease_create now raises InvalidDate exception
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
2014-02-07 11:19:19 -03:00
Jenkins
ebab436969 Merge "Implement basic plugin for VM management" 2014-01-30 15:01:04 +00:00
Sylvain Bauza
bdef491077 Fix API status when Manager raises Exceptions
Manager is raising Exceptions that are not catched by API
due to self.cast() which always returns None.

Change-Id: I7db40bcf5c445e8a4ca1605ee410957c3092d905
Closes-Bug: #1274476
2014-01-30 14:07:41 +01:00
Nikolaj Starodubtsev
0177cd8841 Implement basic plugin for VM management
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
2014-01-29 21:59:32 +04:00
Dina Belova
282426081f Fix common exception usage in manager service
Closes-Bug: #1272629
Change-Id: I7ab7d65bb6ad5eec4ad4b2bcb98d850758d64129
2014-01-26 23:39:13 +04:00
Swann Croiset
ce52684645 Improve coherence of exceptions handling
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
2014-01-23 18:32:24 +01:00
François Rossigneux
22de8bbe71 Physical host reservation plugin (lease update)
Implements bp:host-manager

Change-Id: I4920ea2a7c26b63d2dc2e8fdf51d815e2f59c43b
2014-01-23 18:32:24 +01:00
François Rossigneux
50322e2f9f Physical host reservation plugin
Implements bp:host-manager

Change-Id: I782513c579f3825448bf1de5261e943e1653d521
2014-01-23 18:32:16 +01:00
Jenkins
4f597be33d Merge "Implement keystone trust support" 2014-01-23 17:21:04 +00:00
Nikolaj Starodubtsev
8ba70f2bde Implement keystone trust support
Also, correct lease db model. Now use trust_id, not trust

Implements: bp keystone-trust-support

Change-Id: I676deb8a040e8b80194d1d9f9ab40e03b3bfa86d
2014-01-23 20:57:39 +04:00
Sylvain Bauza
8593a228b8 Fix Authentication problem with Keystone V3
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
2014-01-23 16:28:11 +01:00
Jenkins
205bd31d8a Merge "Physical host reservation (DB related things)" 2014-01-23 11:10:01 +00:00
Jenkins
614279d98a Merge "Add utils to work with OpenStack components" 2014-01-22 20:34:25 +00:00
Nikolaj Starodubtsev
19cc43f79a Add utils to work with OpenStack components
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
2014-01-22 20:42:18 +04:00
François Rossigneux
ce5fa9ba23 Physical host reservation (DB related things)
Implements bp:host-manager

Co-Authored-By: Swann Croiset <swann.croiset@bull.net>

Change-Id: Icbaa44412e041fb689d9a8bc3afdabfece96e7d4
2014-01-22 15:32:51 +01:00
Jenkins
c9f4ea6ca8 Merge "Fix coverage for add_computehost with ID of host" 2014-01-22 14:21:04 +00:00
Jenkins
df1b79d636 Merge "Filter DB queries per project_id" 2014-01-22 02:05:28 +00:00
sbauza
9fc6b17f87 Filter DB queries per project_id
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
2014-01-21 17:20:38 +01:00
Sylvain Bauza
d8a2a1314f Fix coverage for add_computehost with ID of host
add_computehost returns HostNotInFreepool if UUID is given for host
because freepool.hosts only contains names of hosts

Change-Id: I7ea9b240fa7beb60c532175794da2f30a551a985
Closes-Bug: #1261788
2014-01-21 15:08:44 +01:00
François Rossigneux
a0d9eae085 Physical host reservation (manager and base plugin)
Implements bp:host-manager

Change-Id: If3472ca7b0d12eccfd4879595f2efd322cdcb0c1
2014-01-20 15:49:08 +01:00
Sylvain Bauza
16d5f67ba7 Fix service user creating objects
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
2014-01-20 14:46:04 +00:00
Jenkins
88dc709ef5 Merge "Fix Manager exceptions rendering for end-users" 2014-01-20 12:55:13 +00:00
Jenkins
4d13adad83 Merge "Policy management for Climate" 2014-01-16 18:01:39 +00:00
sbauza
8443312186 Policy management for Climate
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
2014-01-07 12:31:39 +01:00
Sylvain Bauza
b35935753b Fix Manager exceptions rendering for end-users
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:
2013-12-20 17:17:16 +01:00
Jenkins
d70eb25e02 Merge "Implement primary support for i18n messages shown to user" 2013-12-20 10:18:25 +00:00
sbauza
984a43683e Add Host Reservation Admin Manager
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
2013-12-16 17:13:38 +01:00
Swann Croiset
0b7bd6dadb Nova Aggregate wrapper to manage host allocation pools
Proxy interface for managing AZs or Pclouds in the
next future

Implements bp:host-reservation-pool

Change-Id: Ife4949896c1679c941df5b7059a8fbcbf55ec287
2013-12-09 23:51:31 +01:00
sbauza
052f17eb20 DB API and models for supporting Compute Hosts Reservations
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
2013-12-09 15:01:40 +01:00
Jenkins
23595d493d Merge "Remove empty copyright headers" 2013-12-06 07:37:56 +00:00
Dina Belova
38685d2b49 Implement primary support for i18n messages shown to user
Implements: blueprint i18n-messages

Change-Id: I8b8a5be0b81c6c6b03f32a34302990fc1b8da702
2013-12-05 18:38:03 +04:00
sbauza
16b55ccd53 Remove empty copyright headers
As discussed, let's remove all headers for files containing no
code but the copyright headers.

Implements bp:remove-empty-copyrights

Change-Id: I276a346360e27df70093241676576995f8e298d8
2013-12-03 11:30:27 +01:00
sbauza
8624ca116f Add Host Reservation Admin API
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
2013-12-03 10:48:00 +01:00
Jenkins
9f63fe76ae Merge "Unittest for manager service" 2013-12-03 08:15:00 +00:00
Jenkins
88816f42ca Merge "Remove config parsing call from test setup" 2013-11-29 12:50:48 +00:00
Dina Belova
03f2cb5037 Remove config parsing call from test setup
Change-Id: Ib30e45d87fc85052114e5727a200e2102c4face6
Fixes: bug #1256027
2013-11-28 20:02:20 +04:00