This changes the default setting for use_nova_server_config_drive
from False to True. By default, nova does not use a config
drive for launched instances. Therefore trove must implicitly
request the config drive be used so that it can inject
guest_info.conf into the guest VM.
This commit also adds an error to guestagent when guest_id
is missing. If the guest_id configuration parameter is not
set at guestagent startup it will throw a RuntimeError. This
case typically occurs because guest_info.conf was
not injected into the guest, or was not included in the set
of configs that guestagent reads at startup.
And finally, this commit adds a section in the 'building guest
images' documentation describing how configuration is injected
into the guest agent.
Change-Id: I084c841472183893a63ca7b70d560f44a2f08901
Partial-Bug: 1609915
- Update the description.
Dangling mocks are no longer detected after
every single test case.
- Use a preffered pattern for unmocking.
- Allow the 'patch_conf_property' take an optional
'section' argument and add examples on configuration
mocking to the doc.
- Add extra examples on object mocking.
Change-Id: I9dc6d26ca879b0d5e1b16d1bdbc97b2a81351781
As discussed in the Liberty Design Summit "Moving apps to Python 3"
cross-project workshop, the way forward in the near future is to
switch to the pure-python PyMySQL library as a default.
https://etherpad.openstack.org/p/liberty-cross-project-python3
BaseMySqlRootAccess.enable_root(): catch also InternalError because
the PyMySQL error is not wrapped into a SQLAlchemy OperationalError,
but a generic SQLAlchemy InternalError. Similar change is made in
026_datastore_versions_unique_fix.py.
This change requires a trove integration change to add the PyMySQL to
the guest image: Id4d013d174ba40a453819f900aaa316a93e59b48.
Partially implements: blueprint trove-python3
Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Depends-On: Id4d013d174ba40a453819f900aaa316a93e59b48
Change-Id: I65e8a8d5dc251a8b00529cdfb1a6ada3d5720f68
The point behind the addition of the stevedore.sphinxext extension is
"to document drivers and other types of plugins to make the available
sets built into projects easier to discover"(dhellman).
More details in the ML thread at
http://lists.openstack.org/pipermail/openstack-dev/2015-August/073338.html
Change-Id: Ib1d4c23a64cbd0010c88ff77b97b1173da302bed
The glance command line parameter changed from
--public to --is-public {True|False}. Updated it in
documentation
Change-Id: Icfc81966608ace049fceef260ec2b18d9e3570bb
The Issue:
Dangling mock objects in global modules (mocked members of imported
modules that never get restored) have been causing various transient
failures in the unit test suite.
The main issues posed by dangling mock objects include:
- Such object references propagate across the entire test suite. Any
caller may be hit by a non-functional or worse crippled module member
because some other (potentially totally unrelated) test case failed to
restore it.
- Dangling mock references shared across different test modules may
lead to unexpected results/behavior in multi-threaded environments. One
example could be a test case failing because a mock got called multiple
times from unrelated modules.
Such issues are likely to exhibit transient random behavior depending
on the runtime environment making them difficult to debug.
This contribution is aiming to provide a simple transparent detection
layer that would help us prevent (most of) such issues.
Solution Strategy:
We extend the 'testtools.TestCase' class currently used as the base
class of Trove unit tests with functions that attempts to detect leaked
mock objects in imported modules. The new 'trove_testtools.TestCase'
implementation basically retrieves all loaded modules and scans their
members for mock objects before and after each test case.
An outline of the procedure follows:
1. Override the setUp() method and add a cleanup call (executed after
the tearDown()) to collect mock references before and after a test case.
2. Subtract the two sets after each test case and mark it as failed if
there are any new mock references left over.
Code Impact:
The existing test classes replace 'testtools.TestCase' base class with
'trove_testtools.TestCase'.
Documentation Impact:
Added a short document on recommended mocking strategies in unit tests
to the Trove Developer Documentation.
Known Limitations:
The current implementation has a configurable recursion depth which is
the number of nested levels to examine when searching for mocks.
Higher setting will potentially uncover more dangling objects,
at the cost of increased scanning time.
We set it to 2 by default to get better coverage.
This setting will increase test runtime.
Recommended Mocking Patterns:
Mock Guide: https://docs.python.org/3/library/unittest.mock.html
- Mocking a class or object shared across multiple test cases.
Use the patcher pattern in conjunction with the setUp() and tearDown()
methods [ see section 26.4.3.5. of Mock Guide ].
def setUp(self):
super(CouchbaseBackupTests, self).setUp()
self.exe_timeout_patch = patch.object(utils, 'execute_with_timeout')
def test_case(self):
# This line can be moved to the setUp() method if the mock object
# is not needed.
mock_object = self.exe_timeout_patch.start()
def tearDown(self):
super(CouchbaseBackupTests, self).tearDown()
self.exe_timeout_patch.stop()
Note also: patch.stopall()
Stop all active patches. Only stops patches started with start.
- Mocking a class or object for a single entire test case.
Use the decorator pattern.
@patch.object(utils, 'execute_with_timeout')
@patch.object(os, 'popen')
def test_case(self, popen_mock, execute_with_timeout_mock):
pass
@patch.multiple(utils, execute_with_timeout=DEFAULT,
generate_random_password=MagicMock(return_value=1))
def test_case(self, generate_random_password, execute_with_timeout):
pass
- Mocking a class or object for a smaller scope within one test case.
Use the context manager pattern.
def test_case(self):
# Some code using real implementation of 'generate_random_password'.
with patch.object(utils, 'generate_random_password') as pwd_mock:
# Using the mocked implementation of 'generate_random_password'.
# Again code using the actual implementation of the method.
def test_case(self):
with patch.multiple(utils, execute_with_timeout_mock=DEFAULT,
generate_random_password=MagicMock(
return_value=1)) as mocks:
password_mock = mocks['generate_random_password']
execute_mock = mocks['execute_with_timeout_mock']
Change-Id: Ia487fada249aa903410a1a3fb3f717d6e0d581d2
Closes-Bug: 1447833
It has long been felt that we need more (better) documentation on
building guest images. This document is a starting point in that
direction.
Authored-By: Amrith Kumar <amrith@tesora.com>
Co-Authored-By: Peter Stachowski <peter@tesora.com>
Change-Id: I2fe0cd1856778a47f1bfad2b9098a1f98e701f91
OpenStack hosts things in places that are not github. Also, it seems
that there is a big blob of unrelated readme in the README file.
Closes-Bug: 1399839
Change-Id: I70cc6772b50591c4b3badd6c92567a7a6541bacf
Remove intersphinx from the docs build as it triggers network calls that
occasionally fail, and we don't really use intersphinx (links other
sphinx documents out on the internet)
This also removes the requirement for internet access during docs build.
This causes docs jobs to fail because we error out on warnings.
Change-Id: I71e941e2a639641a662a163c682eb86d51de42fb
Related-Bug: #1368910
* rename db_wipe to db_recreate
* make --repo-path an optional argument for db_wipe and use it
* add command line help strings for db_wipe
Closes-Bug: #1279734
Change-Id: I1a1d3ad56989026fb10f6c57bb479814dc51328e
Trove depends on MySQL-python package, to compile and install it is
required libmysqlclient-dev, otherwise the installation procedure
described in 'doc/source/dev/manual_install.rst' will fail in recently
installed boxes.
Closes-Bug: #1261525
Change-Id: I0cc325eb7efb056efe9682fa3478795ae025bfa1
Previously, instances updated their status by
updating the database on the host directly.
Necessarily, each instance would need access to the
database to stay updated.
Trove's new conductor service eliminates that need by
working as a proxy for those instances. By sending a heartbeat
to conductor via RPC, conductor updates the database
on the host on behalf of the instance.
As backups also made use of the host database, the backup
code has been refactored to take richer inputs to remove
the need to query the host database, and now conductor is
also used to submit updates to backup states.
Implements: blueprint trove-conductor
Change-Id: I4cb34baedd0e3a50051f9e66de95c9028c66e4b5
Some files still use trademark OpenStack LLC in header, which
should be changed to OpenStack Foundation.
NOTE: tools/install_venv.py is not touched, should sync with oslo,
so does trove/openstack/common/*
Change-Id: I7218ae896eb7db681bb224a209df47f203952606
Fixes-Bug: #1214176
Added initial sphinx/docutils documentation for Trove. Also made
corresponding changes to setup.cfg so that OpenStack CI is able
to build the Trove developer docs.
Fixes blueprint: trove-dev-docs
Change-Id: I900ffd2c0b661fb7642fa06c08ee92892eb176f0