Commit Graph

80 Commits (fd730c42a32c5c597dd08e496c6a33c7faa579f4)

Author SHA1 Message Date
Joshua Harlow fd730c42a3 Have examples run in the py27 environment and make them work
It is great to ensure that the examples that tooz has actually run
during testing time, so enable this as well as adjust the examples
to create unique group ids and run for a limited amount of time instead
of running forever (and fix a few other brokeness)...

Change-Id: I573cf5946a1d3f13862c0c28cf3a5d7fc6178873
2014-09-19 11:57:56 -07:00
Jenkins 0df6d848ea Merge "Fix the comment which was borrowed from the IPC driver" 2014-09-18 18:05:07 +00:00
Joshua Harlow fccdd173c5 Fix the comment which was borrowed from the IPC driver
Change-Id: If175b23e6d0e4333edadcbda67916f1f4badfe4b
2014-09-18 08:55:51 -07:00
Joshua Harlow 9d0836c710 Be more tolerant of unicode exceptions
When an exception message is in unicode we should not fail
when trying to get that unicode containing exceptions message
so instead of using str() use a new utils function that has
been working in other projects to attempt to convert a exception
message into its corresponding unicode in a safer manner.

Change-Id: I202f12d8f9bf562972b760f91805dba2ad14d804
2014-09-18 17:08:11 +02:00
Jenkins a07fe43b3d Merge "Standardize on the same lock acquire method definition" 2014-09-18 08:36:09 +00:00
Joshua Harlow 12ecba2b73 Standardize on the same lock acquire method definition
It appears the the other drivers have a acquire that does not
take a timeout, but the zookeeper driver has a acquire method that
does take a timeout.

To be more consistent just standardize on the acquire not taking
a timeout paramater and having it provided by the driver options
like the IPC and memcached drivers do.

Change-Id: I86d5197ad57a4c891615e100365347e3e0bdd4c3
2014-09-17 18:19:06 -07:00
Joshua Harlow 3139512c9f Standardize on hiding the lock implementation
It seems like the other drivers (if they use a proxy object
to do the locking) hide the lock in the external non-proxy
object so this changes mirrors that hiding of the proxy object
instead of exposing it.

Change-Id: I2bd8f8c9f66aed960d14784053b9b32999ac394e
2014-09-17 18:07:20 -07:00
Joshua Harlow fab18f8c80 On lock removal validate that they key was actually deleted
Instead of assuming the lock was released (when it might have
not been) be more reliable and return whether it really was
or was not by validating the reply.

Change-Id: I70b2e1946d5101c7fbbf4ed9f15007bb98e92581
2014-09-17 09:01:55 -07:00
Jenkins 90792db9d4 Merge "Use a thread safe deque instead of a queue" 2014-09-17 09:38:26 +00:00
Jenkins 0cdf7a8d8c Merge "Add doc8 to the py27 test running" 2014-09-17 09:35:12 +00:00
Jenkins 9b1e17420f Merge "Change inline docs about class fake storage variable" 2014-09-17 09:21:03 +00:00
Jenkins 07ec935900 Merge "LOG a warning if the heartbeat can not be validated" 2014-09-17 09:19:50 +00:00
Joshua Harlow 3f08c3e933 Use a thread safe deque instead of a queue
Instead of using a queue like a deque just use
a deque directly instead, a queue doesn't seem
to add much value when its used like it was.

Change-Id: I515c14bb16e18c4031f446c7176915c94b3fb8f4
2014-09-16 17:24:07 -07:00
Joshua Harlow 84bb5fbef5 Change inline docs about class fake storage variable
Adjust the docs to better describe why a fake storage
class attribute exists and how it is used and what it
represents compared to a real zookeeper setup.

Change-Id: I255ccd83c8033266e9cee09a343468ae4e0f2bfd
2014-09-16 17:03:06 -07:00
Joshua Harlow e98a937306 LOG a warning if the heartbeat can not be validated
If for some reason the heartbeat can not occur instead
of failing silently it is better to at least log a message
so that operators can investigate the underlying issue.

Change-Id: Ide88314c413afa389d6c039478324d6e47f63e82
2014-09-16 16:55:14 -07:00
Joshua Harlow 781fb760a6 Add doc8 to the py27 test running
To ensure the docs are style checked add in doc8 to the
py27 tox environment so that the docs will be checked.

This also adjusts the one issue that was found in one
of the rst files.

Change-Id: Iea38d4ac53d9c5255e0694a840c38b04530890ce
2014-09-16 16:44:41 -07:00
Joshua Harlow 37a80126f2 Use the more reliable sysv_ipc instead of posix_ipc+lockutils
Remove the usage of lockutils (and surronding oslo modules)
and keep it much simpler by just using the sysv_ipc module
directly.

This adjustment reduces the complexity, test exposure and
API complexity of tooz; removing much of the complex functionality
that was pulled in when sucking in the lockutils module for its
simple (but still broken) posix_ipc logic.

Change-Id: I46db9bda252473317a0f3d65fe0329ac2151f332
2014-09-16 11:27:39 -07:00
Jenkins c5e1c3f96f Merge "Let zake act as a in-memory fully functional driver" 2014-09-16 10:05:05 +00:00
Joshua Harlow 0046b270ab Only start zookeeper/memcached when not already running
Since openstack infra already runs these services (or will)
we should just use them when we can. Also for developers that
already have these services running we should use them when
we can instead of trying to recreate them.

Change-Id: I8655e5365ad36c57836f87e147102e2d02db7830
2014-09-15 19:49:38 -07:00
Joshua Harlow ac6f7d93db Let zake act as a in-memory fully functional driver
The zake driver should theoretically function the same as the
non-local driver so all the same kazoo functions should work,
without the whole distributed part as they work with the regular
zookeeper backed kazoo driver.

Change-Id: I19df0da0e58c5624ca1b10f61c42510f1f104847
2014-09-15 16:38:11 -07:00
Julien Danjou 3981a3a300 Switch to a custom NotImplemented error
Some code in the drivers might actually raise the standard
NotImplemented error, and that would be a bug to skip a test if that was
the case. In that case we want the test to fail.

So let's switch to a custom exception that is used to skip the test if
it's raised.

Change-Id: Ideafee0b1f008ff32724fb98d6a477bd3976104d
2014-09-12 11:20:17 +02:00
Joshua Harlow 9b81673302 Ensure lock list isn't mutated while iterating
While iterating over the acquired lock list we
do not want the lock.release call to mutate the
list that we are currently iterating over. To fix
this just iterate over a copy instead so that the
lock.release can remove without issue.

Change-Id: I157331ca116b97e17d10854b5227ac7ee67fac57
2014-09-10 23:17:45 -07:00
Jenkins beb73ba651 Merge "Move Zake driver code to separated Python module" 2014-09-10 09:24:02 +00:00
Dina Belova faaeb41721 Move Zake driver code to separated Python module
That is needed to prevent Zake driver load in real-life Zookeeper
usage - currently we had the situation when even if you want to use
just KaZoo, you needed to install partially test-requierements
(zake package).

Change-Id: I9664fda2d6e76a6e48776b4a6d92af4c4baf1425
2014-09-05 11:13:03 -07:00
Jeremy Stanley 603bac9b22 Work toward Python 3.4 support and testing
Change-Id: I6dff7188ab26c59facf5b9566c48cb4684c422bb
2014-09-03 19:11:45 +00:00
Joshua Harlow 54dd719079 Unlock the kazoo version
Latching on to an exact version is going to make it for consumers
of tooz+kazoo, which may themselves use a newer version, to be able
to correctly install tooz.

I'm also pretty sure there isn't any reason to bind to exactly 1.3.1
and allowing newer versions (which for now is up to 2.0) should be
fine.

Change-Id: I0dc810c2d9dbf5ff04cb5000b843ad4ac772fc43
2014-08-28 11:49:22 -07:00
Joshua Harlow ca1c3412ac Bump up zake to be using the newer 0.1 or greater
0.1 brings in quite a few new hotness than prior
to it. The big one is multi-client -> single storage
which mimics many zookeeper clients attached to
the same zookeeper.

Change-Id: Iee6f4157743a094dd0d59dc12e66592594d54792
2014-08-26 10:26:09 -07:00
Jenkins 0525da6acf Merge "memcached: switch leader election implementation to a lock" 2014-08-26 16:13:26 +00:00
Julien Danjou 9d7a153c98 Fix zake driver with latest release
Change-Id: I58c7dfa2d61821c335846684f21f82a5e6dfd8e8
2014-08-26 13:26:08 +02:00
Julien Danjou 7221c70469 memcached: switch leader election implementation to a lock
We reuse our lock code to manage the leader election, a.k.a. eat our own
dog food.

This also fixes the issue that all lock were not released when stop()
was called.

Change-Id: Ibbec3e8ac29d55247ec3b1b8941d5a9569b67677
2014-08-21 17:10:30 +02:00
Yassine Lamgarchal fe7af7b3c1 Add the generation of the documentation in tox.ini
Change-Id: I0a07cf1624b8f75ced8689804b1b1d0e4fbf91aa
2014-08-20 17:01:07 +02:00
Yassine Lamgarchal 9c3f75621d Add coverage report
Change-Id: Ia520e5f0e96612fe9d0223a2fba1f49bcaa5070f
2014-08-19 14:55:40 +02:00
Julien Danjou d38fe0301d Switch to URL for loading backends
This allow to pass options in a single string, which is going to be
easier for managing options.

Change-Id: I32409c09153b8abaf2b36c31f0bbf658a9d653bc
2014-08-07 18:12:51 +02:00
Julien Danjou 30588b877a Import network_utils from Oslo
This to avoid the URL parsing bug in old Python 2.7.

Change-Id: Ic3bc51a6dc3c7ce04405d1f5c1a67a491fcfaa77
2014-08-07 18:09:28 +02:00
Julien Danjou f3e11e40f9 coordination: add IPC driver
For now it only supports locking.

Change-Id: Iccbc1da162e70d0186131adc0ac9cfeb20f7a647
2014-08-04 15:03:06 +02:00
Julien Danjou 09e527453c coordination: raise NotImplementedError as default
This simplifies the code of drivers not implementing basic stuff.

Change-Id: I6b966af8c04e383af444ee8300c10e139259f403
2014-07-31 13:28:02 +02:00
Julien Danjou fc85db067a Add documentation
Change-Id: Ib236d2061f5f375f7314993db7e6fc38d0f8750b
2014-07-18 15:08:14 +02:00
Julien Danjou 90b977ee5e Upgrade hacking requirement
Change-Id: I61a853751bd6e459b0d78cd526e098c7f4a48081
2014-07-16 10:58:20 +02:00
Julien Danjou f438de0fdf memcached: use retrying rather than sleeping
That should allow better handling of retrying, sleep delays, etc.

Change-Id: I7658b4d5bacb0aef84a8c377a7e487327011b7ee
2014-07-15 15:58:15 +02:00
Julien Danjou 135a523a94 Use retrying instead of our custom code
This pulls in retrying that handles the retry logic better than ours
custom made one.

Change-Id: Iedf00e245702add4cf122ed39732378de44eb3db
2014-07-15 15:58:15 +02:00
Longgeek cfdf585f2a Update requirements file matching global requ
Change-Id: I75f50b3f028a57f65856ee24ea48720cfacd51aa
2014-07-01 02:50:12 +08:00
Julien Danjou 57d24bd54b memcached: implement leader election
Change-Id: I82bfdce0174410f7cb15bf594fa4c6a364881df1
Co-Authored-By: Sahid Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
2014-06-20 15:04:09 +02:00
Julien Danjou 698f554c9d Fix a race condition in one of the test
It appears that sometimes with memcached, the acquire of the lock takes
a little more time than expected, so let's be blocking instead to be
sure we grab it.

Change-Id: I87031c8c3523d0ec5dec1a9e3e585cfa3821eb8b
2014-06-20 15:04:09 +02:00
Julien Danjou 26e6243772 memcached: add locking
Change-Id: I18d5358278e31fcff1cbd1c20b7be814052cae05
Co-Authored-By: Sahid Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
2014-04-14 11:08:24 +02:00
Julien Danjou 7ac1d2110c coordination: implement lock mechanism in ZK
Change-Id: I0372200abbb79d2812a0e89317518e58d754845a
Co-Authored-By: Sahid Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
2014-04-14 10:57:48 +02:00
Julien Danjou d991188d7c coordination, zookeeper: add get_leader()
Change-Id: I6b62057221b0a382c5605d730c439054e9bb1649
Co-Authored-By: Sahid Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
2014-04-07 14:01:06 +02:00
Julien Danjou dda34fac81 coordination, zookeeper: implement leader election
Change-Id: Ic3d1934b87be37ba56f744abd045adb634bcdb08
2014-04-07 13:54:34 +02:00
Jenkins 3123c5a1fe Merge "memcached: add support for leave events" 2014-04-04 09:24:38 +00:00
Jenkins b10f37a4aa Merge "coordination: remove wrong comment in tests" 2014-04-04 09:21:02 +00:00
Julien Danjou e2765b6dd6 coordination: remove wrong comment in tests
Change-Id: Ia53ce14d6a468781ff7a8f24e46ee14d6eb35d03
2014-04-03 16:08:01 +02:00