Merge lp://staging/~chad.smith/charms/precise/storage/storage-fix-nfs-relation-ordering into lp://staging/~dpb/charms/precise/storage/trunk

Proposed by Chad Smith
Status: Merged
Merged at revision: 34
Proposed branch: lp://staging/~chad.smith/charms/precise/storage/storage-fix-nfs-relation-ordering
Merge into: lp://staging/~dpb/charms/precise/storage/trunk
Diff against target: 272 lines (+69/-65)
5 files modified
hooks/common_util.py (+18/-18)
hooks/storage-provider.d/nfs/data-relation-changed (+2/-1)
hooks/storage-provider.d/nfs/nfs-relation-changed (+0/-23)
hooks/storage-provider.d/nfs/nfs-relation-departed (+0/-7)
hooks/test_common_util.py (+49/-16)
To merge this branch: bzr merge lp://staging/~chad.smith/charms/precise/storage/storage-fix-nfs-relation-ordering
Reviewer Review Type Date Requested Status
David Britton Approve
Fernando Correa Neto (community) Approve
Review via email: mp+210892@code.staging.launchpad.net

Description of the change

Because we cannot rely on ordering of nfs versus data relation hooks fired, we need to account for either the data relation with the principal charm being fired before the nfs relation with the nfs charm or the other way around.

This branch allows either hook to call mount_volume() which will now attempt to grab specific attributes from a designated "data" or "nfs" hook name. This way either hook can determine if all required information is present before proceeding to try mounting the nfs share.

To post a comment you must log in.
Revision history for this message
David Britton (dpb) wrote :

[0] Test failures... Of the form:

https://pastebin.canonical.com/106789/

  File "/usr/lib/python2.7/unittest/case.py", line 331, in run
    testMethod()
  File "/usr/lib/python2.7/dist-packages/mocker.py", line 146, in test_method_wrapper
    result = test_method()
  File "/home/dpb/src/canonical/juju/charms/blockstoragebroker/bsb-ec2-support/hooks/test_util.py", line 1332, in test_wb_ec2_describe_volumes_with_attac
hed_instances
    self.storage._ec2_describe_volumes(), expected)
  File "/home/dpb/src/canonical/juju/charms/blockstoragebroker/bsb-ec2-support/hooks/util.py", line 250, in _ec2_describe_volumes
    command = describevolumes.DescribeVolumes()

[...]

requestbuilder.exceptions.ServiceInitError: No ec2 endpoint to connect to was given. ec2 endpoints may be specified in a config file with "ec2-url".

test_util.TestEC2Util.test_wb_ec2_describe_volumes_with_attached_instances

--
David Britton <email address hidden>

Revision history for this message
David Britton (dpb) wrote :
Download full text (3.2 KiB)

Failure while testing:

2014-03-20 17:02:47 INFO worker.uniter.jujuc server.go:108 running hook tool "relation-set" ["-r" "data:1" "mountpoint=/srv/data"]
2014-03-20 17:02:47 INFO juju.worker.uniter uniter.go:356 ran "block-storage-relation-changed" hook
2014-03-20 17:02:47 INFO juju.worker.uniter uniter.go:363 committing "relation-changed" hook
2014-03-20 17:02:47 INFO juju.worker.uniter uniter.go:381 committed "relation-changed" hook
2014-03-20 17:46:08 INFO juju fslock.go:144 attempted lock failed "uniter-hook-execution", storage/0: running hook "data-relation-departed", currently held: postgresql/0: running hook "data-relation-departed"
2014-03-20 17:46:11 INFO juju fslock.go:144 attempted lock failed "uniter-hook-execution", storage/0: running hook "data-relation-departed", currently held: postgresql/0: running hook "data-relation-broken"
2014-03-20 17:46:13 INFO juju.worker.uniter uniter.go:348 running "data-relation-departed" hook
2014-03-20 17:46:13 INFO worker.uniter.jujuc server.go:108 running hook tool "config-get" ["provider"]
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK Storage provider: block-storage-broker calling data-relation-departed hook
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK umount: /srv/data: device is busy.
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK (In some cases useful info about processes that use
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK the device is found by lsof(8) or fuser(1))
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK Traceback (most recent call last):
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK File "hooks/storage-provider.d/block-storage-broker/data-relation-departed", line 6, in <module>
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK common_util.unmount_volume()
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK File "/var/lib/juju/agents/unit-storage-0/charm/hooks/common_util.py", line 110, in unmount_volume
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK "lsof %s | awk '(NR == 2){print $1}'" % mountpoint)
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK File "/usr/lib/python2.7/subprocess.py", line 537, in check_output
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK process = Popen(stdout=PIPE, *popenargs, **kwargs)
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK errread, errwrite)
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK raise child_exception
2014-03-20 17:46:13 INFO juju.worker.uniter context.go:255 HOOK OSError: [Errno 2] No such file or directory
2014-03-20 17:46:13 ERROR juju.worker.uniter uniter.go:350 hook failed: exit status 1
2014-03-20 17:46:13 INFO juju.worker.uniter modes.go:421 ModeHookError starting
2014-03-20 17:46:13 INFO juju.worker.uniter.filter f...

Read more...

Revision history for this message
David Britton (dpb) wrote :

[0] can be ignored... wrong MP

37. By Chad Smith

don't use awk. use python to parse lsof output. Add unit test for lsof subprocess command failure

38. By Chad Smith

use lsof -b

Revision history for this message
Chad Smith (chad.smith) wrote :

>
> [0] Test failures... Of the form:
>

Okay the above was block-storage-broker charm issues with trusty. Resolved in a followon branch https://code.launchpad.net/~chad.smith/charms/precise/block-storage-broker/bsb-trusty-support

Revision history for this message
Chad Smith (chad.smith) wrote :

[1] lsof |awk issues when volume is umounted.... This is resolved by dropping the lsof | awk in subprocess command and instead using subprocess.check_output(["lsof", mountpoint, "-b"])

fixes and unit tests are pushed in rev 37 &38

Revision history for this message
Fernando Correa Neto (fcorrea) wrote :

Works great! +1

Went through the process of deploying landscape, nfs and this storage branch.
Tried to establish landscape<->storage and could verify that it didn't go into a error state and it also logged the message.
As soon as I established storage<->nfs, the hooks started firing again and landscape ended with its nfs mounted.

review: Approve
Revision history for this message
David Britton (dpb) wrote :

I'm deploying and removing OK now. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: