At the moment, those tests use fcntl to acquire file locks, which
will fail on Windows.
This change addresses this issue by adding some platform checks,
using the appropriate functions when handling file locks. Note that
we've avoided running private methods from fasteners.
Also, we now avoid using os.fork, which won't work on Windows.
Instead, we spawn new processes using multiprocessing.Process, using
queues for communication between processes.
Change-Id: I9839b9033c814280f6d1b53c5ed2643fd2bf8bf8
Many assertEqual sentences don't follow assertEqual(expected, actual),
These misplaces have 2 impacts:
1, giving confusing messages when some tests failed.
2, mislead other developers, new test modules may follow these wrong pattern.
This patch fix all of them.
Change-Id: I00bb4801c208d0eb8078e8a34ae52f9bcfe0b1a6
Closes-Bug: #1604213
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv. This commit also removes py34 specific venv.
Change-Id: I50ddda7d96c77e7db60aa0b42e8e3b701dadf404
Add an optional timeout parameter to ssh_execute() method of
oslo_concurrency.processutils. Timeout is None means infinity,
which is the default.
Change-Id: I45532799ecd23ff8c5572036d06725e71965b2b5
Closes-Bug: #1580826
The original commit adding support for process limits only wired
up address space, max files and resident set size limits. This
is not sufficient to enable nova to protect qemu-img commands
against malicious images.
This commit adds support for the remaining limits supported
by python: core file size, cpu time, data size, file size,
locked memory size, max processes and stack size.
Related-bug: #1449062
Change-Id: I164c4b35e1357a0f80ed7fe00a7ae8f49df92e31
There was a complaint that the usage examples in oslo.concurrency
are lacking (which they are) so this addresses some of those concerns
by adding a few usage examples (and descriptions).
Change-Id: I0738b898f1235e83a600c7732d70058b3fd3860f
This reverts commit 5021ef82fd8f0323b82d6d010bff9dab8a0cbcec.
That commit set default location for lock files to a world-writable
directory (like /tmp) which violates security precaution stated right in
the help string of lock_path config variable: lock_path should be
writable by the user of the process using it only.
There is some history behind this:
- when we decided to not do tempfile.mkdtemp if lock_path were not set
(because it was broken), it broke upgrades for all components
(starting with Cinder;
- it was suggested to provide the same default value:
https://review.openstack.org/60274
but it was not accepted because it weakens security;
- there was a thread about this in ML, please read it for more history:
http://lists.openstack.org/pipermail/openstack-dev/2013-December/021055.html
it ended up with understanding that only a project using the library
can provide sane default value for lock_path, not the library itself.
Change-Id: I801004ad3c83862849696f00c6e7ca9877fd496b
Serialising/deserialising exceptions in python follows the protocol
defined by pickle. It relies on the base Exception.__init__ setting
self.args, and later resurrects exceptions with class(*args).
This change rewrites processutils.ProcessExecutionError so it survives a
pickle.dumps/loads round-trip.
Change-Id: I9b8d104f60df868be7b808c72c932d08f1752777
Follow new infra setup for translations, see spec
http://specs.openstack.org/openstack-infra/infra-specs/specs/translation_setup.html
for full details.
This basically renames
oslo.concurrency/locale/oslo.concurrency.pot to
oslo_concurrency/locale/oslo_concurrency.pot. For this we need to update
setup.cfg.
Update also domain name in i18n.py.
Change-Id: Ie774c4252f8481f2541ed0a2cad565d149dfcc72
Add a new oslo_concurrency.prlimit module which is written to be used
on the command line:
python -m oslo_concurrency.prlimit --rss=RSS -- program arg1 ...
This module calls setrlimit() to restrict the resources and then
executes the program. Its command line is written to be the same than
the Linux prlimit system program.
Add a new ProcessLimits class processutils: resource limits on a
process.
Add an optional prlimit parameter to process_utils.execute(). If the
parameter is used, wrap the command through the new oslo_concurrency
prlimit wrapper.
Linux provides a prlimit command line tool which implements the same
feature (and even more), but it requires util-linux v2.21, and
OpenStack targets other operating systems like Solaris and FreeBSD.
Change-Id: Ib40aa62958ab9c157a2bd51d7ff3edb445556285
Related-Bug: 1449062