Commit Graph

34 Commits

Author SHA1 Message Date
Tobias Urdin 6491be0d19 Use new get_rpc_client API from oslo.messaging
Use the new API that is consistent with
the existing API instead of instantiating the client
class directly.

This was introduced in release 14.1.0 here [1] and
added into oslo.messaging here [2]

[1] https://review.opendev.org/c/openstack/requirements/+/869340
[2] https://review.opendev.org/c/openstack/oslo.messaging/+/862419

Change-Id: I1a0258766757ad3baa4422ed4c51632a4ca0330d
2023-01-19 20:32:13 +00:00
zhangbailin 8f234fd54a Bump oslo.log>=5.0.0
Change-Id: I216da5b653983740a85b698821efa2012981c54b
2022-06-04 17:44:06 +08:00
Zuul ad8e4522f0 Merge "Bump WSME and sphinxcontrib-pecanwsme version" 2021-11-12 08:54:02 +00:00
songwenping d74b897208 update oslo.db version to 10.0.0
This patch[1] added handler for mysql 8.0.19 duplicate key error update,
and in device_profile create progress, we should distinguish the name
and uuid duplicate exception, so update oslo.db version to adapt.

[1] https://review.opendev.org/c/openstack/oslo.db/+/792124

Change-Id: I810cf892545eccd6255b01813a44e2c069ae5a7a
2021-07-29 16:43:54 +08:00
Ghanshyam Mann 5469b497eb Fix oslo policy DeprecatedRule warnings
Since 3.7.0, oslo policy started the DeprecationWarning[1] if
deprecated_reason and deprecated_since param are not passed
in DeprecatedRule or they are passed in RuleDefault object.

These warnings are logged for every test which increase the
log size and sometime can full the log buffer and fail the
job.

[1] https://github.com/openstack/oslo.policy/blob/3.7.0/oslo_policy/policy.py#L1538

Change-Id: I5f7b2027e9d015cef6e8e7b459ebf2005c432209
2021-07-05 11:34:47 -05:00
zhangbailin 6d3ebe4ec1 Bump WSME and sphinxcontrib-pecanwsme version
While pep8 failed in [1], it was required wsme===0.10.1, and in
requirements it has bumped WSME===0.10.1 and
sphinxcontrib-pecanwsme===0.10.0 in [2].

[1] https://review.opendev.org/c/openstack/cyborg/+/790328
[2] https://github.com/openstack/requirements/blob/master/upper-constraints.txt#L327
    https://github.com/openstack/requirements/blob/master/upper-constraints.txt#L415

Closes-Bug: #1929535

Change-Id: I74edc9f886635b6af532271c4f6169dc66970034
2021-05-25 18:09:11 +08:00
songwenping 02e573b95a Remove usage of six
Remove six-library Replace the following items with Python 3 style code.
- six.interger_types
- six.text_type
- six.string_types
- six.PY3
- six.moves
- six.add_metaclass
- six.ensure_str
- six.reraise

Change-Id: I0c7691b3d6f6315137d8f0b9eeaa3b8e76749c04
2020-10-07 06:25:20 +00:00
Zuul ef87b28898 Merge "Change default policy file from JSON to YAML" 2020-09-22 08:40:35 +00:00
Ghanshyam Mann af49d0b30a Change default policy file from JSON to YAML
As Cyborg is switching to new policy, this is required
to avoid breaking the existing deployment using policy
file in json format and relying on default value of
'CONF.oslo_policy.policy_file'.

Default value of 'CONF.oslo_policy.policy_file' config option
has been changed from 'policy.json' to 'policy.yaml'. If new default
file 'policy.yaml' does not exist but old default 'policy.json' exist
then fallback to use old default file.

An upgrade checks is added to check the policy_file format and
fail upgrade checks if it is JSON formatted.

Added a warning in policy doc about JSON formatted file is deprecated,
also removed all the reference to policy.json file in doc as well as
in tests.

Related Blueprint: https://blueprints.launchpad.net/oslo.policy/+spec/policy-json-to-yaml

Change-Id: I865227e516dc7505c463ac279309169d95ea6a22
2020-09-18 14:16:31 +00:00
Yumeng Bao 01e9a74505 [goal] Fixing lower constraints for Ubuntu Focal
As per victoria cycle testing runtime and community goal[1],
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Bump lower constraints to make testing work for Focal.

[1]https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal

Change-Id: I57537f1afaac87cb99d2cae4e150f915428135e0
Story: 2007865
Task: 40181
2020-09-17 16:30:12 +08:00
Yumeng Bao 660b252c91 Suppress policy deprecated warnings in tests
Every unit tests init the policy via fixture which will
log the deprecation warnings. As per our new policy defaults
work, we are going to deprecate almost all the policies due
to their change in default value.

Logging all the deprecation warning for every unit tests will
overflow the log files and leads to error.

Oslo policy has a way to supress the deprecation warning for tests,
so let's supress the deprecation warning for unti tests.

This will not be issue on production cloud as there are only
one time policy initialization.

Bump oslo.policy version tod 2.3.0 which includes the suppress warning
flag - https://docs.openstack.org/oslo.policy/latest/user/history.html#id3

Story: 2007024
Task: 40817
Change-Id: Icd0db14ad6e1cb717b6b6f482d9e4f7a4aad7d8a
2020-09-11 14:27:28 +08:00
zhangbailin 6b0e1f8d12 Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib. Most of this
is autogenerated, as described below, but there are three manual changes
necessary.

Change-Id: If9cd7eca3454d9e1d62a0a1753e157adbf965e8d
2020-06-16 07:24:42 +00:00
zhangbailin ca283d0266 Bump openstacksdk>=0.46.0
We removed python2 support in https://review.opendev.org/#/c/717521/,
but we are missing openstacksdk in reqirements, so when we using
python3, that will be raise "ModuleNotFoundError: No module named
'openstack'".

This commit add the openstacksdk>=0.46.0 to Cyborg to support python3.

Change-Id: I4d015b3723fb13c361cefe5eee6607f9cbe8f65d
Story: 2007533
2020-04-09 10:41:36 +00:00
Xinran WANG 07a8e30f76 Introduce microversion
This patch aims at support microversion in Cyborg API.
The work items is the following:
1. remove old api_version_request.py to avoid the redundancy.
2. add a header in every API request and support to parse it and
route to the correct API method.
3. depracate v1 API.
4. add related UT.

For testing:

CTYPE="Content-Type: application/json"
AUTH="X-Auth-Token: $(openstack token issue -c id -f value)"

curl -s -H "$CTYPE" -H "$AUTH" -H "OpenStack-API-Version: accelerator
2.0" http://localhost/accelerator/devices

This will execute sucessfully because 2.0 microversion is supported.

curl -s -H "$CTYPE" -H "$AUTH" -H "OpenStack-API-Version: accelerator
latest" http://localhost/accelerator/devices

This will execute sucessfully because "latest" will be parsed to 2.0.

curl -s -H "$CTYPE" -H "$AUTH" -H "OpenStack-API-Version: accelerator
2.99" http://localhost/accelerator/devices

This will failed because we don't support 2.99 microversion.

Change-Id: Id9c34dc134d59b2332cefbcae5bbd7e6632e970d
2020-04-07 06:18:50 +00:00
zhangbailin 6aff4debb5 Bump oslo.messaging version >= 10.3.0
When I create a device profile use curl in devstack env by Cyborg
master branch, but there is a
"oslo_messaging.exceptions.MessagingTimeout: Timed out waiting for a
reply to message ID 3f84acee62794d03b2858921bb4950f2" [1] exception raised.

While I update the oslo.messaging that it runs ok, so I bump
oslo.messaging to >=10.3.0 to improve the interaction performance
with other components. Because Cyborg needs to interact with nova, I
keep the oslo.messaging version consistent with the minimum version
required by nova [2].

[1]http://paste.openstack.org/show/790502/
[2]https://opendev.org/openstack/nova/src/branch/master/requirements.txt#L47

Story: 2007396

Change-Id: I0bbeaa286b1add55f00b1059856c785dbf74d800
2020-03-10 10:04:09 +08:00
chenke 4bf582a849 Use ResourceNotFound replace RP and Image NotFound
This is a series of optimization for exception.

In fact, we only need to use the ResourceNotFound exception
to fit NotFound Exception.

This patch also adds dependency package cursive which is used
in [1].

[1]. 6740c3c0c5/cyborg/image/glance.py (L30)

Change-Id: I9e80dcfed54147c942f90c696e483fa6db842dde
Story: 2007045
Task: 37968
2020-01-17 09:08:22 +00:00
Yumeng Bao 45ade8a10b Implement privsep boilerplate in cyborg.
This includes implementing a first trivial example of how to use
privsep to run something as root, specifically the gpu driver. FPGA
and other drivers should implement as well in the future.

For reference:
https://review.opendev.org/#/c/566479/4
https://docs.openstack.org/oslo.privsep/latest/user/index.html#converting-from-rootwrap-to-privsep

Change-Id: Ibff356d9a7f57bc99cc26de90d81ff92948f37c4
2019-09-25 19:22:12 -07:00
pengyuesheng 04bbd98e86 Blacklist eventlet 0.23.0,0.25.0
more details https://review.opendev.org/#/c/678078/

Change-Id: If571d7044a0cca48cf442c2915b8e9cf9510914c
2019-09-23 15:03:49 -07:00
Yikun Jiang 658334455b Add the fake driver
This patch add the fake driver, this driver can be configured
in cyborg.cfg to enable it:

[agent]
enabled_drivers = fake_driver

It would be used in cyborg test.

Change-Id: I08c63d533fd5dbd4330c68a22d2ecafb38134766
2019-08-09 16:24:53 +08:00
Yongjun Bai 4bb248b260 Fix:add python-glanceclient to cyborg requirements
Because in cyborg/image/glance.py line 33 hava "import glanceclient"
but requirements.txt not have python-glanceclient

Change-Id: I3ba7b9eb87ed799ad5ea61f842dd1bbe08d533a8
Story: 2005097
Task: 29710
2019-02-27 17:30:05 +08:00
whoami-rajat 79e8f86aa0 Add cyborg-status upgrade check command framework
This adds basic framework for cyborg-status upgrade
check commands. For now it has only "check_placeholder"
check implemented.
Real checks can be added to this tool in the future.

Change-Id: I4a180f9a1b25c75489ad3cfee30a7b55506e0bbd
Story: 2003657
Task: 26126
2018-10-26 19:42:43 +05:30
Vu Cong Tuan e76f2a5f90 Switch to stestr
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: I8b0f96f05799b892acfae03522726c17010f0df3
2018-07-24 15:10:52 +07:00
Doug Hellmann 305c320dcb uncap eventlet
We will manage the eventlet version using constraints now. See the
thread starting at
http://lists.openstack.org/pipermail/openstack-dev/2018-April/129096.html
for more details.

Change-Id: I3c4282f0bc2ddedf816f366cd058823777ecdab9
Co-Authored-By: Michel Peterson <michel@redhat.com>
2018-05-07 17:42:19 +03:00
heluwei 488cc340ef Add Cyborg SPDK Driver
SPDKDRIVER is a virtual interface which provides common methods
for specific drivers (such as: VHOSTDRIVER, NVMFDRIVER, etc.).
For this reason, the Cyborg agent should invoke these drivers
via py-spdk[0] to communicate with the backend SPDK-base app server.
The py-spdk is management lib for SPDK applications which need to
be imported into the cyborg, so we put the pyspdk lib into cyborg/
cyborg/accelerator/drivers/spdk/util/. There are some unit tests
we added in cyborg/cyborg/tests/unit/accelerator/drivers/spdk/.
Now We are first implementing the unit tests of
test_discover_accelerator() and test_accelerator_list(),
and the rest will be added later.

For example:
When the Cyborg agent call the NVMFDRIVER.discover_accelerator(),
the return value we get is:
{
    'server': 'nvmf_tgt',
    'bdevs': [{
       "num_blocks": 131072,
       "name": "nvme1",
       "block_size": 512,
       ......
     }]
    'subsystems': [{
       "core": 0,
       "nqn": "nqn.2018-01.org.nvmexpress.discovery",
       "hosts": [],
       ......
     }]
}

[0] The implementation of py-spdk is subbmitted to
https://review.gerrithub.io/#/c/379741/, please visit it.

Change-Id: I2d0e4dc6b58e725584d22ee85961877a870c68a7
2018-02-05 00:57:30 +08:00
zhuli b860aef110 Supplementing accelerator CRUD api
with this patch, we are able to do CRUD via accelerator api

POST /accelerators
    Create a new accelerator
GET /accelerators/{uuid}
    Retrieve information about the given accelerator
GET /accelerators
    Retrieve a list of accelerators
PATCH /accelerators/{uuid}
    Update information about the given accelerator
DELETE /accelerators/{uuid}
    Delete the given accelerator

Change-Id: Ibc97ec49f557cac69dfd38f99f28bc7b205732b9
2018-01-14 02:03:24 +08:00
Nguyen Van Trung 111630aa07 Replace jsonutils by common json package
Should remove oslo.serialization which only use at one test-case.
This change will help project do not depends this package,
and let's use the regular json attribute anyway.

Change-Id: I01af1e1b09fb9866acf54fc7a19aedfaab34a684
2017-11-29 03:21:39 +00:00
Jenkins 4e45b8624e Merge "add authtoken-middleware" 2017-09-13 04:08:05 +00:00
zhuli ee48522720 add authtoken-middleware
Add authtoken middleware for integrating with the OpenStack Identity API
and handling authorization enforcement based upon the data within the
OpenStack Identity tokens

Change-Id: I8056d69657d0a98b4446a494877f7b965ceb786f
2017-09-13 09:48:01 +08:00
zhuli c6c5ca042f add policy support
Add policy support to determine which user can access which objects
in which way

Change-Id: If959089366ec252d4a7904d0e78733a2bf52fff5
2017-09-03 21:04:20 +08:00
zhuli 57e4c042ca add cyborg-conductor & db
1. add conductor rpc
2. add cyborg-conductor command
3. add db and init `accelerators` table
4. add accelerator_create method
5. add cyborg-dbsync command

Change-Id: I07333a4df7a42878dcf950b2b7893a37670da87b
2017-08-21 09:25:48 +08:00
zhuli c7b24fda7f Add cyborg-api command
Change-Id: I392ad0383d5d8299db407df79bd60adbfbd428cd
2017-07-29 04:01:06 -04:00
zhuli 1861b88138 Add Pecan/WSME framework for API
Change-Id: I4a411c4f2af1b659c3d1a51b69045524842c236b
2017-07-21 10:00:04 +08:00
zhipengh 43e717bd9e Rename old Nomad files to Cyborg
Replace nomad with cyborg in the skeleton, also update
test-requirement.txt

Change-Id: I2b3f54f2591facc6bab7ab8f41fb8c9919b01845
2017-02-05 22:31:28 +08:00
zhipengh 84fc02aedb initial setup "correct tox.ini testr and test-requirement.txt requirement
, add .testr.cof"

Change-Id: I5abe3fe60897e22edefaf226f9431d5ade2797e1
2016-01-18 14:29:39 +08:00