This test feels very flaky, only passing 2-3 times out of ten (by
my vague guesstimate). This needs investigation.
However I don't want to block all of CI against quincy for this this
now.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
On ceph quincy, removing the subvolume explicitly (even with --force)
triggered an error. Due to the discussion in
https://tracker.ceph.com/issues/54625
I was informed that the explicit delete was not necessary, and while
the error on quincy was not correct, even on previous versions the
call is basically a no-op.
Rather than wait for this to be changed back to a no-op on quincy,
we remove the unneeded call. While we're at it, change the polling
loop to use the assert lib's Eventually call which is much nicer
to read and expires based on a duration avoiding the need to
think about loop iterations. :-)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
It appears the JSON being returned from `ceph fs status` has changed.
The field returning the mds version was previously "just" a string.
Now its a more complex thing. This of course breaks the old version
of the go code which is statically typed to expect a string.
In order not to break backwards compatibility we replace the object
used for parsing the JSON with a private object that has a custom
unmarshaller function for the mds version field. If it sees the string
it uses the string. Otherwise, it looks for this new structure and,
if possible, extracts the version string from the first item.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
When testing the mirroing workflow, we will not explicitly check
on the mgr for the presence of the mirroring module before proceeding
with the tests. The plan is to have this cut down on test flakes.
The previous workaround also had a bug in that the 2nd sleep was in the
wrong location. Perhaps, fixing this alone would resolve the test
flakes, but this is more proper anyway.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a function for getting the lists of enabled/disabled mgr modules
from ceph. This is private for the moment as general module management
probably shouldn't be part of cephfs admin. It's bad enough we hacked
in the functions for enabling mirroring. :-)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Luminous and mimic have not been supported for a few releases now.
There's no need to keep these build tags any more.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This is a workaround for the common test flake:
```
=== RUN TestMirroring
mirror_workflow_test.go:63:
Error Trace: mirror_workflow_test.go:63
Error: Received unexpected error:
rados: ret=-95, Operation not supported:
"Module 'mirroring' is not enabled (required by command 'fs snapshot
mirror enable'): use `ceph mgr module enable mirroring` to enable it"
Test: TestMirroring
```
at even though we've certainly requested the mode be enabled the mgr
has apparently not fully processed the request and the module is
not yet available. We add a half-second sleep after each call
to hopefully give the mgr time enough to completely enable the module.
A future improvement would be to poll the mgr until we know it is ready to
use the cephfs mirroring module, but that would take some research and
(probably) new API calls. So this is a temporary workaround just
to try and reduce the number of test flakes sooner rather than later.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
It was previously DaemonStatusPeerRemote but this struck the reviewers
as redundant so it is now simply DaemonStatusPeer.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This rather large test case tests the mirroring functions in an
end-to-end manner. It sets up the mirroring peers, enables mirroring on
directories and verifies that mirroring was set up by writing data and
verifying that data was propagated from site a to site b.
Ceph pacific is required to use cephfs mirroring and thus run this test.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add the functions DaemonStatus and PeerList which provide information
about the cephfs mirroring daemon and mirroring peers.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
These functions require support in the ceph mgr and pertain to setting
up mirroring in the file system, adding directories to mirror, and
setting up mirroring peers.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add functions EnableMirroringModule and DisableMirroringModule for
turning on an off the mirroring module at the ceph mgr.
This also adds the lower level EnableModule and DisableModule that take
a string parameter naming the module, and are the base for
EnableMirroringModule and DisableMirroringModule.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The fsConnect function is used by the tests to support getting a
data-path cephfs connection, in order to support those fs admin tests
that need to make changes in the file system directly. The new second
argument to the call allows for the cephfs connection to be made with a
non-default configuration.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, the getFSAdmin function always fetched a cached (if
available) fsadmin instance set up for the default configuration of
ceph. This change makes getFSAdmin based on newFSAdmin a function
that always returns a new instance and allows a custom configuration
to be passed.
Otherwise, newFSAdmin works like getFSAdmin did previously, supporting
debugging via an environment variable.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Remove the logic previously ported over to internal/commands and just
leave the functions in place as to not have to excessively touch the
existing code.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Now that we have shared support working with "command json" we attempt
a minimal conversion, using aliases where appropriate, to the
new commands.Response type.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The json key sent to retain snapshots on subvolume remove was misspelled
and had a dash in it rather than an underscore. Fix the incorrect key
and add a test, that needs to be able to run on version of cephfs w/o
snapshot retention, and verifies that flag does the correct thing.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Now that the new year has arrived this test assertion has started to
fail. This is because, although I anticipated the year would eventually
change and used GreaterOrEqual, the argument order is wrong. My excuse
is that I find the argument order in testify's Equal function confusing,
it causes me to assume other functions in testify are also confusing
(even when it's the "normal" order) and/or I copy and pasted from an
Equal line and didn't change the args (both are true!).
Instead of allowing any old year, we assume that the clocks where the
test are run are in sync enough that the current year is correct for
the assertion (thanks for the suggestion Sven).
Happy new year, go-ceph!
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This flagSet type allows the user to also set the value of the retain
snapshots flag, something unique to subvolume removal (all others had
the force flag only).
Signed-off-by: John Mulligan <jmulligan@redhat.com>
To prepare for multiple flags types, we create a flagSet interface and
break out the functionality that was in Update into a per-type method
and then the common "merger" function.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Due to a new ceph nautilus the workflow test was breaking because the
existing code failed to anticipate the "subvolume uuid" in the path
to the snapshot data. This is the curse of writing code without anything
to test it against. I also add a very short delay just to give us
a chance to avoid issues in the future in case the snapshot creation
is not quite synchronous.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Apparently, this feature is being removed from all active ceph versions
and will not be present in future versions. Since we won't be able to
test it any more, and the api is provisional still, we just remove it
entirely.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This doesn't touch every call in cephfs admin, but does try to act like
a real application, or set of applications would: reading and writing
data as well as using the api to create and manage subvolumes,
snapshots, and clones.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Some versions of ceph return a list of supported features for a
subvolume. On versions that don't return this field the list will always
be empty.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
For users who need to know the pools (by name) as well as the files
systems, we add ListFileSystems which is similar to 'ceph fs ls', rather
than the existing ListVolumes as that function is simlar to 'ceph fs
volume ls' and that does not return pool information.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Return not implemented errors when "older" versions of ceph return
formatted text for output instead of JSON, even tho we asked for json.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Rather than compile things in and out, which really should only be for
the client version of the ceph libs, add vars that tests can use to
check the server. Also, a "sentinel" test is added to make sure the
tests are being fed a version it understands.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, I was sort of abusing the build tags system to just get our
tests working. That was incorrect because you could be building go-ceph
against nautilus libs but using an octopus server and vice versa. In
addition, I've learned that some of the snapshot and clone behaviors are
being changed as items are backported in ceph. This means that build
tags themselves are not good indicators of what a particular version of
ceph supports.
This patch is the first step to removing these restrictions and making
cephfs admin work more smoothly across more versions of ceph.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This test is added after we add force delete functions as deleting a
canceled clone requires a force remove function.
Signed-off-by: John Mulligan <jmulligan@redhat.com>