Commit Graph

59 Commits

Author SHA1 Message Date
Harry Rybacki 265146ed2e Become 1.3.0
Change-Id: Ia5d9f82219ceffd50e5d1b3f3be3c216a63e2e74
2019-12-17 09:43:36 -05:00
Harry Rybacki b971c7836f Become 1.2.0
Change-Id: I5b26e62b0de1204284b30a0dc972e1dd6534f608
2019-09-12 13:16:39 -04:00
Harry Rybacki 4f1353bb1f Handle add_host and delete_host cases more robustly
Presently novajoin has no way of differentiating between hosts and
hostnames. As a result, it is possible for a host to be inadvertantly
deleted in certain conditions.

This fix aims to resolve this and other join/delete edge cases  by
passing the instance-id (server uuid) from nova along in the
description field that is passed to IdM. We can use this
description and id to ensure we delete only the hosts we meant to.

Overview of changes:
- Persist nova instance-id in IdM's Description field
- Update join logic to handle hosts with old Description field
- Update join logic to cause nova deploy failure when attempting to
  add a host with a hostname that is already enrolled
- Add new DuplicateInstanceError exception type
- Add new DeleteInstanceIdMismatch exception type
- Add inline comments documenting code flow
- IPAClient add_host doc strings for clarity

Change-Id: I676bac162a6ec35366c506bdb660cf3913131afd
2019-09-12 09:26:39 -04:00
Ade Lee ade787b90c Add debug messages
We are having a hard time keeping track of which operations
correspond to which request.  This patch adds the ability to track
operations in the notifier with the message_id of the notification
being processed.  This message_id (which is generated by oslo is
a uuid

For the server, we could also set the message_id to the request_id
of the python-requests object received, but this is already
logged as part of the server logs.

Change-Id: Ie8b885a2b5cba6684e92c49eed4a99d24621402e
2019-08-22 07:54:17 +00:00
Ade Lee 9750c363f6 Refactor method names
Debugging is confusing when the same names are used for methods
in two different controllers.  Fixing this to more accurately
reflect whats going on.

Change-Id: I3740cd3ae81776cb1ecf066e617e615d880dc2e8
2019-08-20 11:02:18 -04:00
Ade Lee 6ed30c9476 Fix backoff mechanism
Right now, the backoff mechanism is broken when the backoff is
set to something non-zero.  Basically, you go into this state where
you retry ad infinitum, leading to inconsistent behavior.

This change fixes the mechanism so that you only get a fixed number
of retries.  You can choose (through a new config parameter) to allow
backoff (or not).

To restore some of the old behavior, the default for the connect_retries
parameter has been increased from 2 to 4, and the max backoff time has
been decreased from 1024 to 512 seconds.  Its unlikely that we'd ever
reach that backoff time without a large number of retries, but 1024
seems too long.

And there is a new exception that is thrown when the connection
fails.  This will result in nice 500 errors in the novajoin-server,
and some log messages for the notifier.

Change-Id: I10547fbde8966c8694346ed8c054e627bee2ee51
2019-08-20 11:02:07 -04:00
Grzegorz Grasza 74fd4c4357 Become 1.1.1
Change-Id: Ia5483264808812e8b7550aa44240d05c9b7337de
2019-02-07 19:33:24 +01:00
Grzegorz Grasza b3f961e331 Become 1.1.0
Change-Id: I38e1cb161dabec02de72a7d22cb1ace7cda6f142
2019-01-08 13:54:33 +01:00
Ade Lee c75c4c05a1 Become 1.0.22
Change-Id: I2a44e1e52317c1bf05aa76e07c7bd5283521e02e
2018-12-13 00:05:49 -05:00
Douglas Mendizábal 2c0091d23d Handle compact services on multiple lines
This patch adds logic to handle compact service metadata that
has been split into multiple lines to avoid hitting the metadata
size limit.

Co-Authored-By: Grzegorz Grasza <xek@redhat.com>
Change-Id: Ida39f5768c67f982b2fe316f6fae4988a74c8534
2018-12-12 20:56:16 +00:00
Grzegorz Grasza 609f6e2b2b Support versioned notifications
Support nova versioned notifications. Unversioned notifications
are still supported and the default. The CI is configured to test
versioned notifications, and both implementations use the same methods.
Because of this, testing versioned notifications also covers
unversioned notifications, since the execution path flows through both.

Change-Id: If028afa9e9fbcb344786cd287605e0d9af5d3c01
2018-11-26 10:57:26 +01:00
Grzegorz Grasza 4d997dddc6 Support for associating and disassociating neutron floating IPs
This adds support for creating and removing DNS A records when
floating IPs are associated and disassociated in neutron.
novajoin-install and functional tests are enhanced to test it.

Change-Id: I82c83ad9e8c84ddfd4ecfc4d5c3b31a418af97a7
2018-11-22 15:40:05 +01:00
Grzegorz Grasza 7fa5789e51 Refactor notifications
Make a registry of different types of processed events
instead of an endless if/elif clause.

Change-Id: I34ebdca82810b9abd46a84aca7f1a8febf718be6
2018-11-22 12:28:50 +01:00
Ade Lee fde8eb6867 Become 1.0.21
Change-Id: Ibc015732185781c8b6a213794b828a5a759381a7
2018-11-09 13:46:09 -05:00
Juan Antonio Osorio Robles 0b05c95388 Become 1.0.20
Change-Id: I4107242b32f889e03f42f6eb361b3a4564cbbfec
2018-10-23 09:40:55 +03:00
Ade Lee 3d58511664 Become 1.0.19
Change-Id: If4c572071d6e6337146316d31ec95e0c80e4f92b
2018-08-24 13:39:43 -04:00
Juan Antonio Osorio Robles 12552eb4d0 Become 1.0.18
Change-Id: I0614372265510b3f210a9465a4689822e134d768
2018-02-22 15:57:05 +02:00
Juan Antonio Osorio Robles e2a15af973 Implement updating services based on update notifications
This implements adding additional services via the metadata interface by
reacting on the compute.instance.update notifications. This effectively
covers updates from already enrolled nodes with some services towards
adding new services.

Note that this still requires folks to remove services manually if
they're no longer used.

Another important thing to note is that this doesn't yet cover updates
from non-enrolled deployments to enrolling them and adding services.

Related-Bug: #1715295
Change-Id: I48ab94a184657f6730281740935a05143abbc499
2018-02-06 13:13:47 +00:00
Rob Crittenden 67896f8a9c Become 1.0.17
Change-Id: I58bee7a7b681e16f4bae0b34f3b9b1df519e9c18
2017-09-14 14:29:59 -04:00
Rob Crittenden c422f02c7b Become 1.0.16
Change-Id: I96145b22bcf5c9287e94f9755e92ec221c9f3070
2017-08-28 17:08:55 -04:00
Jenkins a427d5eef8 Merge "Replace oslo.messaging.get_transport with get_notification_transport" 2017-08-28 19:46:36 +00:00
Rob Crittenden dbafbd603a Become 1.0.15
Change-Id: If721e580020112eec9ab326612d595162885274c
2017-08-21 11:40:16 -04:00
Rob Crittenden f34e8807da Become 1.0.14
Change-Id: I3240c98e9c291a0e592cef4be085867a99596014
2017-08-04 09:59:51 -04:00
Vu Cong Tuan b56fe27192 Replace oslo.messaging.get_transport with get_notification_transport
DeprecationWarning: Using function/method 'oslo_messaging.get_transport()'
is deprecated: use get_rpc_transport or get_notification_transport

Change-Id: I6d940c89a2dc580996a3f4dd308c483b0e43589b
2017-06-06 11:53:23 +07:00
Rob Crittenden 652c5f96d7 Become 1.0.13
Change-Id: I9a48b9a558eccd038c210ca38fc46d55ead8e1a6
2017-05-26 11:17:20 -04:00
Rob Crittenden b368b95dbc Become 1.0.12
Change-Id: I0de5786758d4ccdb95539013e7beada5c924b03a
2017-03-29 10:46:08 -04:00
Rob Crittenden 1eae7a670b Make the IPA connection code more robust for notifications
Notifications can be multi-threaded but each thread was sharing
the same IPAClient instance which was causing contention in the
retry code (and likely the ccache).

Move the IPA object closer to execution so each notification will
have its own instance. This will mean more kinit activity but
each one will be isolated and be able to handle expired tickets,
IPA being down, network issues, etc.

Add backoff code on failures so we don't spam the IPA server with
retries. It is a by-two backoff from 2 - 1024 seconds.

NOTE: novajoin-server will not use this backoff code. It will
continue to use the retries configuration setting. This is because
we know there is a limited window to respond so cannot infinitely
do a retry unlike notifications.

Change-Id: Ia18d3f97f7549c89dcf4e6f014f44c3fcebc919f
2017-03-14 12:19:26 -04:00
Rob Crittenden df4ddd75e9 On compute.instance.delete.end only delete from IPA if enrolled
Check ipa_enroll in the instance and image metadata to see if
enrollment was requested before attempting to delete a host
from IPA.

Change-Id: Iccc833db47da09b97a16c02e5b184b8f9e1d97d1
2017-02-28 00:32:12 -05:00
Juan Antonio Osorio Robles a2be36b83b Stop requeuing notifications
If we have our own queue, we don't need to requeue the notifications. On
the other hand, requeuing would then lead to a lot of messages lingering
on the queue, which we would need to clean up manually. Consuming the
messages without requeuing saves us from this issue.

Change-Id: I31af8f74e2115e1fe3a01e5ae55e050c1f24704e
2017-02-27 16:45:45 +02:00
Juan Antonio Osorio Robles 863224fe60 Allow notifications topic to be configurable
Using the default notifications topic results in race conditions with
other services that consume these, where this will sporadically work
depending on who gets the notification first. Making this configurable
allows us to avoid these issues by having a novajoin specific queue.

Change-Id: I86b2a9df317e8f9a877d7619a2918e50d58b7c85
2017-02-27 16:45:40 +02:00
Rob Crittenden b33684b781 Become 1.0.11
Change-Id: I8dbebe0fc293867117702c1b16439db9a702dc89
2017-02-14 10:09:10 -05:00
Jenkins 1a5bd2fce3 Merge "Implement service_has_hosts and host_has_services" 2017-02-10 16:44:39 +00:00
Rob Crittenden 674781d049 Implement service_has_hosts and host_has_services
These methods are used to decide whether a given host or service
can be removed or not. We want to avoid deleting hosts that
manage other services or services being managed by other hosts.

Change-Id: I45f3d49e53a3f1bdeed149ae0790d820c87a9a58
2017-01-17 19:42:40 +00:00
Rob Crittenden 2fe8558d80 Don't try to handle compact messages if no compact_services
If compact_services is not set in the instance metadata
then there is no need to call handle_compact_services()

Change-Id: I4c7d098cd2ced4f7903fb048122a924304585347
2017-01-09 21:02:04 +00:00
Ade Lee b98afddf53 Add code to remove compact and managed hosts on delete notification
Change-Id: Ideb455a1b2723b22425ec17fa89f26918693c52b
2017-01-05 11:34:36 -05:00
Rob Crittenden 28a010e3ae Make domain an optional configuration option
This will use the IPA domain by default. If a domain is specified
then it will be used.

For testing, if there is no config option and IPA is not available
then the domain 'test' will be mocked.

Change-Id: I21b66c61830c49a79094927f42c22c76ec1b447c
2016-12-15 16:57:29 -05:00
Rob Crittenden b9698f3bab Become 1.0.10 2016-11-30 04:37:12 +00:00
Rob Crittenden 7fbf469990 Become 1.0.9 2016-11-29 16:15:41 +00:00
Rob Crittenden dcf5d621d7 Move the configuration file to /etc/nova/join.conf
This was requested by the puppet team for inclusion in the
puppet-nova module. It does make a certain amount of sense for
all nova-type configuration to exist in a single place.

oslo.config isn't really made to handle this type of thing. If
project='nova' and prog='join' it would still find
/etc/nova/nova.conf first and try to load that instead. So I
had to duplicate some of the oslo.config code and hard code
nova and join in order to simulate the previous behavior but
work for my purposes.

The original location, /etc/join/join.conf, is the final
fallback to support any existing installations.
2016-11-29 16:14:37 +00:00
Rob Crittenden 923739e15f Become 1.0.8 2016-11-17 16:32:20 +00:00
Rob Crittenden 025c81c35b Become 1.0.7 2016-11-10 14:39:41 +00:00
Rob Crittenden ef2c9baa36 Address issues found by pep8, pylint and unit tests
flake8 is quite a bit more picky and discovered a lot of
issues.

Don't let missing configuration blow things up in order to be
able to run unit tests.

Hacky workaround for missing ipalib/ipapython in PyPy
2016-11-09 19:52:38 +00:00
Rob Crittenden 981927d722 Become 1.0.6 2016-10-07 10:31:36 -04:00
Rob Crittenden cffcc2ca08 Remove OTP cache (again)
The sqlite cache wouldn't work in an HA system as one can never
tell which controller is going to be requested. This would require
a shared or replicating database backend which is simply overkill
for this.

Instead let the last request win. With each request for metadata
generate a new OTP and update the value in the host record in
IPA.
2016-10-06 17:51:50 -04:00
Rob Crittenden 8a48b623ea Become 1.0.5 2016-10-04 10:54:14 -04:00
Rob Crittenden 29cac09eef Become 1.0.4 2016-09-22 13:11:54 -04:00
Rob Crittenden b1c36e62e9 Become 1.0.3 2016-09-20 13:18:28 -04:00
Rob Crittenden e0eb3eed51 Address more issues reported by pylint
This does not bring it to 100% passing but it gets a lot closer.
2016-09-20 09:02:32 -04:00
Rob Crittenden 7fb07ad480 Add target for pep8 and lint, fix initial batch of issues
There are still quite a few lint errors to address but none
of them seems critical.
2016-09-20 09:02:32 -04:00
Rob Crittenden 861f151c4b Become 1.0.2 2016-09-07 14:39:40 -04:00