Commit Graph

130 Commits

Author SHA1 Message Date
Michal Nasiadka d544698fae Remove use of autocommit
Change-Id: I6e973935edf5e754ba054e724b6963b6d5fd795a
2024-02-29 11:54:28 +00:00
Takashi Kajinami 206d19ec52 Remove six from db module
This is part of the steps to remove usage of six library, which is no
longer needed since python 2 support was removed.

Change-Id: I529759167f960714ebf93be7b89ee849040361b2
2024-02-19 10:43:16 +00:00
karolinku fd6f2d5238 Fix compatibility with oslo.db 12.1.0
oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However, we
are currently relying on the autocommit behavior and need changes to
explicitly manage sessions. Until that happens, we need to override the
default.

Also squashed change: [CI] move queue setting to project level

Jobs are currently not running. Fix as described in [1][2]

[1] https://lists.opendev.org/pipermail/service-announce/2022-September/000044.html
[2] https://lists.zuul-ci.org/pipermail/zuul-discuss/2022-May/001801.html

Story: 2010296
Co-Authored-By: Stephen Finucane <stephenfin@redhat.com>
Co-Authored-By: Jake Yip <jake.yip@ardc.edu.au>
Change-Id: I625500d9e6670a429c70a0f6d582d0865ce78fd1
2022-09-20 12:35:28 +00:00
Jake Yip cb40fb3685 Add back pep8 test
In Change I523a4a85867f82d234ba1f3e6fad8b8cd2291182, the pep8 test was
accidentally dropped.

Fix up code so that pep8 passes.

In addition to that following change has been added here to unbreak CI:

Add WebTest as an indirect test dependency

Pecan has made webtest an optional dependency for testing only [1].
Since it is still used for testing we need to add it to our
test-requirements.txt.

[1]: https://github.com/pecan/pecan/pull/140

Change-Id: I2f85adb4ef29a43389897c201e6152fd4c7be9d6
2022-07-19 12:35:14 +00:00
Stephen Crawley 5fca23f2fc Quota deletion bug fix
Due to a bug in the db api code for sqlalchemy, deleting a single
quota was actually deleting all existing quotas.

Change-Id: Ia588db99fad0276ca9c512799e4e8c89d29d42fb
2021-12-22 09:09:33 +11:00
Bharat Kunwar ba75dce28a Ensure backward compatibility with SQLAlchemy<1.4
In Ib6e3ed40dc8b075c3cecb967b7417097e3cab60d, a breaking change was
introduced to suppose SQLAlchemy 1.4.x but this PS ensures backward
compatibility with 1.3.x.

Change-Id: I73ef4f99f02abc8b1083860f34a8a8e084ad96fd
2021-06-29 15:44:53 +00:00
Bharat Kunwar b2e20a1143 Make code compatible with SQLAlchemy 1.4.18
Also, plugins do not need to enable any network service other than what
devstack is already doing [1].

Also, fix doc build:
- bump up tox minversion to 3.18
- set ignore_basepython_conflict to True [2]
- add tex-gyre to binddep.txt [3]

[1] https://review.opendev.org/c/openstack/devstack/+/791436
[2] a0ec2de968/tox.ini (L7)
[3] https://review.opendev.org/c/openstack/openstack-health/+/793984

Change-Id: Ib6e3ed40dc8b075c3cecb967b7417097e3cab60d
Co-authored-by: Ghanshyam Mann <gmann@ghanshyammann.com>
2021-06-28 12:26:19 +00:00
Diogo Guerra 332e2b6fe4 Add CT tags field to the database and API
We noticed that from the user perspective it is hard
to know when a cluster_template provided by the cloud
admin is mature enough for a production release.
This field will allow the administrator to add an
annotation to the cluster template like
{deprecated, recommended, testing} giving further
usefull information to the end user about the
template's life cycle

This patch adds the necessary database column and
API objects to handle the new argument.

story: 2007857
task: 40160

Change-Id: I5d1c4221f089bc5cd12b25f620aa01771a029df9
Signed-off-by: Diogo Guerra <diogo.filipe.tomas.guerra@cern.ch>
2021-02-05 22:45:47 +00:00
Theodoros Tsioutsias cbe05aa97d ng-6: Add new fields to nodegroup objects
Since each nodegroup will be one independent stack, we have to add
more fields to the table and object in order to track each stack
contained in the cluster. This adds the stack_id, version, status,
status_reason and version fields to the nodegroup object.

Change-Id: I6d36b2d3bc6476efbef6a9f702ffc73cfa0fab8c
2019-09-25 12:26:00 +00:00
Theodoros Tsioutsias 3f80cbab06 ng-4: Adapt cluster object
This commit removes the fields node_addresses, master_addresses,
node_count and master_count from the cluster object since this info
will be stored in the nodegroups. At the same time, provides the way
to adapt existing clusters to the new schema.

story: 2005266

Change-Id: Iaf2cef3cc50b956c9b6d7bae13dbb716ae54eaf7
2019-03-29 10:31:48 +00:00
Theodoros Tsioutsias 0607c7a9d6 ng-1: Add nodegroup representation
This adds the object and db schema changes needed for supporting
nodegroups.

story: 2005266

Change-Id: Ibf10277a52aa94c4b217cf3b364844b04baab1e0
2019-03-21 16:19:56 +00:00
Ricardo Rocha 6aee864954 Add hidden flag to cluster template
Add a new hidden flag to cluster templates. This allows an operator to
keep a cluster public (accessible to all users) while not showing them
in cluster template listing.

Story: 2004941
Task: 29342

Change-Id: Ia2717ca960041753f6e772bf2d41c7f5a196dae6
2019-02-12 11:38:15 +01:00
Feilong Wang 766a64a41a Allow cluster template being renamed
To get a better cluster template versioning and relieve the pain
of maintaining public cluster template, the patch is proposing
that the name of cluster template can be changed.

A folllowing patch/spec will be proposed to add a new field
'deprecated' to allow ops to hide old/deprecated templates.

Task: 26889
Story: 2003960

Change-Id: Id1db81d35bc3dccff0fac481be7801de200d52de
2019-01-28 18:57:16 +00:00
Clenimar Filemon 34754f36f0 federation api: federation table and db layer
this commit introduces a new `Federation` table to
Magnum database, as well as the necessary DB layer
APIs to access and manage it.

this belongs to the first phase of the implementation
of the federation api. check [1] for more details.

[1] https://review.openstack.org/#/c/489609/

Change-Id: Ie8a68cd3198c8fc7930069fd2e55f1cad55b6c9b
Partially-Implements: blueprint federation-api
2018-01-15 14:58:04 -03:00
chestack c22f9cd882 Deal with db_exc.DBDuplicate of conductor startup
we have enable multiple workers of magnum-conductor that
result in multiple processes save same DB entry concurrently.

This patch logs warning message instead of raising exception

Change-Id: I548d50bed5d80e96042f88039e880075e1bffc53
Close-Bug: #1711324
2017-08-17 19:40:43 +08:00
Johannes Grassler e93d82e8b3 Fix CVE-2016-7404
This commit addresses multiple potential vulnerabilities in
Magnum. It makes the following changes:

* Permissions for /etc/sysconfig/heat-params inside Magnum
  created instances are tightened to 0600 (used to be 0755).
* Certificate retrieval is modified to work without the need
  for a Keystone trust.
* The cluster's Keystone trust id is only passed into
  instances for clusters where that is actually needed. This
  prevents the trustee user from consuming the trust in cases
  where it is not needed.
* The configuration setting trust/cluster_user_trust (False by
  default) is introduced. It needs to be explicitely enabled
  by the cloud operator to allow clusters that need the
  trust_id to be passed into instances to work. Without this
  setting, attempts to create such clusters will fail.

Please note, that none of these changes apply to existing
clusters. They will have to be deleted and rebuilt to benefit
from these changes.

Change-Id: I643d408cde0d6e30812cf6429fb7118184793400
2017-02-09 16:44:27 +01:00
Jenkins cb7d36ea0f Merge "Resource Quota - Limit clusters per project" 2017-01-26 22:15:52 +00:00
Vijendar Komalla 206d17f8ca Resource Quota - Limit clusters per project
Currently there is no limit on the number of clusters that can
be created in a project. This change limits number of clusters
in a project by checking cluster quota on cluster-create.

Change-Id: Ifa17d12692751fc6929e62be8bb59d481a2fd205
Partially-Implements: blueprint resource-quota
2017-01-25 08:55:45 -06:00
Jenkins 4e1ada7914 Merge "Integrate OSProfiler in Magnum" 2017-01-25 06:47:12 +00:00
Tovin Seven 32d088b2c1 Integrate OSProfiler in Magnum
* Add osprofiler wsgi middleware. This middleware is used for 2 things:
  1) It checks that person who wants to trace is trusted and knows
     secret HMAC key.
  2) It starts tracing in case of proper trace headers
     and adds first wsgi trace point, with info about HTTP request

* Add initialization of osprofiler at start of service
  Currently that includes oslo.messaging notifer instance creation
  to send Ceilometer backend notifications.

* Traces HTTP/RPC/DB API calls

Demo: https://hieulq.github.io/cluster-create-false-new-html.html

Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>
Implements: blueprint osprofiler-support-in-magnum
Change-Id: I7d68995aab81d365433950aada078ef1fcd5469b
2017-01-24 07:43:31 +07:00
Vijendar Komalla ccc04d67fc Resource Quota - DB layer changes
Change-Id: Ib1d4d8634eabdba76c5f7f858efc16702ebc0d2a
Partially-Implements: blueprint resource-quota
2017-01-23 11:00:10 -06:00
Jenkins 942fa495b6 Merge "Magnum stats API" 2017-01-19 07:24:33 +00:00
Vijendar Komalla 51e833137b Magnum stats API
This change introduces a new /stats REST endpoint that
provide the following basic information;
1) Total number of clusters and nodes for the given tenant.
2) Total number of clusters and nodes across all the tenants.
Follow-up patches include more stats.

Change-Id: Iac0bf9343549de31654545d5b1fd7601e56142a7
Partially Implements blueprint magnum-stats-api
2017-01-17 09:48:54 -06:00
Hongbin Lu 900c2af483 Remove unused context variable in db api
Change-Id: I78d7ddccddcc3630ddaf8fc6ddfc62dcff352bcd
2017-01-15 04:26:39 +00:00
yatin 5902daf8ae Remove provision_state parameters(specific to ironic)
The provision_state parameter was copied from ironic
with following patch:
https://review.openstack.org/#/c/138280

It should be removed as it's not required in magnum.

Change-Id: Id9e08ee731ae79531c8e29fd47e4fa650b1c5dcc
Partial-Bug: #1627663
2016-12-29 11:34:09 +05:30
Hieu LE d86b5735cd Centralize config option: database section
Centralize config option of database section.
Replace oslo_conf cfg to magnum.conf.

Change-Id: Id12bbf3ad8d3342450cd64cf23761a60d49ee46a
Implements: blueprint centralize-config-magnum
2016-09-22 05:57:01 +00:00
Jaycen Grant 729c2d0ab4 Rename Bay DB, Object, and internal usage to Cluster
This is patch 3 of 3 to change the internal usage of the terms
Bay and BayModel.  This patch updates Bay to Cluster in DB and
Object as well as all the usages.  No functionality should be
changed by this patch, just naming and db updates.

Change-Id: Ife04b0f944ded03ca932d70e09e6766d09cf5d9f
Implements: blueprint rename-bay-to-cluster
2016-09-08 13:01:12 -07:00
Jenkins 02ef5471b2 Merge "Correctly raising MagnumServiceNotFound exception" 2016-09-06 20:58:23 +00:00
Jaycen Grant 0b7c6401dd Rename BayModel DB, Object, and internal usage to ClusterTemplate
This patch is the first of 3 patches to change the internal
usage of the terms Bay and BayModel. This patch updates
BayModel to ClusterTemplate. No functionality should be
changed by this patch, just naming and db updates.

Change-Id: I0803e81be6482962be2878a8ea2c7480f89111ac
Implements: blueprint rename-bay-to-cluster
2016-09-01 14:47:39 -07:00
Rajiv Kumar b60c447d91 Correctly raising MagnumServiceNotFound exception
Passed arguments in key value form, while raising
MagnumServiceNotFound exception, as expected by the exception
message.

Change-Id: Iae767db0bbd264bb668b2845284fc5d876f7025d
Closes-Bug: #1619225
2016-09-01 15:59:38 +05:30
Jaycen Grant eaddb942fd Rename Bay to Cluster in api
This is the first of several patches to add new Cluster commands
that will replace the Bay terminalogy in Magnum. This patch adds
the new Cluster and ClusterTemplate commands in addition to the
Bay and Baymodel commands.  Additional patches will be created
for client, docs, and additional functional tests.

Change-Id: Ie686281a6f98a1a9931158d2a79eee6ac21ed9a1
Implements: blueprint rename-bay-to-cluster
2016-08-17 22:24:45 +00:00
Spyros Trigazis e6a29fb252 Remove ReplicationController object
Following the removal of service [1], pod [2] and container [3], remove
COE specific object ReplicationController.

This change also removes k8s_conductor.

[1] I4f06bb779caa0ad369a2b96b4714e1bf2db8acc6
[2] I8c2499ccb97aae39d80868ce02fbef292d762c10
[3] I288fa7a9717519b1ae8195820975676d99b4d6d2

Change-Id: Ica100c8d2dfdd7dc709feb1f5cdc5a3f3d6c7318
Partially-Implements: blueprint delete-container-endpoint
Partially-Implements: blueprint bay-drivers
2016-08-10 17:56:48 +02:00
Tom Cammann 40aa6550f1 Remove container object
Following on from removing the k8s specific APIs in
I1f6f04a35dfbb39f217487fea104ded035b75569 the objects associated with
these APIs need removal.

Remove the container object, drop the db table and remove references to
the container object. The docker_conductor has also been removed as this
was used for managing containers using Magnum objects.

Change-Id: I288fa7a9717519b1ae8195820975676d99b4d6d2
Partially-Implements: blueprint delete-container-endpoint
Co-Authored-By: Spyros Trigazis <strigazi@gmail.com>
2016-08-01 16:16:20 +02:00
Tom Cammann 3e02840628 Remove service object
Following on from removing the k8s specific APIs in
I1f6f04a35dfbb39f217487fea104ded035b75569 the objects associated with
these APIs need removal.

Remove the service object, drop the db table and remove references to
the service object.

Change-Id: I4f06bb779caa0ad369a2b96b4714e1bf2db8acc6
Partially-Implements: blueprint delete-container-endpoint
2016-06-02 10:46:13 +01:00
Madhuri Kumari 303d14dde0 X509keypair cleanup
This patch does following:

* Removes X509keypair controller as there is already Certificate
  controller for same purpose.
* Removes X509keypair conductor.
* Removes name, ca_cert and bay_uuid from x509keypair model as
  Bay model already holds certificate references.
* Add intermediates and private_key_passphrase to x509keypair
  model.
* Remove related tests and changes.

Change-Id: I9271221cd1d07c672c4a380a4ae3593237fca66a
Partially-Implements: blueprint barbican-alternative-storeX
2016-05-30 12:02:26 +05:30
Tom Cammann d20e5ef715 Remove pod object
Following on from removing the k8s specific APIs in
I1f6f04a35dfbb39f217487fea104ded035b75569 the objects associated with
these APIs need removal.

Remove the pod object, drop the db table and remove references to the
pod object.

Change-Id: I8c2499ccb97aae39d80868ce02fbef292d762c10
Partially-Implements: blueprint delete-container-endpoint
2016-05-27 11:34:09 +01:00
Bertrand Lallau 586b249686 Use oslo_utils.is_int_like support
oslo_utils library provides is_int_like method

Closes-Bug: #1585925
Change-Id: Ib3af95cc96d9874933785f23f39e138aaa6e1f68
2016-05-26 11:11:37 +02:00
Bertrand Lallau 45ed383ac9 Use oslo_utils.uuidutils support
oslo_utils.uuidutils library provides generate_uuid
and is_uuid_like methods.

Closes-Bug: #1585754
Change-Id: Ica93eb8062ae2e8d2e41b2fc4e5329d3369add70
2016-05-25 21:07:40 +02:00
Eli Qiao c82da08946 Allow update baymodel's public field even if referenced
Allow update baymodel's public field to be True even if referenced by bays,
User case is one operator wants to share this baymodel to others but doesn't
want to delete the referenced bay.

Please note we only allow to update public to be True case. In case of
True->False, this may lead bays lost baymodel, so don't do this.

Closes-Bug: #1557943
Change-Id: Ia08a2e9611de3559c5cec4eee832bade1f9af09e
2016-03-23 11:59:30 +08:00
Eli Qiao 3bd7492f21 Allow show public baymodel
We can not get public baymodel now.

Fix it by:

1. Union public baymodel when fetch baymodel from DB.
2. Don't apply policy checking if the baymodel is public

Closes-Bug: #1557977
Change-Id: Ie5b1432d06611cd697a55f67fd66207e1e757382
2016-03-22 10:51:50 +08:00
Vilobh Meshram faca94607a Resource Quota - Introduce Quota Table
Introduce Quota Table and Quota list/create API's. With
this concept it will be possible to set quota on a
resource within a project. Fox example X number
of bay creation within a project and if the request
exceeds X bay creation will not be allowed. This change
only introduces the db layer changes.

Change-Id: I8990052df48bdbf6eee426e88ed6c9c2f8cfd344
Partially-Implements: bp resource-quota
2016-02-27 03:25:47 -08:00
Hua Wang 342e83f033 Remove node object from Magnum
The node object represents either a bare metal or virtual machine
node that is provisioned with an OS to run the containers, or
alternatively, run kubernetes. Magnum use Heat to deploy the nodes,
so it is unnecessary to maintain node object in Magnum. Heat can do
the work for us. The code about node object is useless now, so let's
remove it from Magnum.

Closes-Bug: #1540790
Change-Id: If8761b06a364127683099afb4dc51ea551be6f89
2016-02-04 14:02:49 +08:00
houming-wang ab14191218 Fix ignored E711 rule and remove this exception
Fix the ignored E711 hacking rule and remove this exclusion in tox.ini.
This will make Magnum code have no pep8 violations and exceptions.

Change-Id: If7bf9f0cd61cebf2c85011156eb187453578faf7
2016-01-14 16:42:08 +08:00
houming-wang aa5c392f0a Disallow updating baymodel when it is referenced
It is very dangerous to update a baymodel when it is referenced by
bay(s). We should disallow updating a baymodel if it is referenced
by one or multiple bays. A BayModelReferenced exception will be raised
when do this action.

DocImpact
Closes-Bug: #1517259
Change-Id: I6c6cd1eebbb6e1f4b5e1657d3909b1bc8d287a35
2016-01-12 23:15:44 -05:00
houming-wang e5bdfb9b49 Trival: Remove unused logging import
In some Magnum source code files, oslo log is imported but not used.
Remove it.
from oslo_log import logging
LOG = logging.getLogger(__name__)

Closes-Bug: #1529253
Change-Id: I4d3911b94aed4c74b8163993b38e756139198049
2015-12-25 09:41:22 -05:00
Hua Wang 41b7bccc02 Remove baylock
bay_lock was used for horizontal scalability perivously,
and it is deprecated now. The discussions are in [1].
Let's remove it.

[1] https://blueprints.launchpad.net/magnum/+spec/horizontal-scale

Change-Id: Ia2b33a96c0e831d8c85a2a18d701575958be6dbd
Closes-Bug: #1526581
2015-12-18 09:47:46 +08:00
Hua Wang 53c5542a33 Add bay filter to container
Add bay filter to container, so that we can filter containers by bay_uuid.

Change-Id: Ie48757df37c1859211d775282cfcee82fe4fc9f8
Partially-Implements: blueprint filter-resource-by-bay
2015-10-28 09:55:56 +08:00
Hua Wang 584ad48e00 The default of filters should be an empty dict
Change-Id: I9d6923c0985c8cfefa8d02416092a2ef2be5f226
Closes-Bug: #1509229
2015-10-23 15:52:08 +08:00
Surojit Pathak ec2cd88a05 Make Kubernetes API call secure
This patch makes API call to Kubernetes secure using the certificate
and key.

Co-Authored-By: Madhuri Kumari<madhuri.kumari@intel.com>
Co-Authored-By: OTSUKA, Yuanying<yuanying@fraction.jp>
Depends-On: I76b0f91f0c44f9880980e35c6b8856ea48ed3ce1
Change-Id: Id4dceb83f67b80f5b39e3047011f9e34e840359d
Partially-Implements: blueprint secure-kubernetes
2015-10-08 16:41:38 +09:00
Hongbin Lu 454911f830 Allow container memory size to be specified
With docker, users have an option to specify memory size when
creating containers. This patch bring this capability to Magnum.
Specifying memory size is optional but recommended. If memory size
is unset, magnum will set mem_limit as None on docker create.

Change-Id: Ife88284402ff39a7b2e051f6e66913e502f2ba8c
Closes-Bug: #1487224
2015-10-03 17:27:30 -04:00