Commit Graph
257 Commits
Author SHA1 Message Date
Sébastien Han aa9f408822 ceph: use quorum_status instead of mon_status
In Octopus, this commit
https://github.com/ceph/ceph/pull/30859/commits/c09b82a80a392ccd0da7677c7b424ce5cd3fa5d6
moved the quorum_status command to a socket call. Thus, the `ceph
quorum_status` command does not exist anymore, to use it we need to do
`ceph daemon mon.$ID quorum_status`. However, this command only works
locally so it won't work if we run it from the operator.
The `ceph mon_status` command is a general command that run from
anywhere and returns the mon map, let's use this one on the operator
code.
This is not a breaking change.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-24 11:27:52 +02:00
Travis Nielsen 766a0a81a2 Merge pull request #4021 from travisn/restore-cluster
Enable restoring a cluster after disaster recovery
2019-10-23 11:18:06 -06:00
Santosh Pillai 8ea693a740 ceph: fix operator reconcile to restart osds daemons
OSD on PVC does not upgrade when the user upgrades the ceph version on cluster-on-pvc yaml.
The solution incudes:
   - upgrade osd prepare and daemon pods on upgrade
   - skip c-v prepare if filesystem is already present on the pvc device.
   - skip lvm release in case of upgrade.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-10-23 16:56:15 +05:30
Sébastien Han eafc2a477e ceph: do not enable app on pool
The command `fs new` already enable the application pool settings for
the cephfs pools so we don't need to run that command again.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-22 15:14:28 +02:00
travisn 4397974762 ceph: reduce verbose logging checking for clean PGs
Checking for clean PGs is a recurring event when reconciling nodes
for upgrades and fencing. No need to log every request.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-10-21 12:47:47 -06:00
Travis Nielsen fdd92ec883 Merge pull request #4100 from morimoto-cybozu/clarify-errors-in-clusterd
Return explicit errors
2019-10-15 08:57:06 -06:00
morimoto-cybozu 815927d943 clusterd: return explicit errors
PopulateDeviceInfo() in pkg/clusterd/disk.go returns nil as *sys.LocalDisk
if an error has occurred.  This causes a nil pointer exception at
getAvailableDevices() in pkg/daemon/ceph/osd/daemon.go.  At least the returned
value should be checked at the caller.
I added an explicit error to the return value of PopulateDeviceInfo().  This
naturally revokes an error check at the caller.
I modified PopulateDeviceUdevInfo() in the same file too.

Signed-off-by: morimoto-cybozu <kenji_morimoto@cybozu.co.jp>
2019-10-15 08:30:45 +00:00
travisn 22391377a8 ceph: remove full path from vgchange call
The full path to vgchange should not be necessary. For some
downstream releases the path may even be in a different path.
Therefore we require that vgchange be in the path.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-10-14 09:29:45 -06:00
Sébastien Han 148f8da1fb ceph: relax pre-requisite for external cluster
We now differentiate the cases where:

* we only consume the external cluster
* we consume the external cluster as well as creating stateless
resources in Kubernetes (bootstrap mds,rgw, nfs)

This is mostly controlled via the image property spec. If not defined,
not extra CRs won't be able to be created.

Now the external cluster feature supports Ceph cluster as of Luminous 12.2.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-08 10:52:01 +02:00
Juan Miguel Olmo Martínez 2de0787fc8 New setting to avoid delete pools on <fs>/<os> resources deletion
A new CRD property `PreservePoolsOnDelete` has been added to Filesystem(fs) and
Object Store(os) resources in order to increase protection against data loss.
If it is set to `true`, associated pools won't be deleted when the main
resource(fs/os) is deleted. Creating again the deleted fs/os with the same name
 will reuse the preserved pools.

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
2019-09-30 08:13:39 +02:00
Travis Nielsen 11348e8b67 Merge pull request #3972 from Madhu-1/pool-delete
Check Pools is in use before deleting it
2019-09-26 11:12:05 -06:00
Madhu Rajanna 4efba0247d Check Pools is in use before deleting it
currently we are not checking the pool is empty or
not before deleting, This PR adds a check to check
if any images/snapshots using the pool, if yes it will
not delete the pool

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2019-09-26 11:41:47 +05:30
Sébastien Han 24fc94cc57 Merge pull request #3955 from leseb/cv-debug-prepare
ceph: various osd fixes and improvements with lvm and ceph-volume
2019-09-25 08:46:34 +02:00
Sébastien Han 42cebf6311 ceph: osd run lvm config all the time
Previously, we were applying lvm config changes to OSD running on PV. So
now, we do this for any type of cluster deployment (bare metal or
Cloud).

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-24 22:49:39 +02:00
Sébastien Han 3404460d3c ceph: osd, fix lvm filter regexp
The lvm documentation uses commas to separate the regular expressions.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-24 17:17:29 +02:00
Sébastien Han ad514606bf ceph: osd reset 'run dir' to default location
Previously, "run dir" was used to place a number of file and config on
dataDirHostPath. Now, since a lot of configs and options have moved
either on the OSD's startup CLI line or remove with bluestore we don't
need to change the default.

Also, it was confusing for user and difficult to find the socket.
The is is not breaking any config in dataDirHostPath since all the
elements (keyrings) are hardcoded in the config file.

Closes: https://github.com/rook/rook/issues/3966
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-24 10:27:59 +02:00
Sébastien Han d8813513eb ceph: fix various spelling issues
Correct spelling.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-24 10:26:22 +02:00
travisn f3ce214822 ceph: configure additional lvm settings for rhel8
RHEL8 introduces some lvm changes. For OSDs on PVs to work
we need to set allow_changes_with_duplicate_pvs = 1.
This is required since we're copying the block image
under another location.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-09-20 11:51:07 -06:00
Santosh Pillai 9db863377a release the device held onto by lvm
When running osds on pvc, the lvm is still holding the device when the cluster is deleted. As a result the PVs go into `failed` state
when the cluster is deleted. On deactivating the device, the 'failed' pvs get deleted as well. Solution involves:
- Running `lvchange -an <vg group name>` to deactivate the device.
- This command runs after 'osd prepare' completes.
- This command also runs after the 'osd daemon pod' is deleted or if the ceph-osd process terminates for some reasons.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-09-20 18:08:13 +05:30
Sébastien Hanand: Tuan Do Anh <tuanda@vn.fujitsu.com> 13686e3f8c test: remove unused function
Remove dead code.

Co-authored-by:: Tuan Do Anh <tuanda@vn.fujitsu.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-19 11:37:14 +02:00
Sébastien Han 171c4ac438 ceph: fix upgrade commands
Several commands were not using the cli finalizer function which builds
up the right argument to run a ceph command. This was working on the
operator since it used to have an /etc/ceph/ceph.conf file so we could
ran the command without specifying the ceph conf and key paths.
However, we recently removed that and it silently broke this "already"
broken code :).

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-17 18:59:42 +02:00
Sébastien Han ff73043b75 Merge pull request #3790 from umangachapagain/nbd-filter
ignore updates on nbd device
2019-09-11 17:59:15 +02:00
Blaine Gardner 704786f273 Ceph: use combined output from ceph-volume
ceph-volume now sends status and log output to stderr, which breaks
`ceph-volume lvm prepare` if not other things as well. Use the combined
stdout and stderr output from ceph-volume to fix this.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-09-09 10:29:51 -06:00
Travis Nielsen 49c516916e Merge pull request #3781 from rohantmp/topology
Fix topologyAware on PVC-based OSDs
2019-09-06 13:59:22 -06:00
Rohan CJ f8b7537830 Fix topologyAware on PVC-based OSDs
Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-09-06 23:17:01 +05:30
Alexander Trost 10f17bc1e0 Merge pull request #3791 from ashishranjan738/osdpanic
fix(osd prepare): osd prepare job getting into panic state
2019-09-06 17:38:13 +02:00
Travis Nielsen cb5143555d Merge pull request #3779 from sp98/fix-osd-failure-on-pvc
fix random OSD daemon pod failures when running OSD on PVC
2019-09-06 06:59:57 -06:00
Ashish Ranjan f16c8dc060 fix(osd prepare): osd prepare job getting into panic state
Osd pods getting into panic state due to index out of range error.

logs of osd prepare job:

```
[aranjan@localhost:~]$ oc logs -f rook-ceph-osd-prepare-set1-0-data-6f2nh-zh4zl
2019-09-06 07:48:11.448085 I | cephcmd: desired devices to configure osds: [{Name:/mnt/set1-0-data-6f2nh OSDsPerDevice:1 MetadataDevice: DatabaseSizeMB:0 DeviceClass: IsFilter:false}]
2019-09-06 07:48:11.449841 I | rookcmd: starting Rook v1.0.0-623.gc18d575c.dirty with arguments '/rook/rook ceph osd provision'
2019-09-06 07:48:11.449866 I | rookcmd: flag values: --cluster-id=308f232a-d07a-11e9-96ba-0adfe2bb9bfc, --data-device-filter=, --data-devices=/mnt/set1-0-data-6f2nh, --data-directories=, --encrypted-device=false, --force-format=false, --
help=false, --location=, --log-flush-frequency=5s, --log-level=INFO, --metadata-device=, --node-name=set1-0-data-6f2nh, --operator-image=, --osd-database-size=0, --osd-journal-size=5120, --osd-store=, --osd-wal-size=576, --osds-per-devic
e=1, --pvc-backed-osd=true, --service-account=
2019-09-06 07:48:11.449875 I | op-mon: parsing mon endpoints: a=172.30.150.154:6789
2019-09-06 07:48:11.470058 I | cephconfig: writing config file /var/lib/rook/rook-ceph/rook-ceph.config
2019-09-06 07:48:11.470797 I | cephconfig: generated admin config in /var/lib/rook/rook-ceph
2019-09-06 07:48:11.470989 I | cephosd: discovering hardware
2019-09-06 07:48:11.471030 I | exec: Running command: lsblk /mnt/set1-0-data-6f2nh --bytes --nodeps --pairs --output SIZE,ROTA,RO,TYPE,PKNAME
2019-09-06 07:48:11.473887 I | exec: Running command: sgdisk --print /mnt/set1-0-data-6f2nh
2019-09-06 07:48:11.476048 I | cephosd: creating and starting the osds
2019-09-06 07:48:11.476070 I | exec: Running command: lsblk /mnt/set1-0-data-6f2nh --bytes --pairs --output NAME,SIZE,TYPE,PKNAME
2019-09-06 07:48:11.478030 I | sys: Output: NAME="xvdbg" SIZE="10737418240" TYPE="disk" PKNAME=""
2019-09-06 07:48:11.478056 I | cephosd: /mnt/set1-0-data-6f2nh found in the desired devices
2019-09-06 07:48:11.488231 I | cephosd: configuring osd devices: {"Entries":{"/mnt/set1-0-data-6f2nh":{"Data":-1,"Metadata":null,"Config":{"Name":"/mnt/set1-0-data-6f2nh","OSDsPerDevice":1,"MetadataDevice":"","DatabaseSizeMB":0,"DeviceCl
ass":"","IsFilter":false},"LegacyPartitionsFound":false}}}
2019-09-06 07:48:11.492191 I | cephosd: device /mnt/set1-0-data-6f2nh to be configured by ceph-volume
2019-09-06 07:48:11.492213 I | cephosd: 0/0 pre-ceph-volume osd devices succeeded on this node
2019-09-06 07:48:11.492399 I | exec: Running command: ceph auth get-or-create-key client.bootstrap-osd mon allow profile bootstrap-osd --connect-timeout=15 --cluster=rook-ceph --conf=/var/lib/rook/rook-ceph/rook-ceph.config --keyring=/va
r/lib/rook/rook-ceph/client.admin.keyring --format json --out-file /tmp/973674470
2019-09-06 07:48:12.020858 I | cephosd: Successfully updated lvm config file
2019-09-06 07:48:12.020894 I | cephosd: configuring new device /mnt/set1-0-data-6f2nh
2019-09-06 07:48:12.020908 I | exec: Running command: stdbuf -oL ceph-volume lvm prepare --data /mnt/set1-0-data-6f2nh
2019-09-06 07:48:55.172366 I | cephosd:
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/rook/rook/pkg/daemon/ceph/osd.getLVPath(0x0, 0x0, 0x1e3c60d, 0x2)
        /home/aranjan/Project/go/src/github.com/rook/rook/pkg/daemon/ceph/osd/volume.go:128 +0x2fd
github.com/rook/rook/pkg/daemon/ceph/osd.(*OsdAgent).initializeBlockPVC(0xc000829c30, 0xc00072e1e0, 0xc000736e70, 0x1e4927d, 0xd, 0x0, 0x0)
        /home/aranjan/Project/go/src/github.com/rook/rook/pkg/daemon/ceph/osd/volume.go:108 +0x50b
github.com/rook/rook/pkg/daemon/ceph/osd.(*OsdAgent).configureCVDevices(0xc000829c30, 0xc00072e1e0, 0xc000736e70, 0x38, 0xc000829310, 0x2, 0x2, 0x0)
        /home/aranjan/Project/go/src/github.com/rook/rook/pkg/daemon/ceph/osd/volume.go:70 +0x33a
github.com/rook/rook/pkg/daemon/ceph/osd.(*OsdAgent).configureDevices(0xc000829c30, 0xc00072e1e0, 0xc0000bc370, 0x1c, 0xc0008296e8, 0x1, 0x1, 0xd)
        /home/aranjan/Project/go/src/github.com/rook/rook/pkg/daemon/ceph/osd/agent.go:213 +0x97d
github.com/rook/rook/pkg/daemon/ceph/osd.Provision(0xc00072e1e0, 0xc000829c30, 0xc0000560d0, 0x24)
        /home/aranjan/Project/go/src/github.com/rook/rook/pkg/daemon/ceph/osd/daemon.go:166 +0xeb2
github.com/rook/rook/cmd/rook/ceph.prepareOSD(0x359be60, 0x35cd220, 0x0, 0x0, 0x0, 0x0)
        /home/aranjan/Project/go/src/github.com/rook/rook/cmd/rook/ceph/osd.go:252 +0x838
github.com/rook/rook/vendor/github.com/spf13/cobra.(*Command).execute(0x359be60, 0x35cd220, 0x0, 0x0, 0x359be60, 0x35cd220)
        /home/aranjan/Project/go/src/github.com/rook/rook/vendor/github.com/spf13/cobra/command.go:762 +0x465
github.com/rook/rook/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x359e200, 0xc0006eff30, 0xb, 0xb)
        /home/aranjan/Project/go/src/github.com/rook/rook/vendor/github.com/spf13/cobra/command.go:852 +0x2ec
github.com/rook/rook/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /home/aranjan/Project/go/src/github.com/rook/rook/vendor/github.com/spf13/cobra/command.go:800
main.main()
        /home/aranjan/Project/go/src/github.com/rook/rook/cmd/rook/main.go:35 +0x12e
```

Signed-off-by: Ashish Ranjan <aranjan@redhat.com>
2019-09-06 13:40:22 +05:30
Umanga Chapagain 3f2c9f4e79 ignore updates on nbd device
- adds regex to ignore updates on nbd device
  similar to 'rbd' and 'dm'

Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2019-09-06 12:00:51 +05:30
Santosh Pillai ead0653068 fix random OSD daemon pod failures when running OSD on PVC
OSD pods when running on PVC fail randomly due to some race condition:
 - OSD daemon pod was activating the volume group using vgchange -an without any volume group name.
 - This caused the pods to fail randomly when number of OSDs is more, say greater than 10.
 - This fix adds Volume group name while activating/deactivating volume groups to fix this

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-09-05 20:34:03 +05:30
Maksim Nabokikh 179e1a310d ceph: Add dynamic flexvolume expansion
Allow to dynamic resize of rook volumes

Signed-off-by: Maksim Nabokikh <maksim.nabokikh@flant.com>
2019-09-05 02:40:22 +04:00
Sébastien Han 1393b1af3c ceph: osd lvm flag
udev is not running in the container so lvm might be stuck requesting lvm
devices. So let's not talk to udev to get lvm devices.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-30 17:39:49 +02:00
Sébastien Han 87ca208640 Merge pull request #3596 from rohantmp/managedPDB
Managed PDBs
2019-08-30 14:34:31 +02:00
Rohan CJ 4072d14557 Add tests for the clusterdisruption controller and update the docs and
pending releas notes for managed PDBs.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-08-30 14:04:23 +05:30
Sébastien Han e2c8a9935c Merge pull request #3696 from mvollman/db-devices-n-size
ceph: add db-devices flag and fix DatabaseSizeMB
2019-08-30 09:49:42 +02:00
Rohan CJ 5a248fbf59 Set a noout on failuredomains when in maintenance.
Maintenance is only defined when managedDisruptionBudgets are enabled.
Details can be found in the design doc for manged poddisriptionbudgets.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-08-30 09:01:15 +05:30
Rohan CJ d6b23dd549 Add nodedrain controller for deploying canary deployments for every node.
Canary pods can be watched to determine when a node is draining.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-08-30 09:01:11 +05:30
Michael Vollman ed9519953a ceph: add per OSD custom deviceClass support
Add deviceClass as a per OSD config option under
storage/nodes/devices/config for setting a custom crush device class
per OSD.

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-08-29 20:39:41 -04:00
Michael Vollman 496c638306 ceph: add db-devices flag and fix DatabaseSizeMB
Adding support for the db-devices flag for ceph versions 14.2.1 and
newer.  This flag will allow for explictly setting the db device for
bluestore configurations to the device specified as metadataDevice.

Fixing the databaseSizeMB config parameter to ensure it is used to set
the size of the db-device partition when specified at either the global
or individual device level. (#3652)

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-08-29 20:39:41 -04:00
Blaine Gardner 1be43290be Ceph: override configs in CRD
Allow users to specify overrides in the CephCluster CRD. The override
ConfigMap still exists for emergency situations and is mounted into
daemon pods directly instead of being merged into a Rook-created config
file.

Rook Ceph no longer uses a config file for managing daemons with the
exception of the OSDs which still generate a config in an init
container.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-08-29 15:38:27 -06:00
Michael Vollman 9eccffd794 ceph: fix md and dev ordering for c-v batch
Ensure that the metadata device and osd devices are passed as a space
separated list to ceph-volume.  Currently osds-per-device is placed
between the metadataDevice and the osd devices causing an error.

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-08-26 19:17:52 -04:00
Sébastien Han b3f58863e9 Merge pull request #3600 from mvollman/bugfix-osdsPerDevice
ceph: fix osdsPerDevice config
2019-08-22 20:24:01 +02:00
Sébastien Han 0785962e09 ceph: update mon configmap for external cluster
With this change, the admin can specify a single mon and the operator
will add any other mons to both ClusterInfo and the configmap of mon
endpoints.

It will periodically check for changes too and update both ClusterInfo
and the configmap accordingly.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:33 +02:00
Sébastien Han 18bf541c00 ceph: remove redundant debug log
GetMonStatus is called by checkHealth in health.go and is already
printing GetMonStatus's response so there is no need to print it twice.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:33 +02:00
Sébastien Han 46cdf15936 ceph: config: apply the correct msgr2 prefix
External clusters might only listen on msgr2, so we must acknowledge
that and set the correct prefix to 'v2:' instead of 'v1:' on the
operator's ceph config file.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-08-22 17:19:33 +02:00
Michael Vollman 33711b7d36 ceph: fix osdsPerDevice config
Fix variable scoping issue that is ignoring osdsPerDevice config
setting.  Ensure that in all scenarios both the global and per OSD
osdsPerDevice setting are honored.  When both are set the more specific
setting will be used. (#3599)

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-08-20 07:09:12 -04:00
Travis Nielsen 27cad9d008 Merge pull request #3606 from sp98/sed_to_golang
Replace "sed" commands with native golang file handling
2019-08-19 12:03:43 -06:00
Santosh Pillai b1c9ad97ae replace "sed" commands with native golang file handling
- OSD backed by PVC required updating the lvm.conf file which was done by executing the 'sed' commands.
- This patch removes the 'sed' command and uses golang utlities to update the lvm.conf file.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-08-19 12:38:56 +05:30
Michael Vollman 46f8012268 ceph: fix per osd metadata support
When setting metadataDevice per OSD the check that c-v is properly using
the metadata device is failing because it is only looking at the global
md setting which is nil and not the per OSD setting.

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-08-15 07:22:00 -04:00
Travis Nielsen 1591ba843e Merge pull request #3607 from obnoxxx/logic-flow-createReplicationCrushRule
ceph:pools: polish logic flow a bit in createReplicationCrushRule()
2019-08-13 13:22:21 -06:00