Commit Graph

20 Commits

Author SHA1 Message Date
John Mulligan
66ffbfa633 nfs admin: create directories used by nfs tests
Recent changes to ceph check that a directory exists in cephfs before it
will allow an NFS export of the dir to be created. It was a pretty shaky
practice of ours to create NFS exports without dirs backing them anyhow.
This change ensures the dirs exist before the test cases are run and
clean them up afterwards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-04-04 13:21:29 +00:00
Sven Anderson
87041ee7d8 gofmt: reformat everything with new gofmt of go 1.19
Signed-off-by: Sven Anderson <sven@redhat.com>
2023-02-20 20:50:24 +00:00
John Mulligan
daf48e4aa2 nfs admin: fix handling of non-existing psuedo_paths for export info
Fixes: #815

When updates to the NFS mgr API were recently merged on Ceph main branch
the go-ceph test started failing. This occurred because go-ceph was
unintentionally relying on invalid JSON (an empty string) returned from
the API call for an invalid export pseudo path. On ceph main it now
returns an empty JSON object. This change treats both empty string
and empty JSON object as an error explicitly.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-01-31 05:14:58 +00:00
John Mulligan
94f1c7b8a4 nfs admin: make core nfs admin apis stable
As per the api stability doc, the NFS admin apis are due to be stable in 0.18.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-10-17 17:18:49 +00:00
John Mulligan
54918abb0f nfs admin: add SecType field
Ceph is adding a flag to get/set NFS-Ganesha's SecType configuration
opiton. This can be used to specify authentication types for an export.
These changes only affect struct fields and are fully backwards
compatible with existing code. Therefore no API status flags are added
to the code.
Test cases added - with api buildtag for ceph main branch.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-10-12 13:40:09 +00:00
Sven Anderson
9d74c3c2b1 go-ceph: change mature preview APIs to stable
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-08-16 11:42:41 +00:00
John Mulligan
af64f12c62 nfs admin: remove untested build tag
The latest ceph pacific should include the mgr changes needed to test
the NFS apis. We should be able to treat nfs like a normal preview api.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-06-09 16:24:31 +00:00
Sven Anderson
f4fb583252 docs: remove all PREVIEW comments
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-06-06 14:42:04 +00:00
John Mulligan
e74d868365 nfs admin: add mock configuration for test container
Our test container does not support an orchestrator to pre configure
the ".nfs" configuration pool for us. This is something that rook and
cephadm are expected to do before exports are created, etc.
So we support creating a minimal "mock" configuration in rados.
This option can be toggled on and off via the GO_CEPH_TEST_MOCK_NFS
env var. Turning it off can be useful if you want to run the live
suite against a "real" ceph cluster.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-06 17:56:33 +00:00
John Mulligan
ece889e721 nfs admin: add unit and functional tests for nfs export functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-06 17:56:33 +00:00
John Mulligan
2d990c43d9 nfs admin: add APIs for basic NFS export management
* Add CreateCephFSExport method
* Add RemoveExport method
* Add ListDetailedExports method
* Add ExportInfo method

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-06 17:56:33 +00:00
John Mulligan
02da4437ab nfs admin: add the admin type for nfs
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-06 17:56:33 +00:00
John Mulligan
b72dfce520 nfs: add a new common/admin/nfs subpackage
This will provide APIs for managing NFS exports via the Ceph NFS manager
module.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-04-06 17:56:33 +00:00
Sven Anderson
72493ed2f7 common: implement a common log package
This change adds two log packages.  One for the external go-ceph
consumers under common/log, and one for the internal use within the
go-ceph code under internal/log.  The external package exports two
functions for consumers, SetWarnf() and SetDebugf(), that set a
logger for warnings and debug messages respectively. They take a
log.Printf compatible function as argument.

The internal package exports these functions as Warnf() and Debugf(),
which can be used by the go-ceph code to log warnings and debug
messages.

Signed-off-by: Sven Anderson <sven@redhat.com>
2022-02-28 12:03:04 +00:00
John Mulligan
d4c23eb19d common admin: add tests for manager pkg module apis
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan
bd93e9c6d6 common admin: enhance and make public APIs for mgr module admin
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan
4cd344a2be common admin: port mgr module calls from cephfs/admin
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan
73bbdbfe08 common admin: add admin.go file with basic admin type
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan
4fa966d579 common admin: add new manager package
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
John Mulligan
e8e1d722c8 common commands: add new sub-package for common interface types
Add new common interface types for working with Ceph's "JSON commands"
to a public sub-package.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-06-01 11:06:19 +00:00