Commit Graph

100 Commits

Author SHA1 Message Date
Diogo Guerra 11bcc17568 Drop bay and baymodel from magnum
- Drop bay and baymodel tests
- Drop bay and baymodel from controllers

Depends-On: Ib85e4fda8e4ac467bd49590dc72ba5913bb9a19d

Story: 2009104
Task: 42957
Task: 42959

Signed-off-by: Diogo Guerra <diogo.filipe.tomas.guerra@cern.ch>
Change-Id: Ida2e42c86400438951d9804e3ce122c56a46b94f
2023-05-09 13:59:57 +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
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
Erik Olof Gunnar Andersson 41cd85794f Use MultiType and types.text instead of str
The goal of this is to fix python3 compatibility issues.


story: 2003236
task: 23698
Change-Id: I555c7faecfcccaaa3649ef8c631b99a01e747c0b
2019-01-18 11:01:57 +00:00
Erik Olof Gunnar Andersson f2fd732ce2 Trivial code cleanups
Cleaning up comments and logging to make sure they properly adhere
to Openstack standards.

* Consistently use """ instead of ''' for comments.
* Always lazy-load logging parameters.
* Fixed bad log line in cert_manager.

Change-Id: I547f5dfa61609a899aef9b1470be8d8a6d8e4b81
2018-10-02 19:41:34 +00:00
Ricardo Rocha 28fff8006a Make docker_storage_driver a str instead of enum
Allow any value to be passed on the docker_storage_driver field by turning it
into a StringField (was EnumField), and remove the constraints limiting the
values to 'devicemapper' and 'overlay'.

Change the docker storage setup to have a generic setup for all drivers with
the exception of 'devicemapper', which keeps its own specific storage config
function. For all others, do the same we already did for overlay (with two
cases for usage of a cinder volume or not) and simply set the storage driver
in the docker configuration to the value provided in the cluster template.

Change-Id: I9aa8f232ce64ece4d439c0a476f463820a499617
Closes-Bug: #1722522
2017-12-14 14:41:09 +00:00
chestack afa32e8672 Trivial typo fix
found it when work on something else

Change-Id: Ie13544fb4fb5ab8a8ebf0e2c0c6b02d87cebb189
2017-08-23 16:12:22 +08:00
Mark Goddard f1326626b9 Pass a mutable target to oslo policy enforcer
Magnum API previously passed magnum.objects.cluster.Cluster objects as
the target argument to magnum.common.policy.enforce(). However, enforce()
expects target to be a mutable mapping, as it adds an entry for
trustee_domain_id which is used by the magnum policy.json. This causes
cluster detailed GET requests to fail with the following message:

AttributeError: 'Cluster' object has no attribute 'trustee_domain_id'

This change uses the as_dict() method of the magnum RPC objects to
provide a mutable mapping to the policy enforcer.

Change-Id: I54b136243afff9e0fadae3be4b36cad1679e5721
Closes-Bug: #1689797
2017-05-10 17:47:38 +01:00
ricolin 1ca8f18015 Remove support message for using keypair UUID
UUID for keypair is no longer supported from heat and nova cli.
This patch suggest to remove the support message from magnum.
Closes-Bug: #1674211

Change-Id: Idb67fc86f067387060a381c9d2d0ed0f8c953c21
2017-03-20 12:51:55 +08:00
yatin 745188b5ef Restrict server type only to vm/bm
Currently server type can be set to any String, but it should
be restricted to only allowed types: vm/bm.
vm: virtual machine
bm: baremetal
With this patch it is restricted only to allowed types.

Change-Id: Ifbeff8621b26702e54ad088195fddcb7c35424b2
Closes-Bug: #1622432
2016-09-16 14:48:44 +05:30
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 6c2509cbff Merge "Clean up docstrings in BayModel" 2016-09-06 18:57:17 +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
yatin karel d82d8b2420 Get mandatory patch attrs from WSME properties
Attributes which are mandatory (ie, required for object creation) should
not be removable. However, some attributes (such as baymodel.server_type)
are not required for object creation, but should not be removable if they
are set. This commit does the following:

- rename JsonPatchType.mandatory_attrs to non_removable_attrs to better
  describe its meaning,
- change its return type to set-of-strings for faster lookup
- ensure all mandatory attributes on the type being patched are
  included in the set of non-removable attributes,
- add a new field, JsonPatchType._extra_non_removable_attrs, which
  should be a set of attributes that are not required for creation but
  should not be removed if set.

Since the object to be patched does not exist at patch-validation time,
we leave the validation logic in methods of JsonPatchType and
subclasses. This means introspecting the types to be patched.

This patch is copied from ironic [1].
[1] https://review.openstack.org/#/c/240202/9

Change-Id: Ifcfc4e48a05d75b919a33ef463754c199da94a8e
Close-Bug: #1530771
2016-08-23 10:23:19 +05:30
Lars Butler edb17b71c8 Clean up docstrings in BayModel
Fix grammar, punctuation, phrasing, formatting issues, and apply
consistent usage of "Baymodel" in docstrings.

Change-Id: I1abc5626f39958351935f4c711c19588651d2bc6
2016-08-22 11:52:39 +02:00
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
OTSUKA, Yuanying 26370a2509 Add floating_ip_enabled field to baymodel
This patch adds floating_ip_enabled field to baymodel to specify
whether floating ip is used or not.

Change-Id: I99677221250480b43a4b95ebf460c43bc77090ad
Partially-Implements: blueprint bay-with-no-floating-ips
2016-08-16 16:21:35 -05:00
Jenkins 4799c13cd0 Merge "Add microversioning support for methods" 2016-08-04 08:40:05 +00:00
Jaycen Grant e6a71b9e6d Add microversioning support for methods
Adds the functionality to allow versioning of api methods
based by adding a decorator api_version("min_version",
"max_version"). This is similar to how nova implemented api
versioning but updated to work with pecan.

Change-Id: Ie18d92531487f7c107b5132b3d35f38bd0a37aa0
Implements: blueprint api-versioning
2016-08-03 13:28:48 -07:00
Nate Potter ee201a9307 Fix typo in baymodel param
A param for the coe in baymodel currently reads 'mondatory',
it should be 'mandatory'.

Closes-Bug: #1605705
Change-Id: I519a7c4cc56d5c53ecaccaed07dfad774b4c4900
2016-07-22 18:45:33 +00:00
ztetfger 635e79e82e Add check on docker_volume_size
In magnum server side, docker_volume_size allowed minimum value is 1GB.
In fact, the minimum value should be 3GB when docker-storage-driver is
devicemapper, because the limitation of docker-storage-setup. So, I add
check on "--docker-volume-size". If "--docker-storage-driver=devicemapper",
the minimum docker-volume-size should be 3GB, otherwise it should 1GB.

Change-Id: I53c6a9c93ee156fa9afabdbd72a87bb4044d71ca
Closes-Bug: #1583878
2016-07-20 17:35:55 +08:00
OTSUKA, Yuanying 62c75e5883 Add fixed_subnet field to baymodel
Ironic template needs to specify fixed subnet name/ID.
And also user sometimes want to build his cluster on
his network which he built.
This patch adds fixed_subnet field to baymodel to specify
fixed subnet which bay will build on.

Change-Id: Ia21ad6e3e1472a0d078d08369ef62601034fcc17
Partial-Implements: blueprint magnum-baremetal-full-support
2016-06-30 15:16:45 +09:00
Jenkins d310a65970 Merge "Add master_lb_enabled field to baymodel" 2016-06-29 05:10:15 +00:00
Drago Rosson 6d10dbf35d Add master_lb_enabled field to baymodel
master_lb_enabled is a boolean field that determines if a bay's master
nodes should be load balanced. Defaults to False.

Change-Id: Icf8317432dec70c99c29a3af9edb0499bfd2439d
Partially-Implements: blueprint decouple-lbaas
2016-06-28 08:41:49 +00:00
Wenzhi Yu dae88dda59 Auto generate Bay/BayModel name
Add a feature to Magnum to auto-generate human readable names,
like Docker does for un-named containers. Use this feature if
no name is specified upon the creation of a Bay/Baymodel.

Change-Id: I290fb4ad0692c63e6e40af3ec705f205c5ec66d3
Partially-Implements: blueprint auto-generate-name
2016-06-17 19:02:55 +08:00
PanFengyun af07380ca1 Delete duplicate statement
post() has duplicate statement:
    context = pecan.request.context

Change-Id: I0b2f9a13587636053c74505a46417cb8f3c64e1c
2016-06-06 23:39:03 +08:00
Spyros Trigazis dec85b538f Add docker-storage-driver attribute to baymodel
* This parameter will be optional and users will be able to select
  a supported driver, otherwise the default configuration will be
  used.
* Add docker storage driver enum field to baymodel
* Add db upgrade file
* Update heat templates for kubernetes and swarm allowing only
  devicemapper and overlay as docker_storage_driver values.
* Add configuration for OverlayFS on Fedora Atomic, if overlay is
  incompatible bay creation will result a CREATE_FAILED status.
* Factor out configuration of docker storage drivers
* Update tests
* Add Release Notes

Partially-Implements: blueprint support-for-different-docker-storage-driver
Change-Id: Ib58cb734c4e9c90d5d83574852213d2e97359e92
2016-06-01 10:42:19 +02:00
Eli Qiao 7b1e0ecb2e Add insecure_registry column to baymoddel
Adding new column of `insecure_registry`, it indicates using insecure
registry when deploying a bay, it should be a validate url with port.

Partially-Implements: blueprint support-insecure-registry
Change-Id: Iaa28d6409264d1d2acd992a7fa14630bb6394852
2016-05-23 09:02:22 +08:00
Yosef Hoffman 66cbd8c821 Always expand Baymodel fields
In baymodel (https://github.com/openstack/magnum/blob/master/magnum/
api/controllers/v1/baymodel.py), we have an unset exception list:

            baymodel.unset_fields_except(['uuid', 'name', 'image_id',
                                          'apiserver_port', 'coe'])

In order for the new "--fields" option [1] to work better, this patch will
remove the expand option so that all fields are included by default.

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

Change-Id: I1adffca9a7c6e013bed38530036dfc0aed918fdc
Closes-Bug: #1579236
2016-05-12 14:27:30 -04: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
Jenkins 0f4677a297 Merge "Fix baymodel with invalid parameter can updated." 2016-03-12 18:14:24 +00:00
wangqun b927d03cf7 Fix baymodel with invalid parameter can updated.
Now, when we update baymodel with the invalid flavor_id or
master_flavor_id parameters, the baymodel can be updated
successfully.

We need to validate the flavor_id, master_flavor, keypair and so on
before patching baymodel.

Closes-Bug: #1555490
Change-Id: I4ae3cd7c0be1161dacb6f0a80c5ee1b53d06d03d
2016-03-11 09:21:42 +00:00
Hua Wang bf84fdf99a Pass target in enforce
As described in [1], we should pass bay or baymodel as target in
enforce. Otherwise we can not user generic-checks. We need this
check for some situations, for example only allow the user who
creates a bay can delete the bay.

http://docs.openstack.org/developer/oslo.policy/api/
oslo_policy.html#generic-checks

Change-Id: I60f8870dd1a2bb07efbadf5f16a453f0a2e0cb3d
Closes-Bug: #1553914
2016-03-09 16:40:05 +08:00
wangqun 4d39d8cc94 Fix baymodel with invalid parameter can created.
Now, when we create baymodel with the invalid flavor_id and
master_flavor_id parameters, the baymodel can be created
successfully.

We need to validate the flavor_id and master_flavor before
creating baymodel.

Change-Id: Id6768d8246c97d56e529cbc1cab6c8c7d28ca43a
Closed-Bug: #1547345
2016-03-02 15:44:09 -05:00
Jenkins 16603db200 Merge "Rename get_rpc_resource to get_resource" 2016-03-01 10:33:43 +00:00
Hongbin Lu c64e8eb502 Remove unused attribute "ssh_authorized_key"
This attribute was used in CoreOS template before. The usage of this
attribute has been removed [1][2]. This patch remove it from Magnum.
[1] https://review.openstack.org/#/c/262628/
[2] https://review.openstack.org/#/c/262926/

Change-Id: I7ff80fd1421bf2ea61e951e87f83983fb2883f79
Closes-Bug: #1540134
Partial-Implements: blueprint coreos-k8s-bay
2016-02-28 15:33:56 -05:00
Hua Wang 138483a0bd Rename get_rpc_resource to get_resource
Rename get_rpc_resource to get_resource. Because there is no rpc
call in this method.

Change-Id: I4dfba86b9932c9def08959f7fb1df98b7bc41436
Closes-Bug: #1549650
2016-02-26 10:06:00 +08:00
twm2016 13cd74ec2e Added documentation to BayModel attrs
Missing documentation was added to `http_proxy` and `https_proxy` BayModel
attrs.

Change-Id: I8dc0186fa4873eea1a31d93b5a0e992c473ec642
Closes-Bug: #1533142
2016-02-26 01:34:01 +00:00
OTSUKA, Yuanying 1772284b99 Change BayModel#coe type to wtypes.Enum
BayModel coe should be Enum value.
This patch fixes this.

Change-Id: I2fbd0ae16af473e953bfccf7dd5fa34d615de9e5
Closes-Bug: #1542167
2016-02-05 15:28:36 +09:00
wangqun a980198a5b Validates baymodel volume_driver patch requests
Instead of allowing any volume_driver value to be accepted by the
baymodel API. When updating baymodel, the patch can limit the
volume_driver value for the different coe.

Co-Authored By: Kai Qiang Wu(Kennan)<wkqwu@cn.ibm.com>
Co-Authored By: Ton Ngo<ton@us.ibm.com>
Partially-Implements: blueprint magnum-integrate-with-cinder

Change-Id: Ic5efb9ca0d8dfb2092c63caba22a7214e78bba08
2016-01-28 03:37:37 +00:00
wangqun f2629f288c Validates baymodel volume_driver requests
Instead of allowing any volume_driver value to be accepted by the
baymodel API. When creating baymodel, the patch can limit the
volume_driver value for the different coe.
Kubernetes <=> volume_driver = "cinder"
Swarm <=> volume_driver = "rexray"
Mesos <=> volume_driver = "rexray"

Co-Authored By: Kai Qiang Wu(Kennan)<wkqwu@cn.ibm.com>
Co-Authored By: Ton Ngo<ton@us.ibm.com>

Partially-Implements: blueprint magnum-integrate-with-cinder
Depends-On: I52c97e2b04ac636ddac611e3677c4ea3972220eb
Change-Id: I25f1cd005a39950c47f31a8b925f664909b79ee3
2016-01-28 03:15:39 +00:00
Jenkins c15fe398de Merge "Adds volume_driver in db api" 2016-01-27 09:45:49 +00:00
wangqun 6dc4816521 Adds volume_driver in db api
Adds volume_driver to the following:
1. api baymodel attribute
2. a new column to the baymodel db
3. objects.Note: Updates baymodel object version
4. Unit tests

Co-Authored By: Kai Qiang Wu(Kennan)<wkqwu@cn.ibm.com>
Co-Authored By: Ton Ngo<ton@us.ibm.com>
Partially-Implements: blueprint magnum-integrate-with-cinder

Change-Id: I25506bd39ab4be513ef99c39f8c52a502b300d92
2016-01-26 05:42:11 +00:00
Vilobh Meshram 3732045c44 Fix typo in comment of several files
Typo in the spelling of 'against' (written as 'agaist') is observed
in the comment of several files. Not everything was covered as part of
Idefb5d70dba554e2ea732af9d53f4bbe7e49e557.

Change-Id: Ie2ac2be3e18afdf644e02288f13f10c10f6bc723
2016-01-25 16:36:03 -08:00
Jenkins 628f7c4239 Merge "Add mandatory_attrs to BayModelPatchType" 2016-01-14 21:26:44 +00:00
Eli Qiao afc1fb14c2 Add mandatory_attrs to BayModelPatchType
Magnum baymodel requires some mandatory attrs, this patch adds them to
mandatory_attrs() of BayModelPatchType to forbid removing them when do
baymodel-update remove ${attr}

Closes-Bug: #1530506
Change-Id: Iea59fd4811835cda1f232a77f3f345ca7e374fa4
2016-01-11 09:20:21 +08:00
Hongbin Lu 085631b71b Fixed the incorrect policy enforcement
In API controller, "@expose.expose" should be on top of
"@policy.enforce_wsgi". Otherwise, the output won't have the correct
format and status code. That is because "@expose.expose" will format
the exception before sending the response.

In "enforce_wsgi", use decorator module instead of "functools.wraps".
That is because decorator is signature preserving, which is
necessary for other decorator to work.

Also, added unit tests to ensure the correct error message and status
code will return if the request cannot pass the policy check.

Change-Id: I8b77ba95124c13dd1a46700bc60105bc7e33a579
Related-Bug: #1520311
2016-01-04 20:01:57 -05:00
houming-wang a9dc342578 Refactor image check in Baymodel
A new magnum.api.attr_validator.py module is introduced to do the
validation towards OpenStack resources. Currently in Baymodel-creation,
the image validation code is duplicated. We should reduce the
duplicated code and unify the validation both in Bay and Baymodel.

Change-Id: I8517024c77c6dc4082bf2ff6d0205d86e32fbfdc
Partial-Bug: #1522060
2015-12-09 07:51:58 -05:00
houming-wang 743ff7526e Refactor keypair existence check in Baymodel
A new magnum.api.attr_validator.py module is introduced to do the
validation towards OpenStack resources. Currently in Baymodel-creation,
the keypair validation code is duplicated. We should reduce the
duplicated code and unify the validation both in Bay and Baymodel.

Change-Id: Iba1bfad00c97f90d28501e65b73eed33be05e40f
Partial-Bug: #1522060
2015-12-08 03:46:16 -05:00
Hua Wang a09ff4bc25 Remove circle reference
We can not import magnum.api.validation because of circle reference.

We can reproduce this bug by "tox -egenconfig" or importing
magnum.api.validation in a python console.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "magnum/api/validation.py", line 20, in <module>
    from magnum.api.controllers.v1 import utils as api_utils
  File "magnum/api/controllers/v1/__init__.py", line 30, in <module>
    from magnum.api.controllers.v1 import baymodel
  File "magnum/api/controllers/v1/baymodel.py", line 29, in <module>
    from magnum.api import validation
ImportError: cannot import name validation

Change-Id: Ib73d7f1d989b9bc860bfadafa52e9a83996f5de9
Closes-Bug: #1521840
2015-12-02 15:06:17 +08:00