1139 Commits

Author SHA1 Message Date
Zuul
28ffcdbfa1 Merge "LVM: Fix bare raise on LVM command error" 2023-03-23 16:34:16 +00:00
Eric Harney
e15edf6c17 Add Python 3.10 to setup.cfg metadata
We support 3.10 as of Antelope.

Change-Id: Ie3eaf0d16e27e35ec30635c82b38c634db9c4541
2023-03-09 11:21:49 -05:00
a0bc09ba50 Update master for stable/2023.1
Add file to the reno documentation build to show release notes for
stable/2023.1.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2023.1.

Sem-Ver: feature
Change-Id: Ic3ac791f083aa097412dc9075a6b20f2b148db02
2023-02-24 17:34:50 +00:00
Eric Harney
653c4c5c77 Update hacking to 5.0
Update hacking to 5.0 release.

Change-Id: I1c13d2d1effc1b6a91602199f42d59d5bf21ceec
2023-02-10 11:47:43 -05:00
Zuul
65f922b167 Merge "Update minimum requirements in os-brick" 6.2.0 2023-02-10 15:28:42 +00:00
Zuul
4f335d410a Merge "Bump bandit to release 1.7.0" 2023-02-09 22:36:06 +00:00
Eric Harney
05052a1375 LVM: Fix bare raise on LVM command error
This should have an associated message, and is
detected as an error by pylint.

Change-Id: Icc312cb960971ecf2a7754b9056a869c9ec8098a
2023-02-09 11:10:19 -05:00
Rajat Dhasmana
35ea8e3eb6 Update minimum requirements in os-brick
This patch updates os-brick requirements of related OpenStack projects.
Following are the updates:

oslo.concurrency: 4.5.0 -> 5.0.0, released: 4 Aug '2022, u-c: 5.0.1
oslo.config: 8.1.0 -> 9.0.0, released: 12 July '2022, u-c: 9.1.0
oslo.context: 3.4.0 -> 4.1.0, released: 17 Feb '2022, u-c: 5.0.0
oslo.log: 4.6.1 -> 4.8.0, released: 5 May '2022, u-c: 5.0.0
oslo.privsep: 2.6.2 -> 3.0.0, released: 12 July '2022, u-c: 3.0.1
oslo.serialization: 4.2.0 -> 4.3.0, released: 16 Feb '2022, u-c: 5.0.0
oslo.utils: 4.12.1 -> 6.0.0, released: 23 June '2022, u-c: 6.1.0
oslo.win: 5.5.0 -> 5.7.0, released: 18 May '2022, u-c: 5.8.0
oslo.vmware: 3.10.0 -> 4.0.0, released: 17 June '2022, u-c: 4.0.1

Change-Id: I8c19fad8e4a2bcc6756c46cf5ef56367823e5a17
2023-02-09 15:55:40 +00:00
Zuul
9a5c0b5092 Merge "Bump hacking to 4.1.0" 2023-02-09 00:30:07 +00:00
Zuul
2aa838ae75 Merge "Fix wrong assertion methods" 2023-02-08 20:03:23 +00:00
Takashi Natsume
e7b1426e31 Fix wrong assertion methods
Replace 'called_once_with' with 'assert_called_once_with'.

Change-Id: I18b55da0d1f142818e7ea14f6eebcc0f0f0cd23f
Closes-Bug: 1989280
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2023-02-05 22:33:35 +00:00
Eric Harney
0bc4771ee5 Bump hacking to 4.1.0
Bump hacking dependency to the 4.1.0 series.

Change-Id: I8c3792db91fbb253f6a0c89ea9587c3bd43db294
2023-02-01 09:45:18 -05:00
Gorka Eguileor
a82b2ffce5 Support separate privsep logging levels
Currently we don't have os_brick DEBUG log levels in Nova when setting
the service to debug mode.

That happens because Nova is forcefully setting oslo.privsep.daemon
levels to INFO to prevent leaking instance XML details (bug #1784062).

Oslo Privsep now supports per-context debug log levels, so this patch
sets the log level name for its only os_brick privsep context to
"os_brick.privileged" to differentiate it from the service it runs under
which uses the default "oslo_privsep.daemon".

This way even though Nova is still disabling its own privileged calls it
won't affect os-brick privileged calls, allowing us to properly debug
block device attach/detach operations.

Closes-Bug: #1922052
Related-Bug: #1784062
Change-Id: I0de32021eb90ca045845a6c7c7e3d27e52895948
2023-01-26 17:02:22 +01:00
Zuul
655fcc41b3 Merge "Handle FileNotFoundError on get_system_uuid()" 2023-01-25 17:40:42 +00:00
Eric Harney
e43cdf6e1e Bump bandit to release 1.7.0
Use bandit 1.7.0.

Disables B101 globally and allows one instance of B604.

Change-Id: I82a39400520784adb8d26a355cd0e077ad58a530
2023-01-25 10:17:21 -05:00
Eric Harney
6ac170cbc1 Bump mypy version to 0.982
Change-Id: I16548244e6c6d019e8adeeb643a4b1544994ae5b
2023-01-20 12:55:16 -05:00
Zuul
5c36bce2ab Merge "mypy: Annotate utils.get_device_size" 2023-01-20 17:37:30 +00:00
Zuul
b50726da91 Merge "Remove eventlet from requirements" 2023-01-20 16:33:06 +00:00
Brian Rosmaita
c9b82241ea Get ready for tox 4
Changes:
- eliminate whitespace in passenv values
- account for stricter allowlist checking
- removed skipsdist=True, which in tox 4 appears to prevent os-brick
  from being installed in the testenvs
- made 4.0.0 the tox minversion

This patch makes tox 4 the default so that we can hopefully catch
problems locally before they block the gate.

Change-Id: I9f88d024c9d7b4f2761aa4e132ee0bd5b7272207
2022-12-21 08:11:58 -05:00
Zuul
c3f14b467f Merge "nit: correct spelling of Rescanning in debug log" 2022-11-18 15:44:14 +00:00
Eric Harney
dc953012b7 mypy: Annotate utils.get_device_size
Add annotations for parameters of this method.

Change-Id: I3149e0067f97d373333e0901e49725401fc6c068
2022-11-15 13:03:21 -05:00
Eric Harney
acefd44df0 Remove eventlet from requirements
Eventlet hasn't actually been a direct os-brick
requirement since Ussuri Change-Id I9684db.

Leave it in test-reqs since we have a unit test
that mocks it.  (Used via oslo.service.)

Change-Id: I9a72d41c9bb70ad568e5cd9218730b93b226b202
2022-11-09 10:48:12 -05:00
Felipe Reyes
bc96120b7e Handle FileNotFoundError on get_system_uuid()
On some platforms there is no 'dmidecode' program (e.g. s390x), when
privsep attempts to run a program that's not found, it raises a
FileNotFoundError instead of ProcessExecutionError.

Closes-Bug: #1994083
Change-Id: I6fc43ab7e243d50b74036d1af5f9e8f880401cc6
2022-10-24 20:37:49 -03:00
Rajat Dhasmana
22830d7077 nit: correct spelling of Rescanning in debug log
Change-Id: Iba31b709ef0009891d0098600387e3fe6b1af26d
2022-09-24 18:48:14 +00:00
tushargite96
0639af4fc8 Update metadata in setup.cfg
we are using some "aliases" that the setuptools docs say 
"are supported for compatibility reasons" but their use is not advised[1].

[1] https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#metadata

maintaining setup.cfg as per other repos[2]

[2] https://review.opendev.org/c/openstack/cinder-tempest-plugin/+/828475

Change-Id: I9ab95a274f79bbcd8a706662e9e03d0bdcb45654
2022-09-23 14:29:46 +00:00
4a12f1b4da Add Python3 antelope unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for antelope.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Ic5ed8169a799ec83621a0677d75f47823c880ffe
2022-09-09 10:27:46 +00:00
5a523e0539 Update master for stable/zed
Add file to the reno documentation build to show release notes for
stable/zed.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/zed.

Sem-Ver: feature
Change-Id: Ia775c42636307fa35d0612937e4c949c0cc2193b
2022-09-09 10:27:45 +00:00
Zuul
1f928e3015 Merge "Add mypy-report directory to .gitignore" 2022-08-25 18:41:45 +00:00
Eric Harney
47dda4b487 mypy: lvm.py
Change-Id: I27a565b8ca250f6790061932ab000946dedd97c5
2022-08-25 14:00:42 +00:00
Eric Harney
f5d5371cbc mypy: initiator/linuxrbd
Add type coverage for initiator/linuxrbd.

Change-Id: Id9a3bf8b1e8aea14cd2cf1eae6907c9719aad3b0
6.1.0
2022-08-25 09:59:32 -04:00
Zuul
0e3ab3bd74 Merge "RBD: Improve IOWrapper's close & flush methods" 2022-08-25 13:57:27 +00:00
Brian Rosmaita
7131b14806 Add mypy-report directory to .gitignore
We forgot to include this on change I6d09422dbdf5ea58 that introduced
mypy to os-brick.

Change-Id: Iba1bbf0f4256f6783370a697df3f11137039dbc0
2022-08-25 09:03:04 -04:00
Gorka Eguileor
fafd1a6f76 RBD: Improve IOWrapper's close & flush methods
The RBDVolumeIOWrapper class inherits from io.RawIOBase but its close
method doesn't flush and after being called the "closed" attribute still
returns False.

Trying to set the "closed" attribute ourselves in
RBDVolumeIOWrapper.close results in an error, so we call the parent's
implementation to do it.

The parent's close method will also call the flush method.

This change ensures that rbd_image.close is only called once, that the
closed attribute is correct, and that the data is flushed on close.

Without these changes we could have, unintentionally, multiple calls to
the rbd_image.close method.  If we called close on the wrapper
ourselves, then when the Garbage Collector is cleaning up the wrapper it
will call the io.RawIOBase finalizer that will see that the file is not
closed and call close again.

Now that we correctly set the closed flag on the instance, the flush
method should also behave like the parent implementation and fail if it
has already been closed.

Change-Id: Ib3b066a7da071b1c2de78a1a4e569676539bd335
2022-08-24 21:43:28 +02:00
Zuul
5b62f84c63 Merge "NVMe-oF: Get system uuid in privsep" 2022-08-24 14:18:27 +00:00
Gorka Eguileor
da4561165d NVMe-oF: Get system uuid in privsep
Move the _get_system_uuid method from the NVMeOFConnector connector to
os_brick/privsep/nvmeof.py renaming it to get_system_uuid and running it
as privileged.

This allows us to read sys/class/dmi/id/product_uuid file in Python
instead of running a subprocess to execute cat.

It also allows the connector to have one less privsep calls if the file
doesn't exist, because it can execute the dmidecode command directly
without making another request to the privsep daemon.

Change-Id: I8f2edef6fda97af0ff3f92e39c8b24a85b6c3402
2022-08-24 10:50:37 +02:00
Zuul
4e56e046cb Merge "NVMe-oF: read mdstat in Python" 2022-08-23 23:21:14 +00:00
Zuul
4acfd6bc7e Merge "mypy: Update format to future __annotations__" 2022-08-23 19:15:18 +00:00
Eric Harney
6de226ed18 mypy: Update format to future __annotations__
Use dict[], list[] etc. instead of Dict[], List[].

This works on all versions of Python that we support.

Change-Id: If9c737277c041ffd2d3bca1863d300ae7d9bd52e
2022-08-23 15:21:17 +00:00
Eric Harney
794f006f93 mypy: os_brick/encryptors/__init__.py
This coverage is somewhat limited because this
uses classes (context, keymgr) that live outside
of os-brick and therefore don't have type definitons
here.

Change-Id: I7827a870c04a7a6e02510b7909430feebb70e6f1
2022-08-23 15:12:04 +00:00
Eric Harney
aa97f4455c mypy: set no_implicit_optional
The current version of PEP-484 indicates that
type checkers should not allow implicit optional
parameters.

- https://www.python.org/dev/peps/pep-0484/#union-types
- https://github.com/python/mypy/issues/9091

Change-Id: Ie3301798462a89af9fc0053070055a77a2437415
2022-08-23 15:11:56 +00:00
Eric Harney
25756c1279 Move mypy job to check queue (non-voting)
Change-Id: I9ef0580f015fe251d9c118a191465c7453447522
2022-08-23 15:03:58 +00:00
Gorka Eguileor
da2bfa41f5 NVMe-oF: read mdstat in Python
The get_md_name uses the contents of mdstat using cat and piping it to
grep and then to awk using a privileged shell, but there's no need to do
that.

Actually the mdstat file has 0444 access, so we can read it in Python
directly instead of having to call the privsep daemon to create the
subprocess with the shell.

This patch changes the current implementation of the method to do the
reading and searching in Python.

Change-Id: Idbba6f9a6d928aa94d2920fc1bf8b6e2a0626a07
2022-08-23 12:18:17 +02:00
Eric Harney
dfa1d167b9 mypy: initiator/connectors/rbd.py
Change-Id: I55a8baba7e40dc0fe9427231e293a3273936b4be
2022-08-22 11:31:00 -04:00
Eric Harney
b3f89a304f mypy: privileged/rbd.py
Change-Id: I0f0f61dc7a247af2a701c76993f9966e0c812b7e
2022-08-18 18:38:18 +00:00
Eric Harney
2a071914f5 Bump mypy version to 0.960
Change-Id: Ic79f2cb18c32b0670abb2a531259e0e217db0734
2022-08-18 18:37:50 +00:00
Eric Harney
02f4dcf658 mypy: improve utils.py coverage, update format
Change-Id: If8a6058d0112f10cdad22cd1059fd2906615e0f3
2022-08-18 14:36:30 -04:00
Eric Harney
35bf3cb4a6 mypy: privileged/nvmeof.py
Change-Id: I6cc75ebe936443630c2e87b7c31bbfe14f753ae4
2022-08-18 18:35:16 +00:00
Eric Harney
a519dd8d07 mypy: initiator
Change-Id: I96d0a1b1276b3c666e8deb251e5bb71c68fc9a30
2022-08-18 14:34:01 -04:00
Eric Harney
d5820f5319 mypy: work around mypy bug #13214
Turn off in-project stubs for now until this bug
is fixed and in a mypy release we can consume.

https://github.com/python/mypy/issues/13214

Change-Id: Ica954cffd760d7a9d48ba38d01e0e01e84553ff8
2022-08-18 14:04:26 -04:00
Zuul
b41b3c8814 Merge "Add flake8-logging-format extension" 2022-08-11 18:45:14 +00:00