summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------ceph-object-corpus0
-rw-r--r--doc/cephadm/adoption.rst2
-rw-r--r--doc/cephadm/drivegroups.rst9
-rw-r--r--doc/rbd/iscsi-target-cli.rst5
-rw-r--r--qa/tasks/cephadm_cases/test_cli.py6
-rw-r--r--qa/tasks/cephfs/test_volumes.py48
-rw-r--r--qa/tasks/mgr/dashboard/helper.py5
-rwxr-xr-xsrc/ceph.in4
-rwxr-xr-xsrc/cephadm/cephadm67
-rw-r--r--src/cephadm/tests/test_cephadm.py7
-rw-r--r--src/cls/rbd/cls_rbd_client.cc59
-rw-r--r--src/cls/rbd/cls_rbd_client.h14
-rw-r--r--src/common/Timer.cc3
-rw-r--r--src/common/ceph_context.cc2
-rw-r--r--src/common/options.cc4
-rw-r--r--src/common/shunique_lock.h1
-rw-r--r--src/include/neorados/RADOS.hpp25
-rw-r--r--src/include/rados/librados_fwd.hpp2
-rw-r--r--src/key_value_store/kv_flat_btree_async.cc5
-rw-r--r--src/librbd/AsioEngine.cc62
-rw-r--r--src/librbd/AsioEngine.h63
-rw-r--r--src/librbd/CMakeLists.txt7
-rw-r--r--src/librbd/ExclusiveLock.cc2
-rw-r--r--src/librbd/ImageCtx.cc46
-rw-r--r--src/librbd/ImageCtx.h34
-rw-r--r--src/librbd/ImageState.cc8
-rw-r--r--src/librbd/ManagedLock.cc14
-rw-r--r--src/librbd/ManagedLock.h11
-rw-r--r--src/librbd/Types.h5
-rw-r--r--src/librbd/api/Image.cc13
-rw-r--r--src/librbd/api/Migration.cc26
-rw-r--r--src/librbd/api/Mirror.cc6
-rw-r--r--src/librbd/api/Pool.cc7
-rw-r--r--src/librbd/api/Trash.cc12
-rw-r--r--src/librbd/asio/ContextWQ.cc21
-rw-r--r--src/librbd/asio/ContextWQ.h10
-rw-r--r--src/librbd/asio/Utils.h33
-rw-r--r--src/librbd/cache/ObjectCacherObjectDispatch.cc2
-rw-r--r--src/librbd/cache/ObjectCacherObjectDispatch.h2
-rw-r--r--src/librbd/cache/ParentCacheObjectDispatch.cc2
-rw-r--r--src/librbd/cache/ParentCacheObjectDispatch.h2
-rw-r--r--src/librbd/cache/WriteAroundObjectDispatch.cc2
-rw-r--r--src/librbd/cache/WriteAroundObjectDispatch.h2
-rw-r--r--src/librbd/image/OpenRequest.cc1
-rw-r--r--src/librbd/image/RefreshRequest.cc1
-rw-r--r--src/librbd/internal.cc13
-rw-r--r--src/librbd/io/AioCompletion.cc54
-rw-r--r--src/librbd/io/AioCompletion.h2
-rw-r--r--src/librbd/io/AsyncOperation.cc10
-rw-r--r--src/librbd/io/CopyupRequest.cc64
-rw-r--r--src/librbd/io/CopyupRequest.h2
-rw-r--r--src/librbd/io/ImageRequest.cc2
-rw-r--r--src/librbd/io/ObjectDispatch.cc6
-rw-r--r--src/librbd/io/ObjectDispatch.h2
-rw-r--r--src/librbd/io/ObjectDispatchInterface.h2
-rw-r--r--src/librbd/io/ObjectDispatchSpec.h6
-rw-r--r--src/librbd/io/ObjectRequest.cc135
-rw-r--r--src/librbd/io/ObjectRequest.h48
-rw-r--r--src/librbd/io/QosImageDispatch.cc4
-rw-r--r--src/librbd/io/QueueImageDispatch.cc4
-rw-r--r--src/librbd/io/ReadResult.h2
-rw-r--r--src/librbd/io/SimpleSchedulerObjectDispatch.cc15
-rw-r--r--src/librbd/io/SimpleSchedulerObjectDispatch.h2
-rw-r--r--src/librbd/io/Utils.cc20
-rw-r--r--src/librbd/io/Utils.h4
-rw-r--r--src/librbd/journal/ObjectDispatch.h2
-rw-r--r--src/librbd/managed_lock/AcquireRequest.cc14
-rw-r--r--src/librbd/managed_lock/AcquireRequest.h8
-rw-r--r--src/librbd/managed_lock/BreakRequest.cc84
-rw-r--r--src/librbd/managed_lock/BreakRequest.h15
-rw-r--r--src/librbd/object_map/InvalidateRequest.h4
-rw-r--r--src/librbd/object_map/RefreshRequest.cc5
-rw-r--r--src/librbd/object_map/Request.cc8
-rw-r--r--src/librbd/object_map/Request.h4
-rw-r--r--src/librbd/operation/SnapshotCreateRequest.cc1
-rwxr-xr-xsrc/mds/CDir.cc6
-rw-r--r--src/mds/CDir.h1
-rw-r--r--src/mds/CInode.cc10
-rw-r--r--src/mds/CInode.h2
-rw-r--r--src/mds/Locker.cc88
-rw-r--r--src/mds/LogEvent.cc10
-rw-r--r--src/mds/LogEvent.h2
-rw-r--r--src/mds/LogSegment.h6
-rw-r--r--src/mds/MDCache.cc468
-rw-r--r--src/mds/MDCache.h106
-rw-r--r--src/mds/MDSRank.cc6
-rw-r--r--src/mds/Migrator.cc2
-rw-r--r--src/mds/Mutation.cc61
-rw-r--r--src/mds/Mutation.h54
-rw-r--r--src/mds/Server.cc810
-rw-r--r--src/mds/Server.h50
-rw-r--r--src/mds/SimpleLock.h6
-rw-r--r--src/mds/events/EMetaBlob.h4
-rw-r--r--src/mds/events/EPeerUpdate.h (renamed from src/mds/events/ESlaveUpdate.h)42
-rw-r--r--src/mds/events/EUpdate.h6
-rw-r--r--src/mds/journal.cc108
-rw-r--r--src/messages/MMDSCacheRejoin.h34
-rw-r--r--src/messages/MMDSPeerRequest.h (renamed from src/messages/MMDSSlaveRequest.h)34
-rw-r--r--src/messages/MMDSResolve.h34
-rw-r--r--src/messages/MMDSResolveAck.h2
-rw-r--r--src/mgr/Mgr.cc1
-rw-r--r--src/mgr/ServiceMap.cc71
-rw-r--r--src/mgr/ServiceMap.h67
-rw-r--r--src/mon/Monitor.cc18
-rw-r--r--src/mon/OSDMonitor.cc1
-rw-r--r--src/msg/Message.cc6
-rw-r--r--src/msg/Message.h2
-rw-r--r--src/msg/MessageRef.h2
-rw-r--r--src/neorados/RADOS.cc36
-rw-r--r--src/osd/ECBackend.h4
-rw-r--r--src/osd/OSDMap.cc1
-rw-r--r--src/osd/PrimaryLogPG.cc9
-rw-r--r--src/osdc/Objecter.h9
-rw-r--r--src/osdc/Striper.cc141
-rw-r--r--src/osdc/Striper.h12
-rw-r--r--src/pybind/mgr/cephadm/inventory.py74
-rw-r--r--src/pybind/mgr/cephadm/module.py217
-rw-r--r--src/pybind/mgr/cephadm/services/cephadmservice.py37
-rw-r--r--src/pybind/mgr/cephadm/services/iscsi.py9
-rw-r--r--src/pybind/mgr/cephadm/services/monitoring.py16
-rw-r--r--src/pybind/mgr/cephadm/services/nfs.py36
-rw-r--r--src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j22
-rw-r--r--src/pybind/mgr/cephadm/tests/test_cephadm.py10
-rw-r--r--src/pybind/mgr/cephadm/tests/test_spec.py1
-rw-r--r--src/pybind/mgr/dashboard/frontend/angular.json4
-rw-r--r--src/pybind/mgr/dashboard/frontend/cypress.json3
-rw-r--r--src/pybind/mgr/dashboard/frontend/cypress/plugins/index.js8
-rw-r--r--src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json3
-rw-r--r--src/pybind/mgr/dashboard/frontend/ngcc.config.js9
-rw-r--r--src/pybind/mgr/dashboard/frontend/package-lock.json1115
-rw-r--r--src/pybind/mgr/dashboard/frontend/package.json5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/app.module.ts26
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts36
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts18
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts29
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts14
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts27
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts26
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts16
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts24
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts24
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts14
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts16
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts29
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts91
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts14
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts5
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts5
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts21
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts45
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts41
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts20
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts17
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts68
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts80
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts6
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts4
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts20
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts17
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts2
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts14
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts16
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts20
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts36
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts21
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts13
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts11
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts7
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts38
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts11
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts16
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts31
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts32
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts18
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts15
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts14
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts18
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts25
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts33
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts5
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts13
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts18
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts24
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts18
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts20
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts63
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts21
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts11
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts8
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts9
-rwxr-xr-xsrc/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts65
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts11
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts19
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts1
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts126
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts7
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/enum/color.enum.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts12
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.spec.ts22
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts74
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts3
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts5
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts27
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts7
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts26
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts54
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts1
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts6
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts239
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/index.html2
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/setupJest.ts2
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts21
-rw-r--r--src/pybind/mgr/orchestrator/__init__.py1
-rw-r--r--src/pybind/mgr/orchestrator/_interface.py95
-rw-r--r--src/pybind/mgr/orchestrator/module.py9
-rw-r--r--src/pybind/mgr/orchestrator/tests/test_orchestrator.py5
-rw-r--r--src/pybind/mgr/osd_support/__init__.py6
-rw-r--r--src/pybind/mgr/osd_support/module.py14
-rw-r--r--src/pybind/mgr/osd_support/tests/__init__.py0
-rw-r--r--src/pybind/mgr/osd_support/tests/fixtures.py14
-rw-r--r--src/pybind/mgr/osd_support/tests/test_osd_support.py144
-rw-r--r--src/pybind/mgr/selftest/module.py4
-rw-r--r--src/pybind/mgr/volumes/module.py8
-rw-r--r--src/python-common/ceph/deployment/drive_group.py10
-rw-r--r--src/python-common/ceph/deployment/drive_selection/selector.py18
-rw-r--r--src/python-common/ceph/tests/test_drive_group.py26
-rw-r--r--src/python-common/ceph/tests/test_service_spec.py1
-rw-r--r--src/python-common/ceph/tests/utils.py8
-rw-r--r--src/rgw/rgw_admin.cc281
-rw-r--r--src/rgw/rgw_bucket.cc13
-rw-r--r--src/rgw/rgw_common.cc10
-rw-r--r--src/rgw/rgw_common.h12
-rw-r--r--src/rgw/rgw_cr_rados.cc18
-rw-r--r--src/rgw/rgw_data_sync.cc6
-rw-r--r--src/rgw/rgw_data_sync.h2
-rw-r--r--src/rgw/rgw_file.cc29
-rw-r--r--src/rgw/rgw_file.h48
-rw-r--r--src/rgw/rgw_lc.cc4
-rw-r--r--src/rgw/rgw_lib.h5
-rw-r--r--src/rgw/rgw_log.cc18
-rw-r--r--src/rgw/rgw_multi.cc2
-rw-r--r--src/rgw/rgw_notify.cc24
-rw-r--r--src/rgw/rgw_notify.h4
-rw-r--r--src/rgw/rgw_op.cc1096
-rw-r--r--src/rgw/rgw_op.h27
-rw-r--r--src/rgw/rgw_opa.cc4
-rw-r--r--src/rgw/rgw_os_lib.cc7
-rw-r--r--src/rgw/rgw_process.cc2
-rw-r--r--src/rgw/rgw_putobj_processor.cc28
-rw-r--r--src/rgw/rgw_putobj_processor.h39
-rw-r--r--src/rgw/rgw_rados.cc207
-rw-r--r--src/rgw/rgw_rados.h55
-rw-r--r--src/rgw/rgw_rest.cc12
-rw-r--r--src/rgw/rgw_rest.h1
-rw-r--r--src/rgw/rgw_rest_bucket.h3
-rw-r--r--src/rgw/rgw_rest_client.cc10
-rw-r--r--src/rgw/rgw_rest_client.h4
-rw-r--r--src/rgw/rgw_rest_config.h3
-rw-r--r--src/rgw/rgw_rest_conn.cc15
-rw-r--r--src/rgw/rgw_rest_conn.h8
-rw-r--r--src/rgw/rgw_rest_iam.cc7
-rw-r--r--src/rgw/rgw_rest_iam.h3
-rw-r--r--src/rgw/rgw_rest_log.h3
-rw-r--r--src/rgw/rgw_rest_metadata.h3
-rw-r--r--src/rgw/rgw_rest_realm.cc6
-rw-r--r--src/rgw/rgw_rest_realm.h3
-rw-r--r--src/rgw/rgw_rest_s3.cc172
-rw-r--r--src/rgw/rgw_rest_s3.h7
-rw-r--r--src/rgw/rgw_rest_sts.cc7
-rw-r--r--src/rgw/rgw_rest_sts.h3
-rw-r--r--src/rgw/rgw_rest_swift.cc145
-rw-r--r--src/rgw/rgw_rest_swift.h14
-rw-r--r--src/rgw/rgw_rest_usage.h3
-rw-r--r--src/rgw/rgw_rest_user.h3
-rw-r--r--src/rgw/rgw_sal.cc438
-rw-r--r--src/rgw/rgw_sal.h333
-rw-r--r--src/rgw/rgw_swift_auth.cc6
-rw-r--r--src/rgw/rgw_swift_auth.h3
-rw-r--r--src/rgw/rgw_sync_module_aws.cc68
-rw-r--r--src/rgw/rgw_sync_module_es_rest.cc9
-rw-r--r--src/rgw/rgw_sync_module_es_rest.h3
-rw-r--r--src/rgw/rgw_sync_module_pubsub_rest.cc49
-rw-r--r--src/rgw/rgw_sync_module_pubsub_rest.h3
-rw-r--r--src/rgw/rgw_tools.cc8
-rw-r--r--src/rgw/rgw_torrent.cc4
-rw-r--r--src/rgw/rgw_user.cc36
-rwxr-xr-xsrc/script/ptl-tool.py116
-rw-r--r--src/test/cls_rbd/CMakeLists.txt1
-rw-r--r--src/test/librados_test_stub/CMakeLists.txt1
-rw-r--r--src/test/librados_test_stub/LibradosTestStub.cc85
-rw-r--r--src/test/librados_test_stub/LibradosTestStub.h13
-rw-r--r--src/test/librados_test_stub/MockTestMemIoCtxImpl.h48
-rw-r--r--src/test/librados_test_stub/MockTestMemRadosClient.h15
-rw-r--r--src/test/librados_test_stub/NeoradosTestStub.cc533
-rw-r--r--src/test/librados_test_stub/TestClassHandler.cc3
-rw-r--r--src/test/librados_test_stub/TestClassHandler.h2
-rw-r--r--src/test/librados_test_stub/TestIoCtxImpl.cc28
-rw-r--r--src/test/librados_test_stub/TestIoCtxImpl.h17
-rw-r--r--src/test/librados_test_stub/TestMemIoCtxImpl.cc58
-rw-r--r--src/test/librados_test_stub/TestMemIoCtxImpl.h11
-rw-r--r--src/test/librados_test_stub/TestRadosClient.cc51
-rw-r--r--src/test/librados_test_stub/TestRadosClient.h19
-rw-r--r--src/test/librbd/CMakeLists.txt22
-rw-r--r--src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc8
-rw-r--r--src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc9
-rw-r--r--src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc10
-rw-r--r--src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc10
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc7
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc10
-rw-r--r--src/test/librbd/image/test_mock_AttachChildRequest.cc7
-rw-r--r--src/test/librbd/image/test_mock_AttachParentRequest.cc4
-rw-r--r--src/test/librbd/image/test_mock_CloneRequest.cc2
-rw-r--r--src/test/librbd/image/test_mock_DetachChildRequest.cc8
-rw-r--r--src/test/librbd/image/test_mock_DetachParentRequest.cc4
-rw-r--r--src/test/librbd/image/test_mock_PreRemoveRequest.cc2
-rw-r--r--src/test/librbd/image/test_mock_RefreshRequest.cc83
-rw-r--r--src/test/librbd/image/test_mock_RemoveRequest.cc6
-rw-r--r--src/test/librbd/image/test_mock_ValidatePoolRequest.cc2
-rw-r--r--src/test/librbd/io/test_mock_CopyupRequest.cc50
-rw-r--r--src/test/librbd/io/test_mock_ObjectRequest.cc65
-rw-r--r--src/test/librbd/managed_lock/test_mock_AcquireRequest.cc28
-rw-r--r--src/test/librbd/managed_lock/test_mock_BreakRequest.cc52
-rw-r--r--src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc2
-rw-r--r--src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc2
-rw-r--r--src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc2
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc4
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc2
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_ImageMeta.cc4
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc2
-rw-r--r--src/test/librbd/mirror/test_mock_DisableRequest.cc4
-rw-r--r--src/test/librbd/mock/MockImageCtx.cc10
-rw-r--r--src/test/librbd/mock/MockImageCtx.h8
-rw-r--r--src/test/librbd/mock/io/MockObjectDispatch.h4
-rw-r--r--src/test/librbd/object_map/test_mock_InvalidateRequest.cc27
-rw-r--r--src/test/librbd/object_map/test_mock_LockRequest.cc8
-rw-r--r--src/test/librbd/object_map/test_mock_RefreshRequest.cc6
-rw-r--r--src/test/librbd/object_map/test_mock_ResizeRequest.cc12
-rw-r--r--src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc22
-rw-r--r--src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc18
-rw-r--r--src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc9
-rw-r--r--src/test/librbd/object_map/test_mock_UnlockRequest.cc2
-rw-r--r--src/test/librbd/object_map/test_mock_UpdateRequest.cc10
-rw-r--r--src/test/librbd/operation/test_mock_ResizeRequest.cc3
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc7
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc3
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc10
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc8
-rw-r--r--src/test/librbd/test_internal.cc26
-rw-r--r--src/test/librbd/test_mock_DeepCopyRequest.cc7
-rw-r--r--src/test/librbd/test_mock_ExclusiveLock.cc2
-rw-r--r--src/test/librbd/test_mock_ManagedLock.cc58
-rw-r--r--src/test/librbd/test_mock_fixture.cc2
-rw-r--r--src/test/librbd/trash/test_mock_MoveRequest.cc4
-rw-r--r--src/test/librbd/trash/test_mock_RemoveRequest.cc4
-rw-r--r--src/test/rbd_mirror/CMakeLists.txt3
-rw-r--r--src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc9
-rw-r--r--src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc6
-rw-r--r--src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc2
-rw-r--r--src/test/rbd_mirror/image_replayer/snapshot/test_mock_ApplyImageStateRequest.cc4
-rw-r--r--src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc4
-rw-r--r--src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc2
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc6
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc3
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc3
-rw-r--r--src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc3
-rw-r--r--src/test/rbd_mirror/test_ImageReplayer.cc4
-rw-r--r--src/test/rbd_mirror/test_ImageSync.cc2
-rw-r--r--src/test/rbd_mirror/test_InstanceWatcher.cc8
-rw-r--r--src/test/rbd_mirror/test_fixture.cc3
-rw-r--r--src/test/rbd_mirror/test_mock_InstanceWatcher.cc39
-rw-r--r--src/test/rbd_mirror/test_mock_LeaderWatcher.cc8
-rw-r--r--src/test/rbd_mirror/test_mock_MirrorStatusUpdater.cc2
-rw-r--r--src/test/rbd_mirror/test_mock_NamespaceReplayer.cc5
-rw-r--r--src/test/rbd_mirror/test_mock_PoolReplayer.cc6
-rw-r--r--src/tools/ceph-dencoder/common_types.h4
-rw-r--r--src/tools/ceph-dencoder/mds_types.h4
-rw-r--r--src/tools/rbd/CMakeLists.txt7
-rw-r--r--src/tools/rbd_mirror/CMakeLists.txt1
-rw-r--r--src/tools/rbd_mirror/InstanceWatcher.cc20
-rw-r--r--src/tools/rbd_mirror/InstanceWatcher.h8
-rw-r--r--src/tools/rbd_mirror/Instances.cc2
-rw-r--r--src/tools/rbd_mirror/LeaderWatcher.cc4
-rw-r--r--src/tools/rbd_mirror/LeaderWatcher.h7
-rw-r--r--src/tools/rbd_mirror/Mirror.cc11
-rw-r--r--src/tools/rbd_mirror/NamespaceReplayer.cc2
-rw-r--r--src/tools/rbd_mirror/Threads.cc5
-rw-r--r--src/tools/rbd_mirror/Threads.h8
-rwxr-xr-xsrc/vstart.sh4
561 files changed, 7469 insertions, 6384 deletions
diff --git a/ceph-object-corpus b/ceph-object-corpus
-Subproject 45eaee4bb8756c0bcc8120b4b6efb43766b0116
+Subproject 70228ed56466b4be8a9abff9024f69820f68f6d
diff --git a/doc/cephadm/adoption.rst b/doc/cephadm/adoption.rst
index 20ded51a282..701c3d75f55 100644
--- a/doc/cephadm/adoption.rst
+++ b/doc/cephadm/adoption.rst
@@ -111,7 +111,7 @@ Adoption process
#. Redeploy MDS daemons by telling cephadm how many daemons to run for
each file system. You can list file systems by name with ``ceph fs
- ls``. For each file system::
+ ls``. Run the following command on the master nodes::
# ceph orch apply mds <fs-name> [--placement=<placement>]
diff --git a/doc/cephadm/drivegroups.rst b/doc/cephadm/drivegroups.rst
index ae9b9205fc8..e4f9bd8c83d 100644
--- a/doc/cephadm/drivegroups.rst
+++ b/doc/cephadm/drivegroups.rst
@@ -44,6 +44,15 @@ Since we want to have more complex setups, there are more filters than just the
Filters
=======
+.. note::
+ Filters are applied using a `AND` gate by default. This essentially means that a drive needs to fulfill all filter
+ criteria in order to get selected.
+ If you wish to change this behavior you can adjust this behavior by setting
+
+ `filter_logic: OR` # valid arguments are `AND`, `OR`
+
+ in the OSD Specification.
+
You can assign disks to certain groups by their attributes using filters.
The attributes are based off of ceph-volume's disk query. You can retrieve the information
diff --git a/doc/rbd/iscsi-target-cli.rst b/doc/rbd/iscsi-target-cli.rst
index 2448a54148f..7e9c56b3e35 100644
--- a/doc/rbd/iscsi-target-cli.rst
+++ b/doc/rbd/iscsi-target-cli.rst
@@ -149,9 +149,14 @@ For rpm based instructions execute the following commands:
::
# systemctl daemon-reload
+
+ # systemctl enable rbd-target-gw
+ # systemctl start rbd-target-gw
+
# systemctl enable rbd-target-api
# systemctl start rbd-target-api
+
**Configuring:**
gwcli will create and configure the iSCSI target and RBD images and copy the
diff --git a/qa/tasks/cephadm_cases/test_cli.py b/qa/tasks/cephadm_cases/test_cli.py
index b06e276b1a9..3d39902a09b 100644
--- a/qa/tasks/cephadm_cases/test_cli.py
+++ b/qa/tasks/cephadm_cases/test_cli.py
@@ -37,3 +37,9 @@ class TestCephadmCLI(MgrTestCase):
out = self._orch_cmd('status', '--format', 'yaml')
self.assertNotIn('!!python', out)
+
+ def test_pause(self):
+ self._orch_cmd('pause')
+ self.wait_for_health('CEPHADM_PAUSED', 30)
+ self._orch_cmd('resume')
+ self.wait_for_health_clear(30)
diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py
index 680ce32a575..bf6970af984 100644
--- a/qa/tasks/cephfs/test_volumes.py
+++ b/qa/tasks/cephfs/test_volumes.py
@@ -109,28 +109,33 @@ class TestVolumes(CephFSTestCase):
self._verify_clone_attrs(subvolume, clone, source_group=source_group, clone_group=clone_group)
def _generate_random_volume_name(self, count=1):
- r = random.sample(range(10000), count)
- volumes = ["{0}_{1}".format(TestVolumes.TEST_VOLUME_PREFIX, c) for c in r]
+ n = self.volume_start
+ volumes = [f"{TestVolumes.TEST_VOLUME_PREFIX}_{i:016}" for i in range(n, n+count)]
+ self.volume_start += count
return volumes[0] if count == 1 else volumes
def _generate_random_subvolume_name(self, count=1):
- r = random.sample(range(10000), count)
- subvolumes = ["{0}_{1}".format(TestVolumes.TEST_SUBVOLUME_PREFIX, c) for c in r]
+ n = self.subvolume_start
+ subvolumes = [f"{TestVolumes.TEST_SUBVOLUME_PREFIX}_{i:016}" for i in range(n, n+count)]
+ self.subvolume_start += count
return subvolumes[0] if count == 1 else subvolumes
def _generate_random_group_name(self, count=1):
- r = random.sample(range(100), count)
- groups = ["{0}_{1}".format(TestVolumes.TEST_GROUP_PREFIX, c) for c in r]
+ n = self.group_start
+ groups = [f"{TestVolumes.TEST_GROUP_PREFIX}_{i:016}" for i in range(n, n+count)]
+ self.group_start += count
return groups[0] if count == 1 else groups
def _generate_random_snapshot_name(self, count=1):
- r = random.sample(range(100), count)
- snaps = ["{0}_{1}".format(TestVolumes.TEST_SNAPSHOT_PREFIX, c) for c in r]
+ n = self.snapshot_start
+ snaps = [f"{TestVolumes.TEST_SNAPSHOT_PREFIX}_{i:016}" for i in range(n, n+count)]
+ self.snapshot_start += count
return snaps[0] if count == 1 else snaps
def _generate_random_clone_name(self, count=1):
- r = random.sample(range(1000), count)
- clones = ["{0}_{1}".format(TestVolumes.TEST_CLONE_PREFIX, c) for c in r]
+ n = self.clone_start
+ clones = [f"{TestVolumes.TEST_CLONE_PREFIX}_{i:016}" for i in range(n, n+count)]
+ self.clone_start += count
return clones[0] if count == 1 else clones
def _enable_multi_fs(self):
@@ -228,6 +233,11 @@ class TestVolumes(CephFSTestCase):
self._enable_multi_fs()
self._create_or_reuse_test_volume()
self.config_set('mon', 'mon_allow_pool_delete', True)
+ self.volume_start = random.randint(1, (1<<20))
+ self.subvolume_start = random.randint(1, (1<<20))
+ self.group_start = random.randint(1, (1<<20))
+ self.snapshot_start = random.randint(1, (1<<20))
+ self.clone_start = random.randint(1, (1<<20))
def tearDown(self):
if self.vol_created:
@@ -666,8 +676,8 @@ class TestVolumes(CephFSTestCase):
self._fs_cmd("subvolumegroup", "pin", self.volname, group, "distributed", "True")
# (no effect on distribution) pin the group directory to 0 so rank 0 has all subtree bounds visible
self._fs_cmd("subvolumegroup", "pin", self.volname, group, "export", "0")
- for i in range(10):
- subvolume = self._generate_random_subvolume_name()
+ subvolumes = self._generate_random_subvolume_name(10)
+ for subvolume in subvolumes:
self._fs_cmd("subvolume", "create", self.volname, subvolume, "--group_name", group)
self._wait_distributed_subtrees(10, status=status)
@@ -992,8 +1002,7 @@ class TestVolumes(CephFSTestCase):
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
def test_subvolume_group_create_with_desired_data_pool_layout(self):
- group1 = self._generate_random_group_name()
- group2 = self._generate_random_group_name()
+ group1, group2 = self._generate_random_group_name(2)
# create group
self._fs_cmd("subvolumegroup", "create", self.volname, group1)
@@ -1054,8 +1063,7 @@ class TestVolumes(CephFSTestCase):
raise RuntimeError("expected the 'fs subvolumegroup getpath' command to fail")
def test_subvolume_create_with_desired_data_pool_layout_in_group(self):
- subvol1 = self._generate_random_subvolume_name()
- subvol2 = self._generate_random_subvolume_name()
+ subvol1, subvol2 = self._generate_random_subvolume_name(2)
group = self._generate_random_group_name()
# create group. this also helps set default pool layout for subvolumes
@@ -1086,8 +1094,7 @@ class TestVolumes(CephFSTestCase):
self._fs_cmd("subvolumegroup", "rm", self.volname, group)
def test_subvolume_group_create_with_desired_mode(self):
- group1 = self._generate_random_group_name()
- group2 = self._generate_random_group_name()
+ group1, group2 = self._generate_random_group_name(2)
# default mode
expected_mode1 = "755"
# desired mode
@@ -1135,9 +1142,8 @@ class TestVolumes(CephFSTestCase):
self._fs_cmd("subvolumegroup", "rm", self.volname, subvolgroupname)
def test_subvolume_create_with_desired_mode_in_group(self):
- subvol1 = self._generate_random_subvolume_name()
- subvol2 = self._generate_random_subvolume_name()
- subvol3 = self._generate_random_subvolume_name()
+ subvol1, subvol2, subvol3 = self._generate_random_subvolume_name(3)
+
group = self._generate_random_group_name()
# default mode
expected_mode1 = "755"
diff --git a/qa/tasks/mgr/dashboard/helper.py b/qa/tasks/mgr/dashboard/helper.py
index 44f919b1119..1a7a6951c97 100644
--- a/qa/tasks/mgr/dashboard/helper.py
+++ b/qa/tasks/mgr/dashboard/helper.py
@@ -21,6 +21,9 @@ class DashboardTestCase(MgrTestCase):
# Display full error diffs
maxDiff = None
+ # Increased x3 (20 -> 60)
+ TIMEOUT_HEALTH_CLEAR = 60
+
MGRS_REQUIRED = 2
MDSS_REQUIRED = 1
REQUIRE_FILESYSTEM = True
@@ -186,7 +189,7 @@ class DashboardTestCase(MgrTestCase):
super(DashboardTestCase, self).setUp()
if not self._loggedin and self.AUTO_AUTHENTICATE:
self.login('admin', 'admin')
- self.wait_for_health_clear(20)
+ self.wait_for_health_clear(self.TIMEOUT_HEALTH_CLEAR)
@classmethod
def tearDownClass(cls):
diff --git a/src/ceph.in b/src/ceph.in
index e3dc8270868..9a711d1b4c0 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -1038,7 +1038,7 @@ def main():
if parsed_args.help:
target = None
if len(childargs) >= 2 and childargs[0] == 'tell':
- target = childargs[1].split('.')
+ target = childargs[1].split('.', 1)
if not validate_target(target):
print('target {0} doesn\'t exist; please pass correct target to tell command (e.g., mon.a, osd.1, mds.a, mgr)'.format(childargs[1]), file=sys.stderr)
return 1
@@ -1054,7 +1054,7 @@ def main():
# implement "tell service.id help"
if len(childargs) >= 3 and childargs[0] == 'tell' and childargs[2] == 'help':
- target = childargs[1].split('.')
+ target = childargs[1].split('.', 1)
if validate_target(target):
hdr('Tell %s commands' % target[0])
return do_extended_help(parser, childargs, target, None)
diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm
index 19235ed6113..a4df9df176c 100755
--- a/src/cephadm/cephadm
+++ b/src/cephadm/cephadm
@@ -1275,9 +1275,9 @@ def make_data_dir_base(fsid, uid, gid):
def make_data_dir(fsid, daemon_type, daemon_id, uid=None, gid=None):
- # type: (str, str, Union[int, str], int, int) -> str
- if not uid or not gid:
- (uid, gid) = extract_uid_gid()
+ # type: (str, str, Union[int, str], Optional[int], Optional[int]) -> str
+ if uid is None or gid is None:
+ uid, gid = extract_uid_gid()
make_data_dir_base(fsid, uid, gid)
data_dir = get_data_dir(fsid, daemon_type, daemon_id)
makedirs(data_dir, uid, gid, DATA_DIR_MODE)
@@ -1285,9 +1285,9 @@ def make_data_dir(fsid, daemon_type, daemon_id, uid=None, gid=None):
def make_log_dir(fsid, uid=None, gid=None):
- # type: (str, int, int) -> str
- if not uid or not gid:
- (uid, gid) = extract_uid_gid()
+ # type: (str, Optional[int], Optional[int]) -> str
+ if uid is None or gid is None:
+ uid, gid = extract_uid_gid()
log_dir = get_log_dir(fsid)
makedirs(log_dir, uid, gid, LOG_DIR_MODE)
return log_dir
@@ -1808,17 +1808,11 @@ def get_container(fsid, daemon_type, daemon_id,
ceph_args = [] # type: List[str]
if daemon_type in Monitoring.components:
uid, gid = extract_uid_gid_monitoring(daemon_type)
- m = Monitoring.components[daemon_type] # type: ignore
- metadata = m.get('image', dict()) # type: ignore
monitoring_args = [
'--user',
str(uid),
# FIXME: disable cpu/memory limits for the time being (not supported
# by ubuntu 18.04 kernel!)
- #'--cpus',
- #metadata.get('cpus', '2'),
- #'--memory',
- #metadata.get('memory', '4GB')
]
container_args.extend(monitoring_args)
elif daemon_type == 'crash':
@@ -2395,10 +2389,36 @@ def command_version():
@infer_image
def command_pull():
# type: () -> int
- logger.info('Pulling latest %s...' % args.image)
- call_throws([container_path, 'pull', args.image])
+
+ _pull_image(args.image)
return command_inspect_image()
+
+def _pull_image(image):
+ # type: (str) -> None
+ logger.info('Pulling container image %s...' % image)
+
+ ignorelist = [
+ "error creating read-write layer with ID",
+ "net/http: TLS handshake timeout",
+ "Digest did not match, expected",
+ ]
+
+ cmd = [container_path, 'pull', image]
+ cmd_str = ' '.join(cmd)
+
+ for sleep_secs in [1, 4, 25]:
+ out, err, ret = call(cmd)
+ if not ret:
+ return
+
+ if not any(pattern in err for pattern in ignorelist):
+ raise RuntimeError('Failed command: %s' % cmd_str)
+
+ logger.info('"%s failed transiently. Retrying. waiting %s seconds...' % (cmd_str, sleep_secs))
+ time.sleep(sleep_secs)
+
+ raise RuntimeError('Failed command: %s: maximum retries reached' % cmd_str)
##################################
@@ -2544,8 +2564,7 @@ def command_bootstrap():
config = cpf.getvalue()
if not args.skip_pull:
- logger.info('Pulling latest %s container...' % args.image)
- call_throws([container_path, 'pull', args.image])
+ _pull_image(args.image)
logger.info('Extracting ceph user uid/gid from container image...')
(uid, gid) = extract_uid_gid()
@@ -2818,7 +2837,7 @@ def command_bootstrap():
if not os.path.exists(ssh_dir):
makedirs(ssh_dir, ssh_uid, ssh_gid, 0o700)
-
+
auth_keys_file = '%s/authorized_keys' % ssh_dir
add_newline = False
@@ -3267,7 +3286,7 @@ def _list_ipv6_networks():
def _parse_ipv6_route(routes, ips):
r = {} # type: Dict[str,List[str]]
- route_p = re.compile(r'^(\S+) dev (\S+) proto (\S+) metric (\S+) pref (\S+)$')
+ route_p = re.compile(r'^(\S+) dev (\S+) proto (\S+) metric (\S+) .*pref (\S+)$')
ip_p = re.compile(r'^\s+inet6 (\S+)/(.*)scope (.*)$')
for line in routes.splitlines():
m = route_p.findall(line)
@@ -3472,8 +3491,7 @@ def command_adopt():
# type: () -> None
if not args.skip_pull:
- logger.info('Pulling latest %s container...' % args.image)
- call_throws([container_path, 'pull', args.image])
+ _pull_image(args.image)
(daemon_type, daemon_id) = args.name.split('.', 1)
@@ -3985,7 +4003,7 @@ def command_check_host():
commands = ['systemctl', 'lvcreate']
if args.docker:
- container_path = find_program('docker')
+ container_path = find_program('docker')
else:
for i in CONTAINER_PREFERENCE:
try:
@@ -4350,17 +4368,10 @@ class YumDnf(Packager):
if self.distro_code.startswith('el'):
logger.info('Enabling EPEL...')
call_throws([self.tool, 'install', '-y', 'epel-release'])
- if self.distro_code == 'el8':
- # we also need Ken's copr repo, at least for now
- logger.info('Enabling supplementary copr repo ktdreyer/ceph-el8...')
- call_throws(['dnf', 'copr', 'enable', '-y', 'ktdreyer/ceph-el8'])
def rm_repo(self):
if os.path.exists(self.repo_path()):
os.unlink(self.repo_path())
- if self.distro_code == 'el8':
- logger.info('Disabling supplementary copr repo ktdreyer/ceph-el8...')
- call_throws(['dnf', 'copr', 'disable', '-y', 'ktdreyer/ceph-el8'])
def install(self, ls):
logger.info('Installing packages %s...' % ls)
diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py
index bea83d71a65..83969097a79 100644
--- a/src/cephadm/tests/test_cephadm.py
+++ b/src/cephadm/tests/test_cephadm.py
@@ -99,6 +99,7 @@ default via 10.3.64.1 dev eno1 proto static metric 100
::1 dev lo proto kernel metric 256 pref medium
fdbc:7574:21fe:9200::/64 dev wlp2s0 proto ra metric 600 pref medium
fdd8:591e:4969:6363::/64 dev wlp2s0 proto ra metric 600 pref medium
+fde4:8dba:82e1::/64 dev eth1 proto kernel metric 256 expires 1844sec pref medium
fe80::/64 dev tun0 proto kernel metric 256 pref medium
fe80::/64 dev wlp2s0 proto kernel metric 600 pref medium
default dev tun0 proto static metric 50 pref medium
@@ -127,6 +128,10 @@ default via fe80::2480:28ec:5097:3fe2 dev wlp2s0 proto ra metric 20600 pref medi
valid_lft 6745sec preferred_lft 0sec
inet6 fe80::1111:2222:3333:4444/64 scope link noprefixroute
valid_lft forever preferred_lft forever
+ inet6 fde4:8dba:82e1:0:ec4a:e402:e9df:b357/64 scope global temporary dynamic
+ valid_lft 1074sec preferred_lft 1074sec
+ inet6 fde4:8dba:82e1:0:5054:ff:fe72:61af/64 scope global dynamic mngtmpaddr
+ valid_lft 1074sec preferred_lft 1074sec
12: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 state UNKNOWN qlen 100
inet6 fe80::cafe:cafe:cafe:cafe/64 scope link stable-privacy
valid_lft forever preferred_lft forever
@@ -141,6 +146,8 @@ default via fe80::2480:28ec:5097:3fe2 dev wlp2s0 proto ra metric 20600 pref medi
"fdd8:591e:4969:6363:103a:abcd:af1f:57f3",
"fdd8:591e:4969:6363:a128:1234:2bdd:1b6f",
"fdd8:591e:4969:6363:d581:4321:380b:3905"],
+ "fde4:8dba:82e1::/64": ["fde4:8dba:82e1:0:ec4a:e402:e9df:b357",
+ "fde4:8dba:82e1:0:5054:ff:fe72:61af"],
"fe80::/64": ["fe80::1111:2222:3333:4444",
"fe80::cafe:cafe:cafe:cafe"]
}
diff --git a/src/cls/rbd/cls_rbd_client.cc b/src/cls/rbd/cls_rbd_client.cc
index f9ba2419a68..28f1600a855 100644
--- a/src/cls/rbd/cls_rbd_client.cc
+++ b/src/cls/rbd/cls_rbd_client.cc
@@ -7,6 +7,7 @@
#include "include/encoding.h"
#include "include/rbd_types.h"
#include "include/rados/librados.hpp"
+#include "include/neorados/RADOS.hpp"
#include "common/bit_vector.hpp"
#include <errno.h>
@@ -841,10 +842,19 @@ int get_all_features(librados::IoCtx *ioctx, const std::string &oid,
return get_all_features_finish(&it, all_features);
}
-void copyup(librados::ObjectWriteOperation *op, bufferlist data) {
+template <typename O>
+void copyup(O* op, ceph::buffer::list data) {
op->exec("rbd", "copyup", data);
}
+void copyup(neorados::WriteOp* op, ceph::buffer::list data) {
+ copyup<neorados::WriteOp>(op, data);
+}
+
+void copyup(librados::ObjectWriteOperation *op, bufferlist data) {
+ copyup<librados::ObjectWriteOperation>(op, data);
+}
+
int copyup(librados::IoCtx *ioctx, const std::string &oid,
bufferlist data) {
librados::ObjectWriteOperation op;
@@ -853,15 +863,26 @@ int copyup(librados::IoCtx *ioctx, const std::string &oid,
return ioctx->operate(oid, &op);
}
-void sparse_copyup(librados::ObjectWriteOperation *op,
- const std::map<uint64_t, uint64_t> &extent_map,
- bufferlist data) {
+template <typename O, typename E>
+void sparse_copyup(O* op, const E& extent_map, ceph::buffer::list data) {
bufferlist bl;
encode(extent_map, bl);
encode(data, bl);
op->exec("rbd", "sparse_copyup", bl);
}
+void sparse_copyup(neorados::WriteOp* op,
+ const std::map<uint64_t, uint64_t> &extent_map,
+ ceph::buffer::list data) {
+ sparse_copyup<neorados::WriteOp>(op, extent_map, data);
+}
+
+void sparse_copyup(librados::ObjectWriteOperation *op,
+ const std::map<uint64_t, uint64_t> &extent_map,
+ bufferlist data) {
+ sparse_copyup<librados::ObjectWriteOperation>(op, extent_map, data);
+}
+
int sparse_copyup(librados::IoCtx *ioctx, const std::string &oid,
const std::map<uint64_t, uint64_t> &extent_map,
bufferlist data) {
@@ -1732,6 +1753,27 @@ void migration_remove(librados::ObjectWriteOperation *op) {
op->exec("rbd", "migration_remove", bl);
}
+template <typename O>
+void assert_snapc_seq(O* op, uint64_t snapc_seq,
+ cls::rbd::AssertSnapcSeqState state) {
+ bufferlist bl;
+ encode(snapc_seq, bl);
+ encode(state, bl);
+ op->exec("rbd", "assert_snapc_seq", bl);
+}
+
+void assert_snapc_seq(neorados::WriteOp* op,
+ uint64_t snapc_seq,
+ cls::rbd::AssertSnapcSeqState state) {
+ assert_snapc_seq<neorados::WriteOp>(op, snapc_seq, state);
+}
+
+void assert_snapc_seq(librados::ObjectWriteOperation *op,
+ uint64_t snapc_seq,
+ cls::rbd::AssertSnapcSeqState state) {
+ assert_snapc_seq<librados::ObjectWriteOperation>(op, snapc_seq, state);
+}
+
int assert_snapc_seq(librados::IoCtx *ioctx, const std::string &oid,
uint64_t snapc_seq,
cls::rbd::AssertSnapcSeqState state) {
@@ -1740,15 +1782,6 @@ int assert_snapc_seq(librados::IoCtx *ioctx, const std::string &oid,
return ioctx->operate(oid, &op);
}
-void assert_snapc_seq(librados::ObjectWriteOperation *op,
- uint64_t snapc_seq,
- cls::rbd::AssertSnapcSeqState state) {
- bufferlist bl;
- encode(snapc_seq, bl);
- encode(state, bl);
- op->exec("rbd", "assert_snapc_seq", bl);
-}
-
void mirror_uuid_get_start(librados::ObjectReadOperation *op) {
bufferlist bl;
op->exec("rbd", "mirror_uuid_get", bl);
diff --git a/src/cls/rbd/cls_rbd_client.h b/src/cls/rbd/cls_rbd_client.h
index aa9bb2b09e0..5bc43fca883 100644
--- a/src/cls/rbd/cls_rbd_client.h
+++ b/src/cls/rbd/cls_rbd_client.h
@@ -12,6 +12,7 @@
class Context;
namespace ceph { template <uint8_t> class BitVector; }
+namespace neorados { struct WriteOp; }
namespace librbd {
namespace cls_client {
@@ -626,17 +627,24 @@ int namespace_list(librados::IoCtx *ioctx,
std::list<std::string> *entries);
// operations on data objects
-int assert_snapc_seq(librados::IoCtx *ioctx, const std::string &oid,
- uint64_t snapc_seq,
- cls::rbd::AssertSnapcSeqState state);
+void assert_snapc_seq(neorados::WriteOp* op,
+ uint64_t snapc_seq,
+ cls::rbd::AssertSnapcSeqState state);
void assert_snapc_seq(librados::ObjectWriteOperation *op,
uint64_t snapc_seq,
cls::rbd::AssertSnapcSeqState state);
+int assert_snapc_seq(librados::IoCtx *ioctx, const std::string &oid,
+ uint64_t snapc_seq,
+ cls::rbd::AssertSnapcSeqState state);
+void copyup(neorados::WriteOp* op, ceph::buffer::list data);
void copyup(librados::ObjectWriteOperation *op, ceph::buffer::list data);
int copyup(librados::IoCtx *ioctx, const std::string &oid,
ceph::buffer::list data);
+void sparse_copyup(neorados::WriteOp* op,
+ const std::map<uint64_t, uint64_t> &extent_map,
+ ceph::buffer::list data);
void sparse_copyup(librados::ObjectWriteOperation *op,
const std::map<uint64_t, uint64_t> &extent_map,
ceph::buffer::list data);
diff --git a/src/common/Timer.cc b/src/common/Timer.cc
index 39ad4531915..bf050e6395a 100644
--- a/src/common/Timer.cc
+++ b/src/common/Timer.cc
@@ -107,7 +107,8 @@ void SafeTimer::timer_thread()
if (schedule.empty()) {
cond.wait(l);
} else {
- cond.wait_until(l, schedule.begin()->first);
+ auto when = schedule.begin()->first;
+ cond.wait_until(l, when);
}
ldout(cct,20) << "timer_thread awake" << dendl;
}
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc
index d4248d9e9b1..2e46507955c 100644
--- a/src/common/ceph_context.cc
+++ b/src/common/ceph_context.cc
@@ -782,6 +782,8 @@ void CephContext::put() {
if (--nref == 0) {
ANNOTATE_HAPPENS_AFTER(&nref);
ANNOTATE_HAPPENS_BEFORE_FORGET_ALL(&nref);
+ if (g_ceph_context == this)
+ g_ceph_context = nullptr;
delete this;
} else {
ANNOTATE_HAPPENS_BEFORE(&nref);
diff --git a/src/common/options.cc b/src/common/options.cc
index 3ff9807aca2..de44c662918 100644
--- a/src/common/options.cc
+++ b/src/common/options.cc
@@ -7364,6 +7364,10 @@ static std::vector<Option> get_rbd_options() {
.set_default(true)
.set_description("validate new image names for RBD compatibility"),
+ Option("rbd_invalidate_object_map_on_timeout", Option::TYPE_BOOL, Option::LEVEL_DEV)
+ .set_default(true)
+ .set_description("true if object map should be invalidated when load or update timeout"),
+
Option("rbd_auto_exclusive_lock_until_manual_request", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(true)
.set_description("automatically acquire/release exclusive lock until it is explicitly requested"),
diff --git a/src/common/shunique_lock.h b/src/common/shunique_lock.h
index 2a8da953c13..5f809e83a8b 100644
--- a/src/common/shunique_lock.h
+++ b/src/common/shunique_lock.h
@@ -104,7 +104,6 @@ public:
switch (o) {
case ownership::none:
return;
- break;
case ownership::unique:
m->unlock();
break;
diff --git a/src/include/neorados/RADOS.hpp b/src/include/neorados/RADOS.hpp
index 5b0b011d361..45932e16354 100644
--- a/src/include/neorados/RADOS.hpp
+++ b/src/include/neorados/RADOS.hpp
@@ -551,23 +551,25 @@ public:
template<typename CompletionToken>
auto execute(const Object& o, const IOContext& ioc, ReadOp&& op,
ceph::buffer::list* bl,
- CompletionToken&& token, uint64_t* objver = nullptr) {
+ CompletionToken&& token, uint64_t* objver = nullptr,
+ const blkin_trace_info* trace_info = nullptr) {
boost::asio::async_completion<CompletionToken, Op::Signature> init(token);
execute(o, ioc, std::move(op), bl,
ReadOp::Completion::create(get_executor(),
std::move(init.completion_handler)),
- objver);
+ objver, trace_info);
return init.result.get();
}
template<typename CompletionToken>
auto execute(const Object& o, const IOContext& ioc, WriteOp&& op,
- CompletionToken&& token, uint64_t* objver = nullptr) {
+ CompletionToken&& token, uint64_t* objver = nullptr,
+ const blkin_trace_info* trace_info = nullptr) {
boost::asio::async_completion<CompletionToken, Op::Signature> init(token);
execute(o, ioc, std::move(op),
Op::Completion::create(get_executor(),
std::move(init.completion_handler)),
- objver);
+ objver, trace_info);
return init.result.get();
}
@@ -939,6 +941,15 @@ public:
std::move(init.completion_handler)));
return init.result.get();
}
+
+ template<typename CompletionToken>
+ auto wait_for_latest_osd_map(CompletionToken&& token) {
+ boost::asio::async_completion<CompletionToken, SimpleOpSig> init(token);
+ wait_for_latest_osd_map(
+ SimpleOpComp::create(get_executor(), std::move(init.completion_handler)));
+ return init.result.get();
+ }
+
uint64_t instance_id() const;
private:
@@ -954,10 +965,11 @@ private:
void execute(const Object& o, const IOContext& ioc, ReadOp&& op,
ceph::buffer::list* bl, std::unique_ptr<Op::Completion> c,
- uint64_t* objver);
+ uint64_t* objver, const blkin_trace_info* trace_info);
void execute(const Object& o, const IOContext& ioc, WriteOp&& op,
- std::unique_ptr<Op::Completion> c, uint64_t* objver);
+ std::unique_ptr<Op::Completion> c, uint64_t* objver,
+ const blkin_trace_info* trace_info);
void execute(const Object& o, std::int64_t pool, ReadOp&& op,
ceph::buffer::list* bl, std::unique_ptr<Op::Completion> c,
@@ -1070,6 +1082,7 @@ private:
void enable_application(std::string_view pool, std::string_view app_name,
bool force, std::unique_ptr<SimpleOpComp> c);
+ void wait_for_latest_osd_map(std::unique_ptr<SimpleOpComp> c);
// Proxy object to provide access to low-level RADOS messaging clients
std::unique_ptr<detail::Client> impl;
diff --git a/src/include/rados/librados_fwd.hpp b/src/include/rados/librados_fwd.hpp
index 8926d097095..396f3a83875 100644
--- a/src/include/rados/librados_fwd.hpp
+++ b/src/include/rados/librados_fwd.hpp
@@ -1,6 +1,8 @@
#ifndef __LIBRADOS_FWD_HPP
#define __LIBRADOS_FWD_HPP
+struct blkin_trace_info;
+
namespace libradosstriper {
class RadosStriper;
diff --git a/src/key_value_store/kv_flat_btree_async.cc b/src/key_value_store/kv_flat_btree_async.cc
index e5f4d1540e5..d84239409e3 100644
--- a/src/key_value_store/kv_flat_btree_async.cc
+++ b/src/key_value_store/kv_flat_btree_async.cc
@@ -1452,13 +1452,10 @@ int KvFlatBtreeAsync::set_op(const string &key, const bufferlist &val,
case -ESUICIDE:
if (verbose) cout << client_name << " IS SUICIDING!" << std::endl;
return ret;
- break;
case 1:
return set_op(key, val, update_on_existing, idata);
- break;
case 2:
return err;
- break;
}
}
} while (err < 0 && err != -EBALANCE && err != -ENOENT);
@@ -1572,10 +1569,8 @@ int KvFlatBtreeAsync::remove_op(const string &key, index_data &idata,
case -ESUICIDE:
if (verbose) cout << client_name << " IS SUICIDING!" << std::endl;
return err;
- break;
case 1:
return remove_op(key, idata, next_idata);
- break;
case 2:
return err;
break;
diff --git a/src/librbd/AsioEngine.cc b/src/librbd/AsioEngine.cc
index 99e381f0bed..1a46b590479 100644
--- a/src/librbd/AsioEngine.cc
+++ b/src/librbd/AsioEngine.cc
@@ -2,9 +2,12 @@
// vim: ts=8 sw=2 smarttab
#include "librbd/AsioEngine.h"
+#include "include/Context.h"
+#include "include/stringify.h"
+#include "include/neorados/RADOS.hpp"
+#include "include/rados/librados.hpp"
#include "common/dout.h"
#include "librbd/asio/ContextWQ.h"
-#include <boost/system/error_code.hpp>
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
@@ -13,43 +16,40 @@
namespace librbd {
-AsioEngine::AsioEngine(CephContext* cct)
- : m_cct(cct) {
- init();
+AsioEngine::AsioEngine(std::shared_ptr<librados::Rados> rados)
+ : m_rados_api(std::make_shared<neorados::RADOS>(
+ neorados::RADOS::make_with_librados(*rados))),
+ m_cct(m_rados_api->cct()),
+ m_io_context(m_rados_api->get_io_context()),
+ m_api_strand(std::make_unique<boost::asio::io_context::strand>(
+ m_io_context)),
+ m_context_wq(std::make_unique<asio::ContextWQ>(m_cct, m_io_context)) {
+ ldout(m_cct, 20) << dendl;
+
+ auto rados_threads = m_cct->_conf.get_val<uint64_t>("librados_thread_count");
+ auto rbd_threads = m_cct->_conf.get_val<uint64_t>("rbd_op_threads");
+ if (rbd_threads > rados_threads) {
+ // inherit the librados thread count -- but increase it if librbd wants to
+ // utilize more threads
+ m_cct->_conf.set_val("librados_thread_count", stringify(rbd_threads));
+ }
}
-AsioEngine::~AsioEngine() {
- shut_down();
+AsioEngine::AsioEngine(librados::IoCtx& io_ctx)
+ : AsioEngine(std::make_shared<librados::Rados>(io_ctx)) {
}
-void AsioEngine::init() {
- auto thread_count = m_cct->_conf.get_val<uint64_t>("rbd_op_threads");
- m_threads.reserve(thread_count);
-
- // prevent IO context from exiting if no work is currently scheduled
- m_work_guard.emplace(boost::asio::make_work_guard(m_io_context));
-
- ldout(m_cct, 5) << "spawning " << thread_count << " threads" << dendl;
- for (auto i = 0U; i < thread_count; i++) {
- m_threads.emplace_back([=] {
- boost::system::error_code ec;
- m_io_context.run(ec);
- });
- }
-
- m_work_queue = std::make_unique<asio::ContextWQ>(m_io_context);
+AsioEngine::~AsioEngine() {
+ ldout(m_cct, 20) << dendl;
+ m_api_strand.reset();
}
-void AsioEngine::shut_down() {
- ldout(m_cct, 5) << "joining threads" << dendl;
-
- m_work_guard.reset();
- for (auto& thread : m_threads) {
- thread.join();
- }
- m_threads.clear();
+void AsioEngine::dispatch(Context* ctx, int r) {
+ dispatch([ctx, r]() { ctx->complete(r); });
+}
- ldout(m_cct, 5) << "done" << dendl;
+void AsioEngine::post(Context* ctx, int r) {
+ post([ctx, r]() { ctx->complete(r); });
}
} // namespace librbd
diff --git a/src/librbd/AsioEngine.h b/src/librbd/AsioEngine.h
index 6c7f1a7b171..d2730fd9880 100644
--- a/src/librbd/AsioEngine.h
+++ b/src/librbd/AsioEngine.h
@@ -5,12 +5,15 @@
#define CEPH_LIBRBD_ASIO_ENGINE_H
#include "include/common_fwd.h"
+#include "include/rados/librados_fwd.hpp"
#include <memory>
-#include <optional>
-#include <thread>
-#include <vector>
-#include <boost/asio/executor_work_guard.hpp>
+#include <boost/asio/dispatch.hpp>
#include <boost/asio/io_context.hpp>
+#include <boost/asio/io_context_strand.hpp>
+#include <boost/asio/post.hpp>
+
+struct Context;
+namespace neorados { struct RADOS; }
namespace librbd {
@@ -18,34 +21,56 @@ namespace asio { struct ContextWQ; }
class AsioEngine {
public:
- explicit AsioEngine(CephContext* cct);
+ explicit AsioEngine(std::shared_ptr<librados::Rados> rados);
+ explicit AsioEngine(librados::IoCtx& io_ctx);
~AsioEngine();
+ AsioEngine(AsioEngine&&) = delete;
+ AsioEngine(const AsioEngine&) = delete;
+ AsioEngine& operator=(const AsioEngine&) = delete;
+
+ inline neorados::RADOS& get_rados_api() {
+ return *m_rados_api;
+ }
+
inline boost::asio::io_context& get_io_context() {
return m_io_context;
}
+ inline operator boost::asio::io_context&() {
+ return m_io_context;
+ }
+ inline boost::asio::io_context::executor_type get_executor() {
+ return m_io_context.get_executor();
+ }
+
+ inline boost::asio::io_context::strand& get_api_strand() {
+ // API client callbacks should never fire concurrently
+ return *m_api_strand;
+ }
inline asio::ContextWQ* get_work_queue() {
- return m_work_queue.get();
+ return m_context_wq.get();
}
-private:
- typedef std::vector<std::thread> Threads;
+ template <typename T>
+ void dispatch(T&& t) {
+ boost::asio::dispatch(m_io_context, std::forward<T>(t));
+ }
+ void dispatch(Context* ctx, int r);
- typedef boost::asio::executor_work_guard<
- boost::asio::io_context::executor_type> WorkGuard;
+ template <typename T>
+ void post(T&& t) {
+ boost::asio::post(m_io_context, std::forward<T>(t));
+ }
+ void post(Context* ctx, int r);
+private:
+ std::shared_ptr<neorados::RADOS> m_rados_api;
CephContext* m_cct;
- Threads m_threads;
-
- boost::asio::io_context m_io_context;
- std::optional<WorkGuard> m_work_guard;
-
- std::unique_ptr<asio::ContextWQ> m_work_queue;
-
- void init();
- void shut_down();
+ boost::asio::io_context& m_io_context;
+ std::unique_ptr<boost::asio::io_context::strand> m_api_strand;
+ std::unique_ptr<asio::ContextWQ> m_context_wq;
};
} // namespace librbd
diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt
index f4c48c61817..5f9063042ad 100644
--- a/src/librbd/CMakeLists.txt
+++ b/src/librbd/CMakeLists.txt
@@ -234,10 +234,11 @@ target_link_libraries(librbd PRIVATE
rbd_internal
rbd_types
journal
+ libneorados
librados
- cls_rbd_client
- cls_lock_client
- cls_journal_client
+ cls_rbd_client
+ cls_lock_client
+ cls_journal_client
ceph-common
pthread
${CMAKE_DL_LIBS}
diff --git a/src/librbd/ExclusiveLock.cc b/src/librbd/ExclusiveLock.cc
index ebd3198c3d6..bdf67238df3 100644
--- a/src/librbd/ExclusiveLock.cc
+++ b/src/librbd/ExclusiveLock.cc
@@ -31,7 +31,7 @@ using ML = ManagedLock<I>;
template <typename I>
ExclusiveLock<I>::ExclusiveLock(I &image_ctx)
: RefCountedObject(image_ctx.cct),
- ML<I>(image_ctx.md_ctx, image_ctx.op_work_queue, image_ctx.header_oid,
+ ML<I>(image_ctx.md_ctx, *image_ctx.asio_engine, image_ctx.header_oid,
image_ctx.image_watcher, managed_lock::EXCLUSIVE,
image_ctx.config.template get_val<bool>("rbd_blacklist_on_break_lock"),
image_ctx.config.template get_val<uint64_t>("rbd_blacklist_expire_seconds")),
diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc
index f4ef8047605..ddfa8efc768 100644
--- a/src/librbd/ImageCtx.cc
+++ b/src/librbd/ImageCtx.cc
@@ -4,6 +4,8 @@
#include <boost/assign/list_of.hpp>
#include <stddef.h>
+#include "include/neorados/RADOS.hpp"
+
#include "common/ceph_context.h"
#include "common/dout.h"
#include "common/errno.h"
@@ -70,9 +72,10 @@ public:
}
};
-boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
- auto asio_engine_singleton = ImageCtx::get_asio_engine(cct);
- return asio_engine_singleton->get_io_context();
+librados::IoCtx duplicate_io_ctx(librados::IoCtx& io_ctx) {
+ librados::IoCtx dup_io_ctx;
+ dup_io_ctx.dup(io_ctx);
+ return dup_io_ctx;
}
} // anonymous namespace
@@ -90,6 +93,10 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
read_only_flags(ro ? IMAGE_READ_ONLY_FLAG_USER : 0U),
exclusive_locked(false),
name(image_name),
+ asio_engine(std::make_shared<AsioEngine>(p)),
+ rados_api(asio_engine->get_rados_api()),
+ data_ctx(duplicate_io_ctx(p)),
+ md_ctx(duplicate_io_ctx(p)),
image_watcher(NULL),
journal(NULL),
owner_lock(ceph::make_shared_mutex(util::unique_lock_name("librbd::ImageCtx::owner_lock", this))),
@@ -108,23 +115,20 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
state(new ImageState<>(this)),
operations(new Operations<>(*this)),
exclusive_lock(nullptr), object_map(nullptr),
- io_context(get_asio_engine_io_context(cct)),
- op_work_queue(nullptr),
+ op_work_queue(asio_engine->get_work_queue()),
plugin_registry(new PluginRegistry<ImageCtx>(this)),
- external_callback_completions(32),
event_socket_completions(32),
asok_hook(nullptr),
trace_endpoint("librbd")
{
- md_ctx.dup(p);
- data_ctx.dup(p);
if (snap)
snap_name = snap;
+ rebuild_data_io_context();
+
// FIPS zeroization audit 20191117: this memset is not security related.
memset(&header, 0, sizeof(header));
- get_work_queue(cct, &op_work_queue);
io_image_dispatcher = new io::ImageDispatcher<ImageCtx>(this);
io_object_dispatcher = new io::ObjectDispatcher<ImageCtx>(this);
@@ -168,6 +172,11 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
delete state;
delete plugin_registry;
+
+ // destroy our AsioEngine via its shared io_context to ensure that we
+ // aren't executing within an AsioEngine-owned strand
+ auto& io_context = asio_engine->get_io_context();
+ boost::asio::post(io_context, [asio_engine=std::move(asio_engine)]() {});
}
void ImageCtx::init() {
@@ -321,6 +330,7 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
snap_exists = true;
if (data_ctx.is_valid()) {
data_ctx.snap_set_read(snap_id);
+ rebuild_data_io_context();
}
return 0;
}
@@ -336,6 +346,7 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
snap_exists = true;
if (data_ctx.is_valid()) {
data_ctx.snap_set_read(snap_id);
+ rebuild_data_io_context();
}
}
@@ -898,14 +909,19 @@ boost::asio::io_context& get_asio_engine_io_context(CephContext* cct) {
journal_policy = policy;
}
- AsioEngine* ImageCtx::get_asio_engine(CephContext* cct) {
- return &cct->lookup_or_create_singleton_object<AsioEngine>(
- "librbd::AsioEngine", false, cct);
+ void ImageCtx::rebuild_data_io_context() {
+ auto ctx = std::make_shared<neorados::IOContext>(
+ data_ctx.get_id(), data_ctx.get_namespace());
+ ctx->read_snap(snap_id);
+ ctx->write_snap_context(
+ {{snapc.seq, {snapc.snaps.begin(), snapc.snaps.end()}}});
+
+ // atomically reset the data IOContext to new version
+ atomic_store(&data_io_context, ctx);
}
- void ImageCtx::get_work_queue(CephContext *cct,
- asio::ContextWQ **op_work_queue) {
- *op_work_queue = get_asio_engine(cct)->get_work_queue();
+ IOContext ImageCtx::get_data_io_context() const {
+ return atomic_load(&data_io_context);
}
void ImageCtx::get_timer_instance(CephContext *cct, SafeTimer **timer,
diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h
index b134117dc2c..de783e0fb3c 100644
--- a/src/librbd/ImageCtx.h
+++ b/src/librbd/ImageCtx.h
@@ -8,6 +8,7 @@
#include <atomic>
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -32,14 +33,16 @@
#include "librbd/AsyncRequest.h"
#include "librbd/Types.h"
-#include <boost/asio/io_context.hpp>
#include <boost/lockfree/policies.hpp>
#include <boost/lockfree/queue.hpp>
-class Finisher;
-class ThreadPool;
class SafeTimer;
+namespace neorados {
+class IOContext;
+class RADOS;
+} // namespace neorados
+
namespace librbd {
struct AsioEngine;
@@ -109,7 +112,16 @@ namespace librbd {
std::string name;
cls::rbd::SnapshotNamespace snap_namespace;
std::string snap_name;
- IoCtx data_ctx, md_ctx;
+
+ std::shared_ptr<AsioEngine> asio_engine;
+
+ // New ASIO-style RADOS API
+ neorados::RADOS& rados_api;
+
+ // Legacy RADOS API
+ librados::IoCtx data_ctx;
+ librados::IoCtx md_ctx;
+
ImageWatcher<ImageCtx> *image_watcher;
Journal<ImageCtx> *journal;
@@ -181,8 +193,6 @@ namespace librbd {
xlist<operation::ResizeRequest<ImageCtx>*> resize_reqs;
- boost::asio::io_context& io_context;
-
io::ImageDispatcherInterface *io_image_dispatcher = nullptr;
io::ObjectDispatcherInterface *io_object_dispatcher = nullptr;
@@ -194,9 +204,6 @@ namespace librbd {
io::AioCompletion*,
boost::lockfree::allocator<ceph::allocator<void>>> Completions;
- Completions external_callback_completions;
- std::atomic<bool> external_callback_in_progress = {false};
-
Completions event_socket_completions;
EventSocket event_socket;
@@ -344,11 +351,14 @@ namespace librbd {
journal::Policy *get_journal_policy() const;
void set_journal_policy(journal::Policy *policy);
- static AsioEngine* get_asio_engine(CephContext* cct);
- static void get_work_queue(CephContext *cct,
- asio::ContextWQ **op_work_queue);
+ void rebuild_data_io_context();
+ IOContext get_data_io_context() const;
+
static void get_timer_instance(CephContext *cct, SafeTimer **timer,
ceph::mutex **timer_lock);
+
+ private:
+ std::shared_ptr<neorados::IOContext> data_io_context;
};
}
diff --git a/src/librbd/ImageState.cc b/src/librbd/ImageState.cc
index 8e831a6fdc7..96f57f87910 100644
--- a/src/librbd/ImageState.cc
+++ b/src/librbd/ImageState.cc
@@ -7,6 +7,7 @@
#include "common/errno.h"
#include "common/Cond.h"
#include "common/WorkQueue.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
#include "librbd/asio/ContextWQ.h"
@@ -233,11 +234,11 @@ private:
class QuiesceWatchers {
public:
- explicit QuiesceWatchers(CephContext *cct)
+ explicit QuiesceWatchers(CephContext *cct, asio::ContextWQ* work_queue)
: m_cct(cct),
+ m_work_queue(work_queue),
m_lock(ceph::make_mutex(util::unique_lock_name(
"librbd::QuiesceWatchers::m_lock", this))) {
- ImageCtx::get_work_queue(m_cct, &m_work_queue);
}
~QuiesceWatchers() {
@@ -423,7 +424,8 @@ ImageState<I>::ImageState(I *image_ctx)
m_lock(ceph::make_mutex(util::unique_lock_name("librbd::ImageState::m_lock", this))),
m_last_refresh(0), m_refresh_seq(0),
m_update_watchers(new ImageUpdateWatchers(image_ctx->cct)),
- m_quiesce_watchers(new QuiesceWatchers(image_ctx->cct)) {
+ m_quiesce_watchers(new QuiesceWatchers(
+ image_ctx->cct, image_ctx->asio_engine->get_work_queue())) {
}
template <typename I>
diff --git a/src/librbd/ManagedLock.cc b/src/librbd/ManagedLock.cc
index 27514a9a09f..bc7245eb010 100644
--- a/src/librbd/ManagedLock.cc
+++ b/src/librbd/ManagedLock.cc
@@ -2,6 +2,9 @@
// vim: ts=8 sw=2 smarttab
#include "librbd/ManagedLock.h"
+#include "librbd/AsioEngine.h"
+#include "librbd/ImageCtx.h"
+#include "librbd/Watcher.h"
#include "librbd/asio/ContextWQ.h"
#include "librbd/managed_lock/AcquireRequest.h"
#include "librbd/managed_lock/BreakRequest.h"
@@ -10,8 +13,6 @@
#include "librbd/managed_lock/ReacquireRequest.h"
#include "librbd/managed_lock/Types.h"
#include "librbd/managed_lock/Utils.h"
-#include "librbd/Watcher.h"
-#include "librbd/ImageCtx.h"
#include "cls/lock/cls_lock_client.h"
#include "common/dout.h"
#include "common/errno.h"
@@ -63,13 +64,14 @@ using managed_lock::util::decode_lock_cookie;
using managed_lock::util::encode_lock_cookie;
template <typename I>
-ManagedLock<I>::ManagedLock(librados::IoCtx &ioctx, asio::ContextWQ *work_queue,
+ManagedLock<I>::ManagedLock(librados::IoCtx &ioctx, AsioEngine& asio_engine,
const string& oid, Watcher *watcher, Mode mode,
bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds)
: m_lock(ceph::make_mutex(unique_lock_name("librbd::ManagedLock<I>::m_lock", this))),
m_ioctx(ioctx), m_cct(reinterpret_cast<CephContext *>(ioctx.cct())),
- m_work_queue(work_queue),
+ m_asio_engine(asio_engine),
+ m_work_queue(asio_engine.get_work_queue()),
m_oid(oid),
m_watcher(watcher),
m_mode(mode),
@@ -267,7 +269,7 @@ void ManagedLock<I>::break_lock(const managed_lock::Locker &locker,
} else {
on_finish = new C_Tracked(m_async_op_tracker, on_finish);
auto req = managed_lock::BreakRequest<I>::create(
- m_ioctx, m_work_queue, m_oid, locker, m_mode == EXCLUSIVE,
+ m_ioctx, m_asio_engine, m_oid, locker, m_mode == EXCLUSIVE,
m_blacklist_on_break_lock, m_blacklist_expire_seconds, force_break_lock,
on_finish);
req->send();
@@ -509,7 +511,7 @@ void ManagedLock<I>::handle_pre_acquire_lock(int r) {
using managed_lock::AcquireRequest;
AcquireRequest<I>* req = AcquireRequest<I>::create(
- m_ioctx, m_watcher, m_work_queue, m_oid, m_cookie, m_mode == EXCLUSIVE,
+ m_ioctx, m_watcher, m_asio_engine, m_oid, m_cookie, m_mode == EXCLUSIVE,
m_blacklist_on_break_lock, m_blacklist_expire_seconds,
create_context_callback<
ManagedLock<I>, &ManagedLock<I>::handle_acquire_lock>(this));
diff --git a/src/librbd/ManagedLock.h b/src/librbd/ManagedLock.h
index 9bf38ec3026..e1e95fe4302 100644
--- a/src/librbd/ManagedLock.h
+++ b/src/librbd/ManagedLock.h
@@ -17,8 +17,8 @@
namespace librbd {
+struct AsioEngine;
struct ImageCtx;
-
namespace asio { struct ContextWQ; }
namespace managed_lock { struct Locker; }
@@ -30,19 +30,19 @@ private:
public:
static ManagedLock *create(librados::IoCtx& ioctx,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid, Watcher *watcher,
managed_lock::Mode mode,
bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds) {
- return new ManagedLock(ioctx, work_queue, oid, watcher, mode,
+ return new ManagedLock(ioctx, asio_engine, oid, watcher, mode,
blacklist_on_break_lock, blacklist_expire_seconds);
}
void destroy() {
delete this;
}
- ManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
+ ManagedLock(librados::IoCtx& ioctx, AsioEngine& asio_engine,
const std::string& oid, Watcher *watcher,
managed_lock::Mode mode, bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds);
@@ -211,7 +211,8 @@ private:
librados::IoCtx& m_ioctx;
CephContext *m_cct;
- asio::ContextWQ *m_work_queue;
+ AsioEngine& m_asio_engine;
+ asio::ContextWQ* m_work_queue;
std::string m_oid;
Watcher *m_watcher;
managed_lock::Mode m_mode;
diff --git a/src/librbd/Types.h b/src/librbd/Types.h
index 66e3a967f6f..d6d7abe9aca 100644
--- a/src/librbd/Types.h
+++ b/src/librbd/Types.h
@@ -8,8 +8,11 @@
#include "cls/rbd/cls_rbd_types.h"
#include "deep_copy/Types.h"
#include <map>
+#include <memory>
#include <string>
+namespace neorados { class IOContext; }
+
namespace librbd {
// Performance counters
@@ -55,6 +58,8 @@ enum {
l_librbd_last,
};
+typedef std::shared_ptr<neorados::IOContext> IOContext;
+
typedef std::map<uint64_t, uint64_t> SnapSeqs;
/// Full information about an image's parent.
diff --git a/src/librbd/api/Image.cc b/src/librbd/api/Image.cc
index d714aef3db5..db2a82eb5c6 100644
--- a/src/librbd/api/Image.cc
+++ b/src/librbd/api/Image.cc
@@ -7,6 +7,7 @@
#include "common/errno.h"
#include "common/Cond.h"
#include "cls/rbd/cls_rbd_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/DeepCopyRequest.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
@@ -666,7 +667,6 @@ int Image<I>::deep_copy(I *src, librados::IoCtx& dest_md_ctx,
template <typename I>
int Image<I>::deep_copy(I *src, I *dest, bool flatten,
ProgressContext &prog_ctx) {
- CephContext *cct = src->cct;
librados::snap_t snap_id_start = 0;
librados::snap_t snap_id_end;
{
@@ -674,15 +674,14 @@ int Image<I>::deep_copy(I *src, I *dest, bool flatten,
snap_id_end = src->snap_id;
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(src->md_ctx);
C_SaferCond cond;
SnapSeqs snap_seqs;
deep_copy::ProgressHandler progress_handler{&prog_ctx};
auto req = DeepCopyRequest<I>::create(
src, dest, snap_id_start, snap_id_end, 0U, flatten, boost::none,
- op_work_queue, &snap_seqs, &progress_handler, &cond);
+ asio_engine.get_work_queue(), &snap_seqs, &progress_handler, &cond);
req->send();
int r = cond.wait();
if (r < 0) {
@@ -824,15 +823,15 @@ int Image<I>::remove(IoCtx& io_ctx, const std::string &image_name,
// fall-through if trash isn't supported
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
// might be a V1 image format that cannot be moved to the trash
// and would not have been listed in the V2 directory -- or the OSDs
// are too old and don't support the trash feature
C_SaferCond cond;
auto req = librbd::image::RemoveRequest<I>::create(
- io_ctx, image_name, "", false, false, prog_ctx, op_work_queue, &cond);
+ io_ctx, image_name, "", false, false, prog_ctx,
+ asio_engine.get_work_queue(), &cond);
req->send();
return cond.wait();
diff --git a/src/librbd/api/Migration.cc b/src/librbd/api/Migration.cc
index 3d9d86020f1..85733c4cab1 100644
--- a/src/librbd/api/Migration.cc
+++ b/src/librbd/api/Migration.cc
@@ -8,6 +8,7 @@
#include "common/errno.h"
#include "common/Cond.h"
#include "cls/rbd/cls_rbd_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
@@ -835,12 +836,12 @@ int Migration<I>::abort() {
ceph_assert(dst_image_ctx->ignore_migrating);
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(m_cct, &op_work_queue);
+ auto asio_engine = dst_image_ctx->asio_engine;
+
C_SaferCond on_remove;
auto req = librbd::image::RemoveRequest<>::create(
- m_dst_io_ctx, dst_image_ctx, false, false, *m_prog_ctx, op_work_queue,
- &on_remove);
+ m_dst_io_ctx, dst_image_ctx, false, false, *m_prog_ctx,
+ asio_engine->get_work_queue(), &on_remove);
req->send();
r = on_remove.wait();
@@ -1218,9 +1219,6 @@ int Migration<I>::create_dst_image() {
}
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(m_cct, &op_work_queue);
-
ConfigProxy config{m_cct->_conf};
api::Config<I>::apply_pool_overrides(m_dst_io_ctx, &config);
@@ -1240,7 +1238,8 @@ int Migration<I>::create_dst_image() {
auto *req = image::CreateRequest<I>::create(
config, m_dst_io_ctx, m_dst_image_name, m_dst_image_id, size,
m_image_options, image::CREATE_FLAG_SKIP_MIRROR_ENABLE,
- cls::rbd::MIRROR_IMAGE_MODE_JOURNAL, "", "", op_work_queue, &on_create);
+ cls::rbd::MIRROR_IMAGE_MODE_JOURNAL, "", "",
+ m_src_image_ctx->op_work_queue, &on_create);
req->send();
} else {
r = util::create_ioctx(m_src_image_ctx->md_ctx, "destination image",
@@ -1253,7 +1252,8 @@ int Migration<I>::create_dst_image() {
auto *req = image::CloneRequest<I>::create(
config, parent_io_ctx, parent_spec.image_id, "", {}, parent_spec.snap_id,
m_dst_io_ctx, m_dst_image_name, m_dst_image_id, m_image_options,
- cls::rbd::MIRROR_IMAGE_MODE_JOURNAL, "", "", op_work_queue, &on_create);
+ cls::rbd::MIRROR_IMAGE_MODE_JOURNAL, "", "",
+ m_src_image_ctx->op_work_queue, &on_create);
req->send();
}
@@ -1759,12 +1759,12 @@ int Migration<I>::remove_src_image() {
ceph_assert(m_src_image_ctx->ignore_migrating);
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(m_cct, &op_work_queue);
+ auto asio_engine = m_src_image_ctx->asio_engine;
+
C_SaferCond on_remove;
auto req = librbd::image::RemoveRequest<I>::create(
- m_src_io_ctx, m_src_image_ctx, false, true, *m_prog_ctx, op_work_queue,
- &on_remove);
+ m_src_io_ctx, m_src_image_ctx, false, true, *m_prog_ctx,
+ asio_engine->get_work_queue(), &on_remove);
req->send();
r = on_remove.wait();
diff --git a/src/librbd/api/Mirror.cc b/src/librbd/api/Mirror.cc
index adf8da97c56..1e34f34374c 100644
--- a/src/librbd/api/Mirror.cc
+++ b/src/librbd/api/Mirror.cc
@@ -8,6 +8,7 @@
#include "common/dout.h"
#include "common/errno.h"
#include "cls/rbd/cls_rbd_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/Journal.h"
@@ -1940,8 +1941,7 @@ int Mirror<I>::image_info_list(
break;
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
for (auto &it : images) {
auto &image_id = it.first;
@@ -1956,7 +1956,7 @@ int Mirror<I>::image_info_list(
// need to call get_info for every image to retrieve promotion state
mirror_image_info_t info;
- r = image_get_info(io_ctx, op_work_queue, image_id, &info);
+ r = image_get_info(io_ctx, asio_engine.get_work_queue(), image_id, &info);
if (r >= 0) {
(*entries)[image_id] = std::make_pair(mode, info);
}
diff --git a/src/librbd/api/Pool.cc b/src/librbd/api/Pool.cc
index 75f2dd3b529..890341e015c 100644
--- a/src/librbd/api/Pool.cc
+++ b/src/librbd/api/Pool.cc
@@ -9,6 +9,7 @@
#include "common/Throttle.h"
#include "cls/rbd/cls_rbd_client.h"
#include "osd/osd_types.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
#include "librbd/api/Config.h"
@@ -251,11 +252,11 @@ int Pool<I>::init(librados::IoCtx& io_ctx, bool force) {
return 0;
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
C_SaferCond ctx;
- auto req = image::ValidatePoolRequest<I>::create(io_ctx, op_work_queue, &ctx);
+ auto req = image::ValidatePoolRequest<I>::create(
+ io_ctx, asio_engine.get_work_queue(), &ctx);
req->send();
return ctx.wait();
diff --git a/src/librbd/api/Trash.cc b/src/librbd/api/Trash.cc
index 38a270fb8be..eb847e3900d 100644
--- a/src/librbd/api/Trash.cc
+++ b/src/librbd/api/Trash.cc
@@ -7,6 +7,7 @@
#include "common/errno.h"
#include "common/Cond.h"
#include "cls/rbd/cls_rbd_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
@@ -90,12 +91,12 @@ int enable_mirroring(IoCtx &io_ctx, const std::string &image_id) {
ldout(cct, 10) << dendl;
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
+
C_SaferCond ctx;
auto req = mirror::EnableRequest<I>::create(
io_ctx, image_id, cls::rbd::MIRROR_IMAGE_MODE_JOURNAL, "", false,
- op_work_queue, &ctx);
+ asio_engine.get_work_queue(), &ctx);
req->send();
r = ctx.wait();
if (r < 0) {
@@ -534,12 +535,11 @@ int Trash<I>::remove(IoCtx &io_ctx, const std::string &image_id, bool force,
return -EBUSY;
}
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
C_SaferCond cond;
auto req = librbd::trash::RemoveRequest<I>::create(
- io_ctx, image_id, op_work_queue, force, prog_ctx, &cond);
+ io_ctx, image_id, asio_engine.get_work_queue(), force, prog_ctx, &cond);
req->send();
r = cond.wait();
diff --git a/src/librbd/asio/ContextWQ.cc b/src/librbd/asio/ContextWQ.cc
index 7d18f6f3d36..4f6c7277080 100644
--- a/src/librbd/asio/ContextWQ.cc
+++ b/src/librbd/asio/ContextWQ.cc
@@ -4,16 +4,31 @@
#include "librbd/asio/ContextWQ.h"
#include "include/Context.h"
#include "common/Cond.h"
+#include "common/dout.h"
+
+#define dout_subsys ceph_subsys_rbd
+#undef dout_prefix
+#define dout_prefix *_dout << "librbd::asio::ContextWQ: " \
+ << this << " " << __func__ << ": "
namespace librbd {
namespace asio {
-ContextWQ::ContextWQ(boost::asio::io_context& io_context)
- : m_io_context(io_context), m_strand(io_context),
+ContextWQ::ContextWQ(CephContext* cct, boost::asio::io_context& io_context)
+ : m_cct(cct), m_io_context(io_context),
+ m_strand(std::make_unique<boost::asio::io_context::strand>(io_context)),
m_queued_ops(0) {
+ ldout(m_cct, 20) << dendl;
+}
+
+ContextWQ::~ContextWQ() {
+ ldout(m_cct, 20) << dendl;
+ drain();
+ m_strand.reset();
}
void ContextWQ::drain() {
+ ldout(m_cct, 20) << dendl;
C_SaferCond ctx;
drain_handler(&ctx);
ctx.wait();
@@ -27,7 +42,7 @@ void ContextWQ::drain_handler(Context* ctx) {
// new items might be queued while we are trying to drain, so we
// might need to post the handler multiple times
- boost::asio::post(m_strand, [this, ctx]() { drain_handler(ctx); });
+ boost::asio::post(*m_strand, [this, ctx]() { drain_handler(ctx); });
}
} // namespace asio
diff --git a/src/librbd/asio/ContextWQ.h b/src/librbd/asio/ContextWQ.h
index 2fff5b52cd4..85c25416121 100644
--- a/src/librbd/asio/ContextWQ.h
+++ b/src/librbd/asio/ContextWQ.h
@@ -4,8 +4,10 @@
#ifndef CEPH_LIBRBD_ASIO_CONTEXT_WQ_H
#define CEPH_LIBRBD_ASIO_CONTEXT_WQ_H
+#include "include/common_fwd.h"
#include "include/Context.h"
#include <atomic>
+#include <memory>
#include <boost/asio/io_context.hpp>
#include <boost/asio/io_context_strand.hpp>
#include <boost/asio/post.hpp>
@@ -15,7 +17,8 @@ namespace asio {
class ContextWQ {
public:
- explicit ContextWQ(boost::asio::io_context& io_context);
+ explicit ContextWQ(CephContext* cct, boost::asio::io_context& io_context);
+ ~ContextWQ();
void drain();
@@ -24,7 +27,7 @@ public:
// ensure all legacy ContextWQ users are dispatched sequentially for
// backwards compatibility (i.e. might not be concurrent thread-safe)
- boost::asio::post(m_strand, [this, ctx, r]() {
+ boost::asio::post(*m_strand, [this, ctx, r]() {
ctx->complete(r);
ceph_assert(m_queued_ops > 0);
@@ -33,8 +36,9 @@ public:
}
private:
+ CephContext* m_cct;
boost::asio::io_context& m_io_context;
- boost::asio::io_context::strand m_strand;
+ std::unique_ptr<boost::asio::io_context::strand> m_strand;
std::atomic<uint64_t> m_queued_ops;
diff --git a/src/librbd/asio/Utils.h b/src/librbd/asio/Utils.h
new file mode 100644
index 00000000000..2fbbb5846fd
--- /dev/null
+++ b/src/librbd/asio/Utils.h
@@ -0,0 +1,33 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_LIBRBD_ASIO_UTILS_H
+#define CEPH_LIBRBD_ASIO_UTILS_H
+
+#include "include/Context.h"
+#include "include/rados/librados_fwd.hpp"
+#include <boost/system/error_code.hpp>
+
+namespace librbd {
+namespace asio {
+namespace util {
+
+template <typename T>
+auto get_context_adapter(T&& t) {
+ return [t = std::move(t)](boost::system::error_code ec) {
+ t->complete(-ec.value());
+ };
+}
+
+template <typename T>
+auto get_callback_adapter(T&& t) {
+ return [t = std::move(t)](boost::system::error_code ec, auto&& ... args) {
+ t(-ec.value(), std::forward<decltype(args)>(args)...);
+ };
+}
+
+} // namespace util
+} // namespace asio
+} // namespace librbd
+
+#endif // CEPH_LIBRBD_ASIO_UTILS_H
diff --git a/src/librbd/cache/ObjectCacherObjectDispatch.cc b/src/librbd/cache/ObjectCacherObjectDispatch.cc
index 8479ef06b87..ffa0fc0a840 100644
--- a/src/librbd/cache/ObjectCacherObjectDispatch.cc
+++ b/src/librbd/cache/ObjectCacherObjectDispatch.cc
@@ -183,7 +183,7 @@ template <typename I>
bool ObjectCacherObjectDispatch<I>::read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags, const ZTracer::Trace &parent_trace,
- ceph::bufferlist* read_data, io::ExtentMap* extent_map,
+ ceph::bufferlist* read_data, io::Extents* extent_map,
int* object_dispatch_flags, io::DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
// IO chained in reverse order
diff --git a/src/librbd/cache/ObjectCacherObjectDispatch.h b/src/librbd/cache/ObjectCacherObjectDispatch.h
index c6d7af0cd7a..cb5e3891264 100644
--- a/src/librbd/cache/ObjectCacherObjectDispatch.h
+++ b/src/librbd/cache/ObjectCacherObjectDispatch.h
@@ -45,7 +45,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- io::ExtentMap* extent_map, int* object_dispatch_flags,
+ io::Extents* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
diff --git a/src/librbd/cache/ParentCacheObjectDispatch.cc b/src/librbd/cache/ParentCacheObjectDispatch.cc
index 73d37274310..b6c36c1d92d 100644
--- a/src/librbd/cache/ParentCacheObjectDispatch.cc
+++ b/src/librbd/cache/ParentCacheObjectDispatch.cc
@@ -66,7 +66,7 @@ bool ParentCacheObjectDispatch<I>::read(
uint64_t object_no, uint64_t object_off,
uint64_t object_len, librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- io::ExtentMap* extent_map, int* object_dispatch_flags,
+ io::Extents* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) {
auto cct = m_image_ctx->cct;
diff --git a/src/librbd/cache/ParentCacheObjectDispatch.h b/src/librbd/cache/ParentCacheObjectDispatch.h
index 2c7b5234141..98b00bc916d 100644
--- a/src/librbd/cache/ParentCacheObjectDispatch.h
+++ b/src/librbd/cache/ParentCacheObjectDispatch.h
@@ -43,7 +43,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- io::ExtentMap* extent_map, int* object_dispatch_flags,
+ io::Extents* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
diff --git a/src/librbd/cache/WriteAroundObjectDispatch.cc b/src/librbd/cache/WriteAroundObjectDispatch.cc
index 0d96d029659..3d4fd1fc31e 100644
--- a/src/librbd/cache/WriteAroundObjectDispatch.cc
+++ b/src/librbd/cache/WriteAroundObjectDispatch.cc
@@ -59,7 +59,7 @@ template <typename I>
bool WriteAroundObjectDispatch<I>::read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags, const ZTracer::Trace &parent_trace,
- ceph::bufferlist* read_data, io::ExtentMap* extent_map,
+ ceph::bufferlist* read_data, io::Extents* extent_map,
int* object_dispatch_flags, io::DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
return dispatch_unoptimized_io(object_no, object_off, object_len,
diff --git a/src/librbd/cache/WriteAroundObjectDispatch.h b/src/librbd/cache/WriteAroundObjectDispatch.h
index f32e3b4d0f2..873feb72449 100644
--- a/src/librbd/cache/WriteAroundObjectDispatch.h
+++ b/src/librbd/cache/WriteAroundObjectDispatch.h
@@ -45,7 +45,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- io::ExtentMap* extent_map, int* object_dispatch_flags,
+ io::Extents* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
diff --git a/src/librbd/image/OpenRequest.cc b/src/librbd/image/OpenRequest.cc
index ccca85ff476..227fadff2d3 100644
--- a/src/librbd/image/OpenRequest.cc
+++ b/src/librbd/image/OpenRequest.cc
@@ -483,6 +483,7 @@ Context *OpenRequest<I>::handle_v2_get_data_pool(int *result) {
m_image_ctx->data_ctx.close();
} else {
m_image_ctx->data_ctx.set_namespace(m_image_ctx->md_ctx.get_namespace());
+ m_image_ctx->rebuild_data_io_context();
}
} else {
data_pool_id = m_image_ctx->md_ctx.get_id();
diff --git a/src/librbd/image/RefreshRequest.cc b/src/librbd/image/RefreshRequest.cc
index d70e026e36a..c1ccde4000e 100644
--- a/src/librbd/image/RefreshRequest.cc
+++ b/src/librbd/image/RefreshRequest.cc
@@ -1385,6 +1385,7 @@ void RefreshRequest<I>::apply() {
if (m_image_ctx.data_ctx.is_valid()) {
m_image_ctx.data_ctx.selfmanaged_snap_set_write_ctx(m_image_ctx.snapc.seq,
m_image_ctx.snaps);
+ m_image_ctx.rebuild_data_io_context();
}
// handle dynamically enabled / disabled features
diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc
index e3b9bc9ba90..d98e59fc84c 100644
--- a/src/librbd/internal.cc
+++ b/src/librbd/internal.cc
@@ -23,6 +23,7 @@
#include "cls/journal/cls_journal_types.h"
#include "cls/journal/cls_journal_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
@@ -684,8 +685,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
lderr(cct) << "Forced V1 image creation. " << dendl;
r = create_v1(io_ctx, image_name.c_str(), size, order);
} else {
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(io_ctx);
ConfigProxy config{cct->_conf};
api::Config<>::apply_pool_overrides(io_ctx, &config);
@@ -703,7 +703,8 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
image::CreateRequest<> *req = image::CreateRequest<>::create(
config, io_ctx, image_name, id, size, opts, create_flags,
static_cast<cls::rbd::MirrorImageMode>(mirror_image_mode),
- non_primary_global_image_id, primary_mirror_uuid, op_work_queue, &cond);
+ non_primary_global_image_id, primary_mirror_uuid,
+ asio_engine.get_work_queue(), &cond);
req->send();
r = cond.wait();
@@ -789,15 +790,15 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) {
ConfigProxy config{reinterpret_cast<CephContext *>(c_ioctx.cct())->_conf};
api::Config<>::apply_pool_overrides(c_ioctx, &config);
- asio::ContextWQ *op_work_queue;
- ImageCtx::get_work_queue(cct, &op_work_queue);
+ AsioEngine asio_engine(p_ioctx);
C_SaferCond cond;
auto *req = image::CloneRequest<>::create(
config, p_ioctx, parent_id, p_snap_name,
{cls::rbd::UserSnapshotNamespace{}}, CEPH_NOSNAP, c_ioctx, c_name,
clone_id, c_opts, cls::rbd::MIRROR_IMAGE_MODE_JOURNAL,
- non_primary_global_image_id, primary_mirror_uuid, op_work_queue, &cond);
+ non_primary_global_image_id, primary_mirror_uuid,
+ asio_engine.get_work_queue(), &cond);
req->send();
r = cond.wait();
diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc
index dc933a12084..cad10336424 100644
--- a/src/librbd/io/AioCompletion.cc
+++ b/src/librbd/io/AioCompletion.cc
@@ -9,11 +9,13 @@
#include "common/errno.h"
#include "common/perf_counters.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/internal.h"
#include "librbd/Journal.h"
#include "librbd/Types.h"
-#include "librbd/asio/ContextWQ.h"
+#include <boost/asio/dispatch.hpp>
+#include <boost/asio/post.hpp>
#ifdef WITH_LTTNG
#include "tracing/librbd.h"
@@ -105,15 +107,11 @@ void AioCompletion::complete() {
} else {
complete_cb(rbd_comp, complete_arg);
complete_event_socket();
+ notify_callbacks_complete();
}
} else {
complete_event_socket();
- }
- state = AIO_STATE_COMPLETE;
-
- {
- std::unique_lock<std::mutex> locker(lock);
- cond.notify_all();
+ notify_callbacks_complete();
}
if (image_dispatcher_ctx != nullptr) {
@@ -152,8 +150,12 @@ void AioCompletion::queue_complete() {
pending_count.compare_exchange_strong(zero, 1);
ceph_assert(zero == 0);
+ add_request();
+
// ensure completion fires in clean lock context
- ictx->op_work_queue->queue(new C_AioRequest(this), 0);
+ boost::asio::post(ictx->asio_engine->get_api_strand(), [this]() {
+ complete_request(0);
+ });
}
void AioCompletion::block(CephContext* cct) {
@@ -250,29 +252,16 @@ ssize_t AioCompletion::get_return_value() {
}
void AioCompletion::complete_external_callback() {
+ get();
+
// ensure librbd external users never experience concurrent callbacks
// from multiple librbd-internal threads.
- ictx->external_callback_completions.push(this);
-
- while (true) {
- if (ictx->external_callback_in_progress.exchange(true)) {
- // another thread is concurrently invoking external callbacks
- break;
- }
-
- AioCompletion* aio_comp;
- while (ictx->external_callback_completions.pop(aio_comp)) {
- aio_comp->complete_cb(aio_comp->rbd_comp, aio_comp->complete_arg);
- aio_comp->complete_event_socket();
- }
-
- ictx->external_callback_in_progress.store(false);
- if (ictx->external_callback_completions.empty()) {
- // queue still empty implies we didn't have a race between the last failed
- // pop and resetting the in-progress state
- break;
- }
- }
+ boost::asio::dispatch(ictx->asio_engine->get_api_strand(), [this]() {
+ complete_cb(rbd_comp, complete_arg);
+ complete_event_socket();
+ notify_callbacks_complete();
+ put();
+ });
}
void AioCompletion::complete_event_socket() {
@@ -282,5 +271,12 @@ void AioCompletion::complete_event_socket() {
}
}
+void AioCompletion::notify_callbacks_complete() {
+ state = AIO_STATE_COMPLETE;
+
+ std::unique_lock<std::mutex> locker(lock);
+ cond.notify_all();
+}
+
} // namespace io
} // namespace librbd
diff --git a/src/librbd/io/AioCompletion.h b/src/librbd/io/AioCompletion.h
index 43ef3246597..4ae93fe36d2 100644
--- a/src/librbd/io/AioCompletion.h
+++ b/src/librbd/io/AioCompletion.h
@@ -181,7 +181,7 @@ private:
void queue_complete();
void complete_external_callback();
void complete_event_socket();
-
+ void notify_callbacks_complete();
};
class C_AioRequest : public Context {
diff --git a/src/librbd/io/AsyncOperation.cc b/src/librbd/io/AsyncOperation.cc
index 4c4d508e7d2..18db2410e4a 100644
--- a/src/librbd/io/AsyncOperation.cc
+++ b/src/librbd/io/AsyncOperation.cc
@@ -2,10 +2,10 @@
// vim: ts=8 sw=2 smarttab
#include "librbd/io/AsyncOperation.h"
-#include "librbd/ImageCtx.h"
-#include "librbd/asio/ContextWQ.h"
-#include "common/dout.h"
#include "include/ceph_assert.h"
+#include "common/dout.h"
+#include "librbd/AsioEngine.h"
+#include "librbd/ImageCtx.h"
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
@@ -70,7 +70,7 @@ void AsyncOperation::finish_op() {
if (!m_flush_contexts.empty()) {
C_CompleteFlushes *ctx = new C_CompleteFlushes(m_image_ctx,
std::move(m_flush_contexts));
- m_image_ctx->op_work_queue->queue(ctx);
+ m_image_ctx->asio_engine->post(ctx, 0);
}
}
@@ -87,7 +87,7 @@ void AsyncOperation::flush(Context* on_finish) {
}
}
- m_image_ctx->op_work_queue->queue(on_finish);
+ m_image_ctx->asio_engine->post(on_finish, 0);
}
} // namespace io
diff --git a/src/librbd/io/CopyupRequest.cc b/src/librbd/io/CopyupRequest.cc
index 58f0a2ce1a0..537481d9259 100644
--- a/src/librbd/io/CopyupRequest.cc
+++ b/src/librbd/io/CopyupRequest.cc
@@ -2,16 +2,19 @@
// vim: ts=8 sw=2 smarttab
#include "librbd/io/CopyupRequest.h"
+#include "include/neorados/RADOS.hpp"
#include "common/ceph_context.h"
#include "common/ceph_mutex.h"
#include "common/dout.h"
#include "common/errno.h"
+#include "librbd/AsioEngine.h"
#include "librbd/AsyncObjectThrottle.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
#include "librbd/ObjectMap.h"
#include "librbd/Utils.h"
#include "librbd/asio/ContextWQ.h"
+#include "librbd/asio/Utils.h"
#include "librbd/deep_copy/ObjectCopyRequest.h"
#include "librbd/io/AioCompletion.h"
#include "librbd/io/ImageRequest.h"
@@ -153,10 +156,8 @@ void CopyupRequest<I>::read_from_parent() {
if (m_image_ctx->parent == nullptr) {
ldout(cct, 5) << "parent detached" << dendl;
- m_image_ctx->op_work_queue->queue(
- util::create_context_callback<
- CopyupRequest<I>, &CopyupRequest<I>::handle_read_from_parent>(this),
- -ENOENT);
+ m_image_ctx->asio_engine->post(
+ [this]() { handle_read_from_parent(-ENOENT); });
return;
} else if (is_deep_copy()) {
deep_copy();
@@ -371,6 +372,7 @@ void CopyupRequest<I>::copyup() {
auto cct = m_image_ctx->cct;
m_image_ctx->image_lock.lock_shared();
auto snapc = m_image_ctx->snapc;
+ auto io_context = m_image_ctx->get_data_io_context();
m_image_ctx->image_lock.unlock_shared();
m_lock.lock();
@@ -391,8 +393,7 @@ void CopyupRequest<I>::copyup() {
m_copyup_extent_map.clear();
}
- int r;
- librados::ObjectWriteOperation copyup_op;
+ neorados::WriteOp copyup_op;
if (copy_on_read || deep_copyup) {
if (m_image_ctx->enable_sparse_copyup) {
cls_client::sparse_copyup(&copyup_op, m_copyup_extent_map, m_copyup_data);
@@ -403,7 +404,7 @@ void CopyupRequest<I>::copyup() {
++m_pending_copyups;
}
- librados::ObjectWriteOperation write_op;
+ neorados::WriteOp write_op;
if (!copy_on_read) {
if (!deep_copyup) {
if (m_image_ctx->enable_sparse_copyup) {
@@ -428,8 +429,7 @@ void CopyupRequest<I>::copyup() {
m_lock.unlock();
// issue librados ops at the end to simplify test cases
- std::string oid(data_object_name(m_image_ctx, m_object_no));
- std::vector<librados::snap_t> snaps;
+ auto object = neorados::Object{data_object_name(m_image_ctx, m_object_no)};
if (copyup_op.size() > 0) {
// send only the copyup request with a blank snapshot context so that
// all snapshots are detected from the parent for this object. If
@@ -437,13 +437,14 @@ void CopyupRequest<I>::copyup() {
// actual modification.
ldout(cct, 20) << "copyup with empty snapshot context" << dendl;
- auto comp = util::create_rados_callback<
- CopyupRequest<I>, &CopyupRequest<I>::handle_copyup>(this);
- r = m_image_ctx->data_ctx.aio_operate(
- oid, comp, &copyup_op, 0, snaps,
- (m_trace.valid() ? m_trace.get_info() : nullptr));
- ceph_assert(r == 0);
- comp->release();
+ auto copyup_io_context = *io_context;
+ copyup_io_context.write_snap_context({});
+
+ m_image_ctx->rados_api.execute(
+ object, copyup_io_context, std::move(copyup_op),
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_copyup(r); }), nullptr,
+ (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
}
if (write_op.size() > 0) {
@@ -454,14 +455,11 @@ void CopyupRequest<I>::copyup() {
"copyup + ops" : !deep_copyup ? "copyup" : "ops")
<< " with current snapshot context" << dendl;
- snaps.insert(snaps.end(), snapc.snaps.begin(), snapc.snaps.end());
- auto comp = util::create_rados_callback<
- CopyupRequest<I>, &CopyupRequest<I>::handle_copyup>(this);
- r = m_image_ctx->data_ctx.aio_operate(
- oid, comp, &write_op, snapc.seq, snaps,
- (m_trace.valid() ? m_trace.get_info() : nullptr));
- ceph_assert(r == 0);
- comp->release();
+ m_image_ctx->rados_api.execute(
+ object, *io_context, std::move(write_op),
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_copyup(r); }), nullptr,
+ (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
}
}
@@ -469,21 +467,28 @@ template <typename I>
void CopyupRequest<I>::handle_copyup(int r) {
auto cct = m_image_ctx->cct;
unsigned pending_copyups;
+ int copyup_ret_val = r;
{
std::lock_guard locker{m_lock};
ceph_assert(m_pending_copyups > 0);
pending_copyups = --m_pending_copyups;
+ if (m_copyup_ret_val < 0) {
+ copyup_ret_val = m_copyup_ret_val;
+ } else if (r < 0) {
+ m_copyup_ret_val = r;
+ }
}
ldout(cct, 20) << "r=" << r << ", "
<< "pending=" << pending_copyups << dendl;
- if (r < 0 && r != -ENOENT) {
- lderr(cct) << "failed to copyup object: " << cpp_strerror(r) << dendl;
- complete_requests(false, r);
- }
-
if (pending_copyups == 0) {
+ if (copyup_ret_val < 0 && copyup_ret_val != -ENOENT) {
+ lderr(cct) << "failed to copyup object: " << cpp_strerror(copyup_ret_val)
+ << dendl;
+ complete_requests(false, copyup_ret_val);
+ }
+
finish(0);
}
}
@@ -602,6 +607,7 @@ void CopyupRequest<I>::compute_deep_copy_snap_ids() {
deep_copied.insert(it.second.front());
}
}
+ ldout(m_image_ctx->cct, 15) << "deep_copied=" << deep_copied << dendl;
std::copy_if(m_image_ctx->snaps.rbegin(), m_image_ctx->snaps.rend(),
std::back_inserter(m_snap_ids),
diff --git a/src/librbd/io/CopyupRequest.h b/src/librbd/io/CopyupRequest.h
index 01d679f6213..24e65b4d5e9 100644
--- a/src/librbd/io/CopyupRequest.h
+++ b/src/librbd/io/CopyupRequest.h
@@ -5,7 +5,6 @@
#define CEPH_LIBRBD_IO_COPYUP_REQUEST_H
#include "include/int_types.h"
-#include "include/rados/librados.hpp"
#include "include/buffer.h"
#include "common/ceph_mutex.h"
#include "common/zipkin_trace.h"
@@ -99,6 +98,7 @@ private:
ceph::mutex m_lock = ceph::make_mutex("CopyupRequest", false);
WriteRequests m_pending_requests;
unsigned m_pending_copyups = 0;
+ int m_copyup_ret_val = 0;
WriteRequests m_restart_requests;
bool m_append_request_permitted = true;
diff --git a/src/librbd/io/ImageRequest.cc b/src/librbd/io/ImageRequest.cc
index d4a15645fb5..e8b824f0ee6 100644
--- a/src/librbd/io/ImageRequest.cc
+++ b/src/librbd/io/ImageRequest.cc
@@ -42,7 +42,7 @@ struct C_RBD_Readahead : public Context {
uint64_t length;
bufferlist read_data;
- io::ExtentMap extent_map;
+ io::Extents extent_map;
C_RBD_Readahead(I *ictx, uint64_t object_no, uint64_t offset, uint64_t length)
: ictx(ictx), object_no(object_no), offset(offset), length(length) {
diff --git a/src/librbd/io/ObjectDispatch.cc b/src/librbd/io/ObjectDispatch.cc
index ecf9ae23d07..4e0e626cfd3 100644
--- a/src/librbd/io/ObjectDispatch.cc
+++ b/src/librbd/io/ObjectDispatch.cc
@@ -3,9 +3,9 @@
#include "librbd/io/ObjectDispatch.h"
#include "common/dout.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
-#include "librbd/asio/ContextWQ.h"
#include "librbd/io/ObjectRequest.h"
#define dout_subsys ceph_subsys_rbd
@@ -28,14 +28,14 @@ void ObjectDispatch<I>::shut_down(Context* on_finish) {
auto cct = m_image_ctx->cct;
ldout(cct, 5) << dendl;
- m_image_ctx->op_work_queue->queue(on_finish, 0);
+ m_image_ctx->asio_engine->post(on_finish, 0);
}
template <typename I>
bool ObjectDispatch<I>::read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags, const ZTracer::Trace &parent_trace,
- ceph::bufferlist* read_data, ExtentMap* extent_map,
+ ceph::bufferlist* read_data, Extents* extent_map,
int* object_dispatch_flags, DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
auto cct = m_image_ctx->cct;
diff --git a/src/librbd/io/ObjectDispatch.h b/src/librbd/io/ObjectDispatch.h
index cbfe8b5ad0e..a7945ed0ce0 100644
--- a/src/librbd/io/ObjectDispatch.h
+++ b/src/librbd/io/ObjectDispatch.h
@@ -37,7 +37,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, int* object_dispatch_flags,
+ Extents* extent_map, int* object_dispatch_flags,
DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
diff --git a/src/librbd/io/ObjectDispatchInterface.h b/src/librbd/io/ObjectDispatchInterface.h
index 31ed39994eb..9397d1ead14 100644
--- a/src/librbd/io/ObjectDispatchInterface.h
+++ b/src/librbd/io/ObjectDispatchInterface.h
@@ -36,7 +36,7 @@ struct ObjectDispatchInterface {
virtual bool read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,const ZTracer::Trace &parent_trace,
- ceph::bufferlist* read_data, ExtentMap* extent_map,
+ ceph::bufferlist* read_data, Extents* extent_map,
int* object_dispatch_flags, DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) = 0;
diff --git a/src/librbd/io/ObjectDispatchSpec.h b/src/librbd/io/ObjectDispatchSpec.h
index 91a76d7eea0..74ff4208f7a 100644
--- a/src/librbd/io/ObjectDispatchSpec.h
+++ b/src/librbd/io/ObjectDispatchSpec.h
@@ -47,11 +47,11 @@ public:
uint64_t object_len;
librados::snap_t snap_id;
ceph::bufferlist* read_data;
- ExtentMap* extent_map;
+ Extents* extent_map;
ReadRequest(uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, ceph::bufferlist* read_data,
- ExtentMap* extent_map)
+ Extents* extent_map)
: RequestBase(object_no, object_off),
object_len(object_len), snap_id(snap_id), read_data(read_data),
extent_map(extent_map) {
@@ -156,7 +156,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, Context* on_finish) {
+ Extents* extent_map, Context* on_finish) {
return new ObjectDispatchSpec(image_ctx->io_object_dispatcher,
object_dispatch_layer,
ReadRequest{object_no, object_off,
diff --git a/src/librbd/io/ObjectRequest.cc b/src/librbd/io/ObjectRequest.cc
index bacc6234b18..1b2cf9119c6 100644
--- a/src/librbd/io/ObjectRequest.cc
+++ b/src/librbd/io/ObjectRequest.cc
@@ -8,17 +8,20 @@
#include "common/ceph_mutex.h"
#include "include/Context.h"
#include "include/err.h"
+#include "include/neorados/RADOS.hpp"
#include "osd/osd_types.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ExclusiveLock.h"
#include "librbd/ImageCtx.h"
#include "librbd/ObjectMap.h"
#include "librbd/Utils.h"
-#include "librbd/asio/ContextWQ.h"
+#include "librbd/asio/Utils.h"
#include "librbd/io/AioCompletion.h"
#include "librbd/io/CopyupRequest.h"
#include "librbd/io/ImageRequest.h"
#include "librbd/io/ReadResult.h"
+#include "librbd/io/Utils.h"
#include <boost/optional.hpp>
@@ -101,7 +104,7 @@ ObjectRequest<I>::ObjectRequest(
const ZTracer::Trace &trace, Context *completion)
: m_ictx(ictx), m_object_no(objectno), m_object_off(off),
m_object_len(len), m_snap_id(snap_id), m_completion(completion),
- m_trace(util::create_trace(*ictx, "", trace)) {
+ m_trace(librbd::util::create_trace(*ictx, "", trace)) {
ceph_assert(m_ictx->data_ctx.is_valid());
if (m_trace.valid()) {
m_trace.copy_name(trace_name + std::string(" ") +
@@ -111,14 +114,15 @@ ObjectRequest<I>::ObjectRequest(
}
template <typename I>
-void ObjectRequest<I>::add_write_hint(I& image_ctx,
- librados::ObjectWriteOperation *wr) {
+void ObjectRequest<I>::add_write_hint(I& image_ctx, neorados::WriteOp* wr) {
+ auto alloc_hint_flags = static_cast<neorados::alloc_hint::alloc_hint_t>(
+ image_ctx.alloc_hint_flags);
if (image_ctx.enable_alloc_hint) {
- wr->set_alloc_hint2(image_ctx.get_object_size(),
- image_ctx.get_object_size(),
- image_ctx.alloc_hint_flags);
+ wr->set_alloc_hint(image_ctx.get_object_size(),
+ image_ctx.get_object_size(),
+ alloc_hint_flags);
} else if (image_ctx.alloc_hint_flags != 0U) {
- wr->set_alloc_hint2(0, 0, image_ctx.alloc_hint_flags);
+ wr->set_alloc_hint(0, 0, alloc_hint_flags);
}
}
@@ -164,8 +168,7 @@ bool ObjectRequest<I>::compute_parent_extents(Extents *parent_extents,
template <typename I>
void ObjectRequest<I>::async_finish(int r) {
ldout(m_ictx->cct, 20) << "r=" << r << dendl;
- m_ictx->op_work_queue->queue(util::create_context_callback<
- ObjectRequest<I>, &ObjectRequest<I>::finish>(this), r);
+ m_ictx->asio_engine->post([this, r]() { finish(r); });
}
template <typename I>
@@ -181,7 +184,7 @@ template <typename I>
ObjectReadRequest<I>::ObjectReadRequest(
I *ictx, uint64_t objectno, uint64_t offset, uint64_t len,
librados::snap_t snap_id, int op_flags, const ZTracer::Trace &parent_trace,
- bufferlist* read_data, ExtentMap* extent_map, Context *completion)
+ bufferlist* read_data, Extents* extent_map, Context *completion)
: ObjectRequest<I>(ictx, objectno, offset, len, snap_id, "read",
parent_trace, completion),
m_op_flags(op_flags), m_read_data(read_data), m_extent_map(extent_map) {
@@ -202,34 +205,29 @@ void ObjectReadRequest<I>::read_object() {
std::shared_lock image_locker{image_ctx->image_lock};
if (image_ctx->object_map != nullptr &&
!image_ctx->object_map->object_may_exist(this->m_object_no)) {
- image_ctx->op_work_queue->queue(new LambdaContext([this](int r) {
- read_parent();
- }), 0);
+ image_ctx->asio_engine->post([this]() { read_parent(); });
return;
}
}
ldout(image_ctx->cct, 20) << dendl;
- librados::ObjectReadOperation op;
+ neorados::ReadOp read_op;
if (this->m_object_len >= image_ctx->sparse_read_threshold_bytes) {
- op.sparse_read(this->m_object_off, this->m_object_len, m_extent_map,
- m_read_data, nullptr);
+ read_op.sparse_read(this->m_object_off, this->m_object_len, m_read_data,
+ m_extent_map);
} else {
- op.read(this->m_object_off, this->m_object_len, m_read_data, nullptr);
+ read_op.read(this->m_object_off, this->m_object_len, m_read_data);
}
- op.set_op_flags2(m_op_flags);
+ util::apply_op_flags(m_op_flags, image_ctx->get_read_flags(this->m_snap_id),
+ &read_op);
- librados::AioCompletion *rados_completion = util::create_rados_callback<
- ObjectReadRequest<I>, &ObjectReadRequest<I>::handle_read_object>(this);
- int flags = image_ctx->get_read_flags(this->m_snap_id);
- int r = image_ctx->data_ctx.aio_operate(
- data_object_name(this->m_ictx, this->m_object_no), rados_completion, &op,
- flags, nullptr,
- (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
- ceph_assert(r == 0);
-
- rados_completion->release();
+ image_ctx->rados_api.execute(
+ {data_object_name(this->m_ictx, this->m_object_no)},
+ *image_ctx->get_data_io_context(), std::move(read_op), nullptr,
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_read_object(r); }), nullptr,
+ (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
}
template <typename I>
@@ -281,7 +279,7 @@ void ObjectReadRequest<I>::read_parent() {
auto parent_completion = AioCompletion::create_and_start<
ObjectReadRequest<I>, &ObjectReadRequest<I>::handle_read_parent>(
- this, util::get_image_ctx(image_ctx->parent), AIO_TYPE_READ);
+ this, librbd::util::get_image_ctx(image_ctx->parent), AIO_TYPE_READ);
ImageRequest<I>::aio_read(image_ctx->parent, parent_completion,
std::move(parent_extents), ReadResult{m_read_data},
0, this->m_trace);
@@ -389,7 +387,7 @@ void AbstractObjectWriteRequest<I>::compute_parent_info() {
template <typename I>
void AbstractObjectWriteRequest<I>::add_write_hint(
- librados::ObjectWriteOperation *wr) {
+ neorados::WriteOp *wr) {
I *image_ctx = this->m_ictx;
std::shared_lock image_locker{image_ctx->image_lock};
if (image_ctx->object_map == nullptr || !this->m_object_may_exist) {
@@ -479,30 +477,27 @@ void AbstractObjectWriteRequest<I>::write_object() {
I *image_ctx = this->m_ictx;
ldout(image_ctx->cct, 20) << dendl;
- librados::ObjectWriteOperation write;
+ neorados::WriteOp write_op;
if (m_copyup_enabled) {
ldout(image_ctx->cct, 20) << "guarding write" << dendl;
if (m_guarding_migration_write) {
cls_client::assert_snapc_seq(
- &write, m_snap_seq, cls::rbd::ASSERT_SNAPC_SEQ_LE_SNAPSET_SEQ);
+ &write_op, m_snap_seq, cls::rbd::ASSERT_SNAPC_SEQ_LE_SNAPSET_SEQ);
} else {
- write.assert_exists();
+ write_op.assert_exists();
}
}
- add_write_hint(&write);
- add_write_ops(&write);
- ceph_assert(write.size() != 0);
+ add_write_hint(&write_op);
+ add_write_ops(&write_op);
+ ceph_assert(write_op.size() != 0);
- librados::AioCompletion *rados_completion = util::create_rados_callback<
- AbstractObjectWriteRequest<I>,
- &AbstractObjectWriteRequest<I>::handle_write_object>(this);
- int r = image_ctx->data_ctx.aio_operate(
- data_object_name(this->m_ictx, this->m_object_no), rados_completion,
- &write, m_snap_seq, m_snaps,
- (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
- ceph_assert(r == 0);
- rados_completion->release();
+ image_ctx->rados_api.execute(
+ {data_object_name(this->m_ictx, this->m_object_no)},
+ *image_ctx->get_data_io_context(), std::move(write_op),
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_write_object(r); }), nullptr,
+ (this->m_trace.valid() ? this->m_trace.get_info() : nullptr));
}
template <typename I>
@@ -638,33 +633,53 @@ void AbstractObjectWriteRequest<I>::handle_post_write_object_map_update(int r) {
}
template <typename I>
-void ObjectWriteRequest<I>::add_write_ops(librados::ObjectWriteOperation *wr) {
+void ObjectWriteRequest<I>::add_write_ops(neorados::WriteOp* wr) {
if (this->m_full_object) {
- wr->write_full(m_write_data);
+ wr->write_full(bufferlist{m_write_data});
} else {
- wr->write(this->m_object_off, m_write_data);
+ wr->write(this->m_object_off, bufferlist{m_write_data});
+ }
+ util::apply_op_flags(m_op_flags, 0U, wr);
+}
+
+template <typename I>
+void ObjectDiscardRequest<I>::add_write_ops(neorados::WriteOp* wr) {
+ switch (m_discard_action) {
+ case DISCARD_ACTION_REMOVE:
+ wr->remove();
+ break;
+ case DISCARD_ACTION_REMOVE_TRUNCATE:
+ wr->create(false);
+ // fall through
+ case DISCARD_ACTION_TRUNCATE:
+ wr->truncate(this->m_object_off);
+ break;
+ case DISCARD_ACTION_ZERO:
+ wr->zero(this->m_object_off, this->m_object_len);
+ break;
+ default:
+ ceph_abort();
+ break;
}
- wr->set_op_flags2(m_op_flags);
}
template <typename I>
-void ObjectWriteSameRequest<I>::add_write_ops(
- librados::ObjectWriteOperation *wr) {
- wr->writesame(this->m_object_off, this->m_object_len, m_write_data);
- wr->set_op_flags2(m_op_flags);
+void ObjectWriteSameRequest<I>::add_write_ops(neorados::WriteOp* wr) {
+ wr->writesame(this->m_object_off, this->m_object_len,
+ bufferlist{m_write_data});
+ util::apply_op_flags(m_op_flags, 0U, wr);
}
template <typename I>
-void ObjectCompareAndWriteRequest<I>::add_write_ops(
- librados::ObjectWriteOperation *wr) {
- wr->cmpext(this->m_object_off, m_cmp_bl, nullptr);
+void ObjectCompareAndWriteRequest<I>::add_write_ops(neorados::WriteOp* wr) {
+ wr->cmpext(this->m_object_off, bufferlist{m_cmp_bl}, nullptr);
if (this->m_full_object) {
- wr->write_full(m_write_bl);
+ wr->write_full(bufferlist{m_write_bl});
} else {
- wr->write(this->m_object_off, m_write_bl);
+ wr->write(this->m_object_off, bufferlist{m_write_bl});
}
- wr->set_op_flags2(m_op_flags);
+ util::apply_op_flags(m_op_flags, 0U, wr);
}
template <typename I>
diff --git a/src/librbd/io/ObjectRequest.h b/src/librbd/io/ObjectRequest.h
index b9bd134451e..f696e13f71c 100644
--- a/src/librbd/io/ObjectRequest.h
+++ b/src/librbd/io/ObjectRequest.h
@@ -16,6 +16,8 @@
class Context;
class ObjectExtent;
+namespace neorados { struct WriteOp; }
+
namespace librbd {
struct ImageCtx;
@@ -59,7 +61,7 @@ public:
}
static void add_write_hint(ImageCtxT& image_ctx,
- librados::ObjectWriteOperation *wr);
+ neorados::WriteOp *wr);
virtual void send() = 0;
@@ -88,13 +90,11 @@ private:
template <typename ImageCtxT = ImageCtx>
class ObjectReadRequest : public ObjectRequest<ImageCtxT> {
public:
- typedef std::map<uint64_t, uint64_t> ExtentMap;
-
static ObjectReadRequest* create(
ImageCtxT *ictx, uint64_t objectno, uint64_t offset, uint64_t len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, Context *completion) {
+ Extents* extent_map, Context *completion) {
return new ObjectReadRequest(ictx, objectno, offset, len,
snap_id, op_flags, parent_trace, read_data,
extent_map, completion);
@@ -104,7 +104,7 @@ public:
ImageCtxT *ictx, uint64_t objectno, uint64_t offset, uint64_t len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, Context *completion);
+ Extents* extent_map, Context *completion);
void send() override;
@@ -137,7 +137,7 @@ private:
int m_op_flags;
ceph::bufferlist* m_read_data;
- ExtentMap* m_extent_map;
+ Extents* m_extent_map;
void read_object();
void handle_read_object(int r);
@@ -164,7 +164,7 @@ public:
return OBJECT_EXISTS;
}
- virtual void add_copyup_ops(librados::ObjectWriteOperation *wr) {
+ virtual void add_copyup_ops(neorados::WriteOp *wr) {
add_write_ops(wr);
}
@@ -189,8 +189,8 @@ protected:
return false;
}
- virtual void add_write_hint(librados::ObjectWriteOperation *wr);
- virtual void add_write_ops(librados::ObjectWriteOperation *wr) = 0;
+ virtual void add_write_hint(neorados::WriteOp *wr);
+ virtual void add_write_ops(neorados::WriteOp *wr) = 0;
virtual int filter_write_result(int r) const {
return r;
@@ -273,7 +273,7 @@ public:
}
protected:
- void add_write_ops(librados::ObjectWriteOperation *wr) override;
+ void add_write_ops(neorados::WriteOp *wr) override;
private:
ceph::bufferlist m_write_data;
@@ -345,29 +345,11 @@ protected:
return (m_discard_action == DISCARD_ACTION_REMOVE);
}
- void add_write_hint(librados::ObjectWriteOperation *wr) override {
+ void add_write_hint(neorados::WriteOp *wr) override {
// no hint for discard
}
- void add_write_ops(librados::ObjectWriteOperation *wr) override {
- switch (m_discard_action) {
- case DISCARD_ACTION_REMOVE:
- wr->remove();
- break;
- case DISCARD_ACTION_REMOVE_TRUNCATE:
- wr->create(false);
- // fall through
- case DISCARD_ACTION_TRUNCATE:
- wr->truncate(this->m_object_off);
- break;
- case DISCARD_ACTION_ZERO:
- wr->zero(this->m_object_off, this->m_object_len);
- break;
- default:
- ceph_abort();
- break;
- }
- }
+ void add_write_ops(neorados::WriteOp *wr) override;
private:
enum DiscardAction {
@@ -400,7 +382,7 @@ public:
}
protected:
- void add_write_ops(librados::ObjectWriteOperation *wr) override;
+ void add_write_ops(neorados::WriteOp *wr) override;
private:
ceph::bufferlist m_write_data;
@@ -427,7 +409,7 @@ public:
return "compare_and_write";
}
- void add_copyup_ops(librados::ObjectWriteOperation *wr) override {
+ void add_copyup_ops(neorados::WriteOp *wr) override {
// no-op on copyup
}
@@ -436,7 +418,7 @@ protected:
return true;
}
- void add_write_ops(librados::ObjectWriteOperation *wr) override;
+ void add_write_ops(neorados::WriteOp *wr) override;
int filter_write_result(int r) const override;
diff --git a/src/librbd/io/QosImageDispatch.cc b/src/librbd/io/QosImageDispatch.cc
index f19471f8d73..8badb58b1a4 100644
--- a/src/librbd/io/QosImageDispatch.cc
+++ b/src/librbd/io/QosImageDispatch.cc
@@ -3,8 +3,8 @@
#include "librbd/io/QosImageDispatch.h"
#include "common/dout.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
-#include "librbd/asio/ContextWQ.h"
#include "librbd/io/FlushTracker.h"
#include <map>
@@ -282,7 +282,7 @@ void QosImageDispatch<I>::handle_throttle_ready(Tag&& tag, uint64_t flag) {
if (set_throttle_flag(tag.image_dispatch_flags, flag)) {
// timer_lock is held -- so dispatch from outside the timer thread
- m_image_ctx->op_work_queue->queue(tag.on_dispatched, 0);
+ m_image_ctx->asio_engine->post(tag.on_dispatched, 0);
}
}
diff --git a/src/librbd/io/QueueImageDispatch.cc b/src/librbd/io/QueueImageDispatch.cc
index d901d2ebbd0..7cb5dfc5148 100644
--- a/src/librbd/io/QueueImageDispatch.cc
+++ b/src/librbd/io/QueueImageDispatch.cc
@@ -4,9 +4,9 @@
#include "librbd/io/QueueImageDispatch.h"
#include "common/dout.h"
#include "common/Cond.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
-#include "librbd/asio/ContextWQ.h"
#include "librbd/io/AioCompletion.h"
#include "librbd/io/ImageDispatchSpec.h"
@@ -115,7 +115,7 @@ bool QueueImageDispatch<I>::enqueue(
}
*dispatch_result = DISPATCH_RESULT_CONTINUE;
- m_image_ctx->op_work_queue->queue(on_dispatched, 0);
+ m_image_ctx->asio_engine->post(on_dispatched, 0);
return true;
}
diff --git a/src/librbd/io/ReadResult.h b/src/librbd/io/ReadResult.h
index 67339caec85..f4a34a0506b 100644
--- a/src/librbd/io/ReadResult.h
+++ b/src/librbd/io/ReadResult.h
@@ -43,7 +43,7 @@ public:
LightweightBufferExtents buffer_extents;
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_ObjectReadRequest(AioCompletion *aio_completion, uint64_t object_off,
uint64_t object_len,
diff --git a/src/librbd/io/SimpleSchedulerObjectDispatch.cc b/src/librbd/io/SimpleSchedulerObjectDispatch.cc
index ec9c3b43408..eca053e8a70 100644
--- a/src/librbd/io/SimpleSchedulerObjectDispatch.cc
+++ b/src/librbd/io/SimpleSchedulerObjectDispatch.cc
@@ -4,9 +4,9 @@
#include "librbd/io/SimpleSchedulerObjectDispatch.h"
#include "common/Timer.h"
#include "common/errno.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
-#include "librbd/asio/ContextWQ.h"
#include "librbd/io/ObjectDispatchSpec.h"
#include "librbd/io/ObjectDispatcher.h"
#include "librbd/io/Utils.h"
@@ -213,7 +213,7 @@ template <typename I>
bool SimpleSchedulerObjectDispatch<I>::read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags, const ZTracer::Trace &parent_trace,
- ceph::bufferlist* read_data, ExtentMap* extent_map,
+ ceph::bufferlist* read_data, Extents* extent_map,
int* object_dispatch_flags, DispatchResult* dispatch_result,
Context** on_finish, Context* on_dispatched) {
auto cct = m_image_ctx->cct;
@@ -505,12 +505,11 @@ void SimpleSchedulerObjectDispatch<I>::schedule_dispatch_delayed_requests() {
ldout(cct, 20) << "running timer task " << m_timer_task << dendl;
m_timer_task = nullptr;
- m_image_ctx->op_work_queue->queue(
- new LambdaContext(
- [this, object_no](int r) {
- std::lock_guard locker{m_lock};
- dispatch_delayed_requests(object_no);
- }), 0);
+ m_image_ctx->asio_engine->post(
+ [this, object_no]() {
+ std::lock_guard locker{m_lock};
+ dispatch_delayed_requests(object_no);
+ });
});
ldout(cct, 20) << "scheduling task " << m_timer_task << " at "
diff --git a/src/librbd/io/SimpleSchedulerObjectDispatch.h b/src/librbd/io/SimpleSchedulerObjectDispatch.h
index cca6b12b4c3..c32d513a2c8 100644
--- a/src/librbd/io/SimpleSchedulerObjectDispatch.h
+++ b/src/librbd/io/SimpleSchedulerObjectDispatch.h
@@ -52,7 +52,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, int* object_dispatch_flags,
+ Extents* extent_map, int* object_dispatch_flags,
DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) override;
diff --git a/src/librbd/io/Utils.cc b/src/librbd/io/Utils.cc
index bf06663388c..d50ac98d198 100644
--- a/src/librbd/io/Utils.cc
+++ b/src/librbd/io/Utils.cc
@@ -3,12 +3,32 @@
#include "librbd/io/Utils.h"
#include "include/buffer.h"
+#include "include/rados/librados.hpp"
+#include "include/neorados/RADOS.hpp"
#include "osd/osd_types.h"
namespace librbd {
namespace io {
namespace util {
+void apply_op_flags(uint32_t op_flags, uint32_t flags, neorados::Op* op) {
+ if (op_flags & LIBRADOS_OP_FLAG_FADVISE_RANDOM)
+ op->set_fadvise_random();
+ if (op_flags & LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL)
+ op->set_fadvise_sequential();
+ if (op_flags & LIBRADOS_OP_FLAG_FADVISE_WILLNEED)
+ op->set_fadvise_willneed();
+ if (op_flags & LIBRADOS_OP_FLAG_FADVISE_DONTNEED)
+ op->set_fadvise_dontneed();
+ if (op_flags & LIBRADOS_OP_FLAG_FADVISE_NOCACHE)
+ op->set_fadvise_nocache();
+
+ if (flags & librados::OPERATION_BALANCE_READS)
+ op->balance_reads();
+ if (flags & librados::OPERATION_LOCALIZE_READS)
+ op->localize_reads();
+}
+
bool assemble_write_same_extent(
const LightweightObjectExtent &object_extent, const ceph::bufferlist& data,
ceph::bufferlist *ws_data, bool force_write) {
diff --git a/src/librbd/io/Utils.h b/src/librbd/io/Utils.h
index 285985036de..cadc22840bf 100644
--- a/src/librbd/io/Utils.h
+++ b/src/librbd/io/Utils.h
@@ -11,10 +11,14 @@
class ObjectExtent;
+namespace neorados { struct Op; }
+
namespace librbd {
namespace io {
namespace util {
+void apply_op_flags(uint32_t op_flags, uint32_t flags, neorados::Op* op);
+
bool assemble_write_same_extent(const LightweightObjectExtent &object_extent,
const ceph::bufferlist& data,
ceph::bufferlist *ws_data,
diff --git a/src/librbd/journal/ObjectDispatch.h b/src/librbd/journal/ObjectDispatch.h
index e63f05535f8..48176e64345 100644
--- a/src/librbd/journal/ObjectDispatch.h
+++ b/src/librbd/journal/ObjectDispatch.h
@@ -41,7 +41,7 @@ public:
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace &parent_trace, ceph::bufferlist* read_data,
- io::ExtentMap* extent_map, int* object_dispatch_flags,
+ io::Extents* extent_map, int* object_dispatch_flags,
io::DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) {
return false;
diff --git a/src/librbd/managed_lock/AcquireRequest.cc b/src/librbd/managed_lock/AcquireRequest.cc
index c0078b966aa..f869938ad0b 100644
--- a/src/librbd/managed_lock/AcquireRequest.cc
+++ b/src/librbd/managed_lock/AcquireRequest.cc
@@ -8,6 +8,7 @@
#include "common/dout.h"
#include "common/errno.h"
#include "include/stringify.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
#include "librbd/asio/ContextWQ.h"
@@ -33,21 +34,21 @@ namespace managed_lock {
template <typename I>
AcquireRequest<I>* AcquireRequest<I>::create(librados::IoCtx& ioctx,
Watcher *watcher,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const string& oid,
const string& cookie,
bool exclusive,
bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds,
Context *on_finish) {
- return new AcquireRequest(ioctx, watcher, work_queue, oid, cookie,
+ return new AcquireRequest(ioctx, watcher, asio_engine, oid, cookie,
exclusive, blacklist_on_break_lock,
blacklist_expire_seconds, on_finish);
}
template <typename I>
AcquireRequest<I>::AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const string& oid,
const string& cookie, bool exclusive,
bool blacklist_on_break_lock,
@@ -55,11 +56,12 @@ AcquireRequest<I>::AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
Context *on_finish)
: m_ioctx(ioctx), m_watcher(watcher),
m_cct(reinterpret_cast<CephContext *>(m_ioctx.cct())),
- m_work_queue(work_queue), m_oid(oid), m_cookie(cookie),
+ m_asio_engine(asio_engine), m_oid(oid), m_cookie(cookie),
m_exclusive(exclusive),
m_blacklist_on_break_lock(blacklist_on_break_lock),
m_blacklist_expire_seconds(blacklist_expire_seconds),
- m_on_finish(new C_AsyncCallback<asio::ContextWQ>(work_queue, on_finish)) {
+ m_on_finish(new C_AsyncCallback<asio::ContextWQ>(
+ asio_engine.get_work_queue(), on_finish)) {
}
template <typename I>
@@ -147,7 +149,7 @@ void AcquireRequest<I>::send_break_lock() {
Context *ctx = create_context_callback<
AcquireRequest<I>, &AcquireRequest<I>::handle_break_lock>(this);
auto req = BreakRequest<I>::create(
- m_ioctx, m_work_queue, m_oid, m_locker, m_exclusive,
+ m_ioctx, m_asio_engine, m_oid, m_locker, m_exclusive,
m_blacklist_on_break_lock, m_blacklist_expire_seconds, false, ctx);
req->send();
}
diff --git a/src/librbd/managed_lock/AcquireRequest.h b/src/librbd/managed_lock/AcquireRequest.h
index 56e85bfb733..094cd55b4ce 100644
--- a/src/librbd/managed_lock/AcquireRequest.h
+++ b/src/librbd/managed_lock/AcquireRequest.h
@@ -16,8 +16,8 @@ class Context;
namespace librbd {
+class AsioEngine;
class Watcher;
-namespace asio { struct ContextWQ; }
namespace managed_lock {
@@ -29,7 +29,7 @@ private:
public:
static AcquireRequest* create(librados::IoCtx& ioctx, Watcher *watcher,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid,
const std::string& cookie,
bool exclusive,
@@ -64,7 +64,7 @@ private:
*/
AcquireRequest(librados::IoCtx& ioctx, Watcher *watcher,
- asio::ContextWQ *work_queue, const std::string& oid,
+ AsioEngine& asio_engine, const std::string& oid,
const std::string& cookie, bool exclusive,
bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds, Context *on_finish);
@@ -72,7 +72,7 @@ private:
librados::IoCtx& m_ioctx;
Watcher *m_watcher;
CephContext *m_cct;
- asio::ContextWQ *m_work_queue;
+ AsioEngine& m_asio_engine;
std::string m_oid;
std::string m_cookie;
bool m_exclusive;
diff --git a/src/librbd/managed_lock/BreakRequest.cc b/src/librbd/managed_lock/BreakRequest.cc
index d007380e3ae..2c8e3c54f01 100644
--- a/src/librbd/managed_lock/BreakRequest.cc
+++ b/src/librbd/managed_lock/BreakRequest.cc
@@ -4,12 +4,15 @@
#include "librbd/managed_lock/BreakRequest.h"
#include "common/dout.h"
#include "common/errno.h"
+#include "include/neorados/RADOS.hpp"
#include "include/stringify.h"
#include "cls/lock/cls_lock_client.h"
#include "cls/lock/cls_lock_types.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/Utils.h"
#include "librbd/asio/ContextWQ.h"
+#include "librbd/asio/Utils.h"
#include "librbd/managed_lock/GetLockerRequest.h"
#define dout_subsys ceph_subsys_rbd
@@ -23,38 +26,15 @@ namespace managed_lock {
using util::create_context_callback;
using util::create_rados_callback;
-namespace {
-
-struct C_BlacklistClient : public Context {
- librados::IoCtx &ioctx;
- std::string locker_address;
- uint32_t expire_seconds;
- Context *on_finish;
-
- C_BlacklistClient(librados::IoCtx &ioctx, const std::string &locker_address,
- uint32_t expire_seconds, Context *on_finish)
- : ioctx(ioctx), locker_address(locker_address),
- expire_seconds(expire_seconds), on_finish(on_finish) {
- }
-
- void finish(int r) override {
- librados::Rados rados(ioctx);
- r = rados.blacklist_add(locker_address, expire_seconds);
- on_finish->complete(r);
- }
-};
-
-} // anonymous namespace
-
template <typename I>
BreakRequest<I>::BreakRequest(librados::IoCtx& ioctx,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid, const Locker &locker,
bool exclusive, bool blacklist_locker,
uint32_t blacklist_expire_seconds,
bool force_break_lock, Context *on_finish)
: m_ioctx(ioctx), m_cct(reinterpret_cast<CephContext *>(m_ioctx.cct())),
- m_work_queue(work_queue), m_oid(oid), m_locker(locker),
+ m_asio_engine(asio_engine), m_oid(oid), m_locker(locker),
m_exclusive(exclusive), m_blacklist_locker(blacklist_locker),
m_blacklist_expire_seconds(blacklist_expire_seconds),
m_force_break_lock(force_break_lock), m_on_finish(on_finish) {
@@ -171,13 +151,29 @@ void BreakRequest<I>::send_blacklist() {
return;
}
- // TODO: need async version of RadosClient::blacklist_add
- using klass = BreakRequest<I>;
- Context *ctx = create_context_callback<klass, &klass::handle_blacklist>(
- this);
- m_work_queue->queue(new C_BlacklistClient(m_ioctx, m_locker.address,
- m_blacklist_expire_seconds, ctx),
- 0);
+ entity_addr_t locker_addr;
+ if (!locker_addr.parse(m_locker.address.c_str(), 0)) {
+ lderr(m_cct) << "unable to parse locker address: " << m_locker.address
+ << dendl;
+ finish(-EINVAL);
+ return;
+ }
+
+ std::stringstream cmd;
+ cmd << "{"
+ << "\"prefix\": \"osd blacklist\", "
+ << "\"blacklistop\": \"add\", "
+ << "\"addr\": \"" << locker_addr << "\"";
+ if (m_blacklist_expire_seconds != 0) {
+ cmd << ", \"expire\": " << m_blacklist_expire_seconds << ".0";
+ }
+ cmd << "}";
+
+ bufferlist in_bl;
+ m_asio_engine.get_rados_api().mon_command(
+ {cmd.str()}, in_bl, nullptr, nullptr,
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_blacklist(r); }));
}
template <typename I>
@@ -190,6 +186,30 @@ void BreakRequest<I>::handle_blacklist(int r) {
finish(r);
return;
}
+
+ wait_for_osd_map();
+}
+
+template <typename I>
+void BreakRequest<I>::wait_for_osd_map() {
+ ldout(m_cct, 10) << dendl;
+
+ m_asio_engine.get_rados_api().wait_for_latest_osd_map(
+ librbd::asio::util::get_callback_adapter(
+ [this](int r) { handle_wait_for_osd_map(r); }));
+}
+
+template <typename I>
+void BreakRequest<I>::handle_wait_for_osd_map(int r) {
+ ldout(m_cct, 10) << "r=" << r << dendl;
+
+ if (r < 0) {
+ lderr(m_cct) << "failed to wait for updated OSD map: " << cpp_strerror(r)
+ << dendl;
+ finish(r);
+ return;
+ }
+
send_break_lock();
}
diff --git a/src/librbd/managed_lock/BreakRequest.h b/src/librbd/managed_lock/BreakRequest.h
index 50bc0b0cb85..3c812999810 100644
--- a/src/librbd/managed_lock/BreakRequest.h
+++ b/src/librbd/managed_lock/BreakRequest.h
@@ -19,6 +19,7 @@ class obj_watch_t;
namespace librbd {
+class AsioEngine;
class ImageCtx;
template <typename> class Journal;
namespace asio { struct ContextWQ; }
@@ -29,12 +30,12 @@ template <typename ImageCtxT = ImageCtx>
class BreakRequest {
public:
static BreakRequest* create(librados::IoCtx& ioctx,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid, const Locker &locker,
bool exclusive, bool blacklist_locker,
uint32_t blacklist_expire_seconds,
bool force_break_lock, Context *on_finish) {
- return new BreakRequest(ioctx, work_queue, oid, locker, exclusive,
+ return new BreakRequest(ioctx, asio_engine, oid, locker, exclusive,
blacklist_locker, blacklist_expire_seconds,
force_break_lock, on_finish);
}
@@ -57,6 +58,9 @@ private:
* BLACKLIST (skip if disabled)
* |
* v
+ * WAIT_FOR_OSD_MAP
+ * |
+ * v
* BREAK_LOCK
* |
* v
@@ -67,7 +71,7 @@ private:
librados::IoCtx &m_ioctx;
CephContext *m_cct;
- asio::ContextWQ *m_work_queue;
+ AsioEngine& m_asio_engine;
std::string m_oid;
Locker m_locker;
bool m_exclusive;
@@ -83,7 +87,7 @@ private:
Locker m_refreshed_locker;
- BreakRequest(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
+ BreakRequest(librados::IoCtx& ioctx, AsioEngine& asio_engine,
const std::string& oid, const Locker &locker,
bool exclusive, bool blacklist_locker,
uint32_t blacklist_expire_seconds, bool force_break_lock,
@@ -98,6 +102,9 @@ private:
void send_blacklist();
void handle_blacklist(int r);
+ void wait_for_osd_map();
+ void handle_wait_for_osd_map(int r);
+
void send_break_lock();
void handle_break_lock(int r);
diff --git a/src/librbd/object_map/InvalidateRequest.h b/src/librbd/object_map/InvalidateRequest.h
index 11c420372ac..ce15bb2d337 100644
--- a/src/librbd/object_map/InvalidateRequest.h
+++ b/src/librbd/object_map/InvalidateRequest.h
@@ -31,10 +31,6 @@ public:
protected:
bool should_complete(int r) override;
- int filter_return_code(int r) const override{
- // never propagate an error back to the caller
- return 0;
- }
private:
uint64_t m_snap_id;
diff --git a/src/librbd/object_map/RefreshRequest.cc b/src/librbd/object_map/RefreshRequest.cc
index d9febda66da..0f6b81923e0 100644
--- a/src/librbd/object_map/RefreshRequest.cc
+++ b/src/librbd/object_map/RefreshRequest.cc
@@ -133,6 +133,11 @@ Context *RefreshRequest<I>::handle_load(int *ret_val) {
return nullptr;
} else if (*ret_val < 0) {
lderr(cct) << "failed to load object map: " << oid << dendl;
+ if (*ret_val == -ETIMEDOUT &&
+ !cct->_conf.get_val<bool>("rbd_invalidate_object_map_on_timeout")) {
+ return m_on_finish;
+ }
+
send_invalidate();
return nullptr;
}
diff --git a/src/librbd/object_map/Request.cc b/src/librbd/object_map/Request.cc
index e323251878a..1e1aab2ae5c 100644
--- a/src/librbd/object_map/Request.cc
+++ b/src/librbd/object_map/Request.cc
@@ -22,7 +22,11 @@ bool Request::should_complete(int r) {
switch (m_state)
{
case STATE_REQUEST:
- if (r < 0) {
+ if (r == -ETIMEDOUT &&
+ !cct->_conf.get_val<bool>("rbd_invalidate_object_map_on_timeout")) {
+ m_state = STATE_TIMEOUT;
+ return true;
+ } else if (r < 0) {
lderr(cct) << "failed to update object map: " << cpp_strerror(r)
<< dendl;
return invalidate();
@@ -51,7 +55,7 @@ bool Request::invalidate() {
bool flags_set;
int r = m_image_ctx.test_flags(m_snap_id, RBD_FLAG_OBJECT_MAP_INVALID,
&flags_set);
- if (r == 0 && flags_set) {
+ if (r < 0 || flags_set) {
return true;
}
diff --git a/src/librbd/object_map/Request.h b/src/librbd/object_map/Request.h
index aef8800dd8a..7e9bfb88dfd 100644
--- a/src/librbd/object_map/Request.h
+++ b/src/librbd/object_map/Request.h
@@ -41,6 +41,9 @@ protected:
private:
/**
+ * STATE_TIMEOUT --------\
+ * ^ |
+ * | v
* <start> ---> STATE_REQUEST ---> <finish>
* | ^
* v |
@@ -48,6 +51,7 @@ private:
*/
enum State {
STATE_REQUEST,
+ STATE_TIMEOUT,
STATE_INVALIDATE
};
diff --git a/src/librbd/operation/SnapshotCreateRequest.cc b/src/librbd/operation/SnapshotCreateRequest.cc
index 13885cf3011..344dcf781b2 100644
--- a/src/librbd/operation/SnapshotCreateRequest.cc
+++ b/src/librbd/operation/SnapshotCreateRequest.cc
@@ -433,6 +433,7 @@ void SnapshotCreateRequest<I>::update_snap_context() {
image_ctx.snapc.snaps.swap(snaps);
image_ctx.data_ctx.selfmanaged_snap_set_write_ctx(
image_ctx.snapc.seq, image_ctx.snaps);
+ image_ctx.rebuild_data_io_context();
if (!image_ctx.migration_info.empty()) {
auto it = image_ctx.migration_info.snap_map.find(CEPH_NOSNAP);
diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc
index 548a8c8a2ca..c052a4a16b9 100755
--- a/src/mds/CDir.cc
+++ b/src/mds/CDir.cc
@@ -1695,6 +1695,7 @@ CDentry *CDir::_load_dentry(
bufferlist &bl,
const int pos,
const std::set<snapid_t> *snaps,
+ double rand_threshold,
bool *force_dirty)
{
auto q = bl.cbegin();
@@ -1857,7 +1858,7 @@ CDentry *CDir::_load_dentry(
if (in->inode.is_dirty_rstat())
in->mark_dirty_rstat();
- in->maybe_ephemeral_rand(true);
+ in->maybe_ephemeral_rand(true, rand_threshold);
//in->hack_accessed = false;
//in->hack_load_stamp = ceph_clock_now();
//num_new_inodes_loaded++;
@@ -1969,6 +1970,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
}
unsigned pos = omap.size() - 1;
+ double rand_threshold = get_inode()->get_ephemeral_rand();
for (map<string, bufferlist>::reverse_iterator p = omap.rbegin();
p != omap.rend();
++p, --pos) {
@@ -1980,7 +1982,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
try {
dn = _load_dentry(
p->first, dname, last, p->second, pos, snaps,
- &force_dirty);
+ rand_threshold, &force_dirty);
} catch (const buffer::error &err) {
cache->mds->clog->warn() << "Corrupt dentry '" << dname << "' in "
"dir frag " << dirfrag() << ": "
diff --git a/src/mds/CDir.h b/src/mds/CDir.h
index 52e01001b14..a907836aa51 100644
--- a/src/mds/CDir.h
+++ b/src/mds/CDir.h
@@ -646,6 +646,7 @@ protected:
ceph::buffer::list &bl,
int pos,
const std::set<snapid_t> *snaps,
+ double rand_threshold,
bool *force_dirty);
/**
diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc
index 03ad469d507..292321dc0fc 100644
--- a/src/mds/CInode.cc
+++ b/src/mds/CInode.cc
@@ -5388,7 +5388,7 @@ void CInode::set_ephemeral_rand(bool yes)
}
}
-void CInode::maybe_ephemeral_rand(bool fresh)
+void CInode::maybe_ephemeral_rand(bool fresh, double threshold)
{
if (!mdcache->get_export_ephemeral_random_config()) {
dout(15) << __func__ << " config false: cannot ephemeral random pin " << *this << dendl;
@@ -5410,7 +5410,13 @@ void CInode::maybe_ephemeral_rand(bool fresh)
return;
}
- double threshold = get_ephemeral_rand();
+ /* not precomputed? */
+ if (threshold < 0.0) {
+ threshold = get_ephemeral_rand();
+ }
+ if (threshold <= 0.0) {
+ return;
+ }
double n = ceph::util::generate_random_number(0.0, 1.0);
dout(15) << __func__ << " rand " << n << " <?= " << threshold
diff --git a/src/mds/CInode.h b/src/mds/CInode.h
index baf7174e2cf..1e055cf99f9 100644
--- a/src/mds/CInode.h
+++ b/src/mds/CInode.h
@@ -942,7 +942,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
double get_ephemeral_rand(bool inherit=true) const;
void set_ephemeral_rand(bool yes);
- void maybe_ephemeral_rand(bool fresh=false);
+ void maybe_ephemeral_rand(bool fresh=false, double threshold=-1.0);
void setxattr_ephemeral_rand(double prob=0.0);
bool is_ephemeral_rand() const {
return state_test(STATE_RANDEPHEMERALPIN);
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index 07ec858a4af..4dbc1bd37a0 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -26,7 +26,7 @@
#include "MDSRank.h"
#include "MDSMap.h"
#include "messages/MInodeFileCaps.h"
-#include "messages/MMDSSlaveRequest.h"
+#include "messages/MMDSPeerRequest.h"
#include "Migrator.h"
#include "msg/Messenger.h"
#include "osdc/Objecter.h"
@@ -242,7 +242,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
if ((lock->get_type() == CEPH_LOCK_ISNAP ||
lock->get_type() == CEPH_LOCK_IPOLICY) &&
mds->is_cluster_degraded() &&
- mdr->is_master() &&
+ mdr->is_leader() &&
!mdr->is_queued_for_replay()) {
// waiting for recovering mds, to guarantee replayed requests and mksnap/setlayout
// get processed in proper order.
@@ -259,7 +259,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
}
}
} else {
- // if the lock is the latest locked one, it's possible that slave mds got the lock
+ // if the lock is the latest locked one, it's possible that peer mds got the lock
// while there are recovering mds.
if (!mdr->is_xlocked(lock) || mdr->is_last_locked(lock))
wait = true;
@@ -283,11 +283,11 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
CDentry *dn = static_cast<CDentry*>(object);
if (!dn->is_auth())
continue;
- if (mdr->is_master()) {
- // master. wrlock versionlock so we can pipeline dentry updates to journal.
+ if (mdr->is_leader()) {
+ // leader. wrlock versionlock so we can pipeline dentry updates to journal.
lov.add_wrlock(&dn->versionlock, i + 1);
} else {
- // slave. exclusively lock the dentry version (i.e. block other journal updates).
+ // peer. exclusively lock the dentry version (i.e. block other journal updates).
// this makes rollback safe.
lov.add_xlock(&dn->versionlock, i + 1);
}
@@ -297,11 +297,11 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
CInode *in = static_cast<CInode*>(object);
if (!in->is_auth())
continue;
- if (mdr->is_master()) {
- // master. wrlock versionlock so we can pipeline inode updates to journal.
+ if (mdr->is_leader()) {
+ // leader. wrlock versionlock so we can pipeline inode updates to journal.
lov.add_wrlock(&in->versionlock, i + 1);
} else {
- // slave. exclusively lock the inode version (i.e. block other journal updates).
+ // peer. exclusively lock the inode version (i.e. block other journal updates).
// this makes rollback safe.
lov.add_xlock(&in->versionlock, i + 1);
}
@@ -313,7 +313,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
mustpin.insert(object);
} else if (!object->is_auth() &&
!lock->can_wrlock(_client) && // we might have to request a scatter
- !mdr->is_slave()) { // if we are slave (remote_wrlock), the master already authpinned
+ !mdr->is_peer()) { // if we are peer (remote_wrlock), the leader already authpinned
dout(15) << " will also auth_pin " << *object
<< " in case we need to request a scatter" << dendl;
mustpin.insert(object);
@@ -461,13 +461,13 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(p.first)) {
dout(10) << " mds." << p.first << " is not active" << dendl;
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(p.first, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
- auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt,
- MMDSSlaveRequest::OP_AUTHPIN);
+ auto req = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt,
+ MMDSPeerRequest::OP_AUTHPIN);
for (auto& o : p.second) {
dout(10) << " req remote auth_pin of " << *o << dendl;
MDSCacheObjectInfo info;
@@ -485,7 +485,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
mds->send_message_mds(req, p.first);
// put in waiting list
- auto ret = mdr->more()->waiting_on_slave.insert(p.first);
+ auto ret = mdr->more()->waiting_on_peer.insert(p.first);
ceph_assert(ret.second);
}
return false;
@@ -556,7 +556,7 @@ bool Locker::acquire_locks(MDRequestRef& mdr,
continue;
}
- ceph_assert(mdr->is_master());
+ ceph_assert(mdr->is_leader());
if (lock->needs_recover()) {
if (mds->is_cluster_degraded()) {
if (!mdr->is_queued_for_replay()) {
@@ -632,7 +632,7 @@ void Locker::set_xlocks_done(MutationImpl *mut, bool skip_dentry)
void Locker::_drop_locks(MutationImpl *mut, set<CInode*> *pneed_issue,
bool drop_rdlocks)
{
- set<mds_rank_t> slaves;
+ set<mds_rank_t> peers;
for (auto it = mut->locks.begin(); it != mut->locks.end(); ) {
SimpleLock *lock = it->lock;
@@ -646,13 +646,13 @@ void Locker::_drop_locks(MutationImpl *mut, set<CInode*> *pneed_issue,
pneed_issue->insert(static_cast<CInode*>(obj));
} else {
ceph_assert(lock->get_sm()->can_remote_xlock);
- slaves.insert(obj->authority().first);
+ peers.insert(obj->authority().first);
lock->put_xlock();
mut->locks.erase(it++);
}
} else if (it->is_wrlock() || it->is_remote_wrlock()) {
if (it->is_remote_wrlock()) {
- slaves.insert(it->wrlock_target);
+ peers.insert(it->wrlock_target);
it->clear_remote_wrlock();
}
if (it->is_wrlock()) {
@@ -680,13 +680,13 @@ void Locker::_drop_locks(MutationImpl *mut, set<CInode*> *pneed_issue,
}
}
- for (set<mds_rank_t>::iterator p = slaves.begin(); p != slaves.end(); ++p) {
+ for (set<mds_rank_t>::iterator p = peers.begin(); p != peers.end(); ++p) {
if (!mds->is_cluster_degraded() ||
mds->mdsmap->get_state(*p) >= MDSMap::STATE_REJOIN) {
dout(10) << "_drop_non_rdlocks dropping remote locks on mds." << *p << dendl;
- auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt,
- MMDSSlaveRequest::OP_DROPLOCKS);
- mds->send_message_mds(slavereq, *p);
+ auto peerreq = make_message<MMDSPeerRequest>(mut->reqid, mut->attempt,
+ MMDSPeerRequest::OP_DROPLOCKS);
+ mds->send_message_mds(peerreq, *p);
}
}
}
@@ -903,8 +903,8 @@ void Locker::create_lock_cache(MDRequestRef& mdr, CInode *diri, file_layout_t *d
return;
}
- if (mdr->has_more() && !mdr->more()->slaves.empty()) {
- dout(10) << " there are slaves requests for " << *mdr << ", noop" << dendl;
+ if (mdr->has_more() && !mdr->more()->peers.empty()) {
+ dout(10) << " there are peers requests for " << *mdr << ", noop" << dendl;
return;
}
@@ -1414,7 +1414,7 @@ void Locker::try_eval(SimpleLock *lock, bool *pneed_issue)
*
* We can defer while freezing without causing a deadlock. Honor
* scatter_wanted flag here. This will never get deferred by the
- * checks above due to the auth_pin held by the master.
+ * checks above due to the auth_pin held by the leader.
*/
if (lock->is_scatterlock()) {
ScatterLock *slock = static_cast<ScatterLock *>(lock);
@@ -1846,21 +1846,21 @@ void Locker::remote_wrlock_start(SimpleLock *lock, mds_rank_t target, MDRequestR
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(target)) {
dout(7) << " mds." << target << " is not active" << dendl;
- if (mut->more()->waiting_on_slave.empty())
+ if (mut->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(target, new C_MDS_RetryRequest(mdcache, mut));
return;
}
// send lock request
mut->start_locking(lock, target);
- mut->more()->slaves.insert(target);
- auto r = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_WRLOCK);
+ mut->more()->peers.insert(target);
+ auto r = make_message<MMDSPeerRequest>(mut->reqid, mut->attempt, MMDSPeerRequest::OP_WRLOCK);
r->set_lock_type(lock->get_type());
lock->get_parent()->set_object_info(r->get_object_info());
mds->send_message_mds(r, target);
- ceph_assert(mut->more()->waiting_on_slave.count(target) == 0);
- mut->more()->waiting_on_slave.insert(target);
+ ceph_assert(mut->more()->waiting_on_peer.count(target) == 0);
+ mut->more()->waiting_on_peer.insert(target);
}
void Locker::remote_wrlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *mut)
@@ -1878,10 +1878,10 @@ void Locker::remote_wrlock_finish(const MutationImpl::lock_iterator& it, Mutatio
<< " " << *lock->get_parent() << dendl;
if (!mds->is_cluster_degraded() ||
mds->mdsmap->get_state(target) >= MDSMap::STATE_REJOIN) {
- auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNWRLOCK);
- slavereq->set_lock_type(lock->get_type());
- lock->get_parent()->set_object_info(slavereq->get_object_info());
- mds->send_message_mds(slavereq, target);
+ auto peerreq = make_message<MMDSPeerRequest>(mut->reqid, mut->attempt, MMDSPeerRequest::OP_UNWRLOCK);
+ peerreq->set_lock_type(lock->get_type());
+ lock->get_parent()->set_object_info(peerreq->get_object_info());
+ mds->send_message_mds(peerreq, target);
}
}
@@ -1941,7 +1941,7 @@ bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut)
} else {
// replica
ceph_assert(lock->get_sm()->can_remote_xlock);
- ceph_assert(!mut->slave_request);
+ ceph_assert(!mut->peer_request);
// wait for single auth
if (lock->get_parent()->is_ambiguous_auth()) {
@@ -1955,21 +1955,21 @@ bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut)
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(auth)) {
dout(7) << " mds." << auth << " is not active" << dendl;
- if (mut->more()->waiting_on_slave.empty())
+ if (mut->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(auth, new C_MDS_RetryRequest(mdcache, mut));
return false;
}
// send lock request
- mut->more()->slaves.insert(auth);
+ mut->more()->peers.insert(auth);
mut->start_locking(lock, auth);
- auto r = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_XLOCK);
+ auto r = make_message<MMDSPeerRequest>(mut->reqid, mut->attempt, MMDSPeerRequest::OP_XLOCK);
r->set_lock_type(lock->get_type());
lock->get_parent()->set_object_info(r->get_object_info());
mds->send_message_mds(r, auth);
- ceph_assert(mut->more()->waiting_on_slave.count(auth) == 0);
- mut->more()->waiting_on_slave.insert(auth);
+ ceph_assert(mut->more()->waiting_on_peer.count(auth) == 0);
+ mut->more()->waiting_on_peer.insert(auth);
return false;
}
@@ -2032,10 +2032,10 @@ void Locker::xlock_finish(const MutationImpl::lock_iterator& it, MutationImpl *m
mds_rank_t auth = lock->get_parent()->authority().first;
if (!mds->is_cluster_degraded() ||
mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
- auto slavereq = make_message<MMDSSlaveRequest>(mut->reqid, mut->attempt, MMDSSlaveRequest::OP_UNXLOCK);
- slavereq->set_lock_type(lock->get_type());
- lock->get_parent()->set_object_info(slavereq->get_object_info());
- mds->send_message_mds(slavereq, auth);
+ auto peerreq = make_message<MMDSPeerRequest>(mut->reqid, mut->attempt, MMDSPeerRequest::OP_UNXLOCK);
+ peerreq->set_lock_type(lock->get_type());
+ lock->get_parent()->set_object_info(peerreq->get_object_info());
+ mds->send_message_mds(peerreq, auth);
}
// others waiting?
lock->finish_waiters(SimpleLock::WAIT_STABLE |
diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc
index bdffc6a6aff..3df8f327c6c 100644
--- a/src/mds/LogEvent.cc
+++ b/src/mds/LogEvent.cc
@@ -29,7 +29,7 @@
#include "events/ESessions.h"
#include "events/EUpdate.h"
-#include "events/ESlaveUpdate.h"
+#include "events/EPeerUpdate.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
#include "events/EPurged.h"
@@ -82,7 +82,7 @@ std::string_view LogEvent::get_type_str() const
case EVENT_SESSIONS_OLD: return "SESSIONS_OLD";
case EVENT_SESSIONS: return "SESSIONS";
case EVENT_UPDATE: return "UPDATE";
- case EVENT_SLAVEUPDATE: return "SLAVEUPDATE";
+ case EVENT_PEERUPDATE: return "PEERUPDATE";
case EVENT_OPEN: return "OPEN";
case EVENT_COMMITTED: return "COMMITTED";
case EVENT_PURGED: return "PURGED";
@@ -108,7 +108,7 @@ const std::map<std::string, LogEvent::EventType> LogEvent::types = {
{"SESSIONS_OLD", EVENT_SESSIONS_OLD},
{"SESSIONS", EVENT_SESSIONS},
{"UPDATE", EVENT_UPDATE},
- {"SLAVEUPDATE", EVENT_SLAVEUPDATE},
+ {"PEERUPDATE", EVENT_PEERUPDATE},
{"OPEN", EVENT_OPEN},
{"COMMITTED", EVENT_COMMITTED},
{"PURGED", EVENT_PURGED},
@@ -174,8 +174,8 @@ std::unique_ptr<LogEvent> LogEvent::decode_event(bufferlist::const_iterator& p,
case EVENT_UPDATE:
le = std::make_unique<EUpdate>();
break;
- case EVENT_SLAVEUPDATE:
- le = std::make_unique<ESlaveUpdate>();
+ case EVENT_PEERUPDATE:
+ le = std::make_unique<EPeerUpdate>();
break;
case EVENT_OPEN:
le = std::make_unique<EOpen>();
diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h
index b2f3352d43c..4e368c97b5e 100644
--- a/src/mds/LogEvent.h
+++ b/src/mds/LogEvent.h
@@ -31,7 +31,7 @@
#define EVENT_SESSIONS 12
#define EVENT_UPDATE 20
-#define EVENT_SLAVEUPDATE 21
+#define EVENT_PEERUPDATE 21
#define EVENT_OPEN 22
#define EVENT_COMMITTED 23
#define EVENT_PURGED 24
diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h
index 3aad27bf29e..93d88d61860 100644
--- a/src/mds/LogSegment.h
+++ b/src/mds/LogSegment.h
@@ -32,7 +32,7 @@ class CDir;
class CInode;
class CDentry;
class MDSRank;
-struct MDSlaveUpdate;
+struct MDPeerUpdate;
class LogSegment {
public:
@@ -88,8 +88,8 @@ class LogSegment {
MDSContext* purged_cb = nullptr;
map<int, ceph::unordered_set<version_t> > pending_commit_tids; // mdstable
- set<metareqid_t> uncommitted_masters;
- set<metareqid_t> uncommitted_slaves;
+ set<metareqid_t> uncommitted_leaders;
+ set<metareqid_t> uncommitted_peers;
set<dirfrag_t> uncommitted_fragments;
// client request ids
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index caf7cf1c10e..6bbe7e8638e 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -57,7 +57,7 @@
#include "events/ESubtreeMap.h"
#include "events/EUpdate.h"
-#include "events/ESlaveUpdate.h"
+#include "events/EPeerUpdate.h"
#include "events/EImportFinish.h"
#include "events/EFragment.h"
#include "events/ECommitted.h"
@@ -1849,7 +1849,7 @@ void MDCache::project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t fi
if (cur->last >= floor) {
bool update = true;
if (cur->state_test(CInode::STATE_AMBIGUOUSAUTH) && cur->is_auth()) {
- // rename src inode is not projected in the slave rename prep case. so we should
+ // rename src inode is not projected in the peer rename prep case. so we should
// avoid updateing the inode.
ceph_assert(linkunlink < 0);
ceph_assert(cur->is_frozen_inode());
@@ -2258,7 +2258,7 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
// because we are about to write into the dirfrag fnode and that needs
// to commit before the lock can cycle.
if (linkunlink) {
- ceph_assert(pin->nestlock.get_num_wrlocks() || mut->is_slave());
+ ceph_assert(pin->nestlock.get_num_wrlocks() || mut->is_peer());
}
if (!mut->is_wrlocked(&pin->nestlock)) {
@@ -2328,7 +2328,7 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
if (!mut->is_wrlocked(&pin->versionlock))
mds->locker->local_wrlock_grab(&pin->versionlock, mut);
- ceph_assert(mut->is_wrlocked(&pin->nestlock) || mut->is_slave());
+ ceph_assert(mut->is_wrlocked(&pin->nestlock) || mut->is_peer());
pin->last_dirstat_prop = mut->get_mds_stamp();
@@ -2444,106 +2444,106 @@ void MDCache::predirty_journal_parents(MutationRef mut, EMetaBlob *blob,
// ===================================
-// slave requests
+// peer requests
/*
- * some handlers for master requests with slaves. we need to make
- * sure slaves journal commits before we forget we mastered them and
- * remove them from the uncommitted_masters map (used during recovery
- * to commit|abort slaves).
+ * some handlers for leader requests with peers. we need to make
+ * sure leader journal commits before we forget we leadered them and
+ * remove them from the uncommitted_leaders map (used during recovery
+ * to commit|abort peers).
*/
-struct C_MDC_CommittedMaster : public MDCacheLogContext {
+struct C_MDC_CommittedLeader : public MDCacheLogContext {
metareqid_t reqid;
- C_MDC_CommittedMaster(MDCache *s, metareqid_t r) : MDCacheLogContext(s), reqid(r) {}
+ C_MDC_CommittedLeader(MDCache *s, metareqid_t r) : MDCacheLogContext(s), reqid(r) {}
void finish(int r) override {
- mdcache->_logged_master_commit(reqid);
+ mdcache->_logged_leader_commit(reqid);
}
};
-void MDCache::log_master_commit(metareqid_t reqid)
+void MDCache::log_leader_commit(metareqid_t reqid)
{
- dout(10) << "log_master_commit " << reqid << dendl;
- uncommitted_masters[reqid].committing = true;
+ dout(10) << "log_leader_commit " << reqid << dendl;
+ uncommitted_leaders[reqid].committing = true;
mds->mdlog->start_submit_entry(new ECommitted(reqid),
- new C_MDC_CommittedMaster(this, reqid));
+ new C_MDC_CommittedLeader(this, reqid));
}
-void MDCache::_logged_master_commit(metareqid_t reqid)
+void MDCache::_logged_leader_commit(metareqid_t reqid)
{
- dout(10) << "_logged_master_commit " << reqid << dendl;
- ceph_assert(uncommitted_masters.count(reqid));
- uncommitted_masters[reqid].ls->uncommitted_masters.erase(reqid);
- mds->queue_waiters(uncommitted_masters[reqid].waiters);
- uncommitted_masters.erase(reqid);
+ dout(10) << "_logged_leader_commit " << reqid << dendl;
+ ceph_assert(uncommitted_leaders.count(reqid));
+ uncommitted_leaders[reqid].ls->uncommitted_leaders.erase(reqid);
+ mds->queue_waiters(uncommitted_leaders[reqid].waiters);
+ uncommitted_leaders.erase(reqid);
}
// while active...
-void MDCache::committed_master_slave(metareqid_t r, mds_rank_t from)
+void MDCache::committed_leader_peer(metareqid_t r, mds_rank_t from)
{
- dout(10) << "committed_master_slave mds." << from << " on " << r << dendl;
- ceph_assert(uncommitted_masters.count(r));
- uncommitted_masters[r].slaves.erase(from);
- if (!uncommitted_masters[r].recovering && uncommitted_masters[r].slaves.empty())
- log_master_commit(r);
+ dout(10) << "committed_leader_peer mds." << from << " on " << r << dendl;
+ ceph_assert(uncommitted_leaders.count(r));
+ uncommitted_leaders[r].peers.erase(from);
+ if (!uncommitted_leaders[r].recovering && uncommitted_leaders[r].peers.empty())
+ log_leader_commit(r);
}
-void MDCache::logged_master_update(metareqid_t reqid)
+void MDCache::logged_leader_update(metareqid_t reqid)
{
- dout(10) << "logged_master_update " << reqid << dendl;
- ceph_assert(uncommitted_masters.count(reqid));
- uncommitted_masters[reqid].safe = true;
- auto p = pending_masters.find(reqid);
- if (p != pending_masters.end()) {
- pending_masters.erase(p);
- if (pending_masters.empty())
+ dout(10) << "logged_leader_update " << reqid << dendl;
+ ceph_assert(uncommitted_leaders.count(reqid));
+ uncommitted_leaders[reqid].safe = true;
+ auto p = pending_leaders.find(reqid);
+ if (p != pending_leaders.end()) {
+ pending_leaders.erase(p);
+ if (pending_leaders.empty())
process_delayed_resolve();
}
}
/*
- * Master may crash after receiving all slaves' commit acks, but before journalling
- * the final commit. Slaves may crash after journalling the slave commit, but before
- * sending commit ack to the master. Commit masters with no uncommitted slave when
+ * Leader may crash after receiving all peers' commit acks, but before journalling
+ * the final commit. Peers may crash after journalling the peer commit, but before
+ * sending commit ack to the leader. Commit leaders with no uncommitted peer when
* resolve finishes.
*/
-void MDCache::finish_committed_masters()
+void MDCache::finish_committed_leaders()
{
- for (map<metareqid_t, umaster>::iterator p = uncommitted_masters.begin();
- p != uncommitted_masters.end();
+ for (map<metareqid_t, uleader>::iterator p = uncommitted_leaders.begin();
+ p != uncommitted_leaders.end();
++p) {
p->second.recovering = false;
- if (!p->second.committing && p->second.slaves.empty()) {
- dout(10) << "finish_committed_masters " << p->first << dendl;
- log_master_commit(p->first);
+ if (!p->second.committing && p->second.peers.empty()) {
+ dout(10) << "finish_committed_leaders " << p->first << dendl;
+ log_leader_commit(p->first);
}
}
}
/*
- * at end of resolve... we must journal a commit|abort for all slave
+ * at end of resolve... we must journal a commit|abort for all peer
* updates, before moving on.
*
- * this is so that the master can safely journal ECommitted on ops it
- * masters when it reaches up:active (all other recovering nodes must
+ * this is so that the leader can safely journal ECommitted on ops it
+ * leaders when it reaches up:active (all other recovering nodes must
* complete resolve before that happens).
*/
-struct C_MDC_SlaveCommit : public MDCacheLogContext {
+struct C_MDC_PeerCommit : public MDCacheLogContext {
mds_rank_t from;
metareqid_t reqid;
- C_MDC_SlaveCommit(MDCache *c, int f, metareqid_t r) : MDCacheLogContext(c), from(f), reqid(r) {}
+ C_MDC_PeerCommit(MDCache *c, int f, metareqid_t r) : MDCacheLogContext(c), from(f), reqid(r) {}
void finish(int r) override {
- mdcache->_logged_slave_commit(from, reqid);
+ mdcache->_logged_peer_commit(from, reqid);
}
};
-void MDCache::_logged_slave_commit(mds_rank_t from, metareqid_t reqid)
+void MDCache::_logged_peer_commit(mds_rank_t from, metareqid_t reqid)
{
- dout(10) << "_logged_slave_commit from mds." << from << " " << reqid << dendl;
+ dout(10) << "_logged_peer_commit from mds." << from << " " << reqid << dendl;
// send a message
- auto req = make_message<MMDSSlaveRequest>(reqid, 0, MMDSSlaveRequest::OP_COMMITTED);
+ auto req = make_message<MMDSPeerRequest>(reqid, 0, MMDSPeerRequest::OP_COMMITTED);
mds->send_message_mds(req, from);
}
@@ -2755,14 +2755,14 @@ void MDCache::resolve_start(MDSContext *resolve_done_)
void MDCache::send_resolves()
{
- send_slave_resolves();
+ send_peer_resolves();
if (!resolve_done) {
// I'm survivor: refresh snap cache
mds->snapclient->sync(
new MDSInternalContextWrapper(mds,
new LambdaContext([this](int r) {
- maybe_finish_slave_resolve();
+ maybe_finish_peer_resolve();
})
)
);
@@ -2783,20 +2783,20 @@ void MDCache::send_resolves()
send_subtree_resolves();
}
-void MDCache::send_slave_resolves()
+void MDCache::send_peer_resolves()
{
- dout(10) << "send_slave_resolves" << dendl;
+ dout(10) << "send_peer_resolves" << dendl;
map<mds_rank_t, ref_t<MMDSResolve>> resolves;
if (mds->is_resolve()) {
- for (map<metareqid_t, uslave>::iterator p = uncommitted_slaves.begin();
- p != uncommitted_slaves.end();
+ for (map<metareqid_t, upeer>::iterator p = uncommitted_peers.begin();
+ p != uncommitted_peers.end();
++p) {
- mds_rank_t master = p->second.master;
- auto &m = resolves[master];
+ mds_rank_t leader = p->second.leader;
+ auto &m = resolves[leader];
if (!m) m = make_message<MMDSResolve>();
- m->add_slave_request(p->first, false);
+ m->add_peer_request(p->first, false);
}
} else {
set<mds_rank_t> resolve_set;
@@ -2805,16 +2805,16 @@ void MDCache::send_slave_resolves()
p != active_requests.end();
++p) {
MDRequestRef& mdr = p->second;
- if (!mdr->is_slave())
+ if (!mdr->is_peer())
continue;
- if (!mdr->slave_did_prepare() && !mdr->committing) {
+ if (!mdr->peer_did_prepare() && !mdr->committing) {
continue;
}
- mds_rank_t master = mdr->slave_to_mds;
- if (resolve_set.count(master) || is_ambiguous_slave_update(p->first, master)) {
+ mds_rank_t leader = mdr->peer_to_mds;
+ if (resolve_set.count(leader) || is_ambiguous_peer_update(p->first, leader)) {
dout(10) << " including uncommitted " << *mdr << dendl;
- if (!resolves.count(master))
- resolves[master] = make_message<MMDSResolve>();
+ if (!resolves.count(leader))
+ resolves[leader] = make_message<MMDSResolve>();
if (!mdr->committing &&
mdr->has_more() && mdr->more()->is_inode_exporter) {
// re-send cap exports
@@ -2822,18 +2822,18 @@ void MDCache::send_slave_resolves()
map<client_t, Capability::Export> cap_map;
in->export_client_caps(cap_map);
bufferlist bl;
- MMDSResolve::slave_inode_cap inode_caps(in->ino(), cap_map);
+ MMDSResolve::peer_inode_cap inode_caps(in->ino(), cap_map);
encode(inode_caps, bl);
- resolves[master]->add_slave_request(p->first, bl);
+ resolves[leader]->add_peer_request(p->first, bl);
} else {
- resolves[master]->add_slave_request(p->first, mdr->committing);
+ resolves[leader]->add_peer_request(p->first, mdr->committing);
}
}
}
}
for (auto &p : resolves) {
- dout(10) << "sending slave resolve to mds." << p.first << dendl;
+ dout(10) << "sending peer resolve to mds." << p.first << dendl;
mds->send_message_mds(p.second, p.first);
resolve_ack_gather.insert(p.first);
}
@@ -2948,7 +2948,7 @@ void MDCache::send_subtree_resolves()
resolves_pending = false;
}
-void MDCache::maybe_finish_slave_resolve() {
+void MDCache::maybe_finish_peer_resolve() {
if (resolve_ack_gather.empty() && resolve_need_rollback.empty()) {
// snap cache get synced or I'm in resolve state
if (mds->snapclient->is_synced() || resolve_done)
@@ -2965,7 +2965,7 @@ void MDCache::handle_mds_failure(mds_rank_t who)
resolve_gather.insert(who);
discard_delayed_resolve(who);
- ambiguous_slave_updates.erase(who);
+ ambiguous_peer_updates.erase(who);
rejoin_gather.insert(who);
rejoin_sent.erase(who); // i need to send another
@@ -2985,83 +2985,83 @@ void MDCache::handle_mds_failure(mds_rank_t who)
// tell the balancer too.
mds->balancer->handle_mds_failure(who);
- // clean up any requests slave to/from this node
+ // clean up any requests peer to/from this node
list<MDRequestRef> finish;
for (ceph::unordered_map<metareqid_t, MDRequestRef>::iterator p = active_requests.begin();
p != active_requests.end();
++p) {
MDRequestRef& mdr = p->second;
- // slave to the failed node?
- if (mdr->slave_to_mds == who) {
- if (mdr->slave_did_prepare()) {
- dout(10) << " slave request " << *mdr << " uncommitted, will resolve shortly" << dendl;
- if (is_ambiguous_slave_update(p->first, mdr->slave_to_mds))
- remove_ambiguous_slave_update(p->first, mdr->slave_to_mds);
-
- if (!mdr->more()->waiting_on_slave.empty()) {
+ // peer to the failed node?
+ if (mdr->peer_to_mds == who) {
+ if (mdr->peer_did_prepare()) {
+ dout(10) << " peer request " << *mdr << " uncommitted, will resolve shortly" << dendl;
+ if (is_ambiguous_peer_update(p->first, mdr->peer_to_mds))
+ remove_ambiguous_peer_update(p->first, mdr->peer_to_mds);
+
+ if (!mdr->more()->waiting_on_peer.empty()) {
ceph_assert(mdr->more()->srcdn_auth_mds == mds->get_nodeid());
// will rollback, no need to wait
- mdr->reset_slave_request();
- mdr->more()->waiting_on_slave.clear();
+ mdr->reset_peer_request();
+ mdr->more()->waiting_on_peer.clear();
}
} else if (!mdr->committing) {
- dout(10) << " slave request " << *mdr << " has no prepare, finishing up" << dendl;
- if (mdr->slave_request || mdr->slave_rolling_back())
+ dout(10) << " peer request " << *mdr << " has no prepare, finishing up" << dendl;
+ if (mdr->peer_request || mdr->peer_rolling_back())
mdr->aborted = true;
else
finish.push_back(mdr);
}
}
- if (mdr->is_slave() && mdr->slave_did_prepare()) {
- if (mdr->more()->waiting_on_slave.count(who)) {
+ if (mdr->is_peer() && mdr->peer_did_prepare()) {
+ if (mdr->more()->waiting_on_peer.count(who)) {
ceph_assert(mdr->more()->srcdn_auth_mds == mds->get_nodeid());
- dout(10) << " slave request " << *mdr << " no longer need rename notity ack from mds."
+ dout(10) << " peer request " << *mdr << " no longer need rename notity ack from mds."
<< who << dendl;
- mdr->more()->waiting_on_slave.erase(who);
- if (mdr->more()->waiting_on_slave.empty() && mdr->slave_request)
+ mdr->more()->waiting_on_peer.erase(who);
+ if (mdr->more()->waiting_on_peer.empty() && mdr->peer_request)
mds->queue_waiter(new C_MDS_RetryRequest(this, mdr));
}
if (mdr->more()->srcdn_auth_mds == who &&
- mds->mdsmap->is_clientreplay_or_active_or_stopping(mdr->slave_to_mds)) {
+ mds->mdsmap->is_clientreplay_or_active_or_stopping(mdr->peer_to_mds)) {
// rename srcdn's auth mds failed, resolve even I'm a survivor.
- dout(10) << " slave request " << *mdr << " uncommitted, will resolve shortly" << dendl;
- add_ambiguous_slave_update(p->first, mdr->slave_to_mds);
+ dout(10) << " peer request " << *mdr << " uncommitted, will resolve shortly" << dendl;
+ add_ambiguous_peer_update(p->first, mdr->peer_to_mds);
}
- } else if (mdr->slave_request) {
- const cref_t<MMDSSlaveRequest> &slave_req = mdr->slave_request;
- // FIXME: Slave rename request can arrive after we notice mds failure.
+ } else if (mdr->peer_request) {
+ const cref_t<MMDSPeerRequest> &peer_req = mdr->peer_request;
+ // FIXME: Peer rename request can arrive after we notice mds failure.
// This can cause mds to crash (does not affect integrity of FS).
- if (slave_req->get_op() == MMDSSlaveRequest::OP_RENAMEPREP &&
- slave_req->srcdn_auth == who)
- slave_req->mark_interrupted();
+ if (peer_req->get_op() == MMDSPeerRequest::OP_RENAMEPREP &&
+ peer_req->srcdn_auth == who)
+ peer_req->mark_interrupted();
}
- // failed node is slave?
- if (mdr->is_master() && !mdr->committing) {
+ // failed node is peer?
+ if (mdr->is_leader() && !mdr->committing) {
if (mdr->more()->srcdn_auth_mds == who) {
- dout(10) << " master request " << *mdr << " waiting for rename srcdn's auth mds."
+ dout(10) << " leader request " << *mdr << " waiting for rename srcdn's auth mds."
<< who << " to recover" << dendl;
ceph_assert(mdr->more()->witnessed.count(who) == 0);
if (mdr->more()->is_ambiguous_auth)
mdr->clear_ambiguous_auth();
// rename srcdn's auth mds failed, all witnesses will rollback
mdr->more()->witnessed.clear();
- pending_masters.erase(p->first);
+ pending_leaders.erase(p->first);
}
if (mdr->more()->witnessed.count(who)) {
mds_rank_t srcdn_auth = mdr->more()->srcdn_auth_mds;
- if (srcdn_auth >= 0 && mdr->more()->waiting_on_slave.count(srcdn_auth)) {
- dout(10) << " master request " << *mdr << " waiting for rename srcdn's auth mds."
+ if (srcdn_auth >= 0 && mdr->more()->waiting_on_peer.count(srcdn_auth)) {
+ dout(10) << " leader request " << *mdr << " waiting for rename srcdn's auth mds."
<< mdr->more()->srcdn_auth_mds << " to reply" << dendl;
- // waiting for the slave (rename srcdn's auth mds), delay sending resolve ack
- // until either the request is committing or the slave also fails.
- ceph_assert(mdr->more()->waiting_on_slave.size() == 1);
- pending_masters.insert(p->first);
+ // waiting for the peer (rename srcdn's auth mds), delay sending resolve ack
+ // until either the request is committing or the peer also fails.
+ ceph_assert(mdr->more()->waiting_on_peer.size() == 1);
+ pending_leaders.insert(p->first);
} else {
- dout(10) << " master request " << *mdr << " no longer witnessed by slave mds."
+ dout(10) << " leader request " << *mdr << " no longer witnessed by peer mds."
<< who << " to recover" << dendl;
if (srcdn_auth >= 0)
ceph_assert(mdr->more()->witnessed.count(srcdn_auth) == 0);
@@ -3071,12 +3071,12 @@ void MDCache::handle_mds_failure(mds_rank_t who)
}
}
- if (mdr->more()->waiting_on_slave.count(who)) {
- dout(10) << " master request " << *mdr << " waiting for slave mds." << who
+ if (mdr->more()->waiting_on_peer.count(who)) {
+ dout(10) << " leader request " << *mdr << " waiting for peer mds." << who
<< " to recover" << dendl;
// retry request when peer recovers
- mdr->more()->waiting_on_slave.erase(who);
- if (mdr->more()->waiting_on_slave.empty())
+ mdr->more()->waiting_on_peer.erase(who);
+ if (mdr->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(who, new C_MDS_RetryRequest(this, mdr));
}
@@ -3085,18 +3085,18 @@ void MDCache::handle_mds_failure(mds_rank_t who)
}
}
- for (map<metareqid_t, umaster>::iterator p = uncommitted_masters.begin();
- p != uncommitted_masters.end();
+ for (map<metareqid_t, uleader>::iterator p = uncommitted_leaders.begin();
+ p != uncommitted_leaders.end();
++p) {
- // The failed MDS may have already committed the slave update
- if (p->second.slaves.count(who)) {
+ // The failed MDS may have already committed the peer update
+ if (p->second.peers.count(who)) {
p->second.recovering = true;
- p->second.slaves.erase(who);
+ p->second.peers.erase(who);
}
}
while (!finish.empty()) {
- dout(10) << "cleaning up slave request " << *finish.front() << dendl;
+ dout(10) << "cleaning up peer request " << *finish.front() << dendl;
request_finish(finish.front());
finish.pop_front();
}
@@ -3225,40 +3225,40 @@ void MDCache::handle_resolve(const cref_t<MMDSResolve> &m)
discard_delayed_resolve(from);
- // ambiguous slave requests?
- if (!m->slave_requests.empty()) {
+ // ambiguous peer requests?
+ if (!m->peer_requests.empty()) {
if (mds->is_clientreplay() || mds->is_active() || mds->is_stopping()) {
- for (auto p = m->slave_requests.begin(); p != m->slave_requests.end(); ++p) {
- if (uncommitted_masters.count(p->first) && !uncommitted_masters[p->first].safe) {
+ for (auto p = m->peer_requests.begin(); p != m->peer_requests.end(); ++p) {
+ if (uncommitted_leaders.count(p->first) && !uncommitted_leaders[p->first].safe) {
ceph_assert(!p->second.committing);
- pending_masters.insert(p->first);
+ pending_leaders.insert(p->first);
}
}
- if (!pending_masters.empty()) {
- dout(10) << " still have pending updates, delay processing slave resolve" << dendl;
+ if (!pending_leaders.empty()) {
+ dout(10) << " still have pending updates, delay processing peer resolve" << dendl;
delayed_resolve[from] = m;
return;
}
}
auto ack = make_message<MMDSResolveAck>();
- for (const auto &p : m->slave_requests) {
- if (uncommitted_masters.count(p.first)) { //mds->sessionmap.have_completed_request(p.first)) {
+ for (const auto &p : m->peer_requests) {
+ if (uncommitted_leaders.count(p.first)) { //mds->sessionmap.have_completed_request(p.first)) {
// COMMIT
if (p.second.committing) {
- // already committing, waiting for the OP_COMMITTED slave reply
- dout(10) << " already committing slave request " << p << " noop "<< dendl;
+ // already committing, waiting for the OP_COMMITTED peer reply
+ dout(10) << " already committing peer request " << p << " noop "<< dendl;
} else {
- dout(10) << " ambiguous slave request " << p << " will COMMIT" << dendl;
+ dout(10) << " ambiguous peer request " << p << " will COMMIT" << dendl;
ack->add_commit(p.first);
}
- uncommitted_masters[p.first].slaves.insert(from); // wait for slave OP_COMMITTED before we log ECommitted
+ uncommitted_leaders[p.first].peers.insert(from); // wait for peer OP_COMMITTED before we log ECommitted
if (p.second.inode_caps.length() > 0) {
- // slave wants to export caps (rename)
+ // peer wants to export caps (rename)
ceph_assert(mds->is_resolve());
- MMDSResolve::slave_inode_cap inode_caps;
+ MMDSResolve::peer_inode_cap inode_caps;
auto q = p.second.inode_caps.cbegin();
decode(inode_caps, q);
inodeno_t ino = inode_caps.ino;
@@ -3279,15 +3279,15 @@ void MDCache::handle_resolve(const cref_t<MMDSResolve> &m)
}
// will process these caps in rejoin stage
- rejoin_slave_exports[ino].first = from;
- rejoin_slave_exports[ino].second.swap(cap_exports);
+ rejoin_peer_exports[ino].first = from;
+ rejoin_peer_exports[ino].second.swap(cap_exports);
- // send information of imported caps back to slave
+ // send information of imported caps back to peer
encode(rejoin_imported_caps[from][ino], ack->commit[p.first]);
}
} else {
// ABORT
- dout(10) << " ambiguous slave request " << p << " will ABORT" << dendl;
+ dout(10) << " ambiguous peer request " << p << " will ABORT" << dendl;
ceph_assert(!p.second.committing);
ack->add_abort(p.first);
}
@@ -3417,7 +3417,7 @@ void MDCache::maybe_resolve_finish()
dout(10) << "maybe_resolve_finish got all resolves+resolve_acks, done." << dendl;
disambiguate_my_imports();
- finish_committed_masters();
+ finish_committed_leaders();
if (resolve_done) {
ceph_assert(mds->is_resolve());
@@ -3440,60 +3440,60 @@ void MDCache::handle_resolve_ack(const cref_t<MMDSResolveAck> &ack)
return;
}
- if (ambiguous_slave_updates.count(from)) {
+ if (ambiguous_peer_updates.count(from)) {
ceph_assert(mds->mdsmap->is_clientreplay_or_active_or_stopping(from));
ceph_assert(mds->is_clientreplay() || mds->is_active() || mds->is_stopping());
}
for (const auto &p : ack->commit) {
- dout(10) << " commit on slave " << p.first << dendl;
+ dout(10) << " commit on peer " << p.first << dendl;
- if (ambiguous_slave_updates.count(from)) {
- remove_ambiguous_slave_update(p.first, from);
+ if (ambiguous_peer_updates.count(from)) {
+ remove_ambiguous_peer_update(p.first, from);
continue;
}
if (mds->is_resolve()) {
// replay
- MDSlaveUpdate *su = get_uncommitted_slave(p.first, from);
+ MDPeerUpdate *su = get_uncommitted_peer(p.first, from);
ceph_assert(su);
// log commit
- mds->mdlog->start_submit_entry(new ESlaveUpdate(mds->mdlog, "unknown", p.first, from,
- ESlaveUpdate::OP_COMMIT, su->origop),
- new C_MDC_SlaveCommit(this, from, p.first));
+ mds->mdlog->start_submit_entry(new EPeerUpdate(mds->mdlog, "unknown", p.first, from,
+ EPeerUpdate::OP_COMMIT, su->origop),
+ new C_MDC_PeerCommit(this, from, p.first));
mds->mdlog->flush();
- finish_uncommitted_slave(p.first);
+ finish_uncommitted_peer(p.first);
} else {
MDRequestRef mdr = request_get(p.first);
- // information about master imported caps
+ // information about leader imported caps
if (p.second.length() > 0)
mdr->more()->inode_import.share(p.second);
- ceph_assert(mdr->slave_request == 0); // shouldn't be doing anything!
+ ceph_assert(mdr->peer_request == 0); // shouldn't be doing anything!
request_finish(mdr);
}
}
for (const auto &metareq : ack->abort) {
- dout(10) << " abort on slave " << metareq << dendl;
+ dout(10) << " abort on peer " << metareq << dendl;
if (mds->is_resolve()) {
- MDSlaveUpdate *su = get_uncommitted_slave(metareq, from);
+ MDPeerUpdate *su = get_uncommitted_peer(metareq, from);
ceph_assert(su);
// perform rollback (and journal a rollback entry)
// note: this will hold up the resolve a bit, until the rollback entries journal.
MDRequestRef null_ref;
switch (su->origop) {
- case ESlaveUpdate::LINK:
+ case EPeerUpdate::LINK:
mds->server->do_link_rollback(su->rollback, from, null_ref);
break;
- case ESlaveUpdate::RENAME:
+ case EPeerUpdate::RENAME:
mds->server->do_rename_rollback(su->rollback, from, null_ref);
break;
- case ESlaveUpdate::RMDIR:
+ case EPeerUpdate::RMDIR:
mds->server->do_rmdir_rollback(su->rollback, from, null_ref);
break;
default:
@@ -3502,8 +3502,8 @@ void MDCache::handle_resolve_ack(const cref_t<MMDSResolveAck> &ack)
} else {
MDRequestRef mdr = request_get(metareq);
mdr->aborted = true;
- if (mdr->slave_request) {
- if (mdr->slave_did_prepare()) // journaling slave prepare ?
+ if (mdr->peer_request) {
+ if (mdr->peer_did_prepare()) // journaling peer prepare ?
add_rollback(metareq, from);
} else {
request_finish(mdr);
@@ -3511,47 +3511,47 @@ void MDCache::handle_resolve_ack(const cref_t<MMDSResolveAck> &ack)
}
}
- if (!ambiguous_slave_updates.count(from)) {
+ if (!ambiguous_peer_updates.count(from)) {
resolve_ack_gather.erase(from);
- maybe_finish_slave_resolve();
+ maybe_finish_peer_resolve();
}
}
-void MDCache::add_uncommitted_slave(metareqid_t reqid, LogSegment *ls, mds_rank_t master, MDSlaveUpdate *su)
+void MDCache::add_uncommitted_peer(metareqid_t reqid, LogSegment *ls, mds_rank_t leader, MDPeerUpdate *su)
{
- auto const &ret = uncommitted_slaves.emplace(std::piecewise_construct,
+ auto const &ret = uncommitted_peers.emplace(std::piecewise_construct,
std::forward_as_tuple(reqid),
std::forward_as_tuple());
ceph_assert(ret.second);
- ls->uncommitted_slaves.insert(reqid);
- uslave &u = ret.first->second;
- u.master = master;
+ ls->uncommitted_peers.insert(reqid);
+ upeer &u = ret.first->second;
+ u.leader = leader;
u.ls = ls;
u.su = su;
if (su == nullptr) {
return;
}
for(set<CInode*>::iterator p = su->olddirs.begin(); p != su->olddirs.end(); ++p)
- uncommitted_slave_rename_olddir[*p]++;
+ uncommitted_peer_rename_olddir[*p]++;
for(set<CInode*>::iterator p = su->unlinked.begin(); p != su->unlinked.end(); ++p)
- uncommitted_slave_unlink[*p]++;
+ uncommitted_peer_unlink[*p]++;
}
-void MDCache::finish_uncommitted_slave(metareqid_t reqid, bool assert_exist)
+void MDCache::finish_uncommitted_peer(metareqid_t reqid, bool assert_exist)
{
- auto it = uncommitted_slaves.find(reqid);
- if (it == uncommitted_slaves.end()) {
+ auto it = uncommitted_peers.find(reqid);
+ if (it == uncommitted_peers.end()) {
ceph_assert(!assert_exist);
return;
}
- uslave &u = it->second;
- MDSlaveUpdate* su = u.su;
+ upeer &u = it->second;
+ MDPeerUpdate* su = u.su;
if (!u.waiters.empty()) {
mds->queue_waiters(u.waiters);
}
- u.ls->uncommitted_slaves.erase(reqid);
- uncommitted_slaves.erase(it);
+ u.ls->uncommitted_peers.erase(reqid);
+ uncommitted_peers.erase(it);
if (su == nullptr) {
return;
@@ -3559,11 +3559,11 @@ void MDCache::finish_uncommitted_slave(metareqid_t reqid, bool assert_exist)
// discard the non-auth subtree we renamed out of
for(set<CInode*>::iterator p = su->olddirs.begin(); p != su->olddirs.end(); ++p) {
CInode *diri = *p;
- map<CInode*, int>::iterator it = uncommitted_slave_rename_olddir.find(diri);
- ceph_assert(it != uncommitted_slave_rename_olddir.end());
+ map<CInode*, int>::iterator it = uncommitted_peer_rename_olddir.find(diri);
+ ceph_assert(it != uncommitted_peer_rename_olddir.end());
it->second--;
if (it->second == 0) {
- uncommitted_slave_rename_olddir.erase(it);
+ uncommitted_peer_rename_olddir.erase(it);
auto&& ls = diri->get_dirfrags();
for (const auto& dir : ls) {
CDir *root = get_subtree_root(dir);
@@ -3576,14 +3576,14 @@ void MDCache::finish_uncommitted_slave(metareqid_t reqid, bool assert_exist)
} else
ceph_assert(it->second > 0);
}
- // removed the inodes that were unlinked by slave update
+ // removed the inodes that were unlinked by peer update
for(set<CInode*>::iterator p = su->unlinked.begin(); p != su->unlinked.end(); ++p) {
CInode *in = *p;
- map<CInode*, int>::iterator it = uncommitted_slave_unlink.find(in);
- ceph_assert(it != uncommitted_slave_unlink.end());
+ map<CInode*, int>::iterator it = uncommitted_peer_unlink.find(in);
+ ceph_assert(it != uncommitted_peer_unlink.end());
it->second--;
if (it->second == 0) {
- uncommitted_slave_unlink.erase(it);
+ uncommitted_peer_unlink.erase(it);
if (!in->get_projected_parent_dn())
mds->mdcache->remove_inode_recursive(in);
} else
@@ -3592,28 +3592,28 @@ void MDCache::finish_uncommitted_slave(metareqid_t reqid, bool assert_exist)
delete su;
}
-MDSlaveUpdate* MDCache::get_uncommitted_slave(metareqid_t reqid, mds_rank_t master)
+MDPeerUpdate* MDCache::get_uncommitted_peer(metareqid_t reqid, mds_rank_t leader)
{
- MDSlaveUpdate* su = nullptr;
- auto it = uncommitted_slaves.find(reqid);
- if (it != uncommitted_slaves.end() &&
- it->second.master == master) {
+ MDPeerUpdate* su = nullptr;
+ auto it = uncommitted_peers.find(reqid);
+ if (it != uncommitted_peers.end() &&
+ it->second.leader == leader) {
su = it->second.su;
}
return su;
}
void MDCache::finish_rollback(metareqid_t reqid, MDRequestRef& mdr) {
- auto p = resolve_need_rollback.find(mdr->reqid);
+ auto p = resolve_need_rollback.find(reqid);
ceph_assert(p != resolve_need_rollback.end());
if (mds->is_resolve()) {
- finish_uncommitted_slave(reqid, false);
+ finish_uncommitted_peer(reqid, false);
} else if (mdr) {
- finish_uncommitted_slave(mdr->reqid, mdr->more()->slave_update_journaled);
+ finish_uncommitted_peer(mdr->reqid, mdr->more()->peer_update_journaled);
}
resolve_need_rollback.erase(p);
- maybe_finish_slave_resolve();
+ maybe_finish_peer_resolve();
}
void MDCache::disambiguate_other_imports()
@@ -4193,7 +4193,7 @@ void MDCache::rejoin_send_rejoins()
p != active_requests.end();
++p) {
MDRequestRef& mdr = p->second;
- if (mdr->is_slave())
+ if (mdr->is_peer())
continue;
// auth pins
for (const auto& q : mdr->object_states) {
@@ -4841,17 +4841,17 @@ void MDCache::handle_cache_rejoin_strong(const cref_t<MMDSCacheRejoin> &strong)
// dn auth_pin?
const auto pinned_it = strong->authpinned_dentries.find(dirfrag);
if (pinned_it != strong->authpinned_dentries.end()) {
- const auto slave_reqid_it = pinned_it->second.find(ss);
- if (slave_reqid_it != pinned_it->second.end()) {
- for (const auto &r : slave_reqid_it->second) {
+ const auto peer_reqid_it = pinned_it->second.find(ss);
+ if (peer_reqid_it != pinned_it->second.end()) {
+ for (const auto &r : peer_reqid_it->second) {
dout(10) << " dn authpin by " << r << " on " << *dn << dendl;
- // get/create slave mdrequest
+ // get/create peer mdrequest
MDRequestRef mdr;
if (have_request(r.reqid))
mdr = request_get(r.reqid);
else
- mdr = request_start_slave(r.reqid, r.attempt, strong);
+ mdr = request_start_peer(r.reqid, r.attempt, strong);
mdr->auth_pin(dn);
}
}
@@ -4862,7 +4862,7 @@ void MDCache::handle_cache_rejoin_strong(const cref_t<MMDSCacheRejoin> &strong)
if (xlocked_it != strong->xlocked_dentries.end()) {
const auto ss_req_it = xlocked_it->second.find(ss);
if (ss_req_it != xlocked_it->second.end()) {
- const MMDSCacheRejoin::slave_reqid& r = ss_req_it->second;
+ const MMDSCacheRejoin::peer_reqid& r = ss_req_it->second;
dout(10) << " dn xlock by " << r << " on " << *dn << dendl;
MDRequestRef mdr = request_get(r.reqid); // should have this from auth_pin above.
ceph_assert(mdr->is_auth_pinned(dn));
@@ -4941,12 +4941,12 @@ void MDCache::handle_cache_rejoin_strong(const cref_t<MMDSCacheRejoin> &strong)
for (const auto& r : authpinned_inodes_it->second) {
dout(10) << " inode authpin by " << r << " on " << *in << dendl;
- // get/create slave mdrequest
+ // get/create peer mdrequest
MDRequestRef mdr;
if (have_request(r.reqid))
mdr = request_get(r.reqid);
else
- mdr = request_start_slave(r.reqid, r.attempt, strong);
+ mdr = request_start_peer(r.reqid, r.attempt, strong);
if (strong->frozen_authpin_inodes.count(in->vino())) {
ceph_assert(!in->get_num_auth_pins());
mdr->freeze_auth_pin(in);
@@ -5485,9 +5485,9 @@ bool MDCache::process_imported_caps()
return true;
}
- // process caps that were exported by slave rename
- for (map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > >::iterator p = rejoin_slave_exports.begin();
- p != rejoin_slave_exports.end();
+ // process caps that were exported by peer rename
+ for (map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > >::iterator p = rejoin_peer_exports.begin();
+ p != rejoin_peer_exports.end();
++p) {
CInode *in = get_inode(p->first);
ceph_assert(in);
@@ -5516,7 +5516,7 @@ bool MDCache::process_imported_caps()
p->second.first, CEPH_CAP_FLAG_AUTH);
}
}
- rejoin_slave_exports.clear();
+ rejoin_peer_exports.clear();
rejoin_imported_caps.clear();
// process cap imports
@@ -7325,7 +7325,7 @@ bool MDCache::trim_non_auth_subtree(CDir *dir)
dn->state_clear(CDentry::STATE_AUTH);
in->state_clear(CInode::STATE_AUTH);
}
- } else if (keep_dir && dnl->is_null()) { // keep null dentry for slave rollback
+ } else if (keep_dir && dnl->is_null()) { // keep null dentry for peer rollback
dout(20) << "trim_non_auth_subtree(" << dir << ") keeping dentry " << dn <<dendl;
} else { // just remove it
dout(20) << "trim_non_auth_subtree(" << dir << ") removing dentry " << dn << dendl;
@@ -9513,7 +9513,7 @@ int MDCache::get_num_client_requests()
p != active_requests.end();
++p) {
MDRequestRef& mdr = p->second;
- if (mdr->reqid.name.is_client() && !mdr->is_slave())
+ if (mdr->reqid.name.is_client() && !mdr->is_peer())
count++;
}
return count;
@@ -9521,11 +9521,11 @@ int MDCache::get_num_client_requests()
MDRequestRef MDCache::request_start(const cref_t<MClientRequest>& req)
{
- // did we win a forward race against a slave?
+ // did we win a forward race against a peer?
if (active_requests.count(req->get_reqid())) {
MDRequestRef& mdr = active_requests[req->get_reqid()];
ceph_assert(mdr);
- if (mdr->is_slave()) {
+ if (mdr->is_peer()) {
dout(10) << "request_start already had " << *mdr << ", waiting for finish" << dendl;
mdr->more()->waiting_for_finish.push_back(new C_MDS_RetryMessage(mds, req));
} else {
@@ -9552,14 +9552,14 @@ MDRequestRef MDCache::request_start(const cref_t<MClientRequest>& req)
return mdr;
}
-MDRequestRef MDCache::request_start_slave(metareqid_t ri, __u32 attempt, const cref_t<Message> &m)
+MDRequestRef MDCache::request_start_peer(metareqid_t ri, __u32 attempt, const cref_t<Message> &m)
{
int by = m->get_source().num();
MDRequestImpl::Params params;
params.reqid = ri;
params.attempt = attempt;
- params.triggering_slave_req = m;
- params.slave_to = by;
+ params.triggering_peer_req = m;
+ params.peer_to = by;
params.initiated = m->get_recv_stamp();
params.throttled = m->get_throttle_stamp();
params.all_read = m->get_recv_complete_stamp();
@@ -9568,7 +9568,7 @@ MDRequestRef MDCache::request_start_slave(metareqid_t ri, __u32 attempt, const c
mds->op_tracker.create_request<MDRequestImpl,MDRequestImpl::Params*>(&params);
ceph_assert(active_requests.count(mdr->reqid) == 0);
active_requests[mdr->reqid] = mdr;
- dout(7) << "request_start_slave " << *mdr << " by mds." << by << dendl;
+ dout(7) << "request_start_peer " << *mdr << " by mds." << by << dendl;
return mdr;
}
@@ -9605,15 +9605,15 @@ void MDCache::request_finish(MDRequestRef& mdr)
dout(7) << "request_finish " << *mdr << dendl;
mdr->mark_event("finishing request");
- // slave finisher?
- if (mdr->has_more() && mdr->more()->slave_commit) {
- Context *fin = mdr->more()->slave_commit;
- mdr->more()->slave_commit = 0;
+ // peer finisher?
+ if (mdr->has_more() && mdr->more()->peer_commit) {
+ Context *fin = mdr->more()->peer_commit;
+ mdr->more()->peer_commit = 0;
int ret;
if (mdr->aborted) {
mdr->aborted = false;
ret = -1;
- mdr->more()->slave_rolling_back = true;
+ mdr->more()->peer_rolling_back = true;
} else {
ret = 0;
mdr->committing = true;
@@ -9649,7 +9649,9 @@ void MDCache::request_finish(MDRequestRef& mdr)
void MDCache::request_forward(MDRequestRef& mdr, mds_rank_t who, int port)
{
- mdr->mark_event("forwarding request");
+ CachedStackStringStream css;
+ *css << "forwarding request to mds." << who;
+ mdr->mark_event(css->strv());
if (mdr->client_request && mdr->client_request->get_source().is_client()) {
dout(7) << "request_forward " << *mdr << " to mds." << who << " req "
<< *mdr->client_request << dendl;
@@ -9674,8 +9676,8 @@ void MDCache::dispatch_request(MDRequestRef& mdr)
{
if (mdr->client_request) {
mds->server->dispatch_client_request(mdr);
- } else if (mdr->slave_request) {
- mds->server->dispatch_slave_request(mdr);
+ } else if (mdr->peer_request) {
+ mds->server->dispatch_peer_request(mdr);
} else {
switch (mdr->internal_op) {
case CEPH_MDS_OP_FRAGMENTDIR:
@@ -9711,13 +9713,13 @@ void MDCache::request_drop_foreign_locks(MDRequestRef& mdr)
if (!mdr->has_more())
return;
- // clean up slaves
+ // clean up peers
// (will implicitly drop remote dn pins)
- for (set<mds_rank_t>::iterator p = mdr->more()->slaves.begin();
- p != mdr->more()->slaves.end();
+ for (set<mds_rank_t>::iterator p = mdr->more()->peers.begin();
+ p != mdr->more()->peers.end();
++p) {
- auto r = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt,
- MMDSSlaveRequest::OP_FINISH);
+ auto r = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt,
+ MMDSPeerRequest::OP_FINISH);
if (mdr->killed && !mdr->committing) {
r->mark_abort();
@@ -9756,7 +9758,7 @@ void MDCache::request_drop_foreign_locks(MDRequestRef& mdr)
}
}
- mdr->more()->slaves.clear(); /* we no longer have requests out to them, and
+ mdr->more()->peers.clear(); /* we no longer have requests out to them, and
* leaving them in can cause double-notifies as
* this function can get called more than once */
}
@@ -9811,15 +9813,15 @@ void MDCache::request_cleanup(MDRequestRef& mdr)
void MDCache::request_kill(MDRequestRef& mdr)
{
- // rollback slave requests is tricky. just let the request proceed.
+ // rollback peer requests is tricky. just let the request proceed.
if (mdr->has_more() &&
- (!mdr->more()->witnessed.empty() || !mdr->more()->waiting_on_slave.empty())) {
+ (!mdr->more()->witnessed.empty() || !mdr->more()->waiting_on_peer.empty())) {
if (!(mdr->locking_state & MutationImpl::ALL_LOCKED)) {
ceph_assert(mdr->more()->witnessed.empty());
mdr->aborted = true;
- dout(10) << "request_kill " << *mdr << " -- waiting for slave reply, delaying" << dendl;
+ dout(10) << "request_kill " << *mdr << " -- waiting for peer reply, delaying" << dendl;
} else {
- dout(10) << "request_kill " << *mdr << " -- already started slave prep, no-op" << dendl;
+ dout(10) << "request_kill " << *mdr << " -- already started peer prep, no-op" << dendl;
}
ceph_assert(mdr->used_prealloc_ino == 0);
@@ -11893,7 +11895,7 @@ void MDCache::dispatch_fragment_dir(MDRequestRef& mdr)
dout(10) << "dispatch_fragment_dir " << basedirfrag << " bits " << info.bits
<< " on " << *diri << dendl;
- if (mdr->more()->slave_error)
+ if (mdr->more()->peer_error)
mdr->aborted = true;
if (!mdr->aborted) {
diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h
index 11fe5b9e3a6..8760766f9d5 100644
--- a/src/mds/MDCache.h
+++ b/src/mds/MDCache.h
@@ -46,7 +46,7 @@
#include "messages/MMDSOpenInoReply.h"
#include "messages/MMDSResolve.h"
#include "messages/MMDSResolveAck.h"
-#include "messages/MMDSSlaveRequest.h"
+#include "messages/MMDSPeerRequest.h"
#include "messages/MMDSSnapUpdate.h"
#include "osdc/Filer.h"
@@ -384,7 +384,7 @@ class MDCache {
int get_num_client_requests();
MDRequestRef request_start(const cref_t<MClientRequest>& req);
- MDRequestRef request_start_slave(metareqid_t rid, __u32 attempt, const cref_t<Message> &m);
+ MDRequestRef request_start_peer(metareqid_t rid, __u32 attempt, const cref_t<Message> &m);
MDRequestRef request_start_internal(int op);
bool have_request(metareqid_t rid) {
return active_requests.count(rid);
@@ -424,32 +424,32 @@ class MDCache {
int flags, int linkunlink=0,
snapid_t follows=CEPH_NOSNAP);
- // slaves
- void add_uncommitted_master(metareqid_t reqid, LogSegment *ls, set<mds_rank_t> &slaves, bool safe=false) {
- uncommitted_masters[reqid].ls = ls;
- uncommitted_masters[reqid].slaves = slaves;
- uncommitted_masters[reqid].safe = safe;
+ // peers
+ void add_uncommitted_leader(metareqid_t reqid, LogSegment *ls, set<mds_rank_t> &peers, bool safe=false) {
+ uncommitted_leaders[reqid].ls = ls;
+ uncommitted_leaders[reqid].peers = peers;
+ uncommitted_leaders[reqid].safe = safe;
}
- void wait_for_uncommitted_master(metareqid_t reqid, MDSContext *c) {
- uncommitted_masters[reqid].waiters.push_back(c);
+ void wait_for_uncommitted_leader(metareqid_t reqid, MDSContext *c) {
+ uncommitted_leaders[reqid].waiters.push_back(c);
}
- bool have_uncommitted_master(metareqid_t reqid, mds_rank_t from) {
- auto p = uncommitted_masters.find(reqid);
- return p != uncommitted_masters.end() && p->second.slaves.count(from) > 0;
+ bool have_uncommitted_leader(metareqid_t reqid, mds_rank_t from) {
+ auto p = uncommitted_leaders.find(reqid);
+ return p != uncommitted_leaders.end() && p->second.peers.count(from) > 0;
}
- void log_master_commit(metareqid_t reqid);
- void logged_master_update(metareqid_t reqid);
- void _logged_master_commit(metareqid_t reqid);
- void committed_master_slave(metareqid_t r, mds_rank_t from);
- void finish_committed_masters();
+ void log_leader_commit(metareqid_t reqid);
+ void logged_leader_update(metareqid_t reqid);
+ void _logged_leader_commit(metareqid_t reqid);
+ void committed_leader_peer(metareqid_t r, mds_rank_t from);
+ void finish_committed_leaders();
- void add_uncommitted_slave(metareqid_t reqid, LogSegment*, mds_rank_t, MDSlaveUpdate *su=nullptr);
- void wait_for_uncommitted_slave(metareqid_t reqid, MDSContext *c) {
- uncommitted_slaves.at(reqid).waiters.push_back(c);
+ void add_uncommitted_peer(metareqid_t reqid, LogSegment*, mds_rank_t, MDPeerUpdate *su=nullptr);
+ void wait_for_uncommitted_peer(metareqid_t reqid, MDSContext *c) {
+ uncommitted_peers.at(reqid).waiters.push_back(c);
}
- void finish_uncommitted_slave(metareqid_t reqid, bool assert_exist=true);
- MDSlaveUpdate* get_uncommitted_slave(metareqid_t reqid, mds_rank_t master);
- void _logged_slave_commit(mds_rank_t from, metareqid_t reqid);
+ void finish_uncommitted_peer(metareqid_t reqid, bool assert_exist=true);
+ MDPeerUpdate* get_uncommitted_peer(metareqid_t reqid, mds_rank_t leader);
+ void _logged_peer_commit(mds_rank_t from, metareqid_t reqid);
void set_recovery_set(set<mds_rank_t>& s);
void handle_mds_failure(mds_rank_t who);
@@ -458,24 +458,24 @@ class MDCache {
void recalc_auth_bits(bool replay);
void remove_inode_recursive(CInode *in);
- bool is_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
- auto p = ambiguous_slave_updates.find(master);
- return p != ambiguous_slave_updates.end() && p->second.count(reqid);
+ bool is_ambiguous_peer_update(metareqid_t reqid, mds_rank_t leader) {
+ auto p = ambiguous_peer_updates.find(leader);
+ return p != ambiguous_peer_updates.end() && p->second.count(reqid);
}
- void add_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
- ambiguous_slave_updates[master].insert(reqid);
+ void add_ambiguous_peer_update(metareqid_t reqid, mds_rank_t leader) {
+ ambiguous_peer_updates[leader].insert(reqid);
}
- void remove_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) {
- auto p = ambiguous_slave_updates.find(master);
+ void remove_ambiguous_peer_update(metareqid_t reqid, mds_rank_t leader) {
+ auto p = ambiguous_peer_updates.find(leader);
auto q = p->second.find(reqid);
ceph_assert(q != p->second.end());
p->second.erase(q);
if (p->second.empty())
- ambiguous_slave_updates.erase(p);
+ ambiguous_peer_updates.erase(p);
}
- void add_rollback(metareqid_t reqid, mds_rank_t master) {
- resolve_need_rollback[reqid] = master;
+ void add_rollback(metareqid_t reqid, mds_rank_t leader) {
+ resolve_need_rollback[reqid] = leader;
}
void finish_rollback(metareqid_t reqid, MDRequestRef& mdr);
@@ -619,7 +619,7 @@ class MDCache {
void try_trim_non_auth_subtree(CDir *dir);
bool can_trim_non_auth_dirfrag(CDir *dir) {
return my_ambiguous_imports.count((dir)->dirfrag()) == 0 &&
- uncommitted_slave_rename_olddir.count(dir->inode) == 0;
+ uncommitted_peer_rename_olddir.count(dir->inode) == 0;
}
/**
@@ -943,7 +943,7 @@ class MDCache {
void repair_dirfrag_stats(CDir *dir);
void upgrade_inode_snaprealm(CInode *in);
- // my master
+ // my leader
MDSRank *mds;
// -- my cache --
@@ -1004,10 +1004,10 @@ class MDCache {
double export_ephemeral_random_max = 0.0;
protected:
- // track master requests whose slaves haven't acknowledged commit
- struct umaster {
- umaster() {}
- set<mds_rank_t> slaves;
+ // track leader requests whose peers haven't acknowledged commit
+ struct uleader {
+ uleader() {}
+ set<mds_rank_t> peers;
LogSegment *ls = nullptr;
MDSContext::vec waiters;
bool safe = false;
@@ -1015,11 +1015,11 @@ class MDCache {
bool recovering = false;
};
- struct uslave {
- uslave() {}
- mds_rank_t master;
+ struct upeer {
+ upeer() {}
+ mds_rank_t leader;
LogSegment *ls = nullptr;
- MDSlaveUpdate *su = nullptr;
+ MDPeerUpdate *su = nullptr;
MDSContext::vec waiters;
};
@@ -1048,7 +1048,7 @@ class MDCache {
friend class C_MDC_Join;
friend class C_MDC_RespondInternalRequest;
- friend class ESlaveUpdate;
+ friend class EPeerUpdate;
friend class ECommitted;
void set_readonly() { readonly = true; }
@@ -1062,9 +1062,9 @@ class MDCache {
void disambiguate_other_imports();
void trim_unlinked_inodes();
- void send_slave_resolves();
+ void send_peer_resolves();
void send_subtree_resolves();
- void maybe_finish_slave_resolve();
+ void maybe_finish_peer_resolve();
void rejoin_walk(CDir *dir, const ref_t<MMDSCacheRejoin> &rejoin);
void handle_cache_rejoin(const cref_t<MMDSCacheRejoin> &m);
@@ -1165,14 +1165,14 @@ class MDCache {
// from MMDSResolves
map<mds_rank_t, map<dirfrag_t, vector<dirfrag_t> > > other_ambiguous_imports;
- map<CInode*, int> uncommitted_slave_rename_olddir; // slave: preserve the non-auth dir until seeing commit.
- map<CInode*, int> uncommitted_slave_unlink; // slave: preserve the unlinked inode until seeing commit.
+ map<CInode*, int> uncommitted_peer_rename_olddir; // peer: preserve the non-auth dir until seeing commit.
+ map<CInode*, int> uncommitted_peer_unlink; // peer: preserve the unlinked inode until seeing commit.
- map<metareqid_t, umaster> uncommitted_masters; // master: req -> slave set
- map<metareqid_t, uslave> uncommitted_slaves; // slave: preserve the slave req until seeing commit.
+ map<metareqid_t, uleader> uncommitted_leaders; // leader: req -> peer set
+ map<metareqid_t, upeer> uncommitted_peers; // peer: preserve the peer req until seeing commit.
- set<metareqid_t> pending_masters;
- map<int, set<metareqid_t> > ambiguous_slave_updates;
+ set<metareqid_t> pending_leaders;
+ map<int, set<metareqid_t> > ambiguous_peer_updates;
bool resolves_pending = false;
set<mds_rank_t> resolve_gather; // nodes i need resolves from
@@ -1188,7 +1188,7 @@ class MDCache {
set<mds_rank_t> rejoin_ack_sent; // nodes i sent a rejoin to
set<mds_rank_t> rejoin_ack_gather; // nodes from whom i need a rejoin ack
map<mds_rank_t,map<inodeno_t,map<client_t,Capability::Import> > > rejoin_imported_caps;
- map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > > rejoin_slave_exports;
+ map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > > rejoin_peer_exports;
map<client_t,entity_inst_t> rejoin_client_map;
map<client_t,client_metadata_t> rejoin_client_metadata_map;
diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc
index 5847dc10a33..3f49d186243 100644
--- a/src/mds/MDSRank.cc
+++ b/src/mds/MDSRank.cc
@@ -1166,7 +1166,7 @@ bool MDSRank::is_valid_message(const cref_t<Message> &m) {
type == CEPH_MSG_CLIENT_RECONNECT ||
type == CEPH_MSG_CLIENT_RECLAIM ||
type == CEPH_MSG_CLIENT_REQUEST ||
- type == MSG_MDS_SLAVE_REQUEST ||
+ type == MSG_MDS_PEER_REQUEST ||
type == MSG_MDS_HEARTBEAT ||
type == MSG_MDS_TABLE_REQUEST ||
type == MSG_MDS_LOCK ||
@@ -1219,7 +1219,7 @@ void MDSRank::handle_message(const cref_t<Message> &m)
case CEPH_MSG_CLIENT_REQUEST:
server->dispatch(m);
break;
- case MSG_MDS_SLAVE_REQUEST:
+ case MSG_MDS_PEER_REQUEST:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MDS);
server->dispatch(m);
break;
@@ -1257,7 +1257,7 @@ void MDSRank::handle_message(const cref_t<Message> &m)
break;
default:
- derr << "unrecogonized message " << *m << dendl;
+ derr << "unrecognized message " << *m << dendl;
}
}
}
diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc
index a1bbe57f78a..1589dc8482c 100644
--- a/src/mds/Migrator.cc
+++ b/src/mds/Migrator.cc
@@ -1035,7 +1035,7 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count)
}
ceph_assert(it->second.state == EXPORT_LOCKING);
- if (mdr->more()->slave_error || dir->is_frozen() || dir->is_freezing()) {
+ if (mdr->more()->peer_error || dir->is_frozen() || dir->is_freezing()) {
dout(7) << "wouldblock|freezing|frozen, canceling export" << dendl;
export_try_cancel(dir);
return;
diff --git a/src/mds/Mutation.cc b/src/mds/Mutation.cc
index 16f1a7383ab..5359e0a91ce 100644
--- a/src/mds/Mutation.cc
+++ b/src/mds/Mutation.cc
@@ -311,14 +311,14 @@ bool MDRequestImpl::has_witnesses()
return (_more != nullptr) && (!_more->witnessed.empty());
}
-bool MDRequestImpl::slave_did_prepare()
+bool MDRequestImpl::peer_did_prepare()
{
- return has_more() && more()->slave_commit;
+ return has_more() && more()->peer_commit;
}
-bool MDRequestImpl::slave_rolling_back()
+bool MDRequestImpl::peer_rolling_back()
{
- return has_more() && more()->slave_rolling_back;
+ return has_more() && more()->peer_rolling_back;
}
bool MDRequestImpl::freeze_auth_pin(CInode *inode)
@@ -463,16 +463,17 @@ cref_t<MClientRequest> MDRequestImpl::release_client_request()
msg_lock.lock();
cref_t<MClientRequest> req;
req.swap(client_request);
+ client_request = req;
msg_lock.unlock();
return req;
}
-void MDRequestImpl::reset_slave_request(const cref_t<MMDSSlaveRequest>& req)
+void MDRequestImpl::reset_peer_request(const cref_t<MMDSPeerRequest>& req)
{
msg_lock.lock();
- cref_t<MMDSSlaveRequest> old;
- old.swap(slave_request);
- slave_request = req;
+ cref_t<MMDSPeerRequest> old;
+ old.swap(peer_request);
+ peer_request = req;
msg_lock.unlock();
old.reset();
}
@@ -481,9 +482,9 @@ void MDRequestImpl::print(ostream &out) const
{
out << "request(" << reqid << " nref=" << nref;
//if (request) out << " " << *request;
- if (is_slave()) out << " slave_to mds." << slave_to_mds;
+ if (is_peer()) out << " peer_to mds." << peer_to_mds;
if (client_request) out << " cr=" << client_request;
- if (slave_request) out << " sr=" << slave_request;
+ if (peer_request) out << " sr=" << peer_request;
out << ")";
}
@@ -499,7 +500,7 @@ void MDRequestImpl::_dump(Formatter *f) const
{
msg_lock.lock();
auto _client_request = client_request;
- auto _slave_request =slave_request;
+ auto _peer_request =peer_request;
msg_lock.unlock();
if (_client_request) {
@@ -508,25 +509,25 @@ void MDRequestImpl::_dump(Formatter *f) const
f->dump_stream("client") << _client_request->get_orig_source();
f->dump_int("tid", _client_request->get_tid());
f->close_section(); // client_info
- } else if (is_slave() && _slave_request) { // replies go to an existing mdr
- f->dump_string("op_type", "slave_request");
- f->open_object_section("master_info");
- f->dump_stream("master") << _slave_request->get_orig_source();
- f->close_section(); // master_info
+ } else if (is_peer() && _peer_request) { // replies go to an existing mdr
+ f->dump_string("op_type", "peer_request");
+ f->open_object_section("leader_info");
+ f->dump_stream("leader") << _peer_request->get_orig_source();
+ f->close_section(); // leader_info
f->open_object_section("request_info");
- f->dump_int("attempt", _slave_request->get_attempt());
+ f->dump_int("attempt", _peer_request->get_attempt());
f->dump_string("op_type",
- MMDSSlaveRequest::get_opname(_slave_request->get_op()));
- f->dump_int("lock_type", _slave_request->get_lock_type());
- f->dump_stream("object_info") << _slave_request->get_object_info();
- f->dump_stream("srcdnpath") << _slave_request->srcdnpath;
- f->dump_stream("destdnpath") << _slave_request->destdnpath;
- f->dump_stream("witnesses") << _slave_request->witnesses;
+ MMDSPeerRequest::get_opname(_peer_request->get_op()));
+ f->dump_int("lock_type", _peer_request->get_lock_type());
+ f->dump_stream("object_info") << _peer_request->get_object_info();
+ f->dump_stream("srcdnpath") << _peer_request->srcdnpath;
+ f->dump_stream("destdnpath") << _peer_request->destdnpath;
+ f->dump_stream("witnesses") << _peer_request->witnesses;
f->dump_bool("has_inode_export",
- _slave_request->inode_export_v != 0);
- f->dump_int("inode_export_v", _slave_request->inode_export_v);
- f->dump_stream("op_stamp") << _slave_request->op_stamp;
+ _peer_request->inode_export_v != 0);
+ f->dump_int("inode_export_v", _peer_request->inode_export_v);
+ f->dump_stream("op_stamp") << _peer_request->op_stamp;
f->close_section(); // request_info
}
else if (internal_op != -1) { // internal request
@@ -552,17 +553,17 @@ void MDRequestImpl::_dump_op_descriptor_unlocked(ostream& stream) const
{
msg_lock.lock();
auto _client_request = client_request;
- auto _slave_request = slave_request;
+ auto _peer_request = peer_request;
msg_lock.unlock();
if (_client_request) {
_client_request->print(stream);
- } else if (_slave_request) {
- _slave_request->print(stream);
+ } else if (_peer_request) {
+ _peer_request->print(stream);
} else if (internal_op >= 0) {
stream << "internal op " << ceph_mds_op_name(internal_op) << ":" << reqid;
} else {
- // drat, it's triggered by a slave request, but we don't have a message
+ // drat, it's triggered by a peer request, but we don't have a message
// FIXME
stream << "rejoin:" << reqid;
}
diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h
index c1f9aff4375..9bbb4b87c2b 100644
--- a/src/mds/Mutation.h
+++ b/src/mds/Mutation.h
@@ -28,7 +28,7 @@
#include "common/TrackedOp.h"
#include "messages/MClientRequest.h"
-#include "messages/MMDSSlaveRequest.h"
+#include "messages/MMDSPeerRequest.h"
#include "messages/MClientReply.h"
class LogSegment;
@@ -118,10 +118,10 @@ public:
// keep our default values synced with MDRequestParam's
MutationImpl() : TrackedOp(nullptr, utime_t()) {}
MutationImpl(OpTracker *tracker, utime_t initiated,
- const metareqid_t &ri, __u32 att=0, mds_rank_t slave_to=MDS_RANK_NONE)
+ const metareqid_t &ri, __u32 att=0, mds_rank_t peer_to=MDS_RANK_NONE)
: TrackedOp(tracker, initiated),
reqid(ri), attempt(att),
- slave_to_mds(slave_to) {}
+ peer_to_mds(peer_to) {}
~MutationImpl() override {
ceph_assert(!locking);
ceph_assert(!lock_cache);
@@ -159,8 +159,8 @@ public:
return lock == last_locked;
}
- bool is_master() const { return slave_to_mds == MDS_RANK_NONE; }
- bool is_slave() const { return slave_to_mds != MDS_RANK_NONE; }
+ bool is_leader() const { return peer_to_mds == MDS_RANK_NONE; }
+ bool is_peer() const { return peer_to_mds != MDS_RANK_NONE; }
client_t get_client() const {
if (reqid.name.is_client())
@@ -222,8 +222,8 @@ public:
__u32 attempt = 0; // which attempt for this request
LogSegment *ls = nullptr; // the log segment i'm committing to
- // flag mutation as slave
- mds_rank_t slave_to_mds = MDS_RANK_NONE; // this is a slave request if >= 0.
+ // flag mutation as peer
+ mds_rank_t peer_to_mds = MDS_RANK_NONE; // this is a peer request if >= 0.
ceph::unordered_map<MDSCacheObject*, ObjectState> object_states;
int num_pins = 0;
@@ -282,17 +282,17 @@ struct MDRequestImpl : public MutationImpl {
struct More {
More() {}
- int slave_error = 0;
- std::set<mds_rank_t> slaves; // mds nodes that have slave requests to me (implies client_request)
- std::set<mds_rank_t> waiting_on_slave; // peers i'm waiting for slavereq replies from.
+ int peer_error = 0;
+ std::set<mds_rank_t> peers; // mds nodes that have peer requests to me (implies client_request)
+ std::set<mds_rank_t> waiting_on_peer; // peers i'm waiting for peerreq replies from.
// for rename/link/unlink
std::set<mds_rank_t> witnessed; // nodes who have journaled a RenamePrepare
std::map<MDSCacheObject*,version_t> pvmap;
- bool has_journaled_slaves = false;
- bool slave_update_journaled = false;
- bool slave_rolling_back = false;
+ bool has_journaled_peers = false;
+ bool peer_update_journaled = false;
+ bool peer_rolling_back = false;
// for rename
std::set<mds_rank_t> extra_witnesses; // replica list from srcdn auth (rename)
@@ -318,8 +318,8 @@ struct MDRequestImpl : public MutationImpl {
sr_t *srci_srnode = nullptr;
sr_t *desti_srnode = nullptr;
- // called when slave commits or aborts
- Context *slave_commit = nullptr;
+ // called when peer commits or aborts
+ Context *peer_commit = nullptr;
ceph::buffer::list rollback_bl;
MDSContext::vec waiting_for_finish;
@@ -352,15 +352,15 @@ struct MDRequestImpl : public MutationImpl {
metareqid_t reqid;
__u32 attempt = 0;
ceph::cref_t<MClientRequest> client_req;
- ceph::cref_t<Message> triggering_slave_req;
- mds_rank_t slave_to = MDS_RANK_NONE;
+ ceph::cref_t<Message> triggering_peer_req;
+ mds_rank_t peer_to = MDS_RANK_NONE;
utime_t initiated;
utime_t throttled, all_read, dispatched;
int internal_op = -1;
};
MDRequestImpl(const Params* params, OpTracker *tracker) :
MutationImpl(tracker, params->initiated,
- params->reqid, params->attempt, params->slave_to),
+ params->reqid, params->attempt, params->peer_to),
item_session_request(this), client_request(params->client_req),
internal_op(params->internal_op) {}
~MDRequestImpl() override;
@@ -368,8 +368,8 @@ struct MDRequestImpl : public MutationImpl {
More* more();
bool has_more() const;
bool has_witnesses();
- bool slave_did_prepare();
- bool slave_rolling_back();
+ bool peer_did_prepare();
+ bool peer_rolling_back();
bool freeze_auth_pin(CInode *inode);
void unfreeze_auth_pin(bool clear_inode=false);
void set_remote_frozen_auth_pin(CInode *inode);
@@ -394,12 +394,12 @@ struct MDRequestImpl : public MutationImpl {
void dump(ceph::Formatter *f) const override;
ceph::cref_t<MClientRequest> release_client_request();
- void reset_slave_request(const ceph::cref_t<MMDSSlaveRequest>& req=nullptr);
+ void reset_peer_request(const ceph::cref_t<MMDSPeerRequest>& req=nullptr);
Session *session = nullptr;
elist<MDRequestImpl*>::item item_session_request; // if not on list, op is aborted.
- // -- i am a client (master) request
+ // -- i am a client (leader) request
ceph::cref_t<MClientRequest> client_request; // client request (if any)
// tree and depth info of path1 and path2
@@ -430,8 +430,8 @@ struct MDRequestImpl : public MutationImpl {
// inos we did a embedded cap release on, and may need to eval if we haven't since reissued
std::map<vinodeno_t, ceph_seq_t> cap_releases;
- // -- i am a slave request
- ceph::cref_t<MMDSSlaveRequest> slave_request; // slave request (if one is pending; implies slave == true)
+ // -- i am a peer request
+ ceph::cref_t<MMDSPeerRequest> peer_request; // peer request (if one is pending; implies peer == true)
// -- i am an internal op
int internal_op;
@@ -453,12 +453,12 @@ private:
mutable ceph::spinlock msg_lock;
};
-struct MDSlaveUpdate {
- MDSlaveUpdate(int oo, ceph::buffer::list &rbl) :
+struct MDPeerUpdate {
+ MDPeerUpdate(int oo, ceph::buffer::list &rbl) :
origop(oo) {
rollback = std::move(rbl);
}
- ~MDSlaveUpdate() {
+ ~MDPeerUpdate() {
if (waiter)
waiter->complete(0);
}
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index 7e65e9957c5..300de98f766 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -37,7 +37,7 @@
#include "osdc/Objecter.h"
#include "events/EUpdate.h"
-#include "events/ESlaveUpdate.h"
+#include "events/EPeerUpdate.h"
#include "events/ESession.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
@@ -165,8 +165,8 @@ void Server::create_logger()
plb.add_u64_counter(l_mdss_handle_client_request, "handle_client_request",
"Client requests", "hcr", PerfCountersBuilder::PRIO_INTERESTING);
- plb.add_u64_counter(l_mdss_handle_slave_request, "handle_slave_request",
- "Slave requests", "hsr", PerfCountersBuilder::PRIO_INTERESTING);
+ plb.add_u64_counter(l_mdss_handle_peer_request, "handle_peer_request",
+ "Peer requests", "hsr", PerfCountersBuilder::PRIO_INTERESTING);
plb.add_u64_counter(l_mdss_handle_client_session,
"handle_client_session", "Client session messages", "hcs",
PerfCountersBuilder::PRIO_INTERESTING);
@@ -235,7 +235,7 @@ void Server::create_logger()
plb.set_prio_default(PerfCountersBuilder::PRIO_DEBUGONLY);
plb.add_u64_counter(l_mdss_dispatch_client_request, "dispatch_client_request",
"Client requests dispatched");
- plb.add_u64_counter(l_mdss_dispatch_slave_request, "dispatch_server_request",
+ plb.add_u64_counter(l_mdss_dispatch_peer_request, "dispatch_server_request",
"Server requests dispatched");
logger = plb.create_perf_counters();
@@ -274,7 +274,7 @@ void Server::dispatch(const cref_t<Message> &m)
*/
bool sessionclosed_isok = replay_unsafe_with_closed_session;
// active?
- // handle_slave_request()/handle_client_session() will wait if necessary
+ // handle_peer_request()/handle_client_session() will wait if necessary
if (m->get_type() == CEPH_MSG_CLIENT_REQUEST && !mds->is_active()) {
const auto &req = ref_cast<MClientRequest>(m);
if (mds->is_reconnect() || mds->get_want_state() == CEPH_MDS_STATE_RECONNECT) {
@@ -335,8 +335,8 @@ void Server::dispatch(const cref_t<Message> &m)
case CEPH_MSG_CLIENT_RECLAIM:
handle_client_reclaim(ref_cast<MClientReclaim>(m));
return;
- case MSG_MDS_SLAVE_REQUEST:
- handle_slave_request(ref_cast<MMDSSlaveRequest>(m));
+ case MSG_MDS_PEER_REQUEST:
+ handle_peer_request(ref_cast<MMDSPeerRequest>(m));
return;
default:
derr << "server unknown message " << m->get_type() << dendl;
@@ -2012,8 +2012,8 @@ void Server::early_reply(MDRequestRef& mdr, CInode *tracei, CDentry *tracedn)
return;
}
- if (mdr->has_more() && mdr->more()->has_journaled_slaves) {
- dout(10) << "early_reply - there are journaled slaves, not allowed." << dendl;
+ if (mdr->has_more() && mdr->more()->has_journaled_peers) {
+ dout(10) << "early_reply - there are journaled peers, not allowed." << dendl;
return;
}
@@ -2419,7 +2419,7 @@ void Server::handle_osd_map()
void Server::dispatch_client_request(MDRequestRef& mdr)
{
// we shouldn't be waiting on anyone.
- ceph_assert(!mdr->has_more() || mdr->more()->waiting_on_slave.empty());
+ ceph_assert(!mdr->has_more() || mdr->more()->waiting_on_peer.empty());
if (mdr->killed) {
dout(10) << "request " << *mdr << " was killed" << dendl;
@@ -2454,9 +2454,9 @@ void Server::dispatch_client_request(MDRequestRef& mdr)
respond_to_request(mdr, -EROFS);
return;
}
- if (mdr->has_more() && mdr->more()->slave_error) {
- dout(10) << " got error from slaves" << dendl;
- respond_to_request(mdr, mdr->more()->slave_error);
+ if (mdr->has_more() && mdr->more()->peer_error) {
+ dout(10) << " got error from peers" << dendl;
+ respond_to_request(mdr, mdr->more()->peer_error);
return;
}
@@ -2471,7 +2471,7 @@ void Server::dispatch_client_request(MDRequestRef& mdr)
req->get_op() == CEPH_MDS_OP_MKSNAP ||
((req->get_op() == CEPH_MDS_OP_LINK ||
req->get_op() == CEPH_MDS_OP_RENAME) &&
- (!mdr->has_more() || mdr->more()->witnessed.empty())) // haven't started slave request
+ (!mdr->has_more() || mdr->more()->witnessed.empty())) // haven't started peer request
) {
dout(20) << __func__ << ": full, responding ENOSPC to op " << ceph_mds_op_name(req->get_op()) << dendl;
@@ -2590,23 +2590,23 @@ void Server::dispatch_client_request(MDRequestRef& mdr)
// ---------------------------------------
-// SLAVE REQUESTS
+// PEER REQUESTS
-void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
+void Server::handle_peer_request(const cref_t<MMDSPeerRequest> &m)
{
- dout(4) << "handle_slave_request " << m->get_reqid() << " from " << m->get_source() << dendl;
+ dout(4) << "handle_peer_request " << m->get_reqid() << " from " << m->get_source() << dendl;
mds_rank_t from = mds_rank_t(m->get_source().num());
- if (logger) logger->inc(l_mdss_handle_slave_request);
+ if (logger) logger->inc(l_mdss_handle_peer_request);
// reply?
if (m->is_reply())
- return handle_slave_request_reply(m);
+ return handle_peer_request_reply(m);
// the purpose of rename notify is enforcing causal message ordering. making sure
// bystanders have received all messages from rename srcdn's auth MDS.
- if (m->get_op() == MMDSSlaveRequest::OP_RENAMENOTIFY) {
- auto reply = make_message<MMDSSlaveRequest>(m->get_reqid(), m->get_attempt(), MMDSSlaveRequest::OP_RENAMENOTIFYACK);
+ if (m->get_op() == MMDSPeerRequest::OP_RENAMENOTIFY) {
+ auto reply = make_message<MMDSPeerRequest>(m->get_reqid(), m->get_attempt(), MMDSPeerRequest::OP_RENAMENOTIFYACK);
mds->send_message(reply, m->get_connection());
return;
}
@@ -2624,7 +2624,7 @@ void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
return;
}
- // am i a new slave?
+ // am i a new peer?
MDRequestRef mdr;
if (mdcache->have_request(m->get_reqid())) {
// existing?
@@ -2643,22 +2643,22 @@ void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
<< ", closing out" << dendl;
mdcache->request_finish(mdr);
mdr.reset();
- } else if (mdr->slave_to_mds != from) {
- dout(10) << "local request " << *mdr << " not slave to mds." << from << dendl;
+ } else if (mdr->peer_to_mds != from) {
+ dout(10) << "local request " << *mdr << " not peer to mds." << from << dendl;
return;
}
- // may get these while mdr->slave_request is non-null
- if (m->get_op() == MMDSSlaveRequest::OP_DROPLOCKS) {
+ // may get these while mdr->peer_request is non-null
+ if (m->get_op() == MMDSPeerRequest::OP_DROPLOCKS) {
mds->locker->drop_locks(mdr.get());
return;
}
- if (m->get_op() == MMDSSlaveRequest::OP_FINISH) {
+ if (m->get_op() == MMDSPeerRequest::OP_FINISH) {
if (m->is_abort()) {
mdr->aborted = true;
- if (mdr->slave_request) {
+ if (mdr->peer_request) {
// only abort on-going xlock, wrlock and auth pin
- ceph_assert(!mdr->slave_did_prepare());
+ ceph_assert(!mdr->peer_did_prepare());
} else {
mdcache->request_finish(mdr);
}
@@ -2673,15 +2673,15 @@ void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
}
if (!mdr.get()) {
// new?
- if (m->get_op() == MMDSSlaveRequest::OP_FINISH) {
- dout(10) << "missing slave request for " << m->get_reqid()
+ if (m->get_op() == MMDSPeerRequest::OP_FINISH) {
+ dout(10) << "missing peer request for " << m->get_reqid()
<< " OP_FINISH, must have lost race with a forward" << dendl;
return;
}
- mdr = mdcache->request_start_slave(m->get_reqid(), m->get_attempt(), m);
+ mdr = mdcache->request_start_peer(m->get_reqid(), m->get_attempt(), m);
mdr->set_op_stamp(m->op_stamp);
}
- ceph_assert(mdr->slave_request == 0); // only one at a time, please!
+ ceph_assert(mdr->peer_request == 0); // only one at a time, please!
if (straydn) {
mdr->pin(straydn);
@@ -2695,19 +2695,19 @@ void Server::handle_slave_request(const cref_t<MMDSSlaveRequest> &m)
return;
}
- mdr->reset_slave_request(m);
+ mdr->reset_peer_request(m);
- dispatch_slave_request(mdr);
+ dispatch_peer_request(mdr);
}
-void Server::handle_slave_request_reply(const cref_t<MMDSSlaveRequest> &m)
+void Server::handle_peer_request_reply(const cref_t<MMDSPeerRequest> &m)
{
mds_rank_t from = mds_rank_t(m->get_source().num());
if (!mds->is_clientreplay() && !mds->is_active() && !mds->is_stopping()) {
metareqid_t r = m->get_reqid();
- if (!mdcache->have_uncommitted_master(r, from)) {
- dout(10) << "handle_slave_request_reply ignoring slave reply from mds."
+ if (!mdcache->have_uncommitted_leader(r, from)) {
+ dout(10) << "handle_peer_request_reply ignoring peer reply from mds."
<< from << " reqid " << r << dendl;
return;
}
@@ -2716,45 +2716,45 @@ void Server::handle_slave_request_reply(const cref_t<MMDSSlaveRequest> &m)
return;
}
- if (m->get_op() == MMDSSlaveRequest::OP_COMMITTED) {
+ if (m->get_op() == MMDSPeerRequest::OP_COMMITTED) {
metareqid_t r = m->get_reqid();
- mdcache->committed_master_slave(r, from);
+ mdcache->committed_leader_peer(r, from);
return;
}
MDRequestRef mdr = mdcache->request_get(m->get_reqid());
if (m->get_attempt() != mdr->attempt) {
- dout(10) << "handle_slave_request_reply " << *mdr << " ignoring reply from other attempt "
+ dout(10) << "handle_peer_request_reply " << *mdr << " ignoring reply from other attempt "
<< m->get_attempt() << dendl;
return;
}
switch (m->get_op()) {
- case MMDSSlaveRequest::OP_XLOCKACK:
+ case MMDSPeerRequest::OP_XLOCKACK:
{
- // identify lock, master request
+ // identify lock, leader request
SimpleLock *lock = mds->locker->get_lock(m->get_lock_type(),
m->get_object_info());
- mdr->more()->slaves.insert(from);
+ mdr->more()->peers.insert(from);
lock->decode_locked_state(m->get_lock_data());
dout(10) << "got remote xlock on " << *lock << " on " << *lock->get_parent() << dendl;
mdr->emplace_lock(lock, MutationImpl::LockOp::XLOCK);
mdr->finish_locking(lock);
lock->get_xlock(mdr, mdr->get_client());
- ceph_assert(mdr->more()->waiting_on_slave.count(from));
- mdr->more()->waiting_on_slave.erase(from);
- ceph_assert(mdr->more()->waiting_on_slave.empty());
+ ceph_assert(mdr->more()->waiting_on_peer.count(from));
+ mdr->more()->waiting_on_peer.erase(from);
+ ceph_assert(mdr->more()->waiting_on_peer.empty());
mdcache->dispatch_request(mdr);
}
break;
- case MMDSSlaveRequest::OP_WRLOCKACK:
+ case MMDSPeerRequest::OP_WRLOCKACK:
{
- // identify lock, master request
+ // identify lock, leader request
SimpleLock *lock = mds->locker->get_lock(m->get_lock_type(),
m->get_object_info());
- mdr->more()->slaves.insert(from);
+ mdr->more()->peers.insert(from);
dout(10) << "got remote wrlock on " << *lock << " on " << *lock->get_parent() << dendl;
auto it = mdr->emplace_lock(lock, MutationImpl::LockOp::REMOTE_WRLOCK, from);
ceph_assert(it->is_remote_wrlock());
@@ -2762,31 +2762,31 @@ void Server::handle_slave_request_reply(const cref_t<MMDSSlaveRequest> &m)
mdr->finish_locking(lock);
- ceph_assert(mdr->more()->waiting_on_slave.count(from));
- mdr->more()->waiting_on_slave.erase(from);
- ceph_assert(mdr->more()->waiting_on_slave.empty());
+ ceph_assert(mdr->more()->waiting_on_peer.count(from));
+ mdr->more()->waiting_on_peer.erase(from);
+ ceph_assert(mdr->more()->waiting_on_peer.empty());
mdcache->dispatch_request(mdr);
}
break;
- case MMDSSlaveRequest::OP_AUTHPINACK:
- handle_slave_auth_pin_ack(mdr, m);
+ case MMDSPeerRequest::OP_AUTHPINACK:
+ handle_peer_auth_pin_ack(mdr, m);
break;
- case MMDSSlaveRequest::OP_LINKPREPACK:
- handle_slave_link_prep_ack(mdr, m);
+ case MMDSPeerRequest::OP_LINKPREPACK:
+ handle_peer_link_prep_ack(mdr, m);
break;
- case MMDSSlaveRequest::OP_RMDIRPREPACK:
- handle_slave_rmdir_prep_ack(mdr, m);
+ case MMDSPeerRequest::OP_RMDIRPREPACK:
+ handle_peer_rmdir_prep_ack(mdr, m);
break;
- case MMDSSlaveRequest::OP_RENAMEPREPACK:
- handle_slave_rename_prep_ack(mdr, m);
+ case MMDSPeerRequest::OP_RENAMEPREPACK:
+ handle_peer_rename_prep_ack(mdr, m);
break;
- case MMDSSlaveRequest::OP_RENAMENOTIFYACK:
- handle_slave_rename_notify_ack(mdr, m);
+ case MMDSPeerRequest::OP_RENAMENOTIFYACK:
+ handle_peer_rename_notify_ack(mdr, m);
break;
default:
@@ -2794,9 +2794,9 @@ void Server::handle_slave_request_reply(const cref_t<MMDSSlaveRequest> &m)
}
}
-void Server::dispatch_slave_request(MDRequestRef& mdr)
+void Server::dispatch_peer_request(MDRequestRef& mdr)
{
- dout(7) << "dispatch_slave_request " << *mdr << " " << *mdr->slave_request << dendl;
+ dout(7) << "dispatch_peer_request " << *mdr << " " << *mdr->peer_request << dendl;
if (mdr->aborted) {
dout(7) << " abort flag set, finishing" << dendl;
@@ -2804,22 +2804,22 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
return;
}
- if (logger) logger->inc(l_mdss_dispatch_slave_request);
+ if (logger) logger->inc(l_mdss_dispatch_peer_request);
- int op = mdr->slave_request->get_op();
+ int op = mdr->peer_request->get_op();
switch (op) {
- case MMDSSlaveRequest::OP_XLOCK:
- case MMDSSlaveRequest::OP_WRLOCK:
+ case MMDSPeerRequest::OP_XLOCK:
+ case MMDSPeerRequest::OP_WRLOCK:
{
// identify object
- SimpleLock *lock = mds->locker->get_lock(mdr->slave_request->get_lock_type(),
- mdr->slave_request->get_object_info());
+ SimpleLock *lock = mds->locker->get_lock(mdr->peer_request->get_lock_type(),
+ mdr->peer_request->get_object_info());
if (!lock) {
dout(10) << "don't have object, dropping" << dendl;
ceph_abort(); // can this happen, if we auth pinned properly.
}
- if (op == MMDSSlaveRequest::OP_XLOCK && !lock->get_parent()->is_auth()) {
+ if (op == MMDSPeerRequest::OP_XLOCK && !lock->get_parent()->is_auth()) {
dout(10) << "not auth for remote xlock attempt, dropping on "
<< *lock << " on " << *lock->get_parent() << dendl;
} else {
@@ -2834,13 +2834,13 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
int replycode = 0;
switch (op) {
- case MMDSSlaveRequest::OP_XLOCK:
+ case MMDSPeerRequest::OP_XLOCK:
lov.add_xlock(lock);
- replycode = MMDSSlaveRequest::OP_XLOCKACK;
+ replycode = MMDSPeerRequest::OP_XLOCKACK;
break;
- case MMDSSlaveRequest::OP_WRLOCK:
+ case MMDSPeerRequest::OP_WRLOCK:
lov.add_wrlock(lock);
- replycode = MMDSSlaveRequest::OP_WRLOCKACK;
+ replycode = MMDSPeerRequest::OP_WRLOCKACK;
break;
}
@@ -2848,33 +2848,33 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
return;
// ack
- auto r = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, replycode);
+ auto r = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, replycode);
r->set_lock_type(lock->get_type());
lock->get_parent()->set_object_info(r->get_object_info());
- if (replycode == MMDSSlaveRequest::OP_XLOCKACK)
+ if (replycode == MMDSPeerRequest::OP_XLOCKACK)
lock->encode_locked_state(r->get_lock_data());
- mds->send_message(r, mdr->slave_request->get_connection());
+ mds->send_message(r, mdr->peer_request->get_connection());
}
// done.
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
}
break;
- case MMDSSlaveRequest::OP_UNXLOCK:
- case MMDSSlaveRequest::OP_UNWRLOCK:
+ case MMDSPeerRequest::OP_UNXLOCK:
+ case MMDSPeerRequest::OP_UNWRLOCK:
{
- SimpleLock *lock = mds->locker->get_lock(mdr->slave_request->get_lock_type(),
- mdr->slave_request->get_object_info());
+ SimpleLock *lock = mds->locker->get_lock(mdr->peer_request->get_lock_type(),
+ mdr->peer_request->get_object_info());
ceph_assert(lock);
auto it = mdr->locks.find(lock);
ceph_assert(it != mdr->locks.end());
bool need_issue = false;
switch (op) {
- case MMDSSlaveRequest::OP_UNXLOCK:
+ case MMDSPeerRequest::OP_UNXLOCK:
mds->locker->xlock_finish(it, mdr.get(), &need_issue);
break;
- case MMDSSlaveRequest::OP_UNWRLOCK:
+ case MMDSPeerRequest::OP_UNWRLOCK:
mds->locker->wrlock_finish(it, mdr.get(), &need_issue);
break;
}
@@ -2882,25 +2882,25 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
mds->locker->issue_caps(static_cast<CInode*>(lock->get_parent()));
// done. no ack necessary.
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
}
break;
- case MMDSSlaveRequest::OP_AUTHPIN:
- handle_slave_auth_pin(mdr);
+ case MMDSPeerRequest::OP_AUTHPIN:
+ handle_peer_auth_pin(mdr);
break;
- case MMDSSlaveRequest::OP_LINKPREP:
- case MMDSSlaveRequest::OP_UNLINKPREP:
- handle_slave_link_prep(mdr);
+ case MMDSPeerRequest::OP_LINKPREP:
+ case MMDSPeerRequest::OP_UNLINKPREP:
+ handle_peer_link_prep(mdr);
break;
- case MMDSSlaveRequest::OP_RMDIRPREP:
- handle_slave_rmdir_prep(mdr);
+ case MMDSPeerRequest::OP_RMDIRPREP:
+ handle_peer_rmdir_prep(mdr);
break;
- case MMDSSlaveRequest::OP_RENAMEPREP:
- handle_slave_rename_prep(mdr);
+ case MMDSPeerRequest::OP_RENAMEPREP:
+ handle_peer_rename_prep(mdr);
break;
default:
@@ -2908,16 +2908,16 @@ void Server::dispatch_slave_request(MDRequestRef& mdr)
}
}
-void Server::handle_slave_auth_pin(MDRequestRef& mdr)
+void Server::handle_peer_auth_pin(MDRequestRef& mdr)
{
- dout(10) << "handle_slave_auth_pin " << *mdr << dendl;
+ dout(10) << "handle_peer_auth_pin " << *mdr << dendl;
// build list of objects
list<MDSCacheObject*> objects;
CInode *auth_pin_freeze = NULL;
- bool nonblocking = mdr->slave_request->is_nonblocking();
+ bool nonblocking = mdr->peer_request->is_nonblocking();
bool fail = false, wouldblock = false, readonly = false;
- ref_t<MMDSSlaveRequest> reply;
+ ref_t<MMDSPeerRequest> reply;
if (mdcache->is_readonly()) {
dout(10) << " read-only FS" << dendl;
@@ -2926,7 +2926,7 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
}
if (!fail) {
- for (const auto &oi : mdr->slave_request->get_authpins()) {
+ for (const auto &oi : mdr->peer_request->get_authpins()) {
MDSCacheObject *object = mdcache->get_object(oi);
if (!object) {
dout(10) << " don't have " << oi << dendl;
@@ -2935,7 +2935,7 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
}
objects.push_back(object);
- if (oi == mdr->slave_request->get_authpin_freeze())
+ if (oi == mdr->peer_request->get_authpin_freeze())
auth_pin_freeze = static_cast<CInode*>(object);
}
}
@@ -2974,11 +2974,11 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
mdr->more()->rename_inode != auth_pin_freeze)
mdr->unfreeze_auth_pin(true);
- /* handle_slave_rename_prep() call freeze_inode() to wait for all other operations
+ /* handle_peer_rename_prep() call freeze_inode() to wait for all other operations
* on the source inode to complete. This happens after all locks for the rename
* operation are acquired. But to acquire locks, we need auth pin locks' parent
* objects first. So there is an ABBA deadlock if someone auth pins the source inode
- * after locks are acquired and before Server::handle_slave_rename_prep() is called.
+ * after locks are acquired and before Server::handle_peer_rename_prep() is called.
* The solution is freeze the inode and prevent other MDRequests from getting new
* auth pins.
*/
@@ -2992,7 +2992,7 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
}
}
- reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_AUTHPINACK);
+ reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_AUTHPINACK);
if (fail) {
mdr->drop_local_auth_pins(); // just in case
@@ -3018,30 +3018,30 @@ void Server::handle_slave_auth_pin(MDRequestRef& mdr)
}
}
- mds->send_message_mds(reply, mdr->slave_to_mds);
+ mds->send_message_mds(reply, mdr->peer_to_mds);
// clean up this request
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
return;
blocked:
- if (mdr->slave_request->should_notify_blocking()) {
- reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_AUTHPINACK);
+ if (mdr->peer_request->should_notify_blocking()) {
+ reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_AUTHPINACK);
reply->mark_req_blocked();
- mds->send_message_mds(reply, mdr->slave_to_mds);
- mdr->slave_request->clear_notify_blocking();
+ mds->send_message_mds(reply, mdr->peer_to_mds);
+ mdr->peer_request->clear_notify_blocking();
}
return;
}
-void Server::handle_slave_auth_pin_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack)
+void Server::handle_peer_auth_pin_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack)
{
- dout(10) << "handle_slave_auth_pin_ack on " << *mdr << " " << *ack << dendl;
+ dout(10) << "handle_peer_auth_pin_ack on " << *mdr << " " << *ack << dendl;
mds_rank_t from = mds_rank_t(ack->get_source().num());
if (ack->is_req_blocked()) {
mdr->disable_lock_cache();
- // slave auth pin is blocked, drop locks to avoid deadlock
+ // peer auth pin is blocked, drop locks to avoid deadlock
mds->locker->drop_locks(mdr.get(), nullptr);
return;
}
@@ -3079,24 +3079,24 @@ void Server::handle_slave_auth_pin_ack(MDRequestRef& mdr, const cref_t<MMDSSlave
}
}
- // note slave
- mdr->more()->slaves.insert(from);
+ // note peer
+ mdr->more()->peers.insert(from);
// clear from waiting list
- auto ret = mdr->more()->waiting_on_slave.erase(from);
+ auto ret = mdr->more()->waiting_on_peer.erase(from);
ceph_assert(ret);
if (ack->is_error_rofs()) {
- mdr->more()->slave_error = -EROFS;
+ mdr->more()->peer_error = -EROFS;
} else if (ack->is_error_wouldblock()) {
- mdr->more()->slave_error = -EWOULDBLOCK;
+ mdr->more()->peer_error = -EWOULDBLOCK;
}
// go again?
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
mdcache->dispatch_request(mdr);
else
- dout(10) << "still waiting on slaves " << mdr->more()->waiting_on_slave << dendl;
+ dout(10) << "still waiting on peers " << mdr->more()->waiting_on_peer << dendl;
}
@@ -6441,7 +6441,7 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(linkauth)) {
dout(10) << " targeti auth mds." << linkauth << " is not active" << dendl;
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(linkauth, new C_MDS_RetryRequest(mdcache, mdr));
return;
}
@@ -6449,18 +6449,18 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
dout(10) << " targeti auth must prepare nlink++/--" << dendl;
int op;
if (inc)
- op = MMDSSlaveRequest::OP_LINKPREP;
+ op = MMDSPeerRequest::OP_LINKPREP;
else
- op = MMDSSlaveRequest::OP_UNLINKPREP;
- auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, op);
+ op = MMDSPeerRequest::OP_UNLINKPREP;
+ auto req = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, op);
targeti->set_object_info(req->get_object_info());
req->op_stamp = mdr->get_op_stamp();
if (auto& desti_srnode = mdr->more()->desti_srnode)
encode(*desti_srnode, req->desti_snapbl);
mds->send_message_mds(req, linkauth);
- ceph_assert(mdr->more()->waiting_on_slave.count(linkauth) == 0);
- mdr->more()->waiting_on_slave.insert(linkauth);
+ ceph_assert(mdr->more()->waiting_on_peer.count(linkauth) == 0);
+ mdr->more()->waiting_on_peer.insert(linkauth);
return;
}
dout(10) << " targeti auth has prepared nlink++/--" << dendl;
@@ -6480,10 +6480,10 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
mdlog->start_entry(le);
le->metablob.add_client_req(mdr->reqid, mdr->client_request->get_oldest_client_tid());
if (!mdr->more()->witnessed.empty()) {
- dout(20) << " noting uncommitted_slaves " << mdr->more()->witnessed << dendl;
+ dout(20) << " noting uncommitted_peers " << mdr->more()->witnessed << dendl;
le->reqid = mdr->reqid;
- le->had_slaves = true;
- mdcache->add_uncommitted_master(mdr->reqid, mdr->ls, mdr->more()->witnessed);
+ le->had_peers = true;
+ mdcache->add_uncommitted_leader(mdr->reqid, mdr->ls, mdr->more()->witnessed);
}
if (inc) {
@@ -6514,7 +6514,7 @@ void Server::_link_remote_finish(MDRequestRef& mdr, bool inc,
ceph_assert(g_conf()->mds_kill_link_at != 3);
if (!mdr->more()->witnessed.empty())
- mdcache->logged_master_update(mdr->reqid);
+ mdcache->logged_leader_update(mdr->reqid);
if (inc) {
// link the new dentry
@@ -6552,55 +6552,55 @@ void Server::_link_remote_finish(MDRequestRef& mdr, bool inc,
// remote linking/unlinking
-class C_MDS_SlaveLinkPrep : public ServerLogContext {
+class C_MDS_PeerLinkPrep : public ServerLogContext {
CInode *targeti;
bool adjust_realm;
public:
- C_MDS_SlaveLinkPrep(Server *s, MDRequestRef& r, CInode *t, bool ar) :
+ C_MDS_PeerLinkPrep(Server *s, MDRequestRef& r, CInode *t, bool ar) :
ServerLogContext(s, r), targeti(t), adjust_realm(ar) { }
void finish(int r) override {
ceph_assert(r == 0);
- server->_logged_slave_link(mdr, targeti, adjust_realm);
+ server->_logged_peer_link(mdr, targeti, adjust_realm);
}
};
-class C_MDS_SlaveLinkCommit : public ServerContext {
+class C_MDS_PeerLinkCommit : public ServerContext {
MDRequestRef mdr;
CInode *targeti;
public:
- C_MDS_SlaveLinkCommit(Server *s, MDRequestRef& r, CInode *t) :
+ C_MDS_PeerLinkCommit(Server *s, MDRequestRef& r, CInode *t) :
ServerContext(s), mdr(r), targeti(t) { }
void finish(int r) override {
- server->_commit_slave_link(mdr, r, targeti);
+ server->_commit_peer_link(mdr, r, targeti);
}
};
-void Server::handle_slave_link_prep(MDRequestRef& mdr)
+void Server::handle_peer_link_prep(MDRequestRef& mdr)
{
- dout(10) << "handle_slave_link_prep " << *mdr
- << " on " << mdr->slave_request->get_object_info()
+ dout(10) << "handle_peer_link_prep " << *mdr
+ << " on " << mdr->peer_request->get_object_info()
<< dendl;
ceph_assert(g_conf()->mds_kill_link_at != 4);
- CInode *targeti = mdcache->get_inode(mdr->slave_request->get_object_info().ino);
+ CInode *targeti = mdcache->get_inode(mdr->peer_request->get_object_info().ino);
ceph_assert(targeti);
dout(10) << "targeti " << *targeti << dendl;
CDentry *dn = targeti->get_parent_dn();
CDentry::linkage_t *dnl = dn->get_linkage();
ceph_assert(dnl->is_primary());
- mdr->set_op_stamp(mdr->slave_request->op_stamp);
+ mdr->set_op_stamp(mdr->peer_request->op_stamp);
mdr->auth_pin(targeti);
- //ceph_abort(); // test hack: make sure master can handle a slave that fails to prepare...
+ //ceph_abort(); // test hack: make sure leader can handle a peer that fails to prepare...
ceph_assert(g_conf()->mds_kill_link_at != 5);
// journal it
mdr->ls = mdlog->get_current_segment();
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_link_prep", mdr->reqid, mdr->slave_to_mds,
- ESlaveUpdate::OP_PREPARE, ESlaveUpdate::LINK);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_link_prep", mdr->reqid, mdr->peer_to_mds,
+ EPeerUpdate::OP_PREPARE, EPeerUpdate::LINK);
mdlog->start_entry(le);
auto &pi = dnl->get_inode()->project_inode();
@@ -6609,7 +6609,7 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
bool inc;
bool adjust_realm = false;
bool realm_projected = false;
- if (mdr->slave_request->get_op() == MMDSSlaveRequest::OP_LINKPREP) {
+ if (mdr->peer_request->get_op() == MMDSPeerRequest::OP_LINKPREP) {
inc = true;
pi.inode.nlink++;
if (!targeti->is_projected_snaprealm_global()) {
@@ -6623,8 +6623,8 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
inc = false;
pi.inode.nlink--;
if (targeti->is_projected_snaprealm_global()) {
- ceph_assert(mdr->slave_request->desti_snapbl.length());
- auto p = mdr->slave_request->desti_snapbl.cbegin();
+ ceph_assert(mdr->peer_request->desti_snapbl.length());
+ auto p = mdr->peer_request->desti_snapbl.cbegin();
sr_t *newsnap = targeti->project_snaprealm();
decode(*newsnap, p);
@@ -6634,7 +6634,7 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
realm_projected = true;
} else {
- ceph_assert(mdr->slave_request->desti_snapbl.length() == 0);
+ ceph_assert(mdr->peer_request->desti_snapbl.length() == 0);
}
}
@@ -6665,20 +6665,20 @@ void Server::handle_slave_link_prep(MDRequestRef& mdr)
// commit case
mdcache->predirty_journal_parents(mdr, &le->commit, dnl->get_inode(), 0, PREDIRTY_SHALLOW|PREDIRTY_PRIMARY);
mdcache->journal_dirty_inode(mdr.get(), &le->commit, targeti);
- mdcache->add_uncommitted_slave(mdr->reqid, mdr->ls, mdr->slave_to_mds);
+ mdcache->add_uncommitted_peer(mdr->reqid, mdr->ls, mdr->peer_to_mds);
// set up commit waiter
- mdr->more()->slave_commit = new C_MDS_SlaveLinkCommit(this, mdr, targeti);
+ mdr->more()->peer_commit = new C_MDS_PeerLinkCommit(this, mdr, targeti);
- mdr->more()->slave_update_journaled = true;
- submit_mdlog_entry(le, new C_MDS_SlaveLinkPrep(this, mdr, targeti, adjust_realm),
+ mdr->more()->peer_update_journaled = true;
+ submit_mdlog_entry(le, new C_MDS_PeerLinkPrep(this, mdr, targeti, adjust_realm),
mdr, __func__);
mdlog->flush();
}
-void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm)
+void Server::_logged_peer_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm)
{
- dout(10) << "_logged_slave_link " << *mdr
+ dout(10) << "_logged_peer_link " << *mdr
<< " " << *targeti << dendl;
ceph_assert(g_conf()->mds_kill_link_at != 6);
@@ -6691,7 +6691,7 @@ void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_
mds->balancer->hit_inode(targeti, META_POP_IWR);
// done.
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
if (adjust_realm) {
int op = CEPH_SNAP_OP_SPLIT;
@@ -6701,8 +6701,8 @@ void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_
// ack
if (!mdr->aborted) {
- auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_LINKPREPACK);
- mds->send_message_mds(reply, mdr->slave_to_mds);
+ auto reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_LINKPREPACK);
+ mds->send_message_mds(reply, mdr->peer_to_mds);
} else {
dout(10) << " abort flag set, finishing" << dendl;
mdcache->request_finish(mdr);
@@ -6710,16 +6710,16 @@ void Server::_logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_
}
-struct C_MDS_CommittedSlave : public ServerLogContext {
- C_MDS_CommittedSlave(Server *s, MDRequestRef& m) : ServerLogContext(s, m) {}
+struct C_MDS_CommittedPeer : public ServerLogContext {
+ C_MDS_CommittedPeer(Server *s, MDRequestRef& m) : ServerLogContext(s, m) {}
void finish(int r) override {
- server->_committed_slave(mdr);
+ server->_committed_peer(mdr);
}
};
-void Server::_commit_slave_link(MDRequestRef& mdr, int r, CInode *targeti)
+void Server::_commit_peer_link(MDRequestRef& mdr, int r, CInode *targeti)
{
- dout(10) << "_commit_slave_link " << *mdr
+ dout(10) << "_commit_peer_link " << *mdr
<< " r=" << r
<< " " << *targeti << dendl;
@@ -6730,26 +6730,26 @@ void Server::_commit_slave_link(MDRequestRef& mdr, int r, CInode *targeti)
mdr->cleanup();
// write a commit to the journal
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_link_commit", mdr->reqid, mdr->slave_to_mds,
- ESlaveUpdate::OP_COMMIT, ESlaveUpdate::LINK);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_link_commit", mdr->reqid, mdr->peer_to_mds,
+ EPeerUpdate::OP_COMMIT, EPeerUpdate::LINK);
mdlog->start_entry(le);
- submit_mdlog_entry(le, new C_MDS_CommittedSlave(this, mdr), mdr, __func__);
+ submit_mdlog_entry(le, new C_MDS_CommittedPeer(this, mdr), mdr, __func__);
mdlog->flush();
} else {
- do_link_rollback(mdr->more()->rollback_bl, mdr->slave_to_mds, mdr);
+ do_link_rollback(mdr->more()->rollback_bl, mdr->peer_to_mds, mdr);
}
}
-void Server::_committed_slave(MDRequestRef& mdr)
+void Server::_committed_peer(MDRequestRef& mdr)
{
- dout(10) << "_committed_slave " << *mdr << dendl;
+ dout(10) << "_committed_peer " << *mdr << dendl;
ceph_assert(g_conf()->mds_kill_link_at != 8);
- bool assert_exist = mdr->more()->slave_update_journaled;
- mdcache->finish_uncommitted_slave(mdr->reqid, assert_exist);
- auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_COMMITTED);
- mds->send_message_mds(req, mdr->slave_to_mds);
+ bool assert_exist = mdr->more()->peer_update_journaled;
+ mdcache->finish_uncommitted_peer(mdr->reqid, assert_exist);
+ auto req = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_COMMITTED);
+ mds->send_message_mds(req, mdr->peer_to_mds);
mdcache->request_finish(mdr);
}
@@ -6765,7 +6765,7 @@ struct C_MDS_LoggedLinkRollback : public ServerLogContext {
}
};
-void Server::do_link_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr)
+void Server::do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr)
{
link_rollback rollback;
auto p = rbl.cbegin();
@@ -6778,7 +6778,7 @@ void Server::do_link_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
ceph_assert(g_conf()->mds_kill_link_at != 9);
- mdcache->add_rollback(rollback.reqid, master); // need to finish this update before resolve finishes
+ mdcache->add_rollback(rollback.reqid, leader); // need to finish this update before resolve finishes
ceph_assert(mdr || mds->is_resolve());
MutationRef mut(new MutationImpl(nullptr, utime_t(), rollback.reqid));
@@ -6787,7 +6787,7 @@ void Server::do_link_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
CInode *in = mdcache->get_inode(rollback.ino);
ceph_assert(in);
dout(10) << " target is " << *in << dendl;
- ceph_assert(!in->is_projected()); // live slave request hold versionlock xlock.
+ ceph_assert(!in->is_projected()); // live peer request hold versionlock xlock.
auto &pi = in->project_inode();
pi.inode.version = in->pre_dirty();
@@ -6835,8 +6835,8 @@ void Server::do_link_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
}
// journal it
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_link_rollback", rollback.reqid, master,
- ESlaveUpdate::OP_ROLLBACK, ESlaveUpdate::LINK);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_link_rollback", rollback.reqid, leader,
+ EPeerUpdate::OP_ROLLBACK, EPeerUpdate::LINK);
mdlog->start_entry(le);
le->commit.add_dir_context(parent);
le->commit.add_dir(parent, true);
@@ -6868,28 +6868,28 @@ void Server::_link_rollback_finish(MutationRef& mut, MDRequestRef& mdr,
}
-void Server::handle_slave_link_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &m)
+void Server::handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &m)
{
- dout(10) << "handle_slave_link_prep_ack " << *mdr
+ dout(10) << "handle_peer_link_prep_ack " << *mdr
<< " " << *m << dendl;
mds_rank_t from = mds_rank_t(m->get_source().num());
ceph_assert(g_conf()->mds_kill_link_at != 11);
- // note slave
- mdr->more()->slaves.insert(from);
+ // note peer
+ mdr->more()->peers.insert(from);
// witnessed!
ceph_assert(mdr->more()->witnessed.count(from) == 0);
mdr->more()->witnessed.insert(from);
ceph_assert(!m->is_not_journaled());
- mdr->more()->has_journaled_slaves = true;
+ mdr->more()->has_journaled_peers = true;
// remove from waiting list
- ceph_assert(mdr->more()->waiting_on_slave.count(from));
- mdr->more()->waiting_on_slave.erase(from);
+ ceph_assert(mdr->more()->waiting_on_peer.count(from));
+ mdr->more()->waiting_on_peer.erase(from);
- ceph_assert(mdr->more()->waiting_on_slave.empty());
+ ceph_assert(mdr->more()->waiting_on_peer.empty());
dispatch_client_request(mdr); // go again!
}
@@ -7008,7 +7008,7 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
in->clear_snaprealm_global(new_srnode);
mdr->more()->desti_srnode = new_srnode;
} else if (dnl->is_primary()) {
- // prepare snaprealm blob for slave request
+ // prepare snaprealm blob for peer request
SnapRealm *realm = in->find_snaprealm();
snapid_t follows = realm->get_newest_seq();
if (in->snaprealm || follows + 1 > in->get_oldest_snap()) {
@@ -7031,14 +7031,14 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
++p) {
if (mdr->more()->witnessed.count(*p)) {
dout(10) << " already witnessed by mds." << *p << dendl;
- } else if (mdr->more()->waiting_on_slave.count(*p)) {
+ } else if (mdr->more()->waiting_on_peer.count(*p)) {
dout(10) << " already waiting on witness mds." << *p << dendl;
} else {
if (!_rmdir_prepare_witness(mdr, *p, mdr->dn[0], straydn))
return;
}
}
- if (!mdr->more()->waiting_on_slave.empty())
+ if (!mdr->more()->waiting_on_peer.empty())
return; // we're waiting for a witness.
}
@@ -7082,10 +7082,10 @@ void Server::_unlink_local(MDRequestRef& mdr, CDentry *dn, CDentry *straydn)
mdlog->start_entry(le);
le->metablob.add_client_req(mdr->reqid, mdr->client_request->get_oldest_client_tid());
if (!mdr->more()->witnessed.empty()) {
- dout(20) << " noting uncommitted_slaves " << mdr->more()->witnessed << dendl;
+ dout(20) << " noting uncommitted_peers " << mdr->more()->witnessed << dendl;
le->reqid = mdr->reqid;
- le->had_slaves = true;
- mdcache->add_uncommitted_master(mdr->reqid, mdr->ls, mdr->more()->witnessed);
+ le->had_peers = true;
+ mdcache->add_uncommitted_leader(mdr->reqid, mdr->ls, mdr->more()->witnessed);
}
if (straydn) {
@@ -7164,7 +7164,7 @@ void Server::_unlink_local_finish(MDRequestRef& mdr,
dout(10) << "_unlink_local_finish " << *dn << dendl;
if (!mdr->more()->witnessed.empty())
- mdcache->logged_master_update(mdr->reqid);
+ mdcache->logged_leader_update(mdr->reqid);
CInode *strayin = NULL;
bool hadrealm = false;
@@ -7227,13 +7227,13 @@ bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector<CD
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(who)) {
dout(10) << "_rmdir_prepare_witness mds." << who << " is not active" << dendl;
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(who, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
dout(10) << "_rmdir_prepare_witness mds." << who << dendl;
- auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREP);
+ auto req = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RMDIRPREP);
req->srcdnpath = filepath(trace.front()->get_dir()->ino());
for (auto dn : trace)
req->srcdnpath.push_dentry(dn->get_name());
@@ -7244,39 +7244,39 @@ bool Server::_rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector<CD
req->op_stamp = mdr->get_op_stamp();
mds->send_message_mds(req, who);
- ceph_assert(mdr->more()->waiting_on_slave.count(who) == 0);
- mdr->more()->waiting_on_slave.insert(who);
+ ceph_assert(mdr->more()->waiting_on_peer.count(who) == 0);
+ mdr->more()->waiting_on_peer.insert(who);
return true;
}
-struct C_MDS_SlaveRmdirPrep : public ServerLogContext {
+struct C_MDS_PeerRmdirPrep : public ServerLogContext {
CDentry *dn, *straydn;
- C_MDS_SlaveRmdirPrep(Server *s, MDRequestRef& r, CDentry *d, CDentry *st)
+ C_MDS_PeerRmdirPrep(Server *s, MDRequestRef& r, CDentry *d, CDentry *st)
: ServerLogContext(s, r), dn(d), straydn(st) {}
void finish(int r) override {
- server->_logged_slave_rmdir(mdr, dn, straydn);
+ server->_logged_peer_rmdir(mdr, dn, straydn);
}
};
-struct C_MDS_SlaveRmdirCommit : public ServerContext {
+struct C_MDS_PeerRmdirCommit : public ServerContext {
MDRequestRef mdr;
CDentry *straydn;
- C_MDS_SlaveRmdirCommit(Server *s, MDRequestRef& r, CDentry *sd)
+ C_MDS_PeerRmdirCommit(Server *s, MDRequestRef& r, CDentry *sd)
: ServerContext(s), mdr(r), straydn(sd) { }
void finish(int r) override {
- server->_commit_slave_rmdir(mdr, r, straydn);
+ server->_commit_peer_rmdir(mdr, r, straydn);
}
};
-void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
+void Server::handle_peer_rmdir_prep(MDRequestRef& mdr)
{
- dout(10) << "handle_slave_rmdir_prep " << *mdr
- << " " << mdr->slave_request->srcdnpath
- << " to " << mdr->slave_request->destdnpath
+ dout(10) << "handle_peer_rmdir_prep " << *mdr
+ << " " << mdr->peer_request->srcdnpath
+ << " to " << mdr->peer_request->destdnpath
<< dendl;
vector<CDentry*> trace;
- filepath srcpath(mdr->slave_request->srcdnpath);
+ filepath srcpath(mdr->peer_request->srcdnpath);
dout(10) << " src " << srcpath << dendl;
CInode *in;
CF_MDS_MDRContextFactory cf(mdcache, mdr, false);
@@ -7286,7 +7286,7 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
if (r > 0) return;
if (r == -ESTALE) {
mdcache->find_ino_peers(srcpath.get_ino(), new C_MDS_RetryRequest(mdcache, mdr),
- mdr->slave_to_mds, true);
+ mdr->peer_to_mds, true);
return;
}
ceph_assert(r == 0);
@@ -7298,7 +7298,7 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
CDentry *straydn = mdr->straydn;
dout(10) << " straydn " << *straydn << dendl;
- mdr->set_op_stamp(mdr->slave_request->op_stamp);
+ mdr->set_op_stamp(mdr->peer_request->op_stamp);
rmdir_rollback rollback;
rollback.reqid = mdr->reqid;
@@ -7306,7 +7306,7 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
rollback.src_dname = dn->get_name();
rollback.dest_dir = straydn->get_dir()->dirfrag();
rollback.dest_dname = straydn->get_name();
- if (mdr->slave_request->desti_snapbl.length()) {
+ if (mdr->peer_request->desti_snapbl.length()) {
if (in->snaprealm) {
encode(true, rollback.snapbl);
in->encode_snap_blob(rollback.snapbl);
@@ -7319,7 +7319,7 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
dout(20) << " rollback is " << mdr->more()->rollback_bl.length() << " bytes" << dendl;
// set up commit waiter
- mdr->more()->slave_commit = new C_MDS_SlaveRmdirCommit(this, mdr, straydn);
+ mdr->more()->peer_commit = new C_MDS_PeerRmdirCommit(this, mdr, straydn);
straydn->push_projected_linkage(in);
dn->push_projected_linkage();
@@ -7329,41 +7329,41 @@ void Server::handle_slave_rmdir_prep(MDRequestRef& mdr)
if (!in->has_subtree_root_dirfrag(mds->get_nodeid())) {
dout(10) << " no auth subtree in " << *in << ", skipping journal" << dendl;
- _logged_slave_rmdir(mdr, dn, straydn);
+ _logged_peer_rmdir(mdr, dn, straydn);
return;
}
mdr->ls = mdlog->get_current_segment();
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rmdir", mdr->reqid, mdr->slave_to_mds,
- ESlaveUpdate::OP_PREPARE, ESlaveUpdate::RMDIR);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rmdir", mdr->reqid, mdr->peer_to_mds,
+ EPeerUpdate::OP_PREPARE, EPeerUpdate::RMDIR);
mdlog->start_entry(le);
le->rollback = mdr->more()->rollback_bl;
le->commit.add_dir_context(straydn->get_dir());
le->commit.add_primary_dentry(straydn, in, true);
- // slave: no need to journal original dentry
+ // peer: no need to journal original dentry
dout(10) << " noting renamed (unlinked) dir ino " << in->ino() << " in metablob" << dendl;
le->commit.renamed_dirino = in->ino();
mdcache->project_subtree_rename(in, dn->get_dir(), straydn->get_dir());
- mdcache->add_uncommitted_slave(mdr->reqid, mdr->ls, mdr->slave_to_mds);
+ mdcache->add_uncommitted_peer(mdr->reqid, mdr->ls, mdr->peer_to_mds);
- mdr->more()->slave_update_journaled = true;
- submit_mdlog_entry(le, new C_MDS_SlaveRmdirPrep(this, mdr, dn, straydn),
+ mdr->more()->peer_update_journaled = true;
+ submit_mdlog_entry(le, new C_MDS_PeerRmdirPrep(this, mdr, dn, straydn),
mdr, __func__);
mdlog->flush();
}
-void Server::_logged_slave_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *straydn)
+void Server::_logged_peer_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *straydn)
{
- dout(10) << "_logged_slave_rmdir " << *mdr << " on " << *dn << dendl;
+ dout(10) << "_logged_peer_rmdir " << *mdr << " on " << *dn << dendl;
CInode *in = dn->get_linkage()->get_inode();
bool new_realm;
- if (mdr->slave_request->desti_snapbl.length()) {
+ if (mdr->peer_request->desti_snapbl.length()) {
new_realm = !in->snaprealm;
- in->decode_snap_blob(mdr->slave_request->desti_snapbl);
+ in->decode_snap_blob(mdr->peer_request->desti_snapbl);
ceph_assert(in->snaprealm);
ceph_assert(in->snaprealm->have_past_parents_open());
} else {
@@ -7376,54 +7376,54 @@ void Server::_logged_slave_rmdir(MDRequestRef& mdr, CDentry *dn, CDentry *strayd
straydn->pop_projected_linkage();
dn->pop_projected_linkage();
- mdcache->adjust_subtree_after_rename(in, dn->get_dir(), mdr->more()->slave_update_journaled);
+ mdcache->adjust_subtree_after_rename(in, dn->get_dir(), mdr->more()->peer_update_journaled);
if (new_realm)
mdcache->do_realm_invalidate_and_update_notify(in, CEPH_SNAP_OP_SPLIT, false);
// done.
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
mdr->straydn = 0;
if (!mdr->aborted) {
- auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RMDIRPREPACK);
- if (!mdr->more()->slave_update_journaled)
+ auto reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RMDIRPREPACK);
+ if (!mdr->more()->peer_update_journaled)
reply->mark_not_journaled();
- mds->send_message_mds(reply, mdr->slave_to_mds);
+ mds->send_message_mds(reply, mdr->peer_to_mds);
} else {
dout(10) << " abort flag set, finishing" << dendl;
mdcache->request_finish(mdr);
}
}
-void Server::handle_slave_rmdir_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack)
+void Server::handle_peer_rmdir_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack)
{
- dout(10) << "handle_slave_rmdir_prep_ack " << *mdr
+ dout(10) << "handle_peer_rmdir_prep_ack " << *mdr
<< " " << *ack << dendl;
mds_rank_t from = mds_rank_t(ack->get_source().num());
- mdr->more()->slaves.insert(from);
+ mdr->more()->peers.insert(from);
mdr->more()->witnessed.insert(from);
if (!ack->is_not_journaled())
- mdr->more()->has_journaled_slaves = true;
+ mdr->more()->has_journaled_peers = true;
// remove from waiting list
- ceph_assert(mdr->more()->waiting_on_slave.count(from));
- mdr->more()->waiting_on_slave.erase(from);
+ ceph_assert(mdr->more()->waiting_on_peer.count(from));
+ mdr->more()->waiting_on_peer.erase(from);
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
dispatch_client_request(mdr); // go again!
else
- dout(10) << "still waiting on slaves " << mdr->more()->waiting_on_slave << dendl;
+ dout(10) << "still waiting on peers " << mdr->more()->waiting_on_peer << dendl;
}
-void Server::_commit_slave_rmdir(MDRequestRef& mdr, int r, CDentry *straydn)
+void Server::_commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn)
{
- dout(10) << "_commit_slave_rmdir " << *mdr << " r=" << r << dendl;
+ dout(10) << "_commit_peer_rmdir " << *mdr << " r=" << r << dendl;
if (r == 0) {
- if (mdr->more()->slave_update_journaled) {
+ if (mdr->more()->peer_update_journaled) {
CInode *strayin = straydn->get_projected_linkage()->get_inode();
if (strayin && !strayin->snaprealm)
mdcache->clear_dirty_bits_for_stray(strayin);
@@ -7431,20 +7431,20 @@ void Server::_commit_slave_rmdir(MDRequestRef& mdr, int r, CDentry *straydn)
mdr->cleanup();
- if (mdr->more()->slave_update_journaled) {
+ if (mdr->more()->peer_update_journaled) {
// write a commit to the journal
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rmdir_commit", mdr->reqid,
- mdr->slave_to_mds, ESlaveUpdate::OP_COMMIT,
- ESlaveUpdate::RMDIR);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rmdir_commit", mdr->reqid,
+ mdr->peer_to_mds, EPeerUpdate::OP_COMMIT,
+ EPeerUpdate::RMDIR);
mdlog->start_entry(le);
- submit_mdlog_entry(le, new C_MDS_CommittedSlave(this, mdr), mdr, __func__);
+ submit_mdlog_entry(le, new C_MDS_CommittedPeer(this, mdr), mdr, __func__);
mdlog->flush();
} else {
- _committed_slave(mdr);
+ _committed_peer(mdr);
}
} else {
// abort
- do_rmdir_rollback(mdr->more()->rollback_bl, mdr->slave_to_mds, mdr);
+ do_rmdir_rollback(mdr->more()->rollback_bl, mdr->peer_to_mds, mdr);
}
}
@@ -7459,7 +7459,7 @@ struct C_MDS_LoggedRmdirRollback : public ServerLogContext {
}
};
-void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr)
+void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr)
{
// unlink the other rollback methods, the rmdir rollback is only
// needed to record the subtree changes in the journal for inode
@@ -7471,7 +7471,7 @@ void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
decode(rollback, p);
dout(10) << "do_rmdir_rollback on " << rollback.reqid << dendl;
- mdcache->add_rollback(rollback.reqid, master); // need to finish this update before resolve finishes
+ mdcache->add_rollback(rollback.reqid, leader); // need to finish this update before resolve finishes
ceph_assert(mdr || mds->is_resolve());
CDir *dir = mdcache->get_dirfrag(rollback.src_dir);
@@ -7502,7 +7502,7 @@ void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
}
}
- if (mdr && !mdr->more()->slave_update_journaled) {
+ if (mdr && !mdr->more()->peer_update_journaled) {
ceph_assert(!in->has_subtree_root_dirfrag(mds->get_nodeid()));
_rmdir_rollback_finish(mdr, rollback.reqid, dn, straydn);
@@ -7510,13 +7510,13 @@ void Server::do_rmdir_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef&
}
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rmdir_rollback", rollback.reqid, master,
- ESlaveUpdate::OP_ROLLBACK, ESlaveUpdate::RMDIR);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rmdir_rollback", rollback.reqid, leader,
+ EPeerUpdate::OP_ROLLBACK, EPeerUpdate::RMDIR);
mdlog->start_entry(le);
le->commit.add_dir_context(dn->get_dir());
le->commit.add_primary_dentry(dn, in, true);
- // slave: no need to journal straydn
+ // peer: no need to journal straydn
dout(10) << " noting renamed (unlinked) dir ino " << in->ino() << " in metablob" << dendl;
le->commit.renamed_dirino = in->ino();
@@ -7540,7 +7540,7 @@ void Server::_rmdir_rollback_finish(MDRequestRef& mdr, metareqid_t reqid, CDentr
CInode *in = dn->get_linkage()->get_inode();
mdcache->adjust_subtree_after_rename(in, straydn->get_dir(),
- !mdr || mdr->more()->slave_update_journaled);
+ !mdr || mdr->more()->peer_update_journaled);
if (mds->is_resolve()) {
CDir *root = mdcache->get_subtree_root(straydn->get_dir());
@@ -7635,15 +7635,15 @@ public:
/** handle_client_rename
*
- * rename master is the destdn auth. this is because cached inodes
+ * rename leader is the destdn auth. this is because cached inodes
* must remain connected. thus, any replica of srci, must also
* replicate destdn, and possibly straydn, so that srci (and
* destdn->inode) remain connected during the rename.
*
- * to do this, we freeze srci, then master (destdn auth) verifies that
+ * to do this, we freeze srci, then leader (destdn auth) verifies that
* all other nodes have also replciated destdn and straydn. note that
* destdn replicas need not also replicate srci. this only works when
- * destdn is master.
+ * destdn is leader.
*
* This function takes responsibility for the passed mdr.
*/
@@ -8009,27 +8009,27 @@ void Server::handle_client_rename(MDRequestRef& mdr)
if (*p == last) continue; // do it last!
if (mdr->more()->witnessed.count(*p)) {
dout(10) << " already witnessed by mds." << *p << dendl;
- } else if (mdr->more()->waiting_on_slave.count(*p)) {
+ } else if (mdr->more()->waiting_on_peer.count(*p)) {
dout(10) << " already waiting on witness mds." << *p << dendl;
} else {
if (!_rename_prepare_witness(mdr, *p, witnesses, srctrace, desttrace, straydn))
return;
}
}
- if (!mdr->more()->waiting_on_slave.empty())
+ if (!mdr->more()->waiting_on_peer.empty())
return; // we're waiting for a witness.
if (last != MDS_RANK_NONE && mdr->more()->witnessed.count(last) == 0) {
dout(10) << " preparing last witness (srcdn auth)" << dendl;
- ceph_assert(mdr->more()->waiting_on_slave.count(last) == 0);
+ ceph_assert(mdr->more()->waiting_on_peer.count(last) == 0);
_rename_prepare_witness(mdr, last, witnesses, srctrace, desttrace, straydn);
return;
}
- // test hack: bail after slave does prepare, so we can verify it's _live_ rollback.
- if (!mdr->more()->slaves.empty() && !srci->is_dir())
+ // test hack: bail after peer does prepare, so we can verify it's _live_ rollback.
+ if (!mdr->more()->peers.empty() && !srci->is_dir())
ceph_assert(g_conf()->mds_kill_rename_at != 3);
- if (!mdr->more()->slaves.empty() && srci->is_dir())
+ if (!mdr->more()->peers.empty() && srci->is_dir())
ceph_assert(g_conf()->mds_kill_rename_at != 4);
// -- declare now --
@@ -8041,12 +8041,12 @@ void Server::handle_client_rename(MDRequestRef& mdr)
mdlog->start_entry(le);
le->metablob.add_client_req(mdr->reqid, mdr->client_request->get_oldest_client_tid());
if (!mdr->more()->witnessed.empty()) {
- dout(20) << " noting uncommitted_slaves " << mdr->more()->witnessed << dendl;
+ dout(20) << " noting uncommitted_peers " << mdr->more()->witnessed << dendl;
le->reqid = mdr->reqid;
- le->had_slaves = true;
+ le->had_peers = true;
- mdcache->add_uncommitted_master(mdr->reqid, mdr->ls, mdr->more()->witnessed);
+ mdcache->add_uncommitted_leader(mdr->reqid, mdr->ls, mdr->more()->witnessed);
// no need to send frozen auth pin to recovring auth MDS of srci
mdr->more()->is_remote_frozen_authpin = false;
}
@@ -8068,7 +8068,7 @@ void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn,
dout(10) << "_rename_finish " << *mdr << dendl;
if (!mdr->more()->witnessed.empty())
- mdcache->logged_master_update(mdr->reqid);
+ mdcache->logged_leader_update(mdr->reqid);
// apply
_rename_apply(mdr, srcdn, destdn, straydn);
@@ -8079,10 +8079,10 @@ void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn,
CInode *in = destdnl->get_inode();
bool need_eval = mdr->more()->cap_imports.count(in);
- // test hack: test slave commit
- if (!mdr->more()->slaves.empty() && !in->is_dir())
+ // test hack: test peer commit
+ if (!mdr->more()->peers.empty() && !in->is_dir())
ceph_assert(g_conf()->mds_kill_rename_at != 5);
- if (!mdr->more()->slaves.empty() && in->is_dir())
+ if (!mdr->more()->peers.empty() && in->is_dir())
ceph_assert(g_conf()->mds_kill_rename_at != 6);
// bump popularity
@@ -8117,13 +8117,13 @@ bool Server::_rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set<mds_
if (mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(who)) {
dout(10) << "_rename_prepare_witness mds." << who << " is not active" << dendl;
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
mds->wait_for_active_peer(who, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
dout(10) << "_rename_prepare_witness mds." << who << dendl;
- auto req = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREP);
+ auto req = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RENAMEPREP);
req->srcdnpath = filepath(srctrace.front()->get_dir()->ino());
for (auto dn : srctrace)
@@ -8147,8 +8147,8 @@ bool Server::_rename_prepare_witness(MDRequestRef& mdr, mds_rank_t who, set<mds_
req->op_stamp = mdr->get_op_stamp();
mds->send_message_mds(req, who);
- ceph_assert(mdr->more()->waiting_on_slave.count(who) == 0);
- mdr->more()->waiting_on_slave.insert(who);
+ ceph_assert(mdr->more()->waiting_on_peer.count(who) == 0);
+ mdr->more()->waiting_on_peer.insert(who);
return true;
}
@@ -8432,10 +8432,10 @@ void Server::_rename_prepare(MDRequestRef& mdr,
} else if (destdnl->is_remote()) {
if (oldin->is_auth()) {
sr_t *new_srnode = NULL;
- if (mdr->slave_request) {
- if (mdr->slave_request->desti_snapbl.length() > 0) {
+ if (mdr->peer_request) {
+ if (mdr->peer_request->desti_snapbl.length() > 0) {
new_srnode = new sr_t();
- auto p = mdr->slave_request->desti_snapbl.cbegin();
+ auto p = mdr->peer_request->desti_snapbl.cbegin();
decode(*new_srnode, p);
}
} else if (auto& desti_srnode = mdr->more()->desti_srnode) {
@@ -8468,10 +8468,10 @@ void Server::_rename_prepare(MDRequestRef& mdr,
metablob->add_remote_dentry(destdn, true, srcdnl->get_remote_ino(), srcdnl->get_remote_d_type());
if (srci->is_auth() ) { // it's remote
- if (mdr->slave_request) {
- if (mdr->slave_request->srci_snapbl.length() > 0) {
+ if (mdr->peer_request) {
+ if (mdr->peer_request->srci_snapbl.length() > 0) {
sr_t *new_srnode = new sr_t();
- auto p = mdr->slave_request->srci_snapbl.cbegin();
+ auto p = mdr->peer_request->srci_snapbl.cbegin();
decode(*new_srnode, p);
srci->project_snaprealm(new_srnode);
}
@@ -8520,7 +8520,7 @@ void Server::_rename_prepare(MDRequestRef& mdr,
if (srcdn->is_auth()) {
dout(10) << " journaling srcdn " << *srcdn << dendl;
mdcache->journal_cow_dentry(mdr.get(), metablob, srcdn, CEPH_NOSNAP, 0, srcdnl);
- // also journal the inode in case we need do slave rename rollback. It is Ok to add
+ // also journal the inode in case we need do peer rename rollback. It is Ok to add
// both primary and NULL dentries. Because during journal replay, null dentry is
// processed after primary dentry.
if (srcdnl->is_primary() && !srci->is_dir() && !destdn->is_auth())
@@ -8581,10 +8581,10 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
oldin->early_pop_projected_snaprealm();
new_oldin_snaprealm = (oldin->snaprealm && !hadrealm);
} else {
- ceph_assert(mdr->slave_request);
- if (mdr->slave_request->desti_snapbl.length()) {
+ ceph_assert(mdr->peer_request);
+ if (mdr->peer_request->desti_snapbl.length()) {
new_oldin_snaprealm = !oldin->snaprealm;
- oldin->decode_snap_blob(mdr->slave_request->desti_snapbl);
+ oldin->decode_snap_blob(mdr->peer_request->desti_snapbl);
ceph_assert(oldin->snaprealm);
ceph_assert(oldin->snaprealm->have_past_parents_open());
}
@@ -8593,7 +8593,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
destdn->get_dir()->unlink_inode(destdn, false);
straydn->pop_projected_linkage();
- if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
+ if (mdr->is_peer() && !mdr->more()->peer_update_journaled)
ceph_assert(!straydn->is_projected()); // no other projected
// nlink-- targeti
@@ -8605,10 +8605,10 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
destdn->get_dir()->unlink_inode(destdn, false);
if (oldin->is_auth()) {
oldin->pop_and_dirty_projected_inode(mdr->ls);
- } else if (mdr->slave_request) {
- if (mdr->slave_request->desti_snapbl.length() > 0) {
+ } else if (mdr->peer_request) {
+ if (mdr->peer_request->desti_snapbl.length() > 0) {
ceph_assert(oldin->snaprealm);
- oldin->decode_snap_blob(mdr->slave_request->desti_snapbl);
+ oldin->decode_snap_blob(mdr->peer_request->desti_snapbl);
}
} else if (auto& desti_srnode = mdr->more()->desti_srnode) {
delete desti_srnode;
@@ -8630,10 +8630,10 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
in->early_pop_projected_snaprealm();
new_in_snaprealm = (in->snaprealm && !hadrealm);
} else {
- ceph_assert(mdr->slave_request);
- if (mdr->slave_request->srci_snapbl.length()) {
+ ceph_assert(mdr->peer_request);
+ if (mdr->peer_request->srci_snapbl.length()) {
new_in_snaprealm = !in->snaprealm;
- in->decode_snap_blob(mdr->slave_request->srci_snapbl);
+ in->decode_snap_blob(mdr->peer_request->srci_snapbl);
ceph_assert(in->snaprealm);
ceph_assert(in->snaprealm->have_past_parents_open());
}
@@ -8647,7 +8647,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
if (!linkmerge) {
// destdn
destdnl = destdn->pop_projected_linkage();
- if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
+ if (mdr->is_peer() && !mdr->more()->peer_update_journaled)
ceph_assert(!destdn->is_projected()); // no other projected
destdn->link_remote(destdnl, in);
@@ -8656,10 +8656,10 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
// in
if (in->is_auth()) {
in->pop_and_dirty_projected_inode(mdr->ls);
- } else if (mdr->slave_request) {
- if (mdr->slave_request->srci_snapbl.length() > 0) {
+ } else if (mdr->peer_request) {
+ if (mdr->peer_request->srci_snapbl.length() > 0) {
ceph_assert(in->snaprealm);
- in->decode_snap_blob(mdr->slave_request->srci_snapbl);
+ in->decode_snap_blob(mdr->peer_request->srci_snapbl);
}
} else if (auto& srci_srnode = mdr->more()->srci_srnode) {
delete srci_srnode;
@@ -8675,7 +8675,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
destdn->get_dir()->unlink_inode(destdn, false);
}
destdnl = destdn->pop_projected_linkage();
- if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
+ if (mdr->is_peer() && !mdr->more()->peer_update_journaled)
ceph_assert(!destdn->is_projected()); // no other projected
// srcdn inode import?
@@ -8725,7 +8725,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
if (srcdn->is_auth())
srcdn->mark_dirty(mdr->more()->pvmap[srcdn], mdr->ls);
srcdn->pop_projected_linkage();
- if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
+ if (mdr->is_peer() && !mdr->more()->peer_update_journaled)
ceph_assert(!srcdn->is_projected()); // no other projected
// apply remaining projected inodes (nested)
@@ -8751,57 +8751,57 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
// ------------
-// SLAVE
+// PEER
-class C_MDS_SlaveRenamePrep : public ServerLogContext {
+class C_MDS_PeerRenamePrep : public ServerLogContext {
CDentry *srcdn, *destdn, *straydn;
public:
- C_MDS_SlaveRenamePrep(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) :
+ C_MDS_PeerRenamePrep(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) :
ServerLogContext(s, m), srcdn(sr), destdn(de), straydn(st) {}
void finish(int r) override {
- server->_logged_slave_rename(mdr, srcdn, destdn, straydn);
+ server->_logged_peer_rename(mdr, srcdn, destdn, straydn);
}
};
-class C_MDS_SlaveRenameCommit : public ServerContext {
+class C_MDS_PeerRenameCommit : public ServerContext {
MDRequestRef mdr;
CDentry *srcdn, *destdn, *straydn;
public:
- C_MDS_SlaveRenameCommit(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) :
+ C_MDS_PeerRenameCommit(Server *s, MDRequestRef& m, CDentry *sr, CDentry *de, CDentry *st) :
ServerContext(s), mdr(m), srcdn(sr), destdn(de), straydn(st) {}
void finish(int r) override {
- server->_commit_slave_rename(mdr, r, srcdn, destdn, straydn);
+ server->_commit_peer_rename(mdr, r, srcdn, destdn, straydn);
}
};
-class C_MDS_SlaveRenameSessionsFlushed : public ServerContext {
+class C_MDS_PeerRenameSessionsFlushed : public ServerContext {
MDRequestRef mdr;
public:
- C_MDS_SlaveRenameSessionsFlushed(Server *s, MDRequestRef& r) :
+ C_MDS_PeerRenameSessionsFlushed(Server *s, MDRequestRef& r) :
ServerContext(s), mdr(r) {}
void finish(int r) override {
- server->_slave_rename_sessions_flushed(mdr);
+ server->_peer_rename_sessions_flushed(mdr);
}
};
-void Server::handle_slave_rename_prep(MDRequestRef& mdr)
+void Server::handle_peer_rename_prep(MDRequestRef& mdr)
{
- dout(10) << "handle_slave_rename_prep " << *mdr
- << " " << mdr->slave_request->srcdnpath
- << " to " << mdr->slave_request->destdnpath
+ dout(10) << "handle_peer_rename_prep " << *mdr
+ << " " << mdr->peer_request->srcdnpath
+ << " to " << mdr->peer_request->destdnpath
<< dendl;
- if (mdr->slave_request->is_interrupted()) {
- dout(10) << " slave request interrupted, sending noop reply" << dendl;
- auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
+ if (mdr->peer_request->is_interrupted()) {
+ dout(10) << " peer request interrupted, sending noop reply" << dendl;
+ auto reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RENAMEPREPACK);
reply->mark_interrupted();
- mds->send_message_mds(reply, mdr->slave_to_mds);
- mdr->reset_slave_request();
+ mds->send_message_mds(reply, mdr->peer_to_mds);
+ mdr->reset_peer_request();
return;
}
// discover destdn
- filepath destpath(mdr->slave_request->destdnpath);
+ filepath destpath(mdr->peer_request->destdnpath);
dout(10) << " dest " << destpath << dendl;
vector<CDentry*> trace;
CF_MDS_MDRContextFactory cf(mdcache, mdr, false);
@@ -8811,7 +8811,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
if (r > 0) return;
if (r == -ESTALE) {
mdcache->find_ino_peers(destpath.get_ino(), new C_MDS_RetryRequest(mdcache, mdr),
- mdr->slave_to_mds, true);
+ mdr->peer_to_mds, true);
return;
}
ceph_assert(r == 0); // we shouldn't get an error here!
@@ -8822,7 +8822,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
mdr->pin(destdn);
// discover srcdn
- filepath srcpath(mdr->slave_request->srcdnpath);
+ filepath srcpath(mdr->peer_request->srcdnpath);
dout(10) << " src " << srcpath << dendl;
CInode *srci = nullptr;
r = mdcache->path_traverse(mdr, cf, srcpath,
@@ -8845,12 +8845,12 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
if (destdnl->is_primary() && !linkmerge)
ceph_assert(straydn);
- mdr->set_op_stamp(mdr->slave_request->op_stamp);
+ mdr->set_op_stamp(mdr->peer_request->op_stamp);
mdr->more()->srcdn_auth_mds = srcdn->authority().first;
// set up commit waiter (early, to clean up any freezing etc we do)
- if (!mdr->more()->slave_commit)
- mdr->more()->slave_commit = new C_MDS_SlaveRenameCommit(this, mdr, srcdn, destdn, straydn);
+ if (!mdr->more()->peer_commit)
+ mdr->more()->peer_commit = new C_MDS_PeerRenameCommit(this, mdr, srcdn, destdn, straydn);
// am i srcdn auth?
if (srcdn->is_auth()) {
@@ -8880,27 +8880,27 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
/*
* set ambiguous auth for srci
* NOTE: we don't worry about ambiguous cache expire as we do
- * with subtree migrations because all slaves will pin
+ * with subtree migrations because all peers will pin
* srcdn->get_inode() for duration of this rename.
*/
mdr->set_ambiguous_auth(srcdnl->get_inode());
// just mark the source inode as ambiguous auth if more than two MDS are involved.
- // the master will send another OP_RENAMEPREP slave request later.
- if (mdr->slave_request->witnesses.size() > 1) {
+ // the leader will send another OP_RENAMEPREP peer request later.
+ if (mdr->peer_request->witnesses.size() > 1) {
dout(10) << " set srci ambiguous auth; providing srcdn replica list" << dendl;
reply_witness = true;
}
// make sure bystanders have received all lock related messages
for (set<mds_rank_t>::iterator p = srcdnrep.begin(); p != srcdnrep.end(); ++p) {
- if (*p == mdr->slave_to_mds ||
+ if (*p == mdr->peer_to_mds ||
(mds->is_cluster_degraded() &&
!mds->mdsmap->is_clientreplay_or_active_or_stopping(*p)))
continue;
- auto notify = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMENOTIFY);
+ auto notify = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RENAMENOTIFY);
mds->send_message_mds(notify, *p);
- mdr->more()->waiting_on_slave.insert(*p);
+ mdr->more()->waiting_on_peer.insert(*p);
}
// make sure clients have received all cap related messages
@@ -8910,16 +8910,16 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
MDSGatherBuilder gather(g_ceph_context);
flush_client_sessions(export_client_set, gather);
if (gather.has_subs()) {
- mdr->more()->waiting_on_slave.insert(MDS_RANK_NONE);
- gather.set_finisher(new C_MDS_SlaveRenameSessionsFlushed(this, mdr));
+ mdr->more()->waiting_on_peer.insert(MDS_RANK_NONE);
+ gather.set_finisher(new C_MDS_PeerRenameSessionsFlushed(this, mdr));
gather.activate();
}
}
// is witness list sufficient?
for (set<mds_rank_t>::iterator p = srcdnrep.begin(); p != srcdnrep.end(); ++p) {
- if (*p == mdr->slave_to_mds ||
- mdr->slave_request->witnesses.count(*p)) continue;
+ if (*p == mdr->peer_to_mds ||
+ mdr->peer_request->witnesses.count(*p)) continue;
dout(10) << " witness list insufficient; providing srcdn replica list" << dendl;
reply_witness = true;
break;
@@ -8927,16 +8927,16 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
if (reply_witness) {
ceph_assert(!srcdnrep.empty());
- auto reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
+ auto reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RENAMEPREPACK);
reply->witnesses.swap(srcdnrep);
- mds->send_message_mds(reply, mdr->slave_to_mds);
- mdr->reset_slave_request();
+ mds->send_message_mds(reply, mdr->peer_to_mds);
+ mdr->reset_peer_request();
return;
}
dout(10) << " witness list sufficient: includes all srcdn replicas" << dendl;
- if (!mdr->more()->waiting_on_slave.empty()) {
+ if (!mdr->more()->waiting_on_peer.empty()) {
dout(10) << " still waiting for rename notify acks from "
- << mdr->more()->waiting_on_slave << dendl;
+ << mdr->more()->waiting_on_peer << dendl;
return;
}
} else if (srcdnl->is_primary() && srcdn->authority() != destdn->authority()) {
@@ -8978,7 +8978,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
rollback.stray.dirfrag_old_rctime = straydn->get_dir()->get_projected_fnode()->rstat.rctime;
rollback.stray.dname = straydn->get_name();
}
- if (mdr->slave_request->desti_snapbl.length()) {
+ if (mdr->peer_request->desti_snapbl.length()) {
CInode *oldin = destdnl->get_inode();
if (oldin->snaprealm) {
encode(true, rollback.desti_snapbl);
@@ -8987,7 +8987,7 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
encode(false, rollback.desti_snapbl);
}
}
- if (mdr->slave_request->srci_snapbl.length()) {
+ if (mdr->peer_request->srci_snapbl.length()) {
if (srci->snaprealm) {
encode(true, rollback.srci_snapbl);
srci->encode_snap_blob(rollback.srci_snapbl);
@@ -9001,38 +9001,38 @@ void Server::handle_slave_rename_prep(MDRequestRef& mdr)
// journal.
mdr->ls = mdlog->get_current_segment();
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rename_prep", mdr->reqid, mdr->slave_to_mds,
- ESlaveUpdate::OP_PREPARE, ESlaveUpdate::RENAME);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rename_prep", mdr->reqid, mdr->peer_to_mds,
+ EPeerUpdate::OP_PREPARE, EPeerUpdate::RENAME);
mdlog->start_entry(le);
le->rollback = mdr->more()->rollback_bl;
- bufferlist blah; // inode import data... obviously not used if we're the slave
+ bufferlist blah; // inode import data... obviously not used if we're the peer
_rename_prepare(mdr, &le->commit, &blah, srcdn, destdn, straydn);
if (le->commit.empty()) {
dout(10) << " empty metablob, skipping journal" << dendl;
mdlog->cancel_entry(le);
mdr->ls = NULL;
- _logged_slave_rename(mdr, srcdn, destdn, straydn);
+ _logged_peer_rename(mdr, srcdn, destdn, straydn);
} else {
- mdcache->add_uncommitted_slave(mdr->reqid, mdr->ls, mdr->slave_to_mds);
- mdr->more()->slave_update_journaled = true;
- submit_mdlog_entry(le, new C_MDS_SlaveRenamePrep(this, mdr, srcdn, destdn, straydn),
+ mdcache->add_uncommitted_peer(mdr->reqid, mdr->ls, mdr->peer_to_mds);
+ mdr->more()->peer_update_journaled = true;
+ submit_mdlog_entry(le, new C_MDS_PeerRenamePrep(this, mdr, srcdn, destdn, straydn),
mdr, __func__);
mdlog->flush();
}
}
-void Server::_logged_slave_rename(MDRequestRef& mdr,
+void Server::_logged_peer_rename(MDRequestRef& mdr,
CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_logged_slave_rename " << *mdr << dendl;
+ dout(10) << "_logged_peer_rename " << *mdr << dendl;
// prepare ack
- ref_t<MMDSSlaveRequest> reply;
+ ref_t<MMDSPeerRequest> reply;
if (!mdr->aborted) {
- reply = make_message<MMDSSlaveRequest>(mdr->reqid, mdr->attempt, MMDSSlaveRequest::OP_RENAMEPREPACK);
- if (!mdr->more()->slave_update_journaled)
+ reply = make_message<MMDSPeerRequest>(mdr->reqid, mdr->attempt, MMDSPeerRequest::OP_RENAMEPREPACK);
+ if (!mdr->more()->peer_update_journaled)
reply->mark_not_journaled();
}
@@ -9089,11 +9089,11 @@ void Server::_logged_slave_rename(MDRequestRef& mdr,
mds->balancer->hit_inode(destdnl->get_inode(), META_POP_IWR);
// done.
- mdr->reset_slave_request();
+ mdr->reset_peer_request();
mdr->straydn = 0;
if (reply) {
- mds->send_message_mds(reply, mdr->slave_to_mds);
+ mds->send_message_mds(reply, mdr->peer_to_mds);
} else {
ceph_assert(mdr->aborted);
dout(10) << " abort flag set, finishing" << dendl;
@@ -9101,10 +9101,10 @@ void Server::_logged_slave_rename(MDRequestRef& mdr,
}
}
-void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
+void Server::_commit_peer_rename(MDRequestRef& mdr, int r,
CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_commit_slave_rename " << *mdr << " r=" << r << dendl;
+ dout(10) << "_commit_peer_rename " << *mdr << " r=" << r << dendl;
CInode *in = destdn->get_linkage()->get_inode();
@@ -9137,7 +9137,7 @@ void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
decode(peer_imported, bp);
dout(10) << " finishing inode export on " << *in << dendl;
- mdcache->migrator->finish_export_inode(in, mdr->slave_to_mds, peer_imported, finished);
+ mdcache->migrator->finish_export_inode(in, mdr->peer_to_mds, peer_imported, finished);
mds->queue_waiters(finished); // this includes SINGLEAUTH waiters.
// unfreeze
@@ -9151,7 +9151,7 @@ void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
mdr->more()->is_ambiguous_auth = false;
}
- if (straydn && mdr->more()->slave_update_journaled) {
+ if (straydn && mdr->more()->peer_update_journaled) {
CInode *strayin = straydn->get_projected_linkage()->get_inode();
if (strayin && !strayin->snaprealm)
mdcache->clear_dirty_bits_for_stray(strayin);
@@ -9160,36 +9160,36 @@ void Server::_commit_slave_rename(MDRequestRef& mdr, int r,
mds->queue_waiters(finished);
mdr->cleanup();
- if (mdr->more()->slave_update_journaled) {
+ if (mdr->more()->peer_update_journaled) {
// write a commit to the journal
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rename_commit", mdr->reqid,
- mdr->slave_to_mds, ESlaveUpdate::OP_COMMIT,
- ESlaveUpdate::RENAME);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rename_commit", mdr->reqid,
+ mdr->peer_to_mds, EPeerUpdate::OP_COMMIT,
+ EPeerUpdate::RENAME);
mdlog->start_entry(le);
- submit_mdlog_entry(le, new C_MDS_CommittedSlave(this, mdr), mdr, __func__);
+ submit_mdlog_entry(le, new C_MDS_CommittedPeer(this, mdr), mdr, __func__);
mdlog->flush();
} else {
- _committed_slave(mdr);
+ _committed_peer(mdr);
}
} else {
// abort
// rollback_bl may be empty if we froze the inode but had to provide an expanded
- // witness list from the master, and they failed before we tried prep again.
+ // witness list from the leader, and they failed before we tried prep again.
if (mdr->more()->rollback_bl.length()) {
if (mdr->more()->is_inode_exporter) {
dout(10) << " reversing inode export of " << *in << dendl;
in->abort_export();
}
- if (mdcache->is_ambiguous_slave_update(mdr->reqid, mdr->slave_to_mds)) {
- mdcache->remove_ambiguous_slave_update(mdr->reqid, mdr->slave_to_mds);
- // rollback but preserve the slave request
- do_rename_rollback(mdr->more()->rollback_bl, mdr->slave_to_mds, mdr, false);
+ if (mdcache->is_ambiguous_peer_update(mdr->reqid, mdr->peer_to_mds)) {
+ mdcache->remove_ambiguous_peer_update(mdr->reqid, mdr->peer_to_mds);
+ // rollback but preserve the peer request
+ do_rename_rollback(mdr->more()->rollback_bl, mdr->peer_to_mds, mdr, false);
mdr->more()->rollback_bl.clear();
} else
- do_rename_rollback(mdr->more()->rollback_bl, mdr->slave_to_mds, mdr, true);
+ do_rename_rollback(mdr->more()->rollback_bl, mdr->peer_to_mds, mdr, true);
} else {
- dout(10) << " rollback_bl empty, not rollback back rename (master failed after getting extra witnesses?)" << dendl;
+ dout(10) << " rollback_bl empty, not rollback back rename (leader failed after getting extra witnesses?)" << dendl;
// singleauth
if (mdr->more()->is_ambiguous_auth) {
if (srcdn->is_auth())
@@ -9257,7 +9257,7 @@ struct C_MDS_LoggedRenameRollback : public ServerLogContext {
}
};
-void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr,
+void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr,
bool finish_mdr)
{
rename_rollback rollback;
@@ -9266,7 +9266,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
dout(10) << "do_rename_rollback on " << rollback.reqid << dendl;
// need to finish this update before sending resolve to claim the subtree
- mdcache->add_rollback(rollback.reqid, master);
+ mdcache->add_rollback(rollback.reqid, leader);
MutationRef mut(new MutationImpl(nullptr, utime_t(), rollback.reqid));
mut->ls = mds->mdlog->get_current_segment();
@@ -9334,7 +9334,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
// can't use is_auth() in the resolve stage
mds_rank_t whoami = mds->get_nodeid();
- // slave
+ // peer
ceph_assert(!destdn || destdn->authority().first != whoami);
ceph_assert(!straydn || straydn->authority().first != whoami);
@@ -9492,8 +9492,8 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
dout(0) << " desti back to " << *target << dendl;
// journal it
- ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_rename_rollback", rollback.reqid, master,
- ESlaveUpdate::OP_ROLLBACK, ESlaveUpdate::RENAME);
+ EPeerUpdate *le = new EPeerUpdate(mdlog, "peer_rename_rollback", rollback.reqid, leader,
+ EPeerUpdate::OP_ROLLBACK, EPeerUpdate::RENAME);
mdlog->start_entry(le);
if (srcdn && (srcdn->authority().first == whoami || force_journal_src)) {
@@ -9516,7 +9516,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
le->commit.add_primary_dentry(destdn, 0, true);
}
- // slave: no need to journal straydn
+ // peer: no need to journal straydn
if (target && target != in && target->authority().first == whoami) {
ceph_assert(rollback.orig_dest.remote_ino);
@@ -9550,7 +9550,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
mdcache->project_subtree_rename(in, destdir, srcdir);
}
- if (mdr && !mdr->more()->slave_update_journaled) {
+ if (mdr && !mdr->more()->peer_update_journaled) {
ceph_assert(le->commit.empty());
mdlog->cancel_entry(le);
mut->ls = NULL;
@@ -9558,7 +9558,7 @@ void Server::do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef
} else {
ceph_assert(!le->commit.empty());
if (mdr)
- mdr->more()->slave_update_journaled = false;
+ mdr->more()->peer_update_journaled = false;
MDSLogContextBase *fin = new C_MDS_LoggedRenameRollback(this, mut, mdr,
srcdn, srcdnpv, destdn, straydn,
splits, finish_mdr);
@@ -9635,7 +9635,7 @@ void Server::_rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentr
if (finish_mdr || mdr->aborted)
mdcache->request_finish(mdr);
else
- mdr->more()->slave_rolling_back = false;
+ mdr->more()->peer_rolling_back = false;
}
mdcache->finish_rollback(mut->reqid, mdr);
@@ -9643,15 +9643,15 @@ void Server::_rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentr
mut->cleanup();
}
-void Server::handle_slave_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack)
+void Server::handle_peer_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack)
{
- dout(10) << "handle_slave_rename_prep_ack " << *mdr
+ dout(10) << "handle_peer_rename_prep_ack " << *mdr
<< " witnessed by " << ack->get_source()
<< " " << *ack << dendl;
mds_rank_t from = mds_rank_t(ack->get_source().num());
- // note slave
- mdr->more()->slaves.insert(from);
+ // note peer
+ mdr->more()->peers.insert(from);
if (mdr->more()->srcdn_auth_mds == from &&
mdr->more()->is_remote_frozen_authpin &&
!mdr->more()->is_ambiguous_auth) {
@@ -9661,11 +9661,11 @@ void Server::handle_slave_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSl
// witnessed? or add extra witnesses?
ceph_assert(mdr->more()->witnessed.count(from) == 0);
if (ack->is_interrupted()) {
- dout(10) << " slave request interrupted, noop" << dendl;
+ dout(10) << " peer request interrupted, noop" << dendl;
} else if (ack->witnesses.empty()) {
mdr->more()->witnessed.insert(from);
if (!ack->is_not_journaled())
- mdr->more()->has_journaled_slaves = true;
+ mdr->more()->has_journaled_peers = true;
} else {
dout(10) << " extra witnesses (srcdn replicas) are " << ack->witnesses << dendl;
mdr->more()->extra_witnesses = ack->witnesses;
@@ -9680,47 +9680,47 @@ void Server::handle_slave_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSl
}
// remove from waiting list
- ceph_assert(mdr->more()->waiting_on_slave.count(from));
- mdr->more()->waiting_on_slave.erase(from);
+ ceph_assert(mdr->more()->waiting_on_peer.count(from));
+ mdr->more()->waiting_on_peer.erase(from);
- if (mdr->more()->waiting_on_slave.empty())
+ if (mdr->more()->waiting_on_peer.empty())
dispatch_client_request(mdr); // go again!
else
- dout(10) << "still waiting on slaves " << mdr->more()->waiting_on_slave << dendl;
+ dout(10) << "still waiting on peers " << mdr->more()->waiting_on_peer << dendl;
}
-void Server::handle_slave_rename_notify_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack)
+void Server::handle_peer_rename_notify_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack)
{
- dout(10) << "handle_slave_rename_notify_ack " << *mdr << " from mds."
+ dout(10) << "handle_peer_rename_notify_ack " << *mdr << " from mds."
<< ack->get_source() << dendl;
- ceph_assert(mdr->is_slave());
+ ceph_assert(mdr->is_peer());
mds_rank_t from = mds_rank_t(ack->get_source().num());
- if (mdr->more()->waiting_on_slave.count(from)) {
- mdr->more()->waiting_on_slave.erase(from);
+ if (mdr->more()->waiting_on_peer.count(from)) {
+ mdr->more()->waiting_on_peer.erase(from);
- if (mdr->more()->waiting_on_slave.empty()) {
- if (mdr->slave_request)
- dispatch_slave_request(mdr);
+ if (mdr->more()->waiting_on_peer.empty()) {
+ if (mdr->peer_request)
+ dispatch_peer_request(mdr);
} else
dout(10) << " still waiting for rename notify acks from "
- << mdr->more()->waiting_on_slave << dendl;
+ << mdr->more()->waiting_on_peer << dendl;
}
}
-void Server::_slave_rename_sessions_flushed(MDRequestRef& mdr)
+void Server::_peer_rename_sessions_flushed(MDRequestRef& mdr)
{
- dout(10) << "_slave_rename_sessions_flushed " << *mdr << dendl;
+ dout(10) << "_peer_rename_sessions_flushed " << *mdr << dendl;
- if (mdr->more()->waiting_on_slave.count(MDS_RANK_NONE)) {
- mdr->more()->waiting_on_slave.erase(MDS_RANK_NONE);
+ if (mdr->more()->waiting_on_peer.count(MDS_RANK_NONE)) {
+ mdr->more()->waiting_on_peer.erase(MDS_RANK_NONE);
- if (mdr->more()->waiting_on_slave.empty()) {
- if (mdr->slave_request)
- dispatch_slave_request(mdr);
+ if (mdr->more()->waiting_on_peer.empty()) {
+ if (mdr->peer_request)
+ dispatch_peer_request(mdr);
} else
dout(10) << " still waiting for rename notify acks from "
- << mdr->more()->waiting_on_slave << dendl;
+ << mdr->more()->waiting_on_peer << dendl;
}
}
diff --git a/src/mds/Server.h b/src/mds/Server.h
index 054090e18dd..30cbd19d8a4 100644
--- a/src/mds/Server.h
+++ b/src/mds/Server.h
@@ -45,10 +45,10 @@ class MetricsHandler;
enum {
l_mdss_first = 1000,
l_mdss_dispatch_client_request,
- l_mdss_dispatch_slave_request,
+ l_mdss_dispatch_peer_request,
l_mdss_handle_client_request,
l_mdss_handle_client_session,
- l_mdss_handle_slave_request,
+ l_mdss_handle_peer_request,
l_mdss_req_create_latency,
l_mdss_req_getattr_latency,
l_mdss_req_getfilelock_latency,
@@ -165,11 +165,11 @@ public:
void set_trace_dist(const ref_t<MClientReply> &reply, CInode *in, CDentry *dn,
MDRequestRef& mdr);
- void handle_slave_request(const cref_t<MMDSSlaveRequest> &m);
- void handle_slave_request_reply(const cref_t<MMDSSlaveRequest> &m);
- void dispatch_slave_request(MDRequestRef& mdr);
- void handle_slave_auth_pin(MDRequestRef& mdr);
- void handle_slave_auth_pin_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack);
+ void handle_peer_request(const cref_t<MMDSPeerRequest> &m);
+ void handle_peer_request_reply(const cref_t<MMDSPeerRequest> &m);
+ void dispatch_peer_request(MDRequestRef& mdr);
+ void handle_peer_auth_pin(MDRequestRef& mdr);
+ void handle_peer_auth_pin_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack);
// some helpers
bool check_fragment_space(MDRequestRef& mdr, CDir *in);
@@ -242,12 +242,12 @@ public:
void _link_remote_finish(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targeti,
version_t);
- void handle_slave_link_prep(MDRequestRef& mdr);
- void _logged_slave_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm);
- void _commit_slave_link(MDRequestRef& mdr, int r, CInode *targeti);
- void _committed_slave(MDRequestRef& mdr); // use for rename, too
- void handle_slave_link_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &m);
- void do_link_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr);
+ void handle_peer_link_prep(MDRequestRef& mdr);
+ void _logged_peer_link(MDRequestRef& mdr, CInode *targeti, bool adjust_realm);
+ void _commit_peer_link(MDRequestRef& mdr, int r, CInode *targeti);
+ void _committed_peer(MDRequestRef& mdr); // use for rename, too
+ void handle_peer_link_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &m);
+ void do_link_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr);
void _link_rollback_finish(MutationRef& mut, MDRequestRef& mdr,
map<client_t,ref_t<MClientSnap>>& split);
@@ -260,11 +260,11 @@ public:
CDentry *dn, CDentry *straydn,
version_t);
bool _rmdir_prepare_witness(MDRequestRef& mdr, mds_rank_t who, vector<CDentry*>& trace, CDentry *straydn);
- void handle_slave_rmdir_prep(MDRequestRef& mdr);
- void _logged_slave_rmdir(MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn);
- void _commit_slave_rmdir(MDRequestRef& mdr, int r, CDentry *straydn);
- void handle_slave_rmdir_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &ack);
- void do_rmdir_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr);
+ void handle_peer_rmdir_prep(MDRequestRef& mdr);
+ void _logged_peer_rmdir(MDRequestRef& mdr, CDentry *srcdn, CDentry *straydn);
+ void _commit_peer_rmdir(MDRequestRef& mdr, int r, CDentry *straydn);
+ void handle_peer_rmdir_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &ack);
+ void do_rmdir_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr);
void _rmdir_rollback_finish(MDRequestRef& mdr, metareqid_t reqid, CDentry *dn, CDentry *straydn);
// rename
@@ -294,13 +294,13 @@ public:
void _rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
// slaving
- void handle_slave_rename_prep(MDRequestRef& mdr);
- void handle_slave_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &m);
- void handle_slave_rename_notify_ack(MDRequestRef& mdr, const cref_t<MMDSSlaveRequest> &m);
- void _slave_rename_sessions_flushed(MDRequestRef& mdr);
- void _logged_slave_rename(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
- void _commit_slave_rename(MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
- void do_rename_rollback(bufferlist &rbl, mds_rank_t master, MDRequestRef& mdr, bool finish_mdr=false);
+ void handle_peer_rename_prep(MDRequestRef& mdr);
+ void handle_peer_rename_prep_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &m);
+ void handle_peer_rename_notify_ack(MDRequestRef& mdr, const cref_t<MMDSPeerRequest> &m);
+ void _peer_rename_sessions_flushed(MDRequestRef& mdr);
+ void _logged_peer_rename(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
+ void _commit_peer_rename(MDRequestRef& mdr, int r, CDentry *srcdn, CDentry *destdn, CDentry *straydn);
+ void do_rename_rollback(bufferlist &rbl, mds_rank_t leader, MDRequestRef& mdr, bool finish_mdr=false);
void _rename_rollback_finish(MutationRef& mut, MDRequestRef& mdr, CDentry *srcdn, version_t srcdnpv,
CDentry *destdn, CDentry *staydn, map<client_t,ref_t<MClientSnap>> splits[2],
bool finish_mdr);
diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h
index bef9dd76dc9..dd436790567 100644
--- a/src/mds/SimpleLock.h
+++ b/src/mds/SimpleLock.h
@@ -398,7 +398,7 @@ public:
void get_xlock(MutationRef who, client_t client) {
ceph_assert(get_xlock_by() == MutationRef());
ceph_assert(state == LOCK_XLOCK || is_locallock() ||
- state == LOCK_LOCK /* if we are a slave */);
+ state == LOCK_LOCK /* if we are a peer */);
parent->get(MDSCacheObject::PIN_LOCK);
more()->num_xlock++;
more()->xlock_by = who;
@@ -407,7 +407,7 @@ public:
void set_xlock_done() {
ceph_assert(more()->xlock_by);
ceph_assert(state == LOCK_XLOCK || is_locallock() ||
- state == LOCK_LOCK /* if we are a slave */);
+ state == LOCK_LOCK /* if we are a peer */);
if (!is_locallock())
state = LOCK_XLOCKDONE;
more()->xlock_by.reset();
@@ -415,7 +415,7 @@ public:
void put_xlock() {
ceph_assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE ||
state == LOCK_XLOCKSNAP || state == LOCK_LOCK_XLOCK ||
- state == LOCK_LOCK || /* if we are a master of a slave */
+ state == LOCK_LOCK || /* if we are a leader of a peer */
is_locallock());
--more()->num_xlock;
parent->put(MDSCacheObject::PIN_LOCK);
diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h
index 52bcce20e19..29bff82128e 100644
--- a/src/mds/events/EMetaBlob.h
+++ b/src/mds/events/EMetaBlob.h
@@ -29,7 +29,7 @@
class MDSRank;
class MDLog;
class LogSegment;
-struct MDSlaveUpdate;
+struct MDPeerUpdate;
/*
* a bunch of metadata in the journal
@@ -590,7 +590,7 @@ private:
}
void update_segment(LogSegment *ls);
- void replay(MDSRank *mds, LogSegment *ls, MDSlaveUpdate *su=NULL);
+ void replay(MDSRank *mds, LogSegment *ls, MDPeerUpdate *su=NULL);
};
WRITE_CLASS_ENCODER_FEATURES(EMetaBlob)
WRITE_CLASS_ENCODER_FEATURES(EMetaBlob::fullbit)
diff --git a/src/mds/events/ESlaveUpdate.h b/src/mds/events/EPeerUpdate.h
index 674166fbdfe..38f53735eb1 100644
--- a/src/mds/events/ESlaveUpdate.h
+++ b/src/mds/events/EPeerUpdate.h
@@ -1,4 +1,4 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
@@ -7,13 +7,13 @@
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
+ * License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
-#ifndef CEPH_MDS_ESLAVEUPDATE_H
-#define CEPH_MDS_ESLAVEUPDATE_H
+#ifndef CEPH_MDS_EPEERUPDATE_H
+#define CEPH_MDS_EPEERUPDATE_H
#include <string_view>
@@ -21,10 +21,10 @@
#include "EMetaBlob.h"
/*
- * rollback records, for remote/slave updates, which may need to be manually
- * rolled back during journal replay. (or while active if master fails, but in
+ * rollback records, for remote/peer updates, which may need to be manually
+ * rolled back during journal replay. (or while active if leader fails, but in
* that case these records aren't needed.)
- */
+ */
struct link_rollback {
metareqid_t reqid;
inodeno_t ino;
@@ -73,7 +73,7 @@ struct rename_rollback {
string dname;
char remote_d_type;
utime_t old_ctime;
-
+
drec() : remote_d_type((char)S_IFREG) {}
void encode(bufferlist& bl) const;
@@ -99,19 +99,19 @@ WRITE_CLASS_ENCODER(rename_rollback::drec)
WRITE_CLASS_ENCODER(rename_rollback)
-class ESlaveUpdate : public LogEvent {
+class EPeerUpdate : public LogEvent {
public:
const static int OP_PREPARE = 1;
const static int OP_COMMIT = 2;
const static int OP_ROLLBACK = 3;
-
+
const static int LINK = 1;
const static int RENAME = 2;
const static int RMDIR = 3;
/*
* we journal a rollback metablob that contains the unmodified metadata
- * too, because we may be updating previously dirty metadata, which
+ * too, because we may be updating previously dirty metadata, which
* will allow old log segments to be trimmed. if we end of rolling back,
* those updates could be lost.. so we re-journal the unmodified metadata,
* and replay will apply _either_ commit or rollback.
@@ -120,18 +120,18 @@ public:
bufferlist rollback;
string type;
metareqid_t reqid;
- mds_rank_t master;
+ mds_rank_t leader;
__u8 op; // prepare, commit, abort
__u8 origop; // link | rename
- ESlaveUpdate() : LogEvent(EVENT_SLAVEUPDATE), master(0), op(0), origop(0) { }
- ESlaveUpdate(MDLog *mdlog, std::string_view s, metareqid_t ri, int mastermds, int o, int oo) :
- LogEvent(EVENT_SLAVEUPDATE),
+ EPeerUpdate() : LogEvent(EVENT_PEERUPDATE), leader(0), op(0), origop(0) { }
+ EPeerUpdate(MDLog *mdlog, std::string_view s, metareqid_t ri, int leadermds, int o, int oo) :
+ LogEvent(EVENT_PEERUPDATE),
type(s),
reqid(ri),
- master(mastermds),
+ leader(leadermds),
op(o), origop(oo) { }
-
+
void print(ostream& out) const override {
if (type.length())
out << type << " ";
@@ -139,7 +139,7 @@ public:
if (origop == LINK) out << " link";
if (origop == RENAME) out << " rename";
out << " " << reqid;
- out << " for mds." << master;
+ out << " for mds." << leader;
out << commit;
}
@@ -148,10 +148,10 @@ public:
void encode(bufferlist& bl, uint64_t features) const override;
void decode(bufferlist::const_iterator& bl) override;
void dump(Formatter *f) const override;
- static void generate_test_instances(std::list<ESlaveUpdate*>& ls);
+ static void generate_test_instances(std::list<EPeerUpdate*>& ls);
void replay(MDSRank *mds) override;
};
-WRITE_CLASS_ENCODER_FEATURES(ESlaveUpdate)
+WRITE_CLASS_ENCODER_FEATURES(EPeerUpdate)
#endif
diff --git a/src/mds/events/EUpdate.h b/src/mds/events/EUpdate.h
index b9f173f8283..d320014a1f0 100644
--- a/src/mds/events/EUpdate.h
+++ b/src/mds/events/EUpdate.h
@@ -27,12 +27,12 @@ public:
bufferlist client_map;
version_t cmapv;
metareqid_t reqid;
- bool had_slaves;
+ bool had_peers;
- EUpdate() : LogEvent(EVENT_UPDATE), cmapv(0), had_slaves(false) { }
+ EUpdate() : LogEvent(EVENT_UPDATE), cmapv(0), had_peers(false) { }
EUpdate(MDLog *mdlog, std::string_view s) :
LogEvent(EVENT_UPDATE),
- type(s), cmapv(0), had_slaves(false) { }
+ type(s), cmapv(0), had_peers(false) { }
void print(ostream& out) const override {
if (type.length())
diff --git a/src/mds/journal.cc b/src/mds/journal.cc
index 42139d96f20..1b18d9b044e 100644
--- a/src/mds/journal.cc
+++ b/src/mds/journal.cc
@@ -23,7 +23,7 @@
#include "events/ENoOp.h"
#include "events/EUpdate.h"
-#include "events/ESlaveUpdate.h"
+#include "events/EPeerUpdate.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
#include "events/EPurged.h"
@@ -111,20 +111,20 @@ void LogSegment::try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int o
}
}
- // master ops with possibly uncommitted slaves
- for (set<metareqid_t>::iterator p = uncommitted_masters.begin();
- p != uncommitted_masters.end();
+ // leader ops with possibly uncommitted peers
+ for (set<metareqid_t>::iterator p = uncommitted_leaders.begin();
+ p != uncommitted_leaders.end();
++p) {
- dout(10) << "try_to_expire waiting for slaves to ack commit on " << *p << dendl;
- mds->mdcache->wait_for_uncommitted_master(*p, gather_bld.new_sub());
+ dout(10) << "try_to_expire waiting for peers to ack commit on " << *p << dendl;
+ mds->mdcache->wait_for_uncommitted_leader(*p, gather_bld.new_sub());
}
- // slave ops that haven't been committed
- for (set<metareqid_t>::iterator p = uncommitted_slaves.begin();
- p != uncommitted_slaves.end();
+ // peer ops that haven't been committed
+ for (set<metareqid_t>::iterator p = uncommitted_peers.begin();
+ p != uncommitted_peers.end();
++p) {
- dout(10) << "try_to_expire waiting for master to ack OP_FINISH on " << *p << dendl;
- mds->mdcache->wait_for_uncommitted_slave(*p, gather_bld.new_sub());
+ dout(10) << "try_to_expire waiting for leader to ack OP_FINISH on " << *p << dendl;
+ mds->mdcache->wait_for_uncommitted_peer(*p, gather_bld.new_sub());
}
// uncommitted fragments
@@ -1072,7 +1072,7 @@ void EMetaBlob::generate_test_instances(std::list<EMetaBlob*>& ls)
ls.push_back(new EMetaBlob());
}
-void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
+void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDPeerUpdate *peerup)
{
dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps by " << client_name << dendl;
@@ -1364,15 +1364,15 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
if (olddir) {
if (olddir->authority() != CDIR_AUTH_UNDEF &&
renamed_diri->authority() == CDIR_AUTH_UNDEF) {
- ceph_assert(slaveup); // auth to non-auth, must be slave prepare
+ ceph_assert(peerup); // auth to non-auth, must be peer prepare
frag_vec_t leaves;
renamed_diri->dirfragtree.get_leaves(leaves);
for (const auto& leaf : leaves) {
CDir *dir = renamed_diri->get_dirfrag(leaf);
ceph_assert(dir);
if (dir->get_dir_auth() == CDIR_AUTH_UNDEF)
- // preserve subtree bound until slave commit
- slaveup->olddirs.insert(dir->inode);
+ // preserve subtree bound until peer commit
+ peerup->olddirs.insert(dir->inode);
else
dir->state_set(CDir::STATE_AUTH);
@@ -1386,8 +1386,8 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
// see if we can discard the subtree we renamed out of
CDir *root = mds->mdcache->get_subtree_root(olddir);
if (root->get_dir_auth() == CDIR_AUTH_UNDEF) {
- if (slaveup) // preserve the old dir until slave commit
- slaveup->olddirs.insert(olddir->inode);
+ if (peerup) // preserve the old dir until peer commit
+ peerup->olddirs.insert(olddir->inode);
else
mds->mdcache->try_trim_non_auth_subtree(root);
}
@@ -1432,8 +1432,8 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
dout(10) << " unlinked set contains " << unlinked << dendl;
for (map<CInode*, CDir*>::iterator p = unlinked.begin(); p != unlinked.end(); ++p) {
CInode *in = p->first;
- if (slaveup) { // preserve unlinked inodes until slave commit
- slaveup->unlinked.insert(in);
+ if (peerup) { // preserve unlinked inodes until peer commit
+ peerup->unlinked.insert(in);
if (in->snaprealm)
in->snaprealm->adjust_parent();
} else
@@ -2074,7 +2074,7 @@ void EUpdate::encode(bufferlist &bl, uint64_t features) const
encode(client_map, bl);
encode(cmapv, bl);
encode(reqid, bl);
- encode(had_slaves, bl);
+ encode(had_peers, bl);
ENCODE_FINISH(bl);
}
@@ -2089,7 +2089,7 @@ void EUpdate::decode(bufferlist::const_iterator &bl)
if (struct_v >= 3)
decode(cmapv, bl);
decode(reqid, bl);
- decode(had_slaves, bl);
+ decode(had_peers, bl);
DECODE_FINISH(bl);
}
@@ -2103,7 +2103,7 @@ void EUpdate::dump(Formatter *f) const
f->dump_int("client map length", client_map.length());
f->dump_int("client map version", cmapv);
f->dump_stream("reqid") << reqid;
- f->dump_string("had slaves", had_slaves ? "true" : "false");
+ f->dump_string("had peers", had_peers ? "true" : "false");
}
void EUpdate::generate_test_instances(std::list<EUpdate*>& ls)
@@ -2120,8 +2120,8 @@ void EUpdate::update_segment()
if (client_map.length())
segment->sessionmapv = cmapv;
- if (had_slaves)
- segment->uncommitted_masters.insert(reqid);
+ if (had_peers)
+ segment->uncommitted_leaders.insert(reqid);
}
void EUpdate::replay(MDSRank *mds)
@@ -2129,11 +2129,11 @@ void EUpdate::replay(MDSRank *mds)
auto&& segment = get_segment();
metablob.replay(mds, segment);
- if (had_slaves) {
- dout(10) << "EUpdate.replay " << reqid << " had slaves, expecting a matching ECommitted" << dendl;
- segment->uncommitted_masters.insert(reqid);
- set<mds_rank_t> slaves;
- mds->mdcache->add_uncommitted_master(reqid, segment, slaves, true);
+ if (had_peers) {
+ dout(10) << "EUpdate.replay " << reqid << " had peers, expecting a matching ECommitted" << dendl;
+ segment->uncommitted_leaders.insert(reqid);
+ set<mds_rank_t> peers;
+ mds->mdcache->add_uncommitted_leader(reqid, segment, peers, true);
}
if (client_map.length()) {
@@ -2237,10 +2237,10 @@ void EOpen::replay(MDSRank *mds)
void ECommitted::replay(MDSRank *mds)
{
- if (mds->mdcache->uncommitted_masters.count(reqid)) {
+ if (mds->mdcache->uncommitted_leaders.count(reqid)) {
dout(10) << "ECommitted.replay " << reqid << dendl;
- mds->mdcache->uncommitted_masters[reqid].ls->uncommitted_masters.erase(reqid);
- mds->mdcache->uncommitted_masters.erase(reqid);
+ mds->mdcache->uncommitted_leaders[reqid].ls->uncommitted_leaders.erase(reqid);
+ mds->mdcache->uncommitted_leaders.erase(reqid);
} else {
dout(10) << "ECommitted.replay " << reqid << " -- didn't see original op" << dendl;
}
@@ -2277,7 +2277,7 @@ void ECommitted::generate_test_instances(std::list<ECommitted*>& ls)
}
// -----------------------
-// ESlaveUpdate
+// EPeerUpdate
void link_rollback::encode(bufferlist &bl) const
{
@@ -2469,13 +2469,13 @@ void rename_rollback::generate_test_instances(std::list<rename_rollback*>& ls)
ls.back()->stray.remote_d_type = IFTODT(S_IFREG);
}
-void ESlaveUpdate::encode(bufferlist &bl, uint64_t features) const
+void EPeerUpdate::encode(bufferlist &bl, uint64_t features) const
{
ENCODE_START(3, 3, bl);
encode(stamp, bl);
encode(type, bl);
encode(reqid, bl);
- encode(master, bl);
+ encode(leader, bl);
encode(op, bl);
encode(origop, bl);
encode(commit, bl, features);
@@ -2483,14 +2483,14 @@ void ESlaveUpdate::encode(bufferlist &bl, uint64_t features) const
ENCODE_FINISH(bl);
}
-void ESlaveUpdate::decode(bufferlist::const_iterator &bl)
+void EPeerUpdate::decode(bufferlist::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
if (struct_v >= 2)
decode(stamp, bl);
decode(type, bl);
decode(reqid, bl);
- decode(master, bl);
+ decode(leader, bl);
decode(op, bl);
decode(origop, bl);
decode(commit, bl);
@@ -2498,7 +2498,7 @@ void ESlaveUpdate::decode(bufferlist::const_iterator &bl)
DECODE_FINISH(bl);
}
-void ESlaveUpdate::dump(Formatter *f) const
+void EPeerUpdate::dump(Formatter *f) const
{
f->open_object_section("metablob");
commit.dump(f);
@@ -2507,43 +2507,43 @@ void ESlaveUpdate::dump(Formatter *f) const
f->dump_int("rollback length", rollback.length());
f->dump_string("type", type);
f->dump_stream("metareqid") << reqid;
- f->dump_int("master", master);
+ f->dump_int("leader", leader);
f->dump_int("op", op);
f->dump_int("original op", origop);
}
-void ESlaveUpdate::generate_test_instances(std::list<ESlaveUpdate*>& ls)
+void EPeerUpdate::generate_test_instances(std::list<EPeerUpdate*>& ls)
{
- ls.push_back(new ESlaveUpdate());
+ ls.push_back(new EPeerUpdate());
}
-void ESlaveUpdate::replay(MDSRank *mds)
+void EPeerUpdate::replay(MDSRank *mds)
{
- MDSlaveUpdate *su;
+ MDPeerUpdate *su;
auto&& segment = get_segment();
switch (op) {
- case ESlaveUpdate::OP_PREPARE:
- dout(10) << "ESlaveUpdate.replay prepare " << reqid << " for mds." << master
+ case EPeerUpdate::OP_PREPARE:
+ dout(10) << "EPeerUpdate.replay prepare " << reqid << " for mds." << leader
<< ": applying commit, saving rollback info" << dendl;
- su = new MDSlaveUpdate(origop, rollback);
+ su = new MDPeerUpdate(origop, rollback);
commit.replay(mds, segment, su);
- mds->mdcache->add_uncommitted_slave(reqid, segment, master, su);
+ mds->mdcache->add_uncommitted_peer(reqid, segment, leader, su);
break;
- case ESlaveUpdate::OP_COMMIT:
- dout(10) << "ESlaveUpdate.replay commit " << reqid << " for mds." << master << dendl;
- mds->mdcache->finish_uncommitted_slave(reqid, false);
+ case EPeerUpdate::OP_COMMIT:
+ dout(10) << "EPeerUpdate.replay commit " << reqid << " for mds." << leader << dendl;
+ mds->mdcache->finish_uncommitted_peer(reqid, false);
break;
- case ESlaveUpdate::OP_ROLLBACK:
- dout(10) << "ESlaveUpdate.replay abort " << reqid << " for mds." << master
+ case EPeerUpdate::OP_ROLLBACK:
+ dout(10) << "EPeerUpdate.replay abort " << reqid << " for mds." << leader
<< ": applying rollback commit blob" << dendl;
commit.replay(mds, segment);
- mds->mdcache->finish_uncommitted_slave(reqid, false);
+ mds->mdcache->finish_uncommitted_peer(reqid, false);
break;
default:
- mds->clog->error() << "invalid op in ESlaveUpdate";
+ mds->clog->error() << "invalid op in EPeerUpdate";
mds->damaged();
ceph_abort(); // Should be unreachable because damaged() calls respawn()
}
diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h
index b0a87af1e3b..09f304ae348 100644
--- a/src/messages/MMDSCacheRejoin.h
+++ b/src/messages/MMDSCacheRejoin.h
@@ -155,11 +155,11 @@ public:
WRITE_CLASS_ENCODER(lock_bls)
// authpins, xlocks
- struct slave_reqid {
+ struct peer_reqid {
metareqid_t reqid;
__u32 attempt;
- slave_reqid() : attempt(0) {}
- slave_reqid(const metareqid_t& r, __u32 a)
+ peer_reqid() : attempt(0) {}
+ peer_reqid(const metareqid_t& r, __u32 a)
: reqid(r), attempt(a) {}
void encode(ceph::buffer::list& bl) const {
using ceph::encode;
@@ -202,16 +202,16 @@ public:
encode(bl, inode_base);
}
void add_inode_authpin(vinodeno_t ino, const metareqid_t& ri, __u32 attempt) {
- authpinned_inodes[ino].push_back(slave_reqid(ri, attempt));
+ authpinned_inodes[ino].push_back(peer_reqid(ri, attempt));
}
void add_inode_frozen_authpin(vinodeno_t ino, const metareqid_t& ri, __u32 attempt) {
- frozen_authpin_inodes[ino] = slave_reqid(ri, attempt);
+ frozen_authpin_inodes[ino] = peer_reqid(ri, attempt);
}
void add_inode_xlock(vinodeno_t ino, int lt, const metareqid_t& ri, __u32 attempt) {
- xlocked_inodes[ino][lt] = slave_reqid(ri, attempt);
+ xlocked_inodes[ino][lt] = peer_reqid(ri, attempt);
}
void add_inode_wrlock(vinodeno_t ino, int lt, const metareqid_t& ri, __u32 attempt) {
- wrlocked_inodes[ino][lt].push_back(slave_reqid(ri, attempt));
+ wrlocked_inodes[ino][lt].push_back(peer_reqid(ri, attempt));
}
void add_scatterlock_state(CInode *in) {
@@ -246,11 +246,11 @@ public:
}
void add_dentry_authpin(dirfrag_t df, std::string_view dname, snapid_t last,
const metareqid_t& ri, __u32 attempt) {
- authpinned_dentries[df][string_snap_t(dname, last)].push_back(slave_reqid(ri, attempt));
+ authpinned_dentries[df][string_snap_t(dname, last)].push_back(peer_reqid(ri, attempt));
}
void add_dentry_xlock(dirfrag_t df, std::string_view dname, snapid_t last,
const metareqid_t& ri, __u32 attempt) {
- xlocked_dentries[df][string_snap_t(dname, last)] = slave_reqid(ri, attempt);
+ xlocked_dentries[df][string_snap_t(dname, last)] = peer_reqid(ri, attempt);
}
// -- encoding --
@@ -330,12 +330,12 @@ public:
ceph::buffer::list inode_locks;
std::map<dirfrag_t, ceph::buffer::list> dirfrag_bases;
- std::map<vinodeno_t, std::list<slave_reqid> > authpinned_inodes;
- std::map<vinodeno_t, slave_reqid> frozen_authpin_inodes;
- std::map<vinodeno_t, std::map<__s32, slave_reqid> > xlocked_inodes;
- std::map<vinodeno_t, std::map<__s32, std::list<slave_reqid> > > wrlocked_inodes;
- std::map<dirfrag_t, std::map<string_snap_t, std::list<slave_reqid> > > authpinned_dentries;
- std::map<dirfrag_t, std::map<string_snap_t, slave_reqid> > xlocked_dentries;
+ std::map<vinodeno_t, std::list<peer_reqid> > authpinned_inodes;
+ std::map<vinodeno_t, peer_reqid> frozen_authpin_inodes;
+ std::map<vinodeno_t, std::map<__s32, peer_reqid> > xlocked_inodes;
+ std::map<vinodeno_t, std::map<__s32, std::list<peer_reqid> > > wrlocked_inodes;
+ std::map<dirfrag_t, std::map<string_snap_t, std::list<peer_reqid> > > authpinned_dentries;
+ std::map<dirfrag_t, std::map<string_snap_t, peer_reqid> > xlocked_dentries;
private:
template<class T, typename... Args>
@@ -354,9 +354,9 @@ WRITE_CLASS_ENCODER(MMDSCacheRejoin::dirfrag_strong)
WRITE_CLASS_ENCODER(MMDSCacheRejoin::dn_strong)
WRITE_CLASS_ENCODER(MMDSCacheRejoin::dn_weak)
WRITE_CLASS_ENCODER(MMDSCacheRejoin::lock_bls)
-WRITE_CLASS_ENCODER(MMDSCacheRejoin::slave_reqid)
+WRITE_CLASS_ENCODER(MMDSCacheRejoin::peer_reqid)
-inline std::ostream& operator<<(std::ostream& out, const MMDSCacheRejoin::slave_reqid& r) {
+inline std::ostream& operator<<(std::ostream& out, const MMDSCacheRejoin::peer_reqid& r) {
return out << r.reqid << '.' << r.attempt;
}
diff --git a/src/messages/MMDSSlaveRequest.h b/src/messages/MMDSPeerRequest.h
index 4c1f2a6c287..11b90247d3c 100644
--- a/src/messages/MMDSSlaveRequest.h
+++ b/src/messages/MMDSPeerRequest.h
@@ -1,4 +1,4 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
@@ -7,19 +7,19 @@
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
+ * License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
- *
+ *
*/
-#ifndef CEPH_MMDSSLAVEREQUEST_H
-#define CEPH_MMDSSLAVEREQUEST_H
+#ifndef CEPH_MMDSPEERREQUEST_H
+#define CEPH_MMDSPEERREQUEST_H
#include "mds/mdstypes.h"
#include "messages/MMDSOp.h"
-class MMDSSlaveRequest : public MMDSOp {
+class MMDSPeerRequest : public MMDSOp {
static constexpr int HEAD_VERSION = 1;
static constexpr int COMPAT_VERSION = 1;
public:
@@ -56,7 +56,7 @@ public:
static const char *get_opname(int o) {
- switch (o) {
+ switch (o) {
case OP_XLOCK: return "xlock";
case OP_XLOCKACK: return "xlock_ack";
case OP_UNXLOCK: return "unxlock";
@@ -110,7 +110,7 @@ public:
// for locking
__u16 lock_type; // lock object type
MDSCacheObjectInfo object_info;
-
+
// for authpins
std::vector<MDSCacheObjectInfo> authpins;
@@ -165,12 +165,12 @@ public:
ceph::buffer::list& get_lock_data() { return inode_export; }
protected:
- MMDSSlaveRequest() : MMDSOp{MSG_MDS_SLAVE_REQUEST, HEAD_VERSION, COMPAT_VERSION} { }
- MMDSSlaveRequest(metareqid_t ri, __u32 att, int o) :
- MMDSOp{MSG_MDS_SLAVE_REQUEST, HEAD_VERSION, COMPAT_VERSION},
+ MMDSPeerRequest() : MMDSOp{MSG_MDS_PEER_REQUEST, HEAD_VERSION, COMPAT_VERSION} { }
+ MMDSPeerRequest(metareqid_t ri, __u32 att, int o) :
+ MMDSOp{MSG_MDS_PEER_REQUEST, HEAD_VERSION, COMPAT_VERSION},
reqid(ri), attempt(att), op(o), flags(0), lock_type(0),
inode_export_v(0), srcdn_auth(MDS_RANK_NONE) { }
- ~MMDSSlaveRequest() override {}
+ ~MMDSPeerRequest() override {}
public:
void encode_payload(uint64_t features) override {
@@ -215,16 +215,16 @@ public:
decode(desti_snapbl, p);
}
- std::string_view get_type_name() const override { return "slave_request"; }
+ std::string_view get_type_name() const override { return "peer_request"; }
void print(std::ostream& out) const override {
- out << "slave_request(" << reqid
+ out << "peer_request(" << reqid
<< "." << attempt
- << " " << get_opname(op)
+ << " " << get_opname(op)
<< ")";
- }
+ }
private:
template<class T, typename... Args>
- friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
+ friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
};
#endif
diff --git a/src/messages/MMDSResolve.h b/src/messages/MMDSResolve.h
index 0de6d1150cd..2fa890ec3c6 100644
--- a/src/messages/MMDSResolve.h
+++ b/src/messages/MMDSResolve.h
@@ -27,12 +27,12 @@ public:
std::map<dirfrag_t, std::vector<dirfrag_t>> subtrees;
std::map<dirfrag_t, std::vector<dirfrag_t>> ambiguous_imports;
- class slave_inode_cap {
+ class peer_inode_cap {
public:
inodeno_t ino;
std::map<client_t,Capability::Export> cap_exports;
- slave_inode_cap() {}
- slave_inode_cap(inodeno_t a, map<client_t, Capability::Export> b) : ino(a), cap_exports(b) {}
+ peer_inode_cap() {}
+ peer_inode_cap(inodeno_t a, map<client_t, Capability::Export> b) : ino(a), cap_exports(b) {}
void encode(ceph::buffer::list &bl) const
{
ENCODE_START(1, 1, bl);
@@ -48,12 +48,12 @@ public:
DECODE_FINISH(blp);
}
};
- WRITE_CLASS_ENCODER(slave_inode_cap)
+ WRITE_CLASS_ENCODER(peer_inode_cap)
- struct slave_request {
+ struct peer_request {
ceph::buffer::list inode_caps;
bool committing;
- slave_request() : committing(false) {}
+ peer_request() : committing(false) {}
void encode(ceph::buffer::list &bl) const {
ENCODE_START(1, 1, bl);
encode(inode_caps, bl);
@@ -68,7 +68,7 @@ public:
}
};
- std::map<metareqid_t, slave_request> slave_requests;
+ std::map<metareqid_t, peer_request> peer_requests;
// table client information
struct table_client {
@@ -104,7 +104,7 @@ public:
void print(std::ostream& out) const override {
out << "mds_resolve(" << subtrees.size()
<< "+" << ambiguous_imports.size()
- << " subtrees +" << slave_requests.size() << " slave requests)";
+ << " subtrees +" << peer_requests.size() << " peer requests)";
}
void add_subtree(dirfrag_t im) {
@@ -118,12 +118,12 @@ public:
ambiguous_imports[im] = m;
}
- void add_slave_request(metareqid_t reqid, bool committing) {
- slave_requests[reqid].committing = committing;
+ void add_peer_request(metareqid_t reqid, bool committing) {
+ peer_requests[reqid].committing = committing;
}
- void add_slave_request(metareqid_t reqid, ceph::buffer::list& bl) {
- slave_requests[reqid].inode_caps = std::move(bl);
+ void add_peer_request(metareqid_t reqid, ceph::buffer::list& bl) {
+ peer_requests[reqid].inode_caps = std::move(bl);
}
void add_table_commits(int table, const std::set<version_t>& pending_commits) {
@@ -134,7 +134,7 @@ public:
using ceph::encode;
encode(subtrees, payload);
encode(ambiguous_imports, payload);
- encode(slave_requests, payload);
+ encode(peer_requests, payload);
encode(table_clients, payload);
}
void decode_payload() override {
@@ -142,7 +142,7 @@ public:
auto p = payload.cbegin();
decode(subtrees, p);
decode(ambiguous_imports, p);
- decode(slave_requests, p);
+ decode(peer_requests, p);
decode(table_clients, p);
}
private:
@@ -150,11 +150,11 @@ private:
friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
};
-inline std::ostream& operator<<(std::ostream& out, const MMDSResolve::slave_request&) {
+inline std::ostream& operator<<(std::ostream& out, const MMDSResolve::peer_request&) {
return out;
}
-WRITE_CLASS_ENCODER(MMDSResolve::slave_request)
+WRITE_CLASS_ENCODER(MMDSResolve::peer_request)
WRITE_CLASS_ENCODER(MMDSResolve::table_client)
-WRITE_CLASS_ENCODER(MMDSResolve::slave_inode_cap)
+WRITE_CLASS_ENCODER(MMDSResolve::peer_inode_cap)
#endif
diff --git a/src/messages/MMDSResolveAck.h b/src/messages/MMDSResolveAck.h
index de92d30f8bc..4af32fb29c3 100644
--- a/src/messages/MMDSResolveAck.h
+++ b/src/messages/MMDSResolveAck.h
@@ -35,7 +35,7 @@ public:
/*void print(ostream& out) const {
out << "resolve_ack.size()
<< "+" << ambiguous_imap.size()
- << " imports +" << slave_requests.size() << " slave requests)";
+ << " imports +" << peer_requests.size() << " peer requests)";
}
*/
diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc
index b36320edb13..c107703e455 100644
--- a/src/mgr/Mgr.cc
+++ b/src/mgr/Mgr.cc
@@ -549,7 +549,6 @@ bool Mgr::ms_dispatch2(const ref_t<Message>& m)
py_module_registry->notify_all("fs_map", "");
handle_fs_map(ref_cast<MFSMap>(m));
return false; // I shall let this pass through for Client
- break;
case CEPH_MSG_OSD_MAP:
handle_osd_map();
diff --git a/src/mgr/ServiceMap.cc b/src/mgr/ServiceMap.cc
index 2a29e0ed900..812691a8478 100644
--- a/src/mgr/ServiceMap.cc
+++ b/src/mgr/ServiceMap.cc
@@ -3,6 +3,8 @@
#include "mgr/ServiceMap.h"
+#include <fmt/format.h>
+
#include "common/Formatter.h"
using ceph::bufferlist;
@@ -65,6 +67,75 @@ void ServiceMap::Daemon::generate_test_instances(std::list<Daemon*>& ls)
// Service
+std::string ServiceMap::Service::get_summary() const
+{
+ if (!summary.empty()) {
+ return summary;
+ }
+ if (daemons.empty()) {
+ return "no daemons active";
+ }
+ std::ostringstream ss;
+ ss << daemons.size() << (daemons.size() > 1 ? " daemons" : " daemon")
+ << " active";
+
+ if (!daemons.empty()) {
+ ss << " (";
+ for (auto p = daemons.begin(); p != daemons.end(); ++p) {
+ if (p != daemons.begin()) {
+ ss << ", ";
+ }
+ ss << p->first;
+ }
+ ss << ")";
+ }
+
+ return ss.str();
+}
+
+bool ServiceMap::Service::has_running_tasks() const
+{
+ return std::any_of(daemons.begin(), daemons.end(), [](auto& daemon) {
+ return !daemon.second.task_status.empty();
+ });
+}
+
+std::string ServiceMap::Service::get_task_summary(const std::string_view task_prefix) const
+{
+ // contruct a map similar to:
+ // {"service1 status" -> {"service1.0" -> "running"}}
+ // {"service2 status" -> {"service2.0" -> "idle"},
+ // {"service2.1" -> "running"}}
+ std::map<std::string, std::map<std::string, std::string>> by_task;
+ for (const auto& [service_id, daemon] : daemons) {
+ for (const auto& [task_name, status] : daemon.task_status) {
+ by_task[task_name].emplace(fmt::format("{}.{}", task_prefix, service_id),
+ status);
+ }
+ }
+ std::stringstream ss;
+ for (const auto &[task_name, status_by_service] : by_task) {
+ ss << "\n " << task_name << ":";
+ for (auto& [service, status] : status_by_service) {
+ ss << "\n " << service << ": " << status;
+ }
+ }
+ return ss.str();
+}
+
+void ServiceMap::Service::count_metadata(const std::string& field,
+ std::map<std::string,int> *out) const
+{
+ for (auto& p : daemons) {
+ auto q = p.second.metadata.find(field);
+ if (q == p.second.metadata.end()) {
+ (*out)["unknown"]++;
+ } else {
+ (*out)[q->second]++;
+ }
+ }
+}
+
void ServiceMap::Service::encode(bufferlist& bl, uint64_t features) const
{
ENCODE_START(1, 1, bl);
diff --git a/src/mgr/ServiceMap.h b/src/mgr/ServiceMap.h
index 169038f3044..ed027907c54 100644
--- a/src/mgr/ServiceMap.h
+++ b/src/mgr/ServiceMap.h
@@ -40,70 +40,11 @@ struct ServiceMap {
void dump(ceph::Formatter *f) const;
static void generate_test_instances(std::list<Service*>& ls);
- std::string get_summary() const {
- if (summary.size()) {
- return summary;
- }
- if (daemons.empty()) {
- return "no daemons active";
- }
- std::ostringstream ss;
- ss << daemons.size() << (daemons.size() > 1 ? " daemons" : " daemon")
- << " active";
-
- if (!daemons.empty()) {
- ss << " (";
- for (auto p = daemons.begin(); p != daemons.end(); ++p) {
- if (p != daemons.begin()) {
- ss << ", ";
- }
- ss << p->first;
- }
- ss << ")";
- }
-
- return ss.str();
- }
-
- std::string get_task_summary(const std::string_view task_prefix) const {
- // contruct a map similar to:
- // {"service1 status" -> {"service1.0" -> "running"}}
- // {"service2 status" -> {"service2.0" -> "idle"},
- // {"service2.1" -> "running"}}
- std::map<std::string, std::map<std::string, std::string>> by_task;
- for (const auto &p : daemons) {
- std::stringstream d;
- d << task_prefix << "." << p.first;
- for (const auto &q : p.second.task_status) {
- auto p1 = by_task.emplace(q.first, std::map<std::string, std::string>{}).first;
- auto p2 = p1->second.emplace(d.str(), std::string()).first;
- p2->second = q.second;
- }
- }
-
- std::stringstream ss;
- for (const auto &p : by_task) {
- ss << "\n " << p.first << ":";
- for (auto q : p.second) {
- ss << "\n " << q.first << ": " << q.second;
- }
- }
-
- return ss.str();
- }
-
+ std::string get_summary() const;
+ bool has_running_tasks() const;
+ std::string get_task_summary(const std::string_view task_prefix) const;
void count_metadata(const std::string& field,
- std::map<std::string,int> *out) const {
- for (auto& p : daemons) {
- auto q = p.second.metadata.find(field);
- if (q == p.second.metadata.end()) {
- (*out)["unknown"]++;
- } else {
- (*out)[q->second]++;
- }
- }
- }
-
+ std::map<std::string,int> *out) const;
};
epoch_t epoch = 0;
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index f7abdba65ec..0e47ffea0fb 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -3027,15 +3027,15 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f)
}
}
- {
- auto& service_map = mgrstatmon()->get_service_map();
- if (!service_map.services.empty()) {
- ss << "\n \n task status:\n";
- {
- for (auto &p : service_map.services) {
- ss << p.second.get_task_summary(p.first);
- }
- }
+ if (auto& service_map = mgrstatmon()->get_service_map();
+ std::any_of(service_map.services.begin(),
+ service_map.services.end(),
+ [](auto& service) {
+ return service.second.has_running_tasks();
+ })) {
+ ss << "\n \n task status:\n";
+ for (auto& [name, service] : service_map.services) {
+ ss << service.get_task_summary(name);
}
}
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 41dc08c48e4..e93e75a72e7 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -7649,7 +7649,6 @@ int OSDMonitor::prepare_pool_crush_rule(const unsigned pool_type,
*ss << "prepare_pool_crush_rule: " << pool_type
<< " is not a known pool type";
return -EINVAL;
- break;
}
} else {
if (!osdmap.crush->ruleset_exists(*crush_rule)) {
diff --git a/src/msg/Message.cc b/src/msg/Message.cc
index efd33ddafc4..3dd7c02ee7a 100644
--- a/src/msg/Message.cc
+++ b/src/msg/Message.cc
@@ -130,7 +130,7 @@
#include "messages/MClientQuota.h"
#include "messages/MClientMetrics.h"
-#include "messages/MMDSSlaveRequest.h"
+#include "messages/MMDSPeerRequest.h"
#include "messages/MMDSMap.h"
#include "messages/MFSMap.h"
@@ -694,8 +694,8 @@ Message *decode_message(CephContext *cct,
break;
// mds
- case MSG_MDS_SLAVE_REQUEST:
- m = make_message<MMDSSlaveRequest>();
+ case MSG_MDS_PEER_REQUEST:
+ m = make_message<MMDSPeerRequest>();
break;
case CEPH_MSG_MDS_MAP:
diff --git a/src/msg/Message.h b/src/msg/Message.h
index d1554ff9dfe..59700bbb7f9 100644
--- a/src/msg/Message.h
+++ b/src/msg/Message.h
@@ -146,7 +146,7 @@
// *** MDS ***
#define MSG_MDS_BEACON 100 // to monitor
-#define MSG_MDS_SLAVE_REQUEST 101
+#define MSG_MDS_PEER_REQUEST 101
#define MSG_MDS_TABLE_REQUEST 102
// 150 already in use (MSG_OSD_RECOVERY_RESERVE)
diff --git a/src/msg/MessageRef.h b/src/msg/MessageRef.h
index 4f30f0b352a..2c11aced52b 100644
--- a/src/msg/MessageRef.h
+++ b/src/msg/MessageRef.h
@@ -88,7 +88,7 @@ class MMDSOpenIno;
class MMDSOpenInoReply;
class MMDSResolveAck;
class MMDSResolve;
-class MMDSSlaveRequest;
+class MMDSPeerRequest;
class MMDSSnapUpdate;
class MMDSTableRequest;
class MMgrBeacon;
diff --git a/src/neorados/RADOS.cc b/src/neorados/RADOS.cc
index 8a49f05a9c4..54e2a23e1a8 100644
--- a/src/neorados/RADOS.cc
+++ b/src/neorados/RADOS.cc
@@ -27,6 +27,7 @@
#include "common/ceph_argparse.h"
#include "common/common_init.h"
#include "common/hobject.h"
+#include "common/EventTrace.h"
#include "global/global_init.h"
@@ -783,33 +784,52 @@ boost::asio::io_context& RADOS::get_io_context() {
void RADOS::execute(const Object& o, const IOContext& _ioc, ReadOp&& _op,
cb::list* bl,
- std::unique_ptr<ReadOp::Completion> c, version_t* objver) {
+ std::unique_ptr<ReadOp::Completion> c, version_t* objver,
+ const blkin_trace_info *trace_info) {
auto oid = reinterpret_cast<const object_t*>(&o.impl);
auto ioc = reinterpret_cast<const IOContextImpl*>(&_ioc.impl);
auto op = reinterpret_cast<OpImpl*>(&_op.impl);
- auto flags = 0; // Should be in Op.
+ auto flags = op->op.flags;
+
+ ZTracer::Trace trace;
+ if (trace_info) {
+ ZTracer::Trace parent_trace("", nullptr, trace_info);
+ trace.init("rados execute", &impl->objecter->trace_endpoint, &parent_trace);
+ }
+ trace.event("init");
impl->objecter->read(
*oid, ioc->oloc, std::move(op->op), ioc->snap_seq, bl, flags,
- std::move(c), objver);
+ std::move(c), objver, nullptr /* data_offset */, 0 /* features */, &trace);
+
+ trace.event("submitted");
}
void RADOS::execute(const Object& o, const IOContext& _ioc, WriteOp&& _op,
- std::unique_ptr<WriteOp::Completion> c, version_t* objver) {
+ std::unique_ptr<WriteOp::Completion> c, version_t* objver,
+ const blkin_trace_info *trace_info) {
auto oid = reinterpret_cast<const object_t*>(&o.impl);
auto ioc = reinterpret_cast<const IOContextImpl*>(&_ioc.impl);
auto op = reinterpret_cast<OpImpl*>(&_op.impl);
- auto flags = 0; // Should be in Op.
+ auto flags = op->op.flags;
ceph::real_time mtime;
if (op->mtime)
mtime = *op->mtime;
else
mtime = ceph::real_clock::now();
+ ZTracer::Trace trace;
+ if (trace_info) {
+ ZTracer::Trace parent_trace("", nullptr, trace_info);
+ trace.init("rados execute", &impl->objecter->trace_endpoint, &parent_trace);
+ }
+
+ trace.event("init");
impl->objecter->mutate(
*oid, ioc->oloc, std::move(op->op), ioc->snapc,
mtime, flags,
- std::move(c), objver);
+ std::move(c), objver, osd_reqid_t{}, &trace);
+ trace.event("submitted");
}
void RADOS::execute(const Object& o, std::int64_t pool, ReadOp&& _op,
@@ -1538,6 +1558,10 @@ void RADOS::enable_application(std::string_view pool, std::string_view app_name,
}
}
+void RADOS::wait_for_latest_osd_map(std::unique_ptr<SimpleOpComp> c) {
+ impl->objecter->wait_for_latest_osdmap(std::move(c));
+}
+
void RADOS::mon_command(std::vector<std::string> command,
const cb::list& bl,
std::string* outs, cb::list* outbl,
diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h
index d659d64dff6..d13be3f25c6 100644
--- a/src/osd/ECBackend.h
+++ b/src/osd/ECBackend.h
@@ -261,16 +261,12 @@ private:
switch (state) {
case ECBackend::RecoveryOp::IDLE:
return "IDLE";
- break;
case ECBackend::RecoveryOp::READING:
return "READING";
- break;
case ECBackend::RecoveryOp::WRITING:
return "WRITING";
- break;
case ECBackend::RecoveryOp::COMPLETE:
return "COMPLETE";
- break;
default:
ceph_abort();
return "";
diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc
index ba31acdab2c..c2b036560ef 100644
--- a/src/osd/OSDMap.cc
+++ b/src/osd/OSDMap.cc
@@ -6081,7 +6081,6 @@ float OSDMap::pool_raw_used_rate(int64_t poolid) const
switch (pool->get_type()) {
case pg_pool_t::TYPE_REPLICATED:
return pool->get_size();
- break;
case pg_pool_t::TYPE_ERASURE:
{
auto& ecp =
diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc
index 3ea1237bcef..6bdeb246c63 100644
--- a/src/osd/PrimaryLogPG.cc
+++ b/src/osd/PrimaryLogPG.cc
@@ -2137,15 +2137,14 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
if (!is_primary()) {
if (!recovery_state.can_serve_replica_read(oid)) {
- dout(20) << __func__ << ": oid " << oid
- << " unstable write on replica, bouncing to primary."
+ dout(20) << __func__
+ << ": unstable write on replica, bouncing to primary "
<< *m << dendl;
osd->reply_op_error(op, -EAGAIN);
return;
- } else {
- dout(20) << __func__ << ": serving replica read on oid" << oid
- << dendl;
}
+ dout(20) << __func__ << ": serving replica read on oid " << oid
+ << dendl;
}
int r = find_object_context(
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index 18f17d53ac6..7341a719e79 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -2931,10 +2931,11 @@ public:
ObjectOperation&& op, const SnapContext& snapc,
ceph::real_time mtime, int flags,
std::unique_ptr<Op::OpComp>&& oncommit,
- version_t *objver = NULL, osd_reqid_t reqid = osd_reqid_t()) {
+ version_t *objver = NULL, osd_reqid_t reqid = osd_reqid_t(),
+ ZTracer::Trace *parent_trace = nullptr) {
Op *o = new Op(oid, oloc, std::move(op.ops), flags | global_op_flags |
CEPH_OSD_FLAG_WRITE, std::move(oncommit), objver,
- nullptr);
+ nullptr, parent_trace);
o->priority = op.priority;
o->mtime = mtime;
o->snapc = snapc;
@@ -2990,10 +2991,10 @@ public:
ObjectOperation&& op, snapid_t snapid, ceph::buffer::list *pbl,
int flags, std::unique_ptr<Op::OpComp>&& onack,
version_t *objver = nullptr, int *data_offset = nullptr,
- uint64_t features = 0) {
+ uint64_t features = 0, ZTracer::Trace *parent_trace = nullptr) {
Op *o = new Op(oid, oloc, std::move(op.ops), flags | global_op_flags |
CEPH_OSD_FLAG_READ, std::move(onack), objver,
- data_offset);
+ data_offset, parent_trace);
o->priority = op.priority;
o->snapid = snapid;
o->outbl = pbl;
diff --git a/src/osdc/Striper.cc b/src/osdc/Striper.cc
index 2c7f0a96087..d0d2ab47c37 100644
--- a/src/osdc/Striper.cc
+++ b/src/osdc/Striper.cc
@@ -50,6 +50,72 @@ struct OrderByObject {
}
};
+template <typename I>
+void add_partial_sparse_result(
+ CephContext *cct,
+ std::map<uint64_t, std::pair<ceph::buffer::list, uint64_t> >* partial,
+ uint64_t* total_intended_len, bufferlist& bl, I* it, const I& end_it,
+ uint64_t* bl_off, uint64_t tofs, uint64_t tlen) {
+ ldout(cct, 30) << " be " << tofs << "~" << tlen << dendl;
+
+ auto& s = *it;
+ while (tlen > 0) {
+ ldout(cct, 20) << " t " << tofs << "~" << tlen
+ << " bl has " << bl.length()
+ << " off " << *bl_off << dendl;
+ if (s == end_it) {
+ ldout(cct, 20) << " s at end" << dendl;
+ auto& r = (*partial)[tofs];
+ r.second = tlen;
+ *total_intended_len += r.second;
+ break;
+ }
+
+ ldout(cct, 30) << " s " << s->first << "~" << s->second << dendl;
+
+ // skip zero-length extent
+ if (s->second == 0) {
+ ldout(cct, 30) << " s len 0, skipping" << dendl;
+ ++s;
+ continue;
+ }
+
+ if (s->first > *bl_off) {
+ // gap in sparse read result
+ pair<bufferlist, uint64_t>& r = (*partial)[tofs];
+ size_t gap = std::min<size_t>(s->first - *bl_off, tlen);
+ ldout(cct, 20) << " s gap " << gap << ", skipping" << dendl;
+ r.second = gap;
+ *total_intended_len += r.second;
+ *bl_off += gap;
+ tofs += gap;
+ tlen -= gap;
+ if (tlen == 0) {
+ continue;
+ }
+ }
+
+ ceph_assert(s->first <= *bl_off);
+ size_t left = (s->first + s->second) - *bl_off;
+ size_t actual = std::min<size_t>(left, tlen);
+
+ if (actual > 0) {
+ ldout(cct, 20) << " s has " << actual << ", copying" << dendl;
+ pair<bufferlist, uint64_t>& r = (*partial)[tofs];
+ bl.splice(0, actual, &r.first);
+ r.second = actual;
+ *total_intended_len += r.second;
+ *bl_off += actual;
+ tofs += actual;
+ tlen -= actual;
+ }
+ if (actual == left) {
+ ldout(cct, 30) << " s advancing" << dendl;
+ ++s;
+ }
+ }
+}
+
} // anonymous namespace
void Striper::file_to_extents(CephContext *cct, const char *object_format,
@@ -361,87 +427,22 @@ void Striper::StripedReadResult::add_partial_sparse_result(
<< " to " << buffer_extents << dendl;
auto s = bl_map.cbegin();
for (auto& be : buffer_extents) {
- add_partial_sparse_result(cct, bl, &s, bl_map.end(), &bl_off, be.first,
- be.second);
+ ::add_partial_sparse_result(cct, &partial, &total_intended_len, bl, &s,
+ bl_map.end(), &bl_off, be.first, be.second);
}
}
void Striper::StripedReadResult::add_partial_sparse_result(
CephContext *cct, ceph::buffer::list& bl,
- const std::map<uint64_t, uint64_t>& bl_map, uint64_t bl_off,
+ const std::vector<std::pair<uint64_t, uint64_t>>& bl_map, uint64_t bl_off,
const striper::LightweightBufferExtents& buffer_extents) {
ldout(cct, 10) << "add_partial_sparse_result(" << this << ") " << bl.length()
<< " covering " << bl_map << " (offset " << bl_off << ")"
<< " to " << buffer_extents << dendl;
auto s = bl_map.cbegin();
for (auto& be : buffer_extents) {
- add_partial_sparse_result(cct, bl, &s, bl_map.cend(), &bl_off, be.first,
- be.second);
- }
-}
-
-void Striper::StripedReadResult::add_partial_sparse_result(
- CephContext *cct, bufferlist& bl,
- std::map<uint64_t, uint64_t>::const_iterator* it,
- const std::map<uint64_t, uint64_t>::const_iterator& end_it,
- uint64_t* bl_off, uint64_t tofs, uint64_t tlen) {
- ldout(cct, 30) << " be " << tofs << "~" << tlen << dendl;
-
- auto& s = *it;
- while (tlen > 0) {
- ldout(cct, 20) << " t " << tofs << "~" << tlen
- << " bl has " << bl.length()
- << " off " << *bl_off << dendl;
- if (s == end_it) {
- ldout(cct, 20) << " s at end" << dendl;
- auto& r = partial[tofs];
- r.second = tlen;
- total_intended_len += r.second;
- break;
- }
-
- ldout(cct, 30) << " s " << s->first << "~" << s->second << dendl;
-
- // skip zero-length extent
- if (s->second == 0) {
- ldout(cct, 30) << " s len 0, skipping" << dendl;
- ++s;
- continue;
- }
-
- if (s->first > *bl_off) {
- // gap in sparse read result
- pair<bufferlist, uint64_t>& r = partial[tofs];
- size_t gap = std::min<size_t>(s->first - *bl_off, tlen);
- ldout(cct, 20) << " s gap " << gap << ", skipping" << dendl;
- r.second = gap;
- total_intended_len += r.second;
- *bl_off += gap;
- tofs += gap;
- tlen -= gap;
- if (tlen == 0) {
- continue;
- }
- }
-
- ceph_assert(s->first <= *bl_off);
- size_t left = (s->first + s->second) - *bl_off;
- size_t actual = std::min<size_t>(left, tlen);
-
- if (actual > 0) {
- ldout(cct, 20) << " s has " << actual << ", copying" << dendl;
- pair<bufferlist, uint64_t>& r = partial[tofs];
- bl.splice(0, actual, &r.first);
- r.second = actual;
- total_intended_len += r.second;
- *bl_off += actual;
- tofs += actual;
- tlen -= actual;
- }
- if (actual == left) {
- ldout(cct, 30) << " s advancing" << dendl;
- ++s;
- }
+ ::add_partial_sparse_result(cct, &partial, &total_intended_len, bl, &s,
+ bl_map.cend(), &bl_off, be.first, be.second);
}
}
diff --git a/src/osdc/Striper.h b/src/osdc/Striper.h
index 2ebc29a1213..9cb48352c4c 100644
--- a/src/osdc/Striper.h
+++ b/src/osdc/Striper.h
@@ -107,8 +107,9 @@
const std::vector<std::pair<uint64_t,uint64_t> >& buffer_extents);
void add_partial_sparse_result(
CephContext *cct, ceph::buffer::list& bl,
- const std::map<uint64_t, uint64_t>& bl_map, uint64_t bl_off,
- const striper::LightweightBufferExtents& buffer_extents);
+ const std::vector<std::pair<uint64_t, uint64_t>>& bl_map,
+ uint64_t bl_off,
+ const striper::LightweightBufferExtents& buffer_extents);
void assemble_result(CephContext *cct, ceph::buffer::list& bl,
bool zero_tail);
@@ -122,13 +123,6 @@
void assemble_result(CephContext *cct,
std::map<uint64_t, uint64_t> *extent_map,
ceph::buffer::list *bl);
-
- private:
- void add_partial_sparse_result(
- CephContext *cct, ceph::buffer::list& bl,
- std::map<uint64_t, uint64_t>::const_iterator* it,
- const std::map<uint64_t, uint64_t>::const_iterator& end_it,
- uint64_t* bl_off, uint64_t tofs, uint64_t tlen);
};
};
diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py
index b63aaf7beac..8966813fd65 100644
--- a/src/pybind/mgr/cephadm/inventory.py
+++ b/src/pybind/mgr/cephadm/inventory.py
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Dict, List, Iterator, Optional, Any, Tuple, Se
import orchestrator
from ceph.deployment import inventory
from ceph.deployment.service_spec import ServiceSpec
-from orchestrator import OrchestratorError, HostSpec
+from orchestrator import OrchestratorError, HostSpec, OrchestratorEvent
if TYPE_CHECKING:
from .module import CephadmOrchestrator
@@ -136,6 +136,7 @@ class SpecStore():
'created': self.spec_created[spec.service_name()].strftime(DATEFMT),
}, sort_keys=True),
)
+ self.mgr.events.for_service(spec, OrchestratorEvent.INFO, 'service was created')
def rm(self, service_name):
# type: (str) -> bool
@@ -344,16 +345,16 @@ class HostCache():
return r
def get_daemons_with_volatile_status(self) -> Iterator[Tuple[str, Dict[str, orchestrator.DaemonDescription]]]:
- for host, dm in self.daemons.items():
+ def alter(host, dd_orig: orchestrator.DaemonDescription) -> orchestrator.DaemonDescription:
+ dd = copy(dd_orig)
if host in self.mgr.offline_hosts:
- def set_offline(dd: orchestrator.DaemonDescription) -> orchestrator.DaemonDescription:
- ret = copy(dd)
- ret.status = -1
- ret.status_desc = 'host is offline'
- return ret
- yield host, {name: set_offline(d) for name, d in dm.items()}
- else:
- yield host, dm
+ dd.status = -1
+ dd.status_desc = 'host is offline'
+ dd.events = self.mgr.events.get_for_daemon(dd.name())
+ return dd
+
+ for host, dm in self.daemons.items():
+ yield host, {name: alter(host, d) for name, d in dm.items()}
def get_daemons_by_service(self, service_name):
# type: (str) -> List[orchestrator.DaemonDescription]
@@ -460,3 +461,56 @@ class HostCache():
"""
return all((h in self.last_daemon_update or h in self.mgr.offline_hosts)
for h in self.get_hosts())
+
+
+class EventStore():
+ def __init__(self, mgr):
+ # type: (CephadmOrchestrator) -> None
+ self.mgr: CephadmOrchestrator = mgr
+ self.events = {} # type: Dict[str, List[OrchestratorEvent]]
+
+ def add(self, event: OrchestratorEvent) -> None:
+
+ if event.kind_subject() not in self.events:
+ self.events[event.kind_subject()] = [event]
+
+ for e in self.events[event.kind_subject()]:
+ if e.message == event.message:
+ return
+
+ self.events[event.kind_subject()].append(event)
+
+ # limit to five events for now.
+ self.events[event.kind_subject()] = self.events[event.kind_subject()][-5:]
+
+ def for_service(self, spec: ServiceSpec, level, message) -> None:
+ e = OrchestratorEvent(datetime.datetime.utcnow(), 'service', spec.service_name(), level, message)
+ self.add(e)
+
+ def for_daemon(self, daemon_name, level, message):
+ e = OrchestratorEvent(datetime.datetime.utcnow(), 'daemon', daemon_name, level, message)
+ self.add(e)
+
+ def cleanup(self) -> None:
+ # Needs to be properly done, in case events are persistently stored.
+
+ unknowns: List[str] = []
+ daemons = self.mgr.cache.get_daemon_names()
+ specs = self.mgr.spec_store.specs.keys()
+ for k_s, v in self.events.items():
+ kind, subject = k_s.split(':')
+ if kind == 'service':
+ if subject not in specs:
+ unknowns.append(k_s)
+ elif kind == 'daemon':
+ if subject not in daemons:
+ unknowns.append(k_s)
+
+ for k_s in unknowns:
+ del self.events[k_s]
+
+ def get_for_service(self, name):
+ return self.events.get('service:' + name, [])
+
+ def get_for_daemon(self, name):
+ return self.events.get('daemon:' + name, [])
diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py
index 1b3d18b8292..dd9582805c6 100644
--- a/src/pybind/mgr/cephadm/module.py
+++ b/src/pybind/mgr/cephadm/module.py
@@ -29,7 +29,7 @@ from cephadm.services.cephadmservice import CephadmDaemonSpec
from mgr_module import MgrModule, HandleCommandResult
import orchestrator
from orchestrator import OrchestratorError, OrchestratorValidationError, HostSpec, \
- CLICommandMeta
+ CLICommandMeta, OrchestratorEvent, set_exception_subject, DaemonDescription
from orchestrator._interface import GenericSpec
from . import remotes
@@ -43,7 +43,7 @@ from .services.osd import RemoveUtil, OSDRemoval, OSDService
from .services.monitoring import GrafanaService, AlertmanagerService, PrometheusService, \
NodeExporterService
from .schedule import HostAssignment, HostPlacementSpec
-from .inventory import Inventory, SpecStore, HostCache
+from .inventory import Inventory, SpecStore, HostCache, EventStore
from .upgrade import CEPH_UPGRADE_ORDER, CephadmUpgrade
from .template import TemplateMgr
@@ -338,7 +338,9 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
if h not in self.inventory:
self.cache.rm_host(h)
+
# in-memory only.
+ self.events = EventStore(self)
self.offline_hosts: Set[str] = set()
self.migration = Migrations(self)
@@ -465,47 +467,68 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
ret = self.event.wait(sleep_interval)
self.event.clear()
- def serve(self):
- # type: () -> None
+ def serve(self) -> None:
+ """
+ The main loop of cephadm.
+
+ A command handler will typically change the declarative state
+ of cephadm. This loop will then attempt to apply this new state.
+ """
self.log.debug("serve starting")
while self.run:
- # refresh daemons
- self.log.debug('refreshing hosts and daemons')
- self._refresh_hosts_and_daemons()
+ try:
- self._check_for_strays()
+ # refresh daemons
+ self.log.debug('refreshing hosts and daemons')
+ self._refresh_hosts_and_daemons()
- if self.paused:
- self.health_checks['CEPHADM_PAUSED'] = {
- 'severity': 'warning',
- 'summary': 'cephadm background work is paused',
- 'count': 1,
- 'detail': ["'ceph orch resume' to resume"],
- }
- self.set_health_checks(self.health_checks)
- else:
- if 'CEPHADM_PAUSED' in self.health_checks:
- del self.health_checks['CEPHADM_PAUSED']
- self.set_health_checks(self.health_checks)
+ self._check_for_strays()
- self.rm_util._remove_osds_bg()
+ self._update_paused_health()
- self.migration.migrate()
- if self.migration.is_migration_ongoing():
- continue
+ if not self.paused:
+ self.rm_util._remove_osds_bg()
- if self._apply_all_services():
- continue # did something, refresh
+ self.migration.migrate()
+ if self.migration.is_migration_ongoing():
+ continue
- self._check_daemons()
+ if self._apply_all_services():
+ continue # did something, refresh
- if self.upgrade.continue_upgrade():
- continue
+ self._check_daemons()
+
+ if self.upgrade.continue_upgrade():
+ continue
+
+ except OrchestratorError as e:
+ if e.event_subject:
+ self.events.add(OrchestratorEvent(
+ datetime.datetime.utcnow(),
+ e.event_subject[0],
+ e.event_subject[1],
+ "ERROR",
+ str(e)
+ ))
self._serve_sleep()
self.log.debug("serve exit")
+ def _update_paused_health(self):
+ if self.paused:
+ self.health_checks['CEPHADM_PAUSED'] = {
+ 'severity': 'warning',
+ 'summary': 'cephadm background work is paused',
+ 'count': 1,
+ 'detail': ["'ceph orch resume' to resume"],
+ }
+ self.set_health_checks(self.health_checks)
+ else:
+ if 'CEPHADM_PAUSED' in self.health_checks:
+ del self.health_checks['CEPHADM_PAUSED']
+ self.set_health_checks(self.health_checks)
+
def config_notify(self):
"""
This method is called whenever one of our config options is changed.
@@ -1069,7 +1092,7 @@ you may want to run:
if err:
self.log.debug('err: %s' % '\n'.join(err))
if code and not error_ok:
- raise RuntimeError(
+ raise OrchestratorError(
'cephadm exited with an error code: %d, stderr:%s' % (
code, '\n'.join(err)))
return out, err, code
@@ -1382,6 +1405,7 @@ you may want to run:
container_image_id=dd.container_image_id,
container_image_name=dd.container_image_name,
spec=spec,
+ events=self.events.get_for_service(spec.service_name()),
)
if n in self.spec_store.specs:
if dd.daemon_type == 'osd':
@@ -1420,6 +1444,7 @@ you may want to run:
spec=spec,
size=spec.placement.get_host_selection_size(self.inventory.all_specs()),
running=0,
+ events=self.events.get_for_service(spec.service_name()),
)
if service_type == 'nfs':
spec = cast(NFSServiceSpec, spec)
@@ -1463,7 +1488,11 @@ you may want to run:
@forall_hosts
def _daemon_actions(self, daemon_type, daemon_id, host, action):
- return self._daemon_action(daemon_type, daemon_id, host, action)
+ with set_exception_subject('daemon', DaemonDescription(
+ daemon_type=daemon_type,
+ daemon_id=daemon_id
+ ).name()):
+ return self._daemon_action(daemon_type, daemon_id, host, action)
def _daemon_action(self, daemon_type, daemon_id, host, action):
daemon_spec: CephadmDaemonSpec = CephadmDaemonSpec(
@@ -1724,52 +1753,64 @@ you may want to run:
) -> str:
- start_time = datetime.datetime.utcnow()
- cephadm_config, deps = self.cephadm_services[daemon_spec.daemon_type].generate_config(daemon_spec)
+ with set_exception_subject('service', orchestrator.DaemonDescription(
+ daemon_type=daemon_spec.daemon_type,
+ daemon_id=daemon_spec.daemon_id,
+ hostname=daemon_spec.host,
+ ).service_id(), overwrite=True):
+
+ start_time = datetime.datetime.utcnow()
+ cephadm_config, deps = self.cephadm_services[daemon_spec.daemon_type].generate_config(daemon_spec)
- daemon_spec.extra_args.extend(['--config-json', '-'])
+ daemon_spec.extra_args.extend(['--config-json', '-'])
- # osd deployments needs an --osd-uuid arg
- if daemon_spec.daemon_type == 'osd':
- if not osd_uuid_map:
- osd_uuid_map = self.get_osd_uuid_map()
- osd_uuid = osd_uuid_map.get(daemon_spec.daemon_id)
- if not osd_uuid:
- raise OrchestratorError('osd.%s not in osdmap' % daemon_spec.daemon_id)
- daemon_spec.extra_args.extend(['--osd-fsid', osd_uuid])
+ # osd deployments needs an --osd-uuid arg
+ if daemon_spec.daemon_type == 'osd':
+ if not osd_uuid_map:
+ osd_uuid_map = self.get_osd_uuid_map()
+ osd_uuid = osd_uuid_map.get(daemon_spec.daemon_id)
+ if not osd_uuid:
+ raise OrchestratorError('osd.%s not in osdmap' % daemon_spec.daemon_id)
+ daemon_spec.extra_args.extend(['--osd-fsid', osd_uuid])
- if reconfig:
- daemon_spec.extra_args.append('--reconfig')
- if self.allow_ptrace:
- daemon_spec.extra_args.append('--allow-ptrace')
+ if reconfig:
+ daemon_spec.extra_args.append('--reconfig')
+ if self.allow_ptrace:
+ daemon_spec.extra_args.append('--allow-ptrace')
- self.log.info('%s daemon %s on %s' % (
- 'Reconfiguring' if reconfig else 'Deploying',
- daemon_spec.name(), daemon_spec.host))
+ self.log.info('%s daemon %s on %s' % (
+ 'Reconfiguring' if reconfig else 'Deploying',
+ daemon_spec.name(), daemon_spec.host))
- out, err, code = self._run_cephadm(
- daemon_spec.host, daemon_spec.name(), 'deploy',
- [
- '--name', daemon_spec.name(),
- ] + daemon_spec.extra_args,
- stdin=json.dumps(cephadm_config))
- if not code and daemon_spec.host in self.cache.daemons:
- # prime cached service state with what we (should have)
- # just created
- sd = orchestrator.DaemonDescription()
- sd.daemon_type = daemon_spec.daemon_type
- sd.daemon_id = daemon_spec.daemon_id
- sd.hostname = daemon_spec.host
- sd.status = 1
- sd.status_desc = 'starting'
- self.cache.add_daemon(daemon_spec.host, sd)
- if daemon_spec.daemon_type in ['grafana', 'iscsi', 'prometheus', 'alertmanager', 'nfs']:
- self.requires_post_actions.add(daemon_spec.daemon_type)
- self.cache.invalidate_host_daemons(daemon_spec.host)
- self.cache.update_daemon_config_deps(daemon_spec.host, daemon_spec.name(), deps, start_time)
- self.cache.save_host(daemon_spec.host)
- return "{} {} on host '{}'".format(
- 'Reconfigured' if reconfig else 'Deployed', daemon_spec.name(), daemon_spec.host)
+ out, err, code = self._run_cephadm(
+ daemon_spec.host, daemon_spec.name(), 'deploy',
+ [
+ '--name', daemon_spec.name(),
+ ] + daemon_spec.extra_args,
+ stdin=json.dumps(cephadm_config))
+ if not code and daemon_spec.host in self.cache.daemons:
+ # prime cached service state with what we (should have)
+ # just created
+ sd = orchestrator.DaemonDescription()
+ sd.daemon_type = daemon_spec.daemon_type
+ sd.daemon_id = daemon_spec.daemon_id
+ sd.hostname = daemon_spec.host
+ sd.status = 1
+ sd.status_desc = 'starting'
+ self.cache.add_daemon(daemon_spec.host, sd)
+ if daemon_spec.daemon_type in ['grafana', 'iscsi', 'prometheus', 'alertmanager', 'nfs']:
+ self.requires_post_actions.add(daemon_spec.daemon_type)
+ self.cache.invalidate_host_daemons(daemon_spec.host)
+ self.cache.update_daemon_config_deps(daemon_spec.host, daemon_spec.name(), deps, start_time)
+ self.cache.save_host(daemon_spec.host)
+ msg = "{} {} on host '{}'".format(
+ 'Reconfigured' if reconfig else 'Deployed', daemon_spec.name(), daemon_spec.host)
+ if not code:
+ self.events.for_daemon(daemon_spec.name(), OrchestratorEvent.INFO, msg)
+ else:
+ what = 'reconfigure' if reconfig else 'deploy'
+ self.events.for_daemon(daemon_spec.name(), OrchestratorEvent.ERROR, f'Failed to {what}: {err}')
+ return msg
@forall_hosts
def _remove_daemons(self, name, host) -> str:
@@ -1781,25 +1822,33 @@ you may want to run:
"""
(daemon_type, daemon_id) = name.split('.', 1)
- self.cephadm_services[daemon_type].pre_remove(daemon_id)
+ with set_exception_subject('service', orchestrator.DaemonDescription(
+ daemon_type=daemon_type,
+ daemon_id=daemon_id,
+ hostname=host,
+ ).service_id(), overwrite=True):
- args = ['--name', name, '--force']
- self.log.info('Removing daemon %s from %s' % (name, host))
- out, err, code = self._run_cephadm(
- host, name, 'rm-daemon', args)
- if not code:
- # remove item from cache
- self.cache.rm_daemon(host, name)
- self.cache.invalidate_host_daemons(host)
- return "Removed {} from host '{}'".format(name, host)
+
+ self.cephadm_services[daemon_type].pre_remove(daemon_id)
+
+ args = ['--name', name, '--force']
+ self.log.info('Removing daemon %s from %s' % (name, host))
+ out, err, code = self._run_cephadm(
+ host, name, 'rm-daemon', args)
+ if not code:
+ # remove item from cache
+ self.cache.rm_daemon(host, name)
+ self.cache.invalidate_host_daemons(host)
+ return "Removed {} from host '{}'".format(name, host)
def _config_fn(self, service_type) -> Optional[Callable[[ServiceSpec], None]]:
- return {
+ fn = {
'mds': self.mds_service.config,
'rgw': self.rgw_service.config,
'nfs': self.nfs_service.config,
'iscsi': self.iscsi_service.config,
}.get(service_type)
+ return cast(Callable[[ServiceSpec], None], fn)
def _apply_service(self, spec: ServiceSpec) -> bool:
"""
@@ -1914,6 +1963,8 @@ you may want to run:
except Exception as e:
self.log.exception('Failed to apply %s spec %s: %s' % (
spec.service_name(), spec, e))
+ self.events.for_service(spec, 'ERROR', 'Failed to apply: ' + str(e))
+
return r
def _check_pool_exists(self, pool, service_name):
diff --git a/src/pybind/mgr/cephadm/services/cephadmservice.py b/src/pybind/mgr/cephadm/services/cephadmservice.py
index 1a6d37bf392..6a1bda7c49f 100644
--- a/src/pybind/mgr/cephadm/services/cephadmservice.py
+++ b/src/pybind/mgr/cephadm/services/cephadmservice.py
@@ -109,7 +109,7 @@ class CephadmService(metaclass=ABCMeta):
def get_active_daemon(self, daemon_descrs: List[DaemonDescription]) -> DaemonDescription:
raise NotImplementedError()
- def _inventory_get_addr(self, hostname: str):
+ def _inventory_get_addr(self, hostname: str) -> str:
"""Get a host's address with its hostname."""
return self.mgr.inventory.get_addr(hostname)
@@ -218,10 +218,11 @@ class CephadmService(metaclass=ABCMeta):
class MonService(CephadmService):
TYPE = 'mon'
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
"""
Create a new monitor on the given host.
"""
+ assert self.TYPE == daemon_spec.daemon_type
name, host, network = daemon_spec.daemon_id, daemon_spec.host, daemon_spec.network
# get mon. key
@@ -248,7 +249,7 @@ class MonService(CephadmService):
'who': 'mon',
'key': 'public_network',
})
- network = network.strip() # type: ignore
+ network = network.strip() if network else network
if not network:
raise OrchestratorError('Must set public_network config option or specify a CIDR network, ceph addrvec, or plain IP')
if '/' not in network:
@@ -260,8 +261,7 @@ class MonService(CephadmService):
return self.mgr._create_daemon(daemon_spec)
- def _check_safe_to_destroy(self, mon_id):
- # type: (str) -> None
+ def _check_safe_to_destroy(self, mon_id: str) -> None:
ret, out, err = self.mgr.check_mon_command({
'prefix': 'quorum_status',
})
@@ -297,11 +297,13 @@ class MonService(CephadmService):
class MgrService(CephadmService):
TYPE = 'mgr'
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
"""
Create a new manager instance on a host.
"""
+ assert self.TYPE == daemon_spec.daemon_type
mgr_id, host = daemon_spec.daemon_id, daemon_spec.host
+
# get mgr. key
ret, keyring, err = self.mgr.check_mon_command({
'prefix': 'auth get-or-create',
@@ -319,9 +321,11 @@ class MgrService(CephadmService):
class MdsService(CephadmService):
TYPE = 'mds'
- def config(self, spec: ServiceSpec):
- # ensure mds_join_fs is set for these daemons
+ def config(self, spec: ServiceSpec) -> None:
+ assert self.TYPE == spec.service_type
assert spec.service_id
+
+ # ensure mds_join_fs is set for these daemons
ret, out, err = self.mgr.check_mon_command({
'prefix': 'config set',
'who': 'mds.' + spec.service_id,
@@ -329,7 +333,8 @@ class MdsService(CephadmService):
'value': spec.service_id,
})
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
mds_id, host = daemon_spec.daemon_id, daemon_spec.host
# get mgr. key
@@ -348,7 +353,9 @@ class MdsService(CephadmService):
class RgwService(CephadmService):
TYPE = 'rgw'
- def config(self, spec: RGWSpec):
+ def config(self, spec: RGWSpec) -> None:
+ assert self.TYPE == spec.service_type
+
# ensure rgw_realm and rgw_zone is set for these daemons
ret, out, err = self.mgr.check_mon_command({
'prefix': 'config set',
@@ -403,8 +410,10 @@ class RgwService(CephadmService):
spec.service_name(), spec.placement.pretty_str()))
self.mgr.spec_store.save(spec)
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
rgw_id, host = daemon_spec.daemon_id, daemon_spec.host
+
ret, keyring, err = self.mgr.check_mon_command({
'prefix': 'auth get-or-create',
'entity': f"{utils.name_to_config_section('rgw')}.{rgw_id}",
@@ -421,7 +430,8 @@ class RgwService(CephadmService):
class RbdMirrorService(CephadmService):
TYPE = 'rbd-mirror'
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
daemon_id, host = daemon_spec.daemon_id, daemon_spec.host
ret, keyring, err = self.mgr.check_mon_command({
@@ -439,7 +449,8 @@ class RbdMirrorService(CephadmService):
class CrashService(CephadmService):
TYPE = 'crash'
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
daemon_id, host = daemon_spec.daemon_id, daemon_spec.host
ret, keyring, err = self.mgr.check_mon_command({
diff --git a/src/pybind/mgr/cephadm/services/iscsi.py b/src/pybind/mgr/cephadm/services/iscsi.py
index 127783c13e4..86ec539cb5f 100644
--- a/src/pybind/mgr/cephadm/services/iscsi.py
+++ b/src/pybind/mgr/cephadm/services/iscsi.py
@@ -15,7 +15,8 @@ logger = logging.getLogger(__name__)
class IscsiService(CephadmService):
TYPE = 'iscsi'
- def config(self, spec: IscsiServiceSpec):
+ def config(self, spec: IscsiServiceSpec) -> None:
+ assert self.TYPE == spec.service_type
self.mgr._check_pool_exists(spec.pool, spec.service_name())
logger.info('Saving service %s spec with placement %s' % (
@@ -23,10 +24,12 @@ class IscsiService(CephadmService):
self.mgr.spec_store.save(spec)
def create(self, daemon_spec: CephadmDaemonSpec[IscsiServiceSpec]) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
+ assert daemon_spec.spec
+
spec = daemon_spec.spec
- if spec is None:
- raise OrchestratorError(f'Unable to deploy {daemon_spec.name()}: Service not found.')
igw_id = daemon_spec.daemon_id
+
ret, keyring, err = self.mgr.check_mon_command({
'prefix': 'auth get-or-create',
'entity': utils.name_to_auth_entity('iscsi', igw_id),
diff --git a/src/pybind/mgr/cephadm/services/monitoring.py b/src/pybind/mgr/cephadm/services/monitoring.py
index 9c4e3ae6266..f910a644469 100644
--- a/src/pybind/mgr/cephadm/services/monitoring.py
+++ b/src/pybind/mgr/cephadm/services/monitoring.py
@@ -12,10 +12,12 @@ class GrafanaService(CephadmService):
TYPE = 'grafana'
DEFAULT_SERVICE_PORT = 3000
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
return self.mgr._create_daemon(daemon_spec)
def generate_config(self, daemon_spec: CephadmDaemonSpec) -> Tuple[Dict[str, Any], List[str]]:
+ assert self.TYPE == daemon_spec.daemon_type
deps = [] # type: List[str]
prom_services = [] # type: List[str]
@@ -75,10 +77,12 @@ class AlertmanagerService(CephadmService):
TYPE = 'alertmanager'
DEFAULT_SERVICE_PORT = 9093
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
return self.mgr._create_daemon(daemon_spec)
def generate_config(self, daemon_spec: CephadmDaemonSpec) -> Tuple[Dict[str, Any], List[str]]:
+ assert self.TYPE == daemon_spec.daemon_type
deps = [] # type: List[str]
# dashboard(s)
@@ -142,10 +146,12 @@ class PrometheusService(CephadmService):
TYPE = 'prometheus'
DEFAULT_SERVICE_PORT = 9095
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
return self.mgr._create_daemon(daemon_spec)
def generate_config(self, daemon_spec: CephadmDaemonSpec) -> Tuple[Dict[str, Any], List[str]]:
+ assert self.TYPE == daemon_spec.daemon_type
deps = [] # type: List[str]
# scrape mgrs
@@ -229,8 +235,10 @@ class PrometheusService(CephadmService):
class NodeExporterService(CephadmService):
TYPE = 'node-exporter'
- def create(self, daemon_spec: CephadmDaemonSpec):
+ def create(self, daemon_spec: CephadmDaemonSpec) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
return self.mgr._create_daemon(daemon_spec)
def generate_config(self, daemon_spec: CephadmDaemonSpec) -> Tuple[Dict[str, Any], List[str]]:
+ assert self.TYPE == daemon_spec.daemon_type
return {}, []
diff --git a/src/pybind/mgr/cephadm/services/nfs.py b/src/pybind/mgr/cephadm/services/nfs.py
index c54a4a539b5..ed751ec4ec0 100644
--- a/src/pybind/mgr/cephadm/services/nfs.py
+++ b/src/pybind/mgr/cephadm/services/nfs.py
@@ -21,6 +21,8 @@ class NFSService(CephadmService):
TYPE = 'nfs'
def generate_config(self, daemon_spec: CephadmDaemonSpec) -> Tuple[Dict[str, Any], List[str]]:
+ assert self.TYPE == daemon_spec.daemon_type
+
daemon_type = daemon_spec.daemon_type
daemon_id = daemon_spec.daemon_id
host = daemon_spec.host
@@ -66,16 +68,22 @@ class NFSService(CephadmService):
return cephadm_config, deps
- def config(self, spec):
+ def config(self, spec: NFSServiceSpec) -> None:
+ assert self.TYPE == spec.service_type
self.mgr._check_pool_exists(spec.pool, spec.service_name())
+
logger.info('Saving service %s spec with placement %s' % (
spec.service_name(), spec.placement.pretty_str()))
self.mgr.spec_store.save(spec)
- def create(self, daemon_spec: CephadmDaemonSpec[NFSServiceSpec]):
+ def create(self, daemon_spec: CephadmDaemonSpec[NFSServiceSpec]) -> str:
+ assert self.TYPE == daemon_spec.daemon_type
+ assert daemon_spec.spec
+
daemon_id = daemon_spec.daemon_id
host = daemon_spec.host
spec = daemon_spec.spec
+
logger.info('Create daemon %s on host %s with spec %s' % (
daemon_id, host, spec))
return self.mgr._create_daemon(daemon_spec)
@@ -118,20 +126,16 @@ class NFSGanesha(object):
self.daemon_id = daemon_id
self.spec = spec
- def get_daemon_name(self):
- # type: () -> str
+ def get_daemon_name(self) -> str:
return '%s.%s' % (self.spec.service_type, self.daemon_id)
- def get_rados_user(self):
- # type: () -> str
+ def get_rados_user(self) -> str:
return '%s.%s' % (self.spec.service_type, self.daemon_id)
- def get_keyring_entity(self):
- # type: () -> str
+ def get_keyring_entity(self) -> str:
return utils.name_to_config_section(self.get_rados_user())
- def get_or_create_keyring(self, entity=None):
- # type: (Optional[str]) -> str
+ def get_or_create_keyring(self, entity: Optional[str] = None) -> str:
if not entity:
entity = self.get_keyring_entity()
@@ -147,8 +151,7 @@ class NFSGanesha(object):
% (entity, ret, err))
return keyring
- def update_keyring_caps(self, entity=None):
- # type: (Optional[str]) -> None
+ def update_keyring_caps(self, entity: Optional[str] = None) -> None:
if not entity:
entity = self.get_keyring_entity()
@@ -169,8 +172,7 @@ class NFSGanesha(object):
'Unable to update keyring caps %s: %s %s' \
% (entity, ret, err))
- def create_rados_config_obj(self, clobber=False):
- # type: (Optional[bool]) -> None
+ def create_rados_config_obj(self, clobber: Optional[bool] = False) -> None:
obj = self.spec.rados_config_name()
with self.mgr.rados.open_ioctx(self.spec.pool) as ioctx:
@@ -191,8 +193,7 @@ class NFSGanesha(object):
logger.info('Creating rados config object: %s' % obj)
ioctx.write_full(obj, ''.encode('utf-8'))
- def get_ganesha_conf(self):
- # type: () -> str
+ def get_ganesha_conf(self) -> str:
context = dict(user=self.get_rados_user(),
nodeid=self.get_daemon_name(),
pool=self.spec.pool,
@@ -200,8 +201,7 @@ class NFSGanesha(object):
url=self.spec.rados_config_location())
return self.mgr.template.render('services/nfs/ganesha.conf.j2', context)
- def get_cephadm_config(self):
- # type: () -> Dict
+ def get_cephadm_config(self) -> Dict[str, Any]:
config = {'pool' : self.spec.pool} # type: Dict
if self.spec.namespace:
config['namespace'] = self.spec.namespace
diff --git a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2
index 381dbb87a14..5fe78320ee9 100644
--- a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2
+++ b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2
@@ -7,8 +7,6 @@ NFS_CORE_PARAM {
MDCACHE {
Dir_Chunk = 0;
- NParts = 1;
- Cache_Size = 1;
}
EXPORT_DEFAULTS {
diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py
index 1d746fcd4a4..b6ca68c1c77 100644
--- a/src/pybind/mgr/cephadm/tests/test_cephadm.py
+++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py
@@ -92,12 +92,13 @@ class TestCephadm(object):
c = cephadm_module.list_daemons()
- def remove_id(dd):
+ def remove_id_events(dd):
out = dd.to_json()
del out['daemon_id']
+ del out['events']
return out
- assert [remove_id(dd) for dd in wait(cephadm_module, c)] == [
+ assert [remove_id_events(dd) for dd in wait(cephadm_module, c)] == [
{
'daemon_type': 'mds',
'hostname': 'test',
@@ -133,9 +134,12 @@ class TestCephadm(object):
'service_id': 'r.z',
'service_name': 'rgw.r.z',
'service_type': 'rgw',
- 'status': {'running': 0, 'size': 1}
+ 'status': {'running': 0, 'size': 1},
}
]
+ for o in out:
+ if 'events' in o:
+ del o['events'] # delete it, as it contains a timestamp
assert out == expected
assert [ServiceDescription.from_json(o).to_json() for o in expected] == expected
diff --git a/src/pybind/mgr/cephadm/tests/test_spec.py b/src/pybind/mgr/cephadm/tests/test_spec.py
index 1a048d82d6f..338759cf11c 100644
--- a/src/pybind/mgr/cephadm/tests/test_spec.py
+++ b/src/pybind/mgr/cephadm/tests/test_spec.py
@@ -102,6 +102,7 @@ def test_spec_octopus(spec_json):
spec = j_c.pop('spec')
j_c.update(spec)
j_c.pop('objectstore', None)
+ j_c.pop('filter_logic', None)
return j_c
assert spec_json == convert_to_old_style_json(spec.to_json())
diff --git a/src/pybind/mgr/dashboard/frontend/angular.json b/src/pybind/mgr/dashboard/frontend/angular.json
index a29f222f01c..3ebca753a2b 100644
--- a/src/pybind/mgr/dashboard/frontend/angular.json
+++ b/src/pybind/mgr/dashboard/frontend/angular.json
@@ -54,9 +54,7 @@
"node_modules/ngx-toastr/toastr.css",
"src/styles.scss"
],
- "scripts": [
- "node_modules/chart.js/dist/Chart.bundle.js"
- ],
+ "scripts": ["node_modules/chart.js/dist/Chart.bundle.js"],
"stylePreprocessorOptions": {
"includePaths": [
"src"
diff --git a/src/pybind/mgr/dashboard/frontend/cypress.json b/src/pybind/mgr/dashboard/frontend/cypress.json
index cef1e3382d3..ce9e5e8453c 100644
--- a/src/pybind/mgr/dashboard/frontend/cypress.json
+++ b/src/pybind/mgr/dashboard/frontend/cypress.json
@@ -5,9 +5,8 @@
],
"supportFile": "cypress/support/index.ts",
"video": false,
- "defaultCommandTimeout": 20000,
+ "defaultCommandTimeout": 120000,
"viewportHeight": 1080,
"viewportWidth": 1920,
- "pluginsFile": false,
"projectId": "k7ab29"
}
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/plugins/index.js b/src/pybind/mgr/dashboard/frontend/cypress/plugins/index.js
new file mode 100644
index 00000000000..0f9934c9897
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/cypress/plugins/index.js
@@ -0,0 +1,8 @@
+module.exports = (on, _config) => {
+ on('before:browser:launch', (browser, launchOptions) => {
+ if (browser.name === 'chrome' && browser.isHeadless) {
+ launchOptions.args.push('--disable-gpu');
+ return launchOptions;
+ }
+ });
+};
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json b/src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json
index 681a8b35dd7..8b5a7ffc9c6 100644
--- a/src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json
+++ b/src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json
@@ -2,7 +2,8 @@
"extends": "../tsconfig.json",
"exclude": [],
"include": [
- "**/*.ts"
+ "**/*.ts",
+ "plugins/index.js"
],
"compilerOptions": {
"types": [
diff --git a/src/pybind/mgr/dashboard/frontend/ngcc.config.js b/src/pybind/mgr/dashboard/frontend/ngcc.config.js
index 2d0a64d82a6..dff8d9b7fb3 100644
--- a/src/pybind/mgr/dashboard/frontend/ngcc.config.js
+++ b/src/pybind/mgr/dashboard/frontend/ngcc.config.js
@@ -1,9 +1,10 @@
module.exports = {
packages: {
'simplebar-angular': {
- ignorableDeepImportMatchers: [
- /simplebar-core\.esm/,
- ]
+ ignorableDeepImportMatchers: [/simplebar-core\.esm/]
},
- },
+ '@locl/cli': {
+ ignorableDeepImportMatchers: [/@angular\/localize/]
+ }
+ }
};
diff --git a/src/pybind/mgr/dashboard/frontend/package-lock.json b/src/pybind/mgr/dashboard/frontend/package-lock.json
index 69459333e85..7eeb202fed7 100644
--- a/src/pybind/mgr/dashboard/frontend/package-lock.json
+++ b/src/pybind/mgr/dashboard/frontend/package-lock.json
@@ -474,9 +474,9 @@
}
},
"@babel/compat-data": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.4.tgz",
- "integrity": "sha512-t+rjExOrSVvjQQXNp5zAIYDp00KjdvGl/TpDX5REPr0S9IAIPQMTilcfG6q8c0QFmj9lSTVySV2VTsyggvtNIw==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.5.tgz",
+ "integrity": "sha512-mPVoWNzIpYJHbWje0if7Ck36bpbtTvIxOi9+6WSK9wjGEXearAqlwBoTQvVjsAY2VIwgcs8V940geY3okzRCEw==",
"dev": true,
"requires": {
"browserslist": "^4.12.0",
@@ -512,19 +512,13 @@
}
},
"@babel/generator": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.4.tgz",
- "integrity": "sha512-toLIHUIAgcQygFZRAQcsLQV3CBuX6yOIru1kJk/qqqvcRmZrYe6WavZTSG+bB8MxhnL9YPf+pKQfuiP161q7ng==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.5.tgz",
+ "integrity": "sha512-3vXxr3FEW7E7lJZiWQ3bM4+v/Vyr9C+hpolQ8BGFr9Y8Ri2tFLWTixmwKBafDujO1WVah4fhZBeU1bieKdghig==",
"requires": {
- "@babel/types": "^7.10.4",
+ "@babel/types": "^7.10.5",
"jsesc": "^2.5.1",
- "lodash": "4.17.19",
"source-map": "^0.5.0"
- },
- "dependencies": {
- "lodash": {
- "version": "4.17.19"
- }
}
},
"@babel/helper-annotate-as-pure": {
@@ -571,13 +565,13 @@
}
},
"@babel/helper-define-map": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.4.tgz",
- "integrity": "sha512-nIij0oKErfCnLUCWaCaHW0Bmtl2RO9cN7+u2QT8yqTywgALKlyUVOvHDElh+b5DwVC6YB1FOYFOTWcN/+41EDA==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz",
+ "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==",
"dev": true,
"requires": {
"@babel/helper-function-name": "^7.10.4",
- "@babel/types": "^7.10.4",
+ "@babel/types": "^7.10.5",
"lodash": "4.17.19"
},
"dependencies": {
@@ -624,12 +618,12 @@
}
},
"@babel/helper-member-expression-to-functions": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.4.tgz",
- "integrity": "sha512-m5j85pK/KZhuSdM/8cHUABQTAslV47OjfIB9Cc7P+PvlAoBzdb79BGNfw8RhT5Mq3p+xGd0ZfAKixbrUZx0C7A==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.5.tgz",
+ "integrity": "sha512-HiqJpYD5+WopCXIAbQDG0zye5XYVvcO9w/DHp5GsaGkRUaamLj2bEtu6i8rnGGprAhHM3qidCMgp71HF4endhA==",
"dev": true,
"requires": {
- "@babel/types": "^7.10.4"
+ "@babel/types": "^7.10.5"
}
},
"@babel/helper-module-imports": {
@@ -642,9 +636,9 @@
}
},
"@babel/helper-module-transforms": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.4.tgz",
- "integrity": "sha512-Er2FQX0oa3nV7eM1o0tNCTx7izmQtwAQsIiaLRWtavAAEcskb0XJ5OjJbVrYXWOTr8om921Scabn4/tzlx7j1Q==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.5.tgz",
+ "integrity": "sha512-4P+CWMJ6/j1W915ITJaUkadLObmCRRSC234uctJfn/vHrsLNxsR8dwlcXv9ZhJWzl77awf+mWXSZEKt5t0OnlA==",
"dev": true,
"requires": {
"@babel/helper-module-imports": "^7.10.4",
@@ -652,7 +646,7 @@
"@babel/helper-simple-access": "^7.10.4",
"@babel/helper-split-export-declaration": "^7.10.4",
"@babel/template": "^7.10.4",
- "@babel/types": "^7.10.4",
+ "@babel/types": "^7.10.5",
"lodash": "4.17.19"
},
"dependencies": {
@@ -677,9 +671,9 @@
"dev": true
},
"@babel/helper-regex": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.4.tgz",
- "integrity": "sha512-inWpnHGgtg5NOF0eyHlC0/74/VkdRITY9dtTpB2PrxKKn+AkVMRiZz/Adrx+Ssg+MLDesi2zohBW6MVq6b4pOQ==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.5.tgz",
+ "integrity": "sha512-68kdUAzDrljqBrio7DYAEgCoJHxppJOERHOgOrDN7WjOzP0ZQ1LsSDRXcemzVZaLvjaJsJEESb6qt+znNuENDg==",
"dev": true,
"requires": {
"lodash": "4.17.19"
@@ -771,14 +765,14 @@
}
},
"@babel/parser": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.4.tgz",
- "integrity": "sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA=="
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.5.tgz",
+ "integrity": "sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ=="
},
"@babel/plugin-proposal-async-generator-functions": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.4.tgz",
- "integrity": "sha512-MJbxGSmejEFVOANAezdO39SObkURO5o/8b6fSH6D1pi9RZQt+ldppKPXfqgUWpSQ9asM6xaSaSJIaeWMDRP0Zg==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz",
+ "integrity": "sha512-cNMCVezQbrRGvXJwm9fu/1sJj9bHdGAgKodZdLqOQIpfoH3raqmRPBM17+lh7CzhiKRRBrGtZL9WcjxSoGYUSg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.10.4",
@@ -1014,18 +1008,12 @@
}
},
"@babel/plugin-transform-block-scoping": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.4.tgz",
- "integrity": "sha512-J3b5CluMg3hPUii2onJDRiaVbPtKFPLEaV5dOPY5OeAbDi1iU/UbbFFTgwb7WnanaDy7bjU35kc26W3eM5Qa0A==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.5.tgz",
+ "integrity": "sha512-6Ycw3hjpQti0qssQcA6AMSFDHeNJ++R6dIMnpRqUjFeBBTmTDPa8zgF90OVfTvAo11mXZTlVUViY1g8ffrURLg==",
"dev": true,
"requires": {
- "@babel/helper-plugin-utils": "^7.10.4",
- "lodash": "4.17.19"
- },
- "dependencies": {
- "lodash": {
- "version": "4.17.19"
- }
+ "@babel/helper-plugin-utils": "^7.10.4"
}
},
"@babel/plugin-transform-classes": {
@@ -1129,12 +1117,12 @@
}
},
"@babel/plugin-transform-modules-amd": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.4.tgz",
- "integrity": "sha512-3Fw+H3WLUrTlzi3zMiZWp3AR4xadAEMv6XRCYnd5jAlLM61Rn+CRJaZMaNvIpcJpQ3vs1kyifYvEVPFfoSkKOA==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.5.tgz",
+ "integrity": "sha512-elm5uruNio7CTLFItVC/rIzKLfQ17+fX7EVz5W0TMgIHFo1zY0Ozzx+lgwhL4plzl8OzVn6Qasx5DeEFyoNiRw==",
"dev": true,
"requires": {
- "@babel/helper-module-transforms": "^7.10.4",
+ "@babel/helper-module-transforms": "^7.10.5",
"@babel/helper-plugin-utils": "^7.10.4",
"babel-plugin-dynamic-import-node": "^2.3.3"
}
@@ -1152,13 +1140,13 @@
}
},
"@babel/plugin-transform-modules-systemjs": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.4.tgz",
- "integrity": "sha512-Tb28LlfxrTiOTGtZFsvkjpyjCl9IoaRI52AEU/VIwOwvDQWtbNJsAqTXzh+5R7i74e/OZHH2c2w2fsOqAfnQYQ==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.5.tgz",
+ "integrity": "sha512-f4RLO/OL14/FP1AEbcsWMzpbUz6tssRaeQg11RH1BP/XnPpRoVwgeYViMFacnkaw4k4wjRSjn3ip1Uw9TaXuMw==",
"dev": true,
"requires": {
"@babel/helper-hoist-variables": "^7.10.4",
- "@babel/helper-module-transforms": "^7.10.4",
+ "@babel/helper-module-transforms": "^7.10.5",
"@babel/helper-plugin-utils": "^7.10.4",
"babel-plugin-dynamic-import-node": "^2.3.3"
}
@@ -1202,9 +1190,9 @@
}
},
"@babel/plugin-transform-parameters": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.4.tgz",
- "integrity": "sha512-RurVtZ/D5nYfEg0iVERXYKEgDFeesHrHfx8RT05Sq57ucj2eOYAP6eu5fynL4Adju4I/mP/I6SO0DqNWAXjfLQ==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.5.tgz",
+ "integrity": "sha512-xPHwUj5RdFV8l1wuYiu5S9fqWGM2DrYc24TMvUiRrPVm+SM3XeqU9BcokQX/kEUe+p2RBwy+yoiR1w/Blq6ubw==",
"dev": true,
"requires": {
"@babel/helper-get-function-arity": "^7.10.4",
@@ -1267,9 +1255,9 @@
}
},
"@babel/plugin-transform-template-literals": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.4.tgz",
- "integrity": "sha512-4NErciJkAYe+xI5cqfS8pV/0ntlY5N5Ske/4ImxAVX7mk9Rxt2bwDTGv1Msc2BRJvWQcmYEC+yoMLdX22aE4VQ==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.5.tgz",
+ "integrity": "sha512-V/lnPGIb+KT12OQikDvgSuesRX14ck5FfJXt6+tXhdkJ+Vsd0lDCVtF6jcB4rNClYFzaB2jusZ+lNISDk2mMMw==",
"dev": true,
"requires": {
"@babel/helper-annotate-as-pure": "^7.10.4",
@@ -1377,9 +1365,9 @@
}
},
"@babel/runtime": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.4.tgz",
- "integrity": "sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.5.tgz",
+ "integrity": "sha512-otddXKhdNn7d0ptoFRHtMLa8LqDxLYwTjB4nYgM1yy5N6gU/MUf8zqyyLltCH3yAVitBzmwK4us+DD0l/MauAg==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.4"
@@ -1396,16 +1384,16 @@
}
},
"@babel/traverse": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.4.tgz",
- "integrity": "sha512-aSy7p5THgSYm4YyxNGz6jZpXf+Ok40QF3aA2LyIONkDHpAcJzDUqlCKXv6peqYUs2gmic849C/t2HKw2a2K20Q==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.5.tgz",
+ "integrity": "sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ==",
"requires": {
"@babel/code-frame": "^7.10.4",
- "@babel/generator": "^7.10.4",
+ "@babel/generator": "^7.10.5",
"@babel/helper-function-name": "^7.10.4",
"@babel/helper-split-export-declaration": "^7.10.4",
- "@babel/parser": "^7.10.4",
- "@babel/types": "^7.10.4",
+ "@babel/parser": "^7.10.5",
+ "@babel/types": "^7.10.5",
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "4.17.19"
@@ -1417,9 +1405,9 @@
}
},
"@babel/types": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.4.tgz",
- "integrity": "sha512-UTCFOxC3FsFHb7lkRMVvgLzaRVamXuAs2Tz4wajva4WxtVY82eZeaUBtC2Zt95FU9TiznuC0Zk35tsim8jeVpg==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.5.tgz",
+ "integrity": "sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q==",
"requires": {
"@babel/helper-validator-identifier": "^7.10.4",
"lodash": "4.17.19",
@@ -2655,235 +2643,284 @@
}
}
},
- "@mrmlnc/readdir-enhanced": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
- "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==",
- "dev": true,
- "requires": {
- "call-me-maybe": "^1.0.1",
- "glob-to-regexp": "^0.3.0"
- }
- },
- "@ng-bootstrap/ng-bootstrap": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-6.1.0.tgz",
- "integrity": "sha512-2GzkNJBKdeHkaUqaCAqSILPft0IzzHjMfAlAuGY6/ZLlVQ0glt5MTbIXtIhSbjR+OvlrljoXFLrvzs1LGdmE+A=="
- },
- "@ngtools/webpack": {
- "version": "9.1.7",
- "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.7.tgz",
- "integrity": "sha512-A7VB2I42Kn+7jl0tDKzGNLAoZLWSqkKo9Hg1bmKpvAAIz+DSbq3uV+JWgGgTprM3tn0lfkVgmqk4H17HKwAOcg==",
+ "@locl/cli": {
+ "version": "0.0.1-beta.9",
+ "resolved": "https://registry.npmjs.org/@locl/cli/-/cli-0.0.1-beta.9.tgz",
+ "integrity": "sha512-sTYl4q585AftySMct/qNF4i3bTsnVxAN6g1STOUinpfx84s4JYWW9WL0sgl0bdM4sL7+AjxlYg21RxCDc6JUkg==",
"dev": true,
"requires": {
- "@angular-devkit/core": "9.1.7",
- "enhanced-resolve": "4.1.1",
- "rxjs": "6.5.4",
- "webpack-sources": "1.4.3"
+ "@babel/core": "^7.8.6",
+ "chalk": "^3.0.0",
+ "find-up": "^4.1.0",
+ "glob": "^7.1.2",
+ "yargs": "^13.1.0"
},
"dependencies": {
- "rxjs": {
- "version": "6.5.4",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
- "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
+ "@babel/core": {
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz",
+ "integrity": "sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w==",
"dev": true,
"requires": {
- "tslib": "^1.9.0"
+ "@babel/code-frame": "^7.10.4",
+ "@babel/generator": "^7.10.5",
+ "@babel/helper-module-transforms": "^7.10.5",
+ "@babel/helpers": "^7.10.4",
+ "@babel/parser": "^7.10.5",
+ "@babel/template": "^7.10.4",
+ "@babel/traverse": "^7.10.5",
+ "@babel/types": "^7.10.5",
+ "convert-source-map": "^1.7.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.1",
+ "json5": "^2.1.2",
+ "lodash": "4.17.19",
+ "resolve": "^1.3.2",
+ "semver": "^5.4.1",
+ "source-map": "^0.5.0"
+ },
+ "dependencies": {
+ "lodash": {
+ "version": "4.17.19"
+ }
}
- }
- }
- },
- "@ngx-translate/i18n-polyfill": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/@ngx-translate/i18n-polyfill/-/i18n-polyfill-1.0.0.tgz",
- "integrity": "sha512-+UKmSr6cWBJiMDex6w2FwVjEeVnlEsINDGYvTgRaFRI3/IKZrsSVcfISDcBX2wWr6m4jumfOyCcimIl2TxcaoA==",
- "requires": {
- "glob": "7.1.2",
- "tslib": "^1.9.0",
- "yargs": "10.0.3"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
- "camelcase": {
+ "ansi-regex": {
"version": "4.1.0",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
- "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
},
- "cliui": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
- "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
+ "ansi-styles": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
+ "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "dev": true,
"requires": {
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1",
- "wrap-ansi": "^2.0.0"
- },
- "dependencies": {
- "string-width": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
- "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
- "requires": {
- "code-point-at": "^1.0.0",
- "is-fullwidth-code-point": "^1.0.0",
- "strip-ansi": "^3.0.0"
- }
- }
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
}
},
- "find-up": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
- "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
+ "dev": true,
"requires": {
- "locate-path": "^2.0.0"
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
}
},
- "get-caller-file": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
- "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w=="
- },
- "is-fullwidth-code-point": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
- "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "cliui": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
+ "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
+ "dev": true,
"requires": {
- "number-is-nan": "^1.0.0"
+ "string-width": "^3.1.0",
+ "strip-ansi": "^5.2.0",
+ "wrap-ansi": "^5.1.0"
}
},
- "locate-path": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
- "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
"requires": {
- "p-locate": "^2.0.0",
- "path-exists": "^3.0.0"
+ "color-name": "~1.1.4"
}
},
- "p-limit": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
- "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "dev": true,
"requires": {
- "p-try": "^1.0.0"
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
}
},
"p-locate": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
- "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "dev": true,
"requires": {
- "p-limit": "^1.1.0"
+ "p-limit": "^2.0.0"
}
},
- "p-try": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
- "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M="
- },
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
- "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
- },
- "require-main-filename": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
- "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE="
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
},
"string-width": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
- "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
"requires": {
+ "emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^4.0.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
- "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
- },
- "is-fullwidth-code-point": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
- "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
- },
- "strip-ansi": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
- "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
- "requires": {
- "ansi-regex": "^3.0.0"
- }
- }
+ "strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
- "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
"requires": {
- "ansi-regex": "^2.0.0"
+ "ansi-regex": "^4.1.0"
+ }
+ },
+ "supports-color": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
+ "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
}
},
"wrap-ansi": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
- "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
+ "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
+ "dev": true,
"requires": {
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1"
+ "ansi-styles": "^3.2.0",
+ "string-width": "^3.0.0",
+ "strip-ansi": "^5.0.0"
},
"dependencies": {
- "string-width": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
- "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
"requires": {
- "code-point-at": "^1.0.0",
- "is-fullwidth-code-point": "^1.0.0",
- "strip-ansi": "^3.0.0"
+ "color-convert": "^1.9.0"
}
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
}
}
},
- "y18n": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
- "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE="
- },
"yargs": {
- "version": "10.0.3",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz",
- "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==",
+ "version": "13.3.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
+ "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
+ "dev": true,
"requires": {
- "cliui": "^3.2.0",
- "decamelize": "^1.1.1",
- "find-up": "^2.1.0",
- "get-caller-file": "^1.0.1",
- "os-locale": "^2.0.0",
+ "cliui": "^5.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
- "require-main-filename": "^1.0.1",
+ "require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
- "string-width": "^2.0.0",
+ "string-width": "^3.0.0",
"which-module": "^2.0.0",
- "y18n": "^3.2.1",
- "yargs-parser": "^8.0.0"
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.1.2"
+ },
+ "dependencies": {
+ "find-up": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+ "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^3.0.0"
+ }
+ }
}
},
"yargs-parser": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz",
- "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==",
+ "version": "13.1.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
+ "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "dev": true,
"requires": {
- "camelcase": "^4.1.0"
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
+ "@mrmlnc/readdir-enhanced": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
+ "integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==",
+ "dev": true,
+ "requires": {
+ "call-me-maybe": "^1.0.1",
+ "glob-to-regexp": "^0.3.0"
+ }
+ },
+ "@ng-bootstrap/ng-bootstrap": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-6.1.0.tgz",
+ "integrity": "sha512-2GzkNJBKdeHkaUqaCAqSILPft0IzzHjMfAlAuGY6/ZLlVQ0glt5MTbIXtIhSbjR+OvlrljoXFLrvzs1LGdmE+A=="
+ },
+ "@ngtools/webpack": {
+ "version": "9.1.7",
+ "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.7.tgz",
+ "integrity": "sha512-A7VB2I42Kn+7jl0tDKzGNLAoZLWSqkKo9Hg1bmKpvAAIz+DSbq3uV+JWgGgTprM3tn0lfkVgmqk4H17HKwAOcg==",
+ "dev": true,
+ "requires": {
+ "@angular-devkit/core": "9.1.7",
+ "enhanced-resolve": "4.1.1",
+ "rxjs": "6.5.4",
+ "webpack-sources": "1.4.3"
+ },
+ "dependencies": {
+ "rxjs": {
+ "version": "6.5.4",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
+ "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
}
}
}
@@ -3003,19 +3040,19 @@
},
"dependencies": {
"@babel/core": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.4.tgz",
- "integrity": "sha512-3A0tS0HWpy4XujGc7QtOIHTeNwUgWaZc/WuS5YQrfhU67jnVmsD6OGPc1AKHH0LJHQICGncy3+YUjIhVlfDdcA==",
+ "version": "7.10.5",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz",
+ "integrity": "sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
- "@babel/generator": "^7.10.4",
- "@babel/helper-module-transforms": "^7.10.4",
+ "@babel/generator": "^7.10.5",
+ "@babel/helper-module-transforms": "^7.10.5",
"@babel/helpers": "^7.10.4",
- "@babel/parser": "^7.10.4",
+ "@babel/parser": "^7.10.5",
"@babel/template": "^7.10.4",
- "@babel/traverse": "^7.10.4",
- "@babel/types": "^7.10.4",
+ "@babel/traverse": "^7.10.5",
+ "@babel/types": "^7.10.5",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
@@ -3090,9 +3127,9 @@
}
},
"@types/chart.js": {
- "version": "2.9.22",
- "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.22.tgz",
- "integrity": "sha512-CneMxwh2T5fyMpXE5fuprTTmFtlLyZUFq1A3laUrCgOblDzupgiohrFg3jjsTIrqRI5K4qLZdrLN4zT9/MY5Dw==",
+ "version": "2.9.23",
+ "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.23.tgz",
+ "integrity": "sha512-4QQNE/b+digosu3mnj4E7aNQGKnlpzXa9JvQYPtexpO7v9gnDeqwc1DxF8vLJWLDCNoO6hH0EgO8K/7PtJl8wg==",
"requires": {
"moment": "^2.10.2"
}
@@ -4821,15 +4858,6 @@
"path-is-absolute": "^1.0.0"
}
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -4844,12 +4872,6 @@
"requires": {
"glob": "^7.1.3"
}
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -4946,9 +4968,9 @@
}
},
"caniuse-lite": {
- "version": "1.0.30001099",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001099.tgz",
- "integrity": "sha512-sdS9A+sQTk7wKoeuZBN/YMAHVztUfVnjDi4/UV3sDE8xoh7YR12hKW+pIdB3oqKGwr9XaFL2ovfzt9w8eUI5CA==",
+ "version": "1.0.30001100",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001100.tgz",
+ "integrity": "sha512-0eYdp1+wFCnMlCj2oudciuQn2B9xAFq3WpgpcBIZTxk/1HNA/O2YA7rpeYhnOqsqAJq1AHUgx6i1jtafg7m2zA==",
"dev": true
},
"canonical-path": {
@@ -5129,9 +5151,9 @@
}
},
"chokidar": {
- "version": "3.4.0",
- "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz",
- "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==",
+ "version": "3.4.1",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz",
+ "integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==",
"dev": true,
"requires": {
"anymatch": "~3.1.1",
@@ -5407,7 +5429,8 @@
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
- "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
},
"codelyzer": {
"version": "5.2.2",
@@ -5813,15 +5836,6 @@
"json5": "^1.0.1"
}
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -5850,12 +5864,6 @@
"requires": {
"figgy-pudding": "^3.5.1"
}
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -5956,11 +5964,14 @@
}
},
"cross-spawn": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
- "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
"requires": {
- "lru-cache": "^4.0.1",
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
@@ -6357,34 +6368,6 @@
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
"dev": true
},
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
"fs-extra": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
@@ -6396,15 +6379,6 @@
"universalify": "^0.1.0"
}
},
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
@@ -6597,45 +6571,6 @@
"requires": {
"execa": "^1.0.0",
"ip-regex": "^2.1.0"
- },
- "dependencies": {
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- }
}
},
"defaults": {
@@ -7037,9 +6972,9 @@
"dev": true
},
"electron-to-chromium": {
- "version": "1.3.497",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.497.tgz",
- "integrity": "sha512-sPdW5bUDZwiFtoonuZCUwRGzsZmKzcLM0bMVhp6SMCfUG+B3faENLx3cE+o+K0Jl+MPuNA9s9cScyFjOlixZpQ==",
+ "version": "1.3.498",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.498.tgz",
+ "integrity": "sha512-W1hGwaQEU8j9su2jeAr3aabkPuuXw+j8t73eajGAkEJWbfWiwbxBwQN/8Qmv2qCy3uCDm2rOAaZneYQM8VGC4w==",
"dev": true
},
"elegant-spinner": {
@@ -7275,9 +7210,9 @@
}
},
"escalade": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.1.tgz",
- "integrity": "sha512-DR6NO3h9niOT+MZs7bjxlj2a1k+POu5RN8CLTPX2+i78bRi9eLe7+0zXgUHMnGXWybYcL61E9hGhPKqedy8tQA==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz",
+ "integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ==",
"dev": true
},
"escape-html": {
@@ -7431,12 +7366,13 @@
"dev": true
},
"execa": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
- "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+ "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+ "dev": true,
"requires": {
- "cross-spawn": "^5.0.1",
- "get-stream": "^3.0.0",
+ "cross-spawn": "^6.0.0",
+ "get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
@@ -8365,9 +8301,13 @@
"dev": true
},
"get-stream": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
- "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
},
"get-value": {
"version": "2.0.6",
@@ -8750,12 +8690,6 @@
"requires": {
"yallist": "^4.0.0"
}
- },
- "yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
}
}
},
@@ -8892,34 +8826,6 @@
"wrap-ansi": "^2.0.0"
}
},
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
@@ -8935,36 +8841,12 @@
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
"dev": true
},
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
- "invert-kv": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
- "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
- "dev": true
- },
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
- "lcid": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
- "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
- "dev": true,
- "requires": {
- "invert-kv": "^2.0.0"
- }
- },
"locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
@@ -8975,37 +8857,6 @@
"path-exists": "^3.0.0"
}
},
- "mem": {
- "dev": true,
- "requires": {
- "map-age-cleaner": "^0.1.1",
- "mimic-fn": "^2.0.0",
- "p-is-promise": "^2.0.0"
- },
- "version": "4.3.0"
- },
- "mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true
- },
- "os-locale": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
- "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
- "dev": true,
- "requires": {
- "execa": "^1.0.0",
- "lcid": "^2.0.0",
- "mem": "4.3.0"
- },
- "dependencies": {
- "mem": {
- "version": "4.3.0"
- }
- }
- },
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
@@ -9582,9 +9433,10 @@
}
},
"invert-kv": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
- "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
+ "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
+ "dev": true
},
"ip": {
"version": "1.1.5",
@@ -9954,7 +9806,8 @@
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true
},
"is-svg": {
"version": "3.0.0",
@@ -10025,7 +9878,8 @@
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
- "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
},
"isobject": {
"version": "3.0.1",
@@ -12788,11 +12642,12 @@
"dev": true
},
"lcid": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
- "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
+ "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
+ "dev": true,
"requires": {
- "invert-kv": "^1.0.0"
+ "invert-kv": "^2.0.0"
}
},
"less": {
@@ -13075,6 +12930,12 @@
"escape-string-regexp": "^1.0.5"
}
},
+ "mimic-fn": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
+ "dev": true
+ },
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
@@ -13483,6 +13344,12 @@
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
+ "mimic-fn": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
+ "dev": true
+ },
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
@@ -13571,12 +13438,20 @@
}
},
"lru-cache": {
- "version": "4.1.5",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
- "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
"requires": {
- "pseudomap": "^1.0.2",
- "yallist": "^2.1.2"
+ "yallist": "^3.0.2"
+ },
+ "dependencies": {
+ "yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true
+ }
}
},
"lunr": {
@@ -13672,15 +13547,6 @@
"path-is-absolute": "^1.0.0"
}
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -13698,12 +13564,6 @@
"requires": {
"figgy-pudding": "^3.5.1"
}
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -13827,10 +13687,15 @@
"dev": true
},
"mem": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
+ "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
+ "dev": true,
"requires": {
- "mimic-fn": "^1.0.0"
- },
- "version": "4.3.0"
+ "map-age-cleaner": "^0.1.1",
+ "mimic-fn": "^2.0.0",
+ "p-is-promise": "^2.0.0"
+ }
},
"memory-fs": {
"version": "0.5.0",
@@ -14075,9 +13940,10 @@
}
},
"mimic-fn": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
- "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "dev": true
},
"min-indent": {
"version": "1.0.1",
@@ -14185,14 +14051,6 @@
"dev": true,
"requires": {
"yallist": "^4.0.0"
- },
- "dependencies": {
- "yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
- }
}
},
"minipass-collect": {
@@ -14230,14 +14088,6 @@
"requires": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
- },
- "dependencies": {
- "yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
- }
}
},
"mississippi": {
@@ -14374,9 +14224,9 @@
}
},
"mri": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.5.tgz",
- "integrity": "sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg==",
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
+ "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
"dev": true
},
"ms": {
@@ -14789,15 +14639,6 @@
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"npm-package-arg": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz",
@@ -14815,12 +14656,6 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -14841,19 +14676,6 @@
"string.prototype.padend": "^3.0.0"
},
"dependencies": {
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
"read-pkg": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
@@ -14871,6 +14693,7 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
"integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "dev": true,
"requires": {
"path-key": "^2.0.0"
}
@@ -14893,7 +14716,8 @@
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
- "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
},
"nwsapi": {
"version": "2.2.0",
@@ -15076,14 +14900,6 @@
"dev": true,
"requires": {
"mimic-fn": "^2.1.0"
- },
- "dependencies": {
- "mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true
- }
}
},
"open": {
@@ -15223,18 +15039,14 @@
"dev": true
},
"os-locale": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
- "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
+ "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
+ "dev": true,
"requires": {
- "execa": "^0.7.0",
- "lcid": "^1.0.0",
- "mem": "4.3.0"
- },
- "dependencies": {
- "mem": {
- "version": "4.3.0"
- }
+ "execa": "^1.0.0",
+ "lcid": "^2.0.0",
+ "mem": "^4.0.0"
}
},
"os-name": {
@@ -15284,7 +15096,8 @@
"p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
- "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true
},
"p-is-promise": {
"version": "2.1.0",
@@ -15401,15 +15214,6 @@
"minipass": "^2.6.0"
}
},
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
@@ -15430,15 +15234,6 @@
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"minipass": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
@@ -15683,7 +15478,8 @@
"path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
- "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "dev": true
},
"path-parse": {
"version": "1.0.6",
@@ -17162,11 +16958,6 @@
"event-stream": "=3.3.4"
}
},
- "pseudomap": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
- "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
- },
"psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
@@ -18001,43 +17792,6 @@
"normalize-path": "^2.1.1"
}
},
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
"normalize-path": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
@@ -18381,6 +18135,7 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
"requires": {
"shebang-regex": "^1.0.0"
}
@@ -18388,7 +18143,8 @@
"shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
- "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
},
"shell-quote": {
"version": "1.7.2",
@@ -18406,7 +18162,8 @@
"signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
- "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
+ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
+ "dev": true
},
"simple-swizzle": {
"version": "0.2.2",
@@ -19263,7 +19020,8 @@
"strip-eof": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
- "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
+ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
+ "dev": true
},
"strip-final-newline": {
"version": "2.0.0",
@@ -20405,12 +20163,6 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
- },
- "yallist": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "dev": true
}
}
},
@@ -20500,15 +20252,6 @@
"path-is-absolute": "^1.0.0"
}
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -20533,12 +20276,6 @@
"figgy-pudding": "^3.5.1",
"minipass": "^3.1.1"
}
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -21909,15 +21646,6 @@
"json5": "^1.0.1"
}
},
- "lru-cache": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
- "dev": true,
- "requires": {
- "yallist": "^3.0.2"
- }
- },
"memory-fs": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
@@ -21988,12 +21716,6 @@
"webpack-sources": "^1.4.0",
"worker-farm": "^1.7.0"
}
- },
- "yallist": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
- "dev": true
}
}
},
@@ -22530,6 +22252,7 @@
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
"requires": {
"isexe": "^2.0.0"
}
@@ -22546,45 +22269,6 @@
"dev": true,
"requires": {
"execa": "^1.0.0"
- },
- "dependencies": {
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- }
}
},
"word-wrap": {
@@ -22756,9 +22440,10 @@
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
},
"yallist": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
- "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
},
"yaml": {
"version": "1.10.0",
diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json
index e99130f2f5a..ddee0a3c23b 100644
--- a/src/pybind/mgr/dashboard/frontend/package.json
+++ b/src/pybind/mgr/dashboard/frontend/package.json
@@ -13,7 +13,7 @@
"postbuild:localize": "node cd --res",
"env_build": "node cd --env",
"i18n": "npm run i18n:extract && npm run i18n:push && npm run i18n:pull && npm run i18n:merge",
- "i18n:extract": "ng xi18n --output-path locale --progress=false && ngx-extractor -i 'src/**/*.ts' -f xlf -o src/locale/messages.xlf -l en-US",
+ "i18n:extract": "ng build --localize=false && locl extract -s=dist/*.js -f=xlf -o=src/locale/messages.xlf",
"i18n:push": "npx i18ntool push -c i18n.config.json",
"i18n:pull": "npx i18ntool pull -c i18n.config.json",
"i18n:merge": "npx i18ntool merge -c i18n.config.json",
@@ -78,7 +78,6 @@
"@angular/router": "9.1.11",
"@auth0/angular-jwt": "4.2.0",
"@ng-bootstrap/ng-bootstrap": "6.1.0",
- "@ngx-translate/i18n-polyfill": "1.0.0",
"@swimlane/ngx-datatable": "17.0.0",
"@types/file-saver": "2.0.1",
"angular-tree-component": "8.5.6",
@@ -107,6 +106,7 @@
"@angular/compiler-cli": "9.1.11",
"@angular/language-service": "9.1.11",
"@compodoc/compodoc": "1.1.11",
+ "@locl/cli": "0.0.1-beta.9",
"@types/jest": "26.0.3",
"@types/lodash": "4.14.157",
"@types/node": "12.12.47",
@@ -135,7 +135,6 @@
"typescript": "3.8.3"
},
"resolutions": {
- "mem": "4.3.0",
"fsevents": "2.1.2",
"lodash": "4.17.19"
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
index 5a48d7eefdd..a8803d96277 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
@@ -1,20 +1,12 @@
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
-import {
- ErrorHandler,
- LOCALE_ID,
- NgModule,
- TRANSLATIONS,
- TRANSLATIONS_FORMAT
-} from '@angular/core';
+import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { JwtModule } from '@auth0/angular-jwt';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
import { ToastrModule } from 'ngx-toastr';
-import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CephModule } from './ceph/ceph.module';
@@ -59,21 +51,7 @@ export function jwtTokenGetter() {
provide: HTTP_INTERCEPTORS,
useClass: ApiInterceptorService,
multi: true
- },
- {
- provide: TRANSLATIONS,
- useFactory: (locale: string) => {
- locale = locale || environment.default_lang;
- try {
- return require(`raw-loader!locale/messages.${locale}.xlf`).default;
- } catch (error) {
- return [];
- }
- },
- deps: [LOCALE_ID]
- },
- { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' },
- I18n
+ }
],
bootstrap: [AppComponent]
})
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts
index 4e0514e0c51..e0cef596b6a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts
@@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TreeModel, TreeModule } from 'angular-tree-component';
import * as _ from 'lodash';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { IscsiTargetDetailsComponent } from './iscsi-target-details.component';
@@ -14,8 +14,7 @@ describe('IscsiTargetDetailsComponent', () => {
configureTestBed({
declarations: [IscsiTargetDetailsComponent],
- imports: [BrowserAnimationsModule, TreeModule.forRoot(), SharedModule],
- providers: [i18nProviders]
+ imports: [BrowserAnimationsModule, TreeModule.forRoot(), SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
index e7b3b96c9c5..983efd4580c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import {
ITreeOptions,
TreeComponent,
@@ -61,7 +60,6 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
};
constructor(
- private i18n: I18n,
private iscsiBackstorePipe: IscsiBackstorePipe,
private booleanTextPipe: BooleanTextPipe
) {}
@@ -70,19 +68,19 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
this.columns = [
{
prop: 'displayName',
- name: this.i18n('Name'),
+ name: $localize`Name`,
flexGrow: 1,
cellTemplate: this.highlightTpl
},
{
prop: 'current',
- name: this.i18n('Current'),
+ name: $localize`Current`,
flexGrow: 1,
cellTemplate: this.highlightTpl
},
{
prop: 'default',
- name: this.i18n('Default'),
+ name: $localize`Default`,
flexGrow: 1,
cellTemplate: this.highlightTpl
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
index ed0a6652187..4f6eec2dd23 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
@@ -11,12 +11,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders,
- IscsiHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, IscsiHelper } from '../../../../testing/unit-test-helper';
import { Permission } from '../../../shared/models/permissions';
import { SharedModule } from '../../../shared/shared.module';
import { IscsiTargetDiscoveryModalComponent } from './iscsi-target-discovery-modal.component';
@@ -39,7 +34,7 @@ describe('IscsiTargetDiscoveryModalComponent', () => {
ToastrModule.forRoot(),
RouterTestingModule
],
- providers: [i18nProviders, NgbActiveModal]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts
index 9f150747d75..914d141b01f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { IscsiService } from '../../../shared/api/iscsi.service';
import { NotificationType } from '../../../shared/enum/notification-type.enum';
@@ -29,8 +28,7 @@ export class IscsiTargetDiscoveryModalComponent implements OnInit {
private authStorageService: AuthStorageService,
public activeModal: NgbActiveModal,
private iscsiService: IscsiService,
- private notificationService: NotificationService,
- private i18n: I18n
+ private notificationService: NotificationService
) {
this.permission = this.authStorageService.getPermissions().iscsi;
}
@@ -111,7 +109,7 @@ export class IscsiTargetDiscoveryModalComponent implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n('Updated discovery authentication')
+ $localize`Updated discovery authentication`
);
this.activeModal.close();
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts
index 299cefd7f20..fb6eef30e8a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts
@@ -7,12 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders,
- IscsiHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, IscsiHelper } from '../../../../testing/unit-test-helper';
import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
import { SharedModule } from '../../../shared/shared.module';
@@ -153,7 +148,6 @@ describe('IscsiTargetFormComponent', () => {
ToastrModule.forRoot()
],
providers: [
- i18nProviders,
{
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ target_iqn: undefined })
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts
index c5bead7dc38..41d67ca87b2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts
@@ -3,7 +3,6 @@ import { FormArray, FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin } from 'rxjs';
@@ -57,30 +56,14 @@ export class IscsiTargetFormComponent extends CdForm implements OnInit {
imagesSettings: any = {};
messages = {
- portals: new SelectMessages(
- { noOptions: this.i18n('There are no portals available.') },
- this.i18n
- ),
- images: new SelectMessages(
- { noOptions: this.i18n('There are no images available.') },
- this.i18n
- ),
- initiatorImage: new SelectMessages(
- {
- noOptions: this.i18n(
- 'There are no images available. Please make sure you add an image to the target.'
- )
- },
- this.i18n
- ),
- groupInitiator: new SelectMessages(
- {
- noOptions: this.i18n(
- 'There are no initiators available. Please make sure you add an initiator to the target.'
- )
- },
- this.i18n
- )
+ portals: new SelectMessages({ noOptions: $localize`There are no portals available.` }),
+ images: new SelectMessages({ noOptions: $localize`There are no images available.` }),
+ initiatorImage: new SelectMessages({
+ noOptions: $localize`There are no images available. Please make sure you add an image to the target.`
+ }),
+ groupInitiator: new SelectMessages({
+ noOptions: $localize`There are no initiators available. Please make sure you add an initiator to the target.`
+ })
};
IQN_REGEX = /^iqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+)*$/;
@@ -95,12 +78,11 @@ export class IscsiTargetFormComponent extends CdForm implements OnInit {
private rbdService: RbdService,
private router: Router,
private route: ActivatedRoute,
- private i18n: I18n,
private taskWrapper: TaskWrapperService,
public actionLabels: ActionLabelsI18n
) {
super();
- this.resource = this.i18n('target');
+ this.resource = $localize`target`;
}
ngOnInit() {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts
index 10ac2c762bd..60d8513964a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { IscsiSettingComponent } from '../iscsi-setting/iscsi-setting.component';
import { IscsiTargetImageSettingsModalComponent } from './iscsi-target-image-settings-modal.component';
@@ -17,7 +17,7 @@ describe('IscsiTargetImageSettingsModalComponent', () => {
configureTestBed({
declarations: [IscsiTargetImageSettingsModalComponent, IscsiSettingComponent],
imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts
index ac6d883499e..8e55b78cb4f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { IscsiSettingComponent } from '../iscsi-setting/iscsi-setting.component';
import { IscsiTargetIqnSettingsModalComponent } from './iscsi-target-iqn-settings-modal.component';
@@ -17,7 +17,7 @@ describe('IscsiTargetIqnSettingsModalComponent', () => {
configureTestBed({
declarations: [IscsiTargetIqnSettingsModalComponent, IscsiSettingComponent],
imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
index 997983872f6..2c8657f3577 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
@@ -11,7 +11,6 @@ import { BehaviorSubject, of } from 'rxjs';
import {
configureTestBed,
expectItemTasks,
- i18nProviders,
PermissionHelper
} from '../../../../testing/unit-test-helper';
import { IscsiService } from '../../../shared/api/iscsi.service';
@@ -46,7 +45,7 @@ describe('IscsiTargetListComponent', () => {
NgbNavModule
],
declarations: [IscsiTargetListComponent, IscsiTabsComponent, IscsiTargetDetailsComponent],
- providers: [TaskListService, i18nProviders]
+ providers: [TaskListService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
index 236e1dc10bd..dd96295ca0e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
@@ -61,7 +60,6 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
constructor(
private authStorageService: AuthStorageService,
- private i18n: I18n,
private iscsiService: IscsiService,
private taskListService: TaskListService,
private cephReleaseNamePipe: CephReleaseNamePipe,
@@ -103,23 +101,23 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
ngOnInit() {
this.columns = [
{
- name: this.i18n('Target'),
+ name: $localize`Target`,
prop: 'target_iqn',
flexGrow: 2,
cellTransformation: CellTemplate.executing
},
{
- name: this.i18n('Portals'),
+ name: $localize`Portals`,
prop: 'cdPortals',
flexGrow: 2
},
{
- name: this.i18n('Images'),
+ name: $localize`Images`,
prop: 'cdImages',
flexGrow: 2
},
{
- name: this.i18n('# Sessions'),
+ name: $localize`# Sessions`,
prop: 'info.num_sessions',
pipe: this.notAvailablePipe,
flexGrow: 1
@@ -168,7 +166,7 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
return first.cdExecuting;
}
if (first && _.isUndefined(first['info'])) {
- return this.i18n('Unavailable gateway(s)');
+ return $localize`Unavailable gateway(s)`;
}
return undefined;
@@ -180,10 +178,10 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
return first.cdExecuting;
}
if (first && _.isUndefined(first['info'])) {
- return this.i18n('Unavailable gateway(s)');
+ return $localize`Unavailable gateway(s)`;
}
if (first && first['info'] && first['info']['num_sessions']) {
- return this.i18n('Target has active sessions');
+ return $localize`Target has active sessions`;
}
return undefined;
@@ -222,7 +220,7 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
const target_iqn = this.selection.first().target_iqn;
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.i18n('iSCSI target'),
+ itemDescription: $localize`iSCSI target`,
itemNames: [target_iqn],
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
index 7b091c01792..4ac569c77a7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
@@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { IscsiService } from '../../../shared/api/iscsi.service';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
@@ -38,8 +38,7 @@ describe('IscsiComponent', () => {
FormatterService,
RelativeDatePipe,
IscsiBackstorePipe,
- { provide: IscsiService, useValue: fakeService },
- i18nProviders
+ { provide: IscsiService, useValue: fakeService }
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
index a8dc711a832..b3a6d0c6926 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
@@ -1,7 +1,5 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { IscsiService } from '../../../shared/api/iscsi.service';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
@@ -28,18 +26,17 @@ export class IscsiComponent implements OnInit {
constructor(
private iscsiService: IscsiService,
private dimlessPipe: DimlessPipe,
- private iscsiBackstorePipe: IscsiBackstorePipe,
- private i18n: I18n
+ private iscsiBackstorePipe: IscsiBackstorePipe
) {}
ngOnInit() {
this.gatewaysColumns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name'
},
{
- name: this.i18n('State'),
+ name: $localize`State`,
prop: 'state',
flexGrow: 1,
cellTransformation: CellTemplate.badge,
@@ -51,52 +48,52 @@ export class IscsiComponent implements OnInit {
}
},
{
- name: this.i18n('# Targets'),
+ name: $localize`# Targets`,
prop: 'num_targets'
},
{
- name: this.i18n('# Sessions'),
+ name: $localize`# Sessions`,
prop: 'num_sessions'
}
];
this.imagesColumns = [
{
- name: this.i18n('Pool'),
+ name: $localize`Pool`,
prop: 'pool'
},
{
- name: this.i18n('Image'),
+ name: $localize`Image`,
prop: 'image'
},
{
- name: this.i18n('Backstore'),
+ name: $localize`Backstore`,
prop: 'backstore',
pipe: this.iscsiBackstorePipe
},
{
- name: this.i18n('Read Bytes'),
+ name: $localize`Read Bytes`,
prop: 'stats_history.rd_bytes',
cellTemplate: this.iscsiSparklineTpl
},
{
- name: this.i18n('Write Bytes'),
+ name: $localize`Write Bytes`,
prop: 'stats_history.wr_bytes',
cellTemplate: this.iscsiSparklineTpl
},
{
- name: this.i18n('Read Ops'),
+ name: $localize`Read Ops`,
prop: 'stats.rd',
pipe: this.dimlessPipe,
cellTemplate: this.iscsiPerSecondTpl
},
{
- name: this.i18n('Write Ops'),
+ name: $localize`Write Ops`,
prop: 'stats.wr',
pipe: this.dimlessPipe,
cellTemplate: this.iscsiPerSecondTpl
},
{
- name: this.i18n('A/O Since'),
+ name: $localize`A/O Since`,
prop: 'optimized_since',
cellTemplate: this.iscsiRelativeDateTpl
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts
index 0200547c407..a03c6aae5e0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -33,7 +29,7 @@ describe('BootstrapCreateModalComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts
index 9acfabb0875..e0b829d6072 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -33,7 +29,7 @@ describe('BootstrapImportModalComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts
index b2a511bf289..5dc7855e52a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.spec.ts
@@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
import { DaemonListComponent } from './daemon-list.component';
@@ -13,8 +13,7 @@ describe('DaemonListComponent', () => {
configureTestBed({
declarations: [DaemonListComponent, MirrorHealthColorPipe],
- imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule],
- providers: i18nProviders
+ imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts
index 7eaae7aa024..399e88750d2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/daemon-list/daemon-list.component.ts
@@ -1,6 +1,5 @@
import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subscription } from 'rxjs';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
@@ -22,24 +21,23 @@ export class DaemonListComponent implements OnInit, OnDestroy {
constructor(
private rbdMirroringService: RbdMirroringService,
- private cephShortVersionPipe: CephShortVersionPipe,
- private i18n: I18n
+ private cephShortVersionPipe: CephShortVersionPipe
) {}
ngOnInit() {
this.columns = [
- { prop: 'instance_id', name: this.i18n('Instance'), flexGrow: 2 },
- { prop: 'id', name: this.i18n('ID'), flexGrow: 2 },
- { prop: 'server_hostname', name: this.i18n('Hostname'), flexGrow: 2 },
+ { prop: 'instance_id', name: $localize`Instance`, flexGrow: 2 },
+ { prop: 'id', name: $localize`ID`, flexGrow: 2 },
+ { prop: 'server_hostname', name: $localize`Hostname`, flexGrow: 2 },
{
prop: 'version',
- name: this.i18n('Version'),
+ name: $localize`Version`,
pipe: this.cephShortVersionPipe,
flexGrow: 2
},
{
prop: 'health',
- name: this.i18n('Health'),
+ name: $localize`Health`,
cellTemplate: this.healthTmpl,
flexGrow: 1
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts
index fc66c868951..4ac1bc3886c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/edit-site-name-modal/edit-site-name-modal.component.spec.ts
@@ -7,7 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -28,7 +28,7 @@ describe('EditSiteNameModalComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts
index 48483693be0..75a6c0c1425 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.spec.ts
@@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
import { ImageListComponent } from './image-list.component';
@@ -21,8 +21,7 @@ describe('ImageListComponent', () => {
NgbNavModule,
NgbProgressbarModule,
HttpClientTestingModule
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts
index 3867da7db92..6b1db0c0661 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts
@@ -1,6 +1,5 @@
import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subscription } from 'rxjs';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
@@ -33,45 +32,45 @@ export class ImageListComponent implements OnInit, OnDestroy {
columns: {}
};
- constructor(private rbdMirroringService: RbdMirroringService, private i18n: I18n) {}
+ constructor(private rbdMirroringService: RbdMirroringService) {}
ngOnInit() {
this.image_error.columns = [
- { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
- { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
- { prop: 'description', name: this.i18n('Issue'), flexGrow: 4 },
+ { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 },
+ { prop: 'name', name: $localize`Image`, flexGrow: 2 },
+ { prop: 'description', name: $localize`Issue`, flexGrow: 4 },
{
prop: 'state',
- name: this.i18n('State'),
+ name: $localize`State`,
cellTemplate: this.stateTmpl,
flexGrow: 1
}
];
this.image_syncing.columns = [
- { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
- { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
+ { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 },
+ { prop: 'name', name: $localize`Image`, flexGrow: 2 },
{
prop: 'progress',
- name: this.i18n('Progress'),
+ name: $localize`Progress`,
cellTemplate: this.progressTmpl,
flexGrow: 2
},
{
prop: 'state',
- name: this.i18n('State'),
+ name: $localize`State`,
cellTemplate: this.syncTmpl,
flexGrow: 1
}
];
this.image_ready.columns = [
- { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
- { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
- { prop: 'description', name: this.i18n('Description'), flexGrow: 4 },
+ { prop: 'pool_name', name: $localize`Pool`, flexGrow: 2 },
+ { prop: 'name', name: $localize`Image`, flexGrow: 2 },
+ { prop: 'description', name: $localize`Description`, flexGrow: 4 },
{
prop: 'state',
- name: this.i18n('State'),
+ name: $localize`State`,
cellTemplate: this.stateTmpl,
flexGrow: 1
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts
index 0ef017448cd..486f3a89c78 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule, NgbProgressbarModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { DaemonListComponent } from '../daemon-list/daemon-list.component';
import { ImageListComponent } from '../image-list/image-list.component';
@@ -34,8 +34,7 @@ describe('OverviewComponent', () => {
HttpClientTestingModule,
RouterTestingModule,
ToastrModule.forRoot()
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts
index 5220912c147..02f7fee878e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts
@@ -1,7 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subscription } from 'rxjs';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
@@ -35,8 +34,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
constructor(
private authStorageService: AuthStorageService,
private rbdMirroringService: RbdMirroringService,
- private modalService: ModalService,
- private i18n: I18n
+ private modalService: ModalService
) {
this.permission = this.authStorageService.getPermissions().rbdMirroring;
@@ -44,7 +42,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
permission: 'update',
icon: Icons.edit,
click: () => this.editSiteNameModal(),
- name: this.i18n('Edit Site Name'),
+ name: $localize`Edit Site Name`,
canBePrimary: () => true,
disable: () => false
};
@@ -52,14 +50,14 @@ export class OverviewComponent implements OnInit, OnDestroy {
permission: 'update',
icon: Icons.upload,
click: () => this.createBootstrapModal(),
- name: this.i18n('Create Bootstrap Token'),
+ name: $localize`Create Bootstrap Token`,
disable: () => false
};
const importBootstrapAction: CdTableAction = {
permission: 'update',
icon: Icons.download,
click: () => this.importBootstrapModal(),
- name: this.i18n('Import Bootstrap Token'),
+ name: $localize`Import Bootstrap Token`,
disable: () => this.peersExist
};
this.tableActions = [editSiteNameAction, createBootstrapAction, importBootstrapAction];
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts
index acafbca8473..b5c37ea5f7b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -33,7 +29,7 @@ describe('PoolEditModeModalComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
index e706af9a7f5..696d12d72b4 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { AbstractControl, FormControl, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subscription } from 'rxjs';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
@@ -31,14 +30,13 @@ export class PoolEditModeModalComponent implements OnInit, OnDestroy {
peerExists = false;
mirrorModes: Array<{ id: string; name: string }> = [
- { id: 'disabled', name: this.i18n('Disabled') },
- { id: 'pool', name: this.i18n('Pool') },
- { id: 'image', name: this.i18n('Image') }
+ { id: 'disabled', name: $localize`Disabled` },
+ { id: 'pool', name: $localize`Pool` },
+ { id: 'image', name: $localize`Image` }
];
constructor(
public activeModal: NgbActiveModal,
- private i18n: I18n,
private rbdMirroringService: RbdMirroringService,
private taskWrapper: TaskWrapperService
) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts
index 578e07e481c..6a4db9aa6a7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- FormHelper,
- i18nProviders
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../../testing/unit-test-helper';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -34,7 +30,7 @@ describe('PoolEditPeerModalComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts
index e40e1acd81c..26a8f333e14 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
import { PoolListComponent } from './pool-list.component';
@@ -22,8 +22,7 @@ describe('PoolListComponent', () => {
HttpClientTestingModule,
RouterTestingModule,
ToastrModule.forRoot()
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
index 10136692c51..6c18acc08ce 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Observable, Subscriber, Subscription } from 'rxjs';
import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.service';
@@ -41,8 +40,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
private authStorageService: AuthStorageService,
private rbdMirroringService: RbdMirroringService,
private modalService: ModalService,
- private taskWrapper: TaskWrapperService,
- private i18n: I18n
+ private taskWrapper: TaskWrapperService
) {
this.data = [];
this.permission = this.authStorageService.getPermissions().rbdMirroring;
@@ -51,13 +49,13 @@ export class PoolListComponent implements OnInit, OnDestroy {
permission: 'update',
icon: Icons.edit,
click: () => this.editModeModal(),
- name: this.i18n('Edit Mode'),
+ name: $localize`Edit Mode`,
canBePrimary: () => true
};
const addPeerAction: CdTableAction = {
permission: 'create',
icon: Icons.add,
- name: this.i18n('Add Peer'),
+ name: $localize`Add Peer`,
click: () => this.editPeersModal('add'),
disable: () => !this.selection.first() || this.selection.first().mirror_mode === 'disabled',
visible: () => !this.getPeerUUID(),
@@ -66,14 +64,14 @@ export class PoolListComponent implements OnInit, OnDestroy {
const editPeerAction: CdTableAction = {
permission: 'update',
icon: Icons.exchange,
- name: this.i18n('Edit Peer'),
+ name: $localize`Edit Peer`,
click: () => this.editPeersModal('edit'),
visible: () => !!this.getPeerUUID()
};
const deletePeerAction: CdTableAction = {
permission: 'delete',
icon: Icons.destroy,
- name: this.i18n('Delete Peer'),
+ name: $localize`Delete Peer`,
click: () => this.deletePeersModal(),
visible: () => !!this.getPeerUUID()
};
@@ -82,14 +80,14 @@ export class PoolListComponent implements OnInit, OnDestroy {
ngOnInit() {
this.columns = [
- { prop: 'name', name: this.i18n('Name'), flexGrow: 2 },
- { prop: 'mirror_mode', name: this.i18n('Mode'), flexGrow: 2 },
- { prop: 'leader_id', name: this.i18n('Leader'), flexGrow: 2 },
- { prop: 'image_local_count', name: this.i18n('# Local'), flexGrow: 2 },
- { prop: 'image_remote_count', name: this.i18n('# Remote'), flexGrow: 2 },
+ { prop: 'name', name: $localize`Name`, flexGrow: 2 },
+ { prop: 'mirror_mode', name: $localize`Mode`, flexGrow: 2 },
+ { prop: 'leader_id', name: $localize`Leader`, flexGrow: 2 },
+ { prop: 'image_local_count', name: $localize`# Local`, flexGrow: 2 },
+ { prop: 'image_remote_count', name: $localize`# Remote`, flexGrow: 2 },
{
prop: 'health',
- name: this.i18n('Health'),
+ name: $localize`Health`,
cellTemplate: this.healthTmpl,
flexGrow: 1
}
@@ -131,7 +129,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
const peerUUID = this.getPeerUUID();
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.i18n('mirror peer'),
+ itemDescription: $localize`mirror peer`,
itemNames: [`${poolName} (${peerUUID})`],
submitActionObservable: () =>
new Observable((observer: Subscriber<any>) => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts
index 8288e9403a9..0f0daa6b9df 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts
@@ -3,7 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { DirectivesModule } from '../../../shared/directives/directives.module';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
import { RbdConfigurationSourceField } from '../../../shared/models/configuration';
@@ -22,12 +22,7 @@ describe('RbdConfigurationFormComponent', () => {
configureTestBed({
imports: [ReactiveFormsModule, DirectivesModule, SharedModule],
declarations: [RbdConfigurationFormComponent],
- providers: [
- RbdConfigurationService,
- FormatterService,
- DimlessBinaryPerSecondPipe,
- i18nProviders
- ]
+ providers: [RbdConfigurationService, FormatterService, DimlessBinaryPerSecondPipe]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts
index 7bb8f2e7420..4150269993f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts
@@ -7,7 +7,7 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import { ChartsModule } from 'ng2-charts';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { ComponentsModule } from '../../../shared/components/components.module';
import { TableComponent } from '../../../shared/datatable/table/table.component';
import { RbdConfigurationEntry } from '../../../shared/models/configuration';
@@ -32,7 +32,7 @@ describe('RbdConfigurationListComponent', () => {
PipesModule
],
declarations: [RbdConfigurationListComponent, TableComponent],
- providers: [FormatterService, RbdConfigurationService, i18nProviders]
+ providers: [FormatterService, RbdConfigurationService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts
index c63a76dccff..1e21a193dc2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.ts
@@ -1,7 +1,5 @@
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { TableComponent } from '../../../shared/datatable/table/table.component';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import {
@@ -34,22 +32,21 @@ export class RbdConfigurationListComponent implements OnInit, OnChanges {
constructor(
public formatterService: FormatterService,
- private rbdConfigurationService: RbdConfigurationService,
- private i18n: I18n
+ private rbdConfigurationService: RbdConfigurationService
) {}
ngOnInit() {
this.poolConfigurationColumns = [
- { prop: 'displayName', name: this.i18n('Name') },
- { prop: 'description', name: this.i18n('Description') },
- { prop: 'name', name: this.i18n('Key') },
+ { prop: 'displayName', name: $localize`Name` },
+ { prop: 'description', name: $localize`Description` },
+ { prop: 'name', name: $localize`Key` },
{
prop: 'source',
- name: this.i18n('Source'),
+ name: $localize`Source`,
cellTemplate: this.configurationSourceTpl,
pipe: new RbdConfigurationSourcePipe()
},
- { prop: 'value', name: this.i18n('Value'), cellTemplate: this.configurationValueTpl }
+ { prop: 'value', name: $localize`Value`, cellTemplate: this.configurationValueTpl }
];
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
index ce34f019a67..8f86c19a5e0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
@@ -10,7 +10,7 @@ import { NEVER, of } from 'rxjs';
import { delay } from 'rxjs/operators';
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { ImageSpec } from '../../../shared/models/image-spec';
import { SharedModule } from '../../../shared/shared.module';
@@ -41,7 +41,6 @@ describe('RbdFormComponent', () => {
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ pool: 'foo', name: 'bar', snap: undefined })
},
- i18nProviders,
RbdService
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
index 09ac2d9e937..f1ae3273071 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit } from '@angular/core';
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin, Observable, ReplaySubject } from 'rxjs';
import { first, switchMap } from 'rxjs/operators';
@@ -102,48 +101,47 @@ export class RbdFormComponent extends CdForm implements OnInit {
private formatter: FormatterService,
private taskWrapper: TaskWrapperService,
private dimlessBinaryPipe: DimlessBinaryPipe,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n,
public router: Router
) {
super();
this.poolPermission = this.authStorageService.getPermissions().pool;
- this.resource = this.i18n('RBD');
+ this.resource = $localize`RBD`;
this.features = {
'deep-flatten': {
- desc: this.i18n('Deep flatten'),
+ desc: $localize`Deep flatten`,
requires: null,
allowEnable: false,
allowDisable: true
},
layering: {
- desc: this.i18n('Layering'),
+ desc: $localize`Layering`,
requires: null,
allowEnable: false,
allowDisable: false
},
'exclusive-lock': {
- desc: this.i18n('Exclusive lock'),
+ desc: $localize`Exclusive lock`,
requires: null,
allowEnable: true,
allowDisable: true
},
'object-map': {
- desc: this.i18n('Object map (requires exclusive-lock)'),
+ desc: $localize`Object map (requires exclusive-lock)`,
requires: 'exclusive-lock',
allowEnable: true,
allowDisable: true,
initDisabled: true
},
journaling: {
- desc: this.i18n('Journaling (requires exclusive-lock)'),
+ desc: $localize`Journaling (requires exclusive-lock)`,
requires: 'exclusive-lock',
allowEnable: true,
allowDisable: true,
initDisabled: true
},
'fast-diff': {
- desc: this.i18n('Fast diff (interlocked with object-map)'),
+ desc: $localize`Fast diff (interlocked with object-map)`,
requires: 'object-map',
allowEnable: true,
allowDisable: true,
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
index 7533bd7fa0f..193a338feb7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
@@ -10,7 +10,6 @@ import { BehaviorSubject, of } from 'rxjs';
import {
configureTestBed,
expectItemTasks,
- i18nProviders,
PermissionHelper
} from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
@@ -54,7 +53,7 @@ describe('RbdListComponent', () => {
RbdConfigurationListComponent,
RbdTabsComponent
],
- providers: [TaskListService, i18nProviders]
+ providers: [TaskListService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
index b1a72abbbee..18ac272143e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { RbdService } from '../../../shared/api/rbd.service';
@@ -108,7 +107,6 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
private modalService: ModalService,
private taskWrapper: TaskWrapperService,
private taskListService: TaskListService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
public actionLabels: ActionLabelsI18n
) {
@@ -185,58 +183,58 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 2,
cellTransformation: CellTemplate.executing
},
{
- name: this.i18n('Pool'),
+ name: $localize`Pool`,
prop: 'pool_name',
flexGrow: 2
},
{
- name: this.i18n('Namespace'),
+ name: $localize`Namespace`,
prop: 'namespace',
flexGrow: 2
},
{
- name: this.i18n('Size'),
+ name: $localize`Size`,
prop: 'size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Objects'),
+ name: $localize`Objects`,
prop: 'num_objs',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessPipe
},
{
- name: this.i18n('Object size'),
+ name: $localize`Object size`,
prop: 'obj_size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Provisioned'),
+ name: $localize`Provisioned`,
prop: 'disk_usage',
cellClass: 'text-center',
flexGrow: 1,
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Total provisioned'),
+ name: $localize`Total provisioned`,
prop: 'total_disk_usage',
cellClass: 'text-center',
flexGrow: 1,
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Parent'),
+ name: $localize`Parent`,
prop: 'parent',
flexGrow: 2,
cellTemplate: this.parentTpl
@@ -434,9 +432,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
getDeleteDisableDesc(): string {
const first = this.selection.first();
if (first && this.hasClonedSnapshots(first)) {
- return this.i18n(
- 'This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.'
- );
+ return $localize`This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.`;
}
return '';
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts
index 33f486981f7..6ef29adc4b2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { ComponentsModule } from '../../../shared/components/components.module';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
import { RbdNamespaceFormModalComponent } from './rbd-namespace-form-modal.component';
@@ -24,7 +24,7 @@ describe('RbdNamespaceFormModalComponent', () => {
RouterTestingModule
],
declarations: [RbdNamespaceFormModalComponent],
- providers: [NgbActiveModal, AuthStorageService, i18nProviders]
+ providers: [NgbActiveModal, AuthStorageService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts
index 1183c541d79..99c73300b6a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form-modal.component.ts
@@ -8,7 +8,6 @@ import {
} from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subject } from 'rxjs';
import { PoolService } from '../../../shared/api/pool.service';
@@ -43,8 +42,7 @@ export class RbdNamespaceFormModalComponent implements OnInit {
private authStorageService: AuthStorageService,
private notificationService: NotificationService,
private poolService: PoolService,
- private rbdService: RbdService,
- private i18n: I18n
+ private rbdService: RbdService
) {
this.poolPermission = this.authStorageService.getPermissions().pool;
this.createForm();
@@ -132,10 +130,7 @@ export class RbdNamespaceFormModalComponent implements OnInit {
.then(() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Created namespace '{{pool}}/{{namespace}}'`, {
- pool: pool,
- namespace: namespace
- })
+ $localize`Created namespace '${pool}/${namespace}'`
);
this.activeModal.close();
this.onSubmit.next();
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts
index 294a598e251..eed9c6c532a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { TaskListService } from '../../../shared/services/task-list.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTabsComponent } from '../rbd-tabs/rbd-tabs.component';
@@ -26,7 +26,7 @@ describe('RbdNamespaceListComponent', () => {
ToastrModule.forRoot(),
NgbNavModule
],
- providers: [TaskListService, i18nProviders]
+ providers: [TaskListService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts
index 7857c09f17e..8d449f3ce79 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin, Observable } from 'rxjs';
@@ -41,7 +40,6 @@ export class RbdNamespaceListComponent implements OnInit {
private poolService: PoolService,
private modalService: ModalService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
@@ -65,17 +63,17 @@ export class RbdNamespaceListComponent implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Namespace'),
+ name: $localize`Namespace`,
prop: 'namespace',
flexGrow: 1
},
{
- name: this.i18n('Pool'),
+ name: $localize`Pool`,
prop: 'pool',
flexGrow: 1
},
{
- name: this.i18n('Total images'),
+ name: $localize`Total images`,
prop: 'num_images',
flexGrow: 1
}
@@ -137,10 +135,7 @@ export class RbdNamespaceListComponent implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Deleted namespace '{{pool}}/{{namespace}}'`, {
- pool: pool,
- namespace: namespace
- })
+ $localize`Deleted namespace '${pool}/${namespace}'`
);
this.modalRef.close();
this.refresh();
@@ -156,7 +151,7 @@ export class RbdNamespaceListComponent implements OnInit {
const first = this.selection.first();
if (first) {
if (first.num_images > 0) {
- return this.i18n('Namespace contains images');
+ return $localize`Namespace contains images`;
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts
index bec05b924ef..9db62c9bada 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-performance/rbd-performance.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTabsComponent } from '../rbd-tabs/rbd-tabs.component';
import { RbdPerformanceComponent } from './rbd-performance.component';
@@ -15,8 +15,7 @@ describe('RbdPerformanceComponent', () => {
configureTestBed({
imports: [HttpClientTestingModule, RouterTestingModule, SharedModule, NgbNavModule],
- declarations: [RbdPerformanceComponent, RbdTabsComponent],
- providers: i18nProviders
+ declarations: [RbdPerformanceComponent, RbdTabsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts
index 3e60a3ba787..15ca77f21c2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { ComponentsModule } from '../../../shared/components/components.module';
import { PipesModule } from '../../../shared/pipes/pipes.module';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -26,7 +26,7 @@ describe('RbdSnapshotFormModalComponent', () => {
RouterTestingModule
],
declarations: [RbdSnapshotFormModalComponent],
- providers: [NgbActiveModal, AuthStorageService, i18nProviders]
+ providers: [NgbActiveModal, AuthStorageService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts
index f49b72dde5d..b908a7ca35f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Subject } from 'rxjs';
import { RbdService } from '../../../shared/api/rbd.service';
@@ -37,11 +36,10 @@ export class RbdSnapshotFormModalComponent implements OnInit {
private rbdService: RbdService,
private taskManagerService: TaskManagerService,
private notificationService: NotificationService,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n
) {
this.action = this.actionLabels.CREATE;
- this.resource = this.i18n('RBD Snapshot');
+ this.resource = $localize`RBD Snapshot`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts
index 871939ec050..040f5824de3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts
@@ -1,4 +1,3 @@
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -7,8 +6,6 @@ import { CdTableAction } from '../../../shared/models/cd-table-action';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
export class RbdSnapshotActionsModel {
- i18n: I18n;
-
create: CdTableAction;
rename: CdTableAction;
protect: CdTableAction;
@@ -19,9 +16,7 @@ export class RbdSnapshotActionsModel {
deleteSnap: CdTableAction;
ordering: CdTableAction[];
- constructor(i18n: I18n, actionLabels: ActionLabelsI18n, featuresName: string[]) {
- this.i18n = i18n;
-
+ constructor(actionLabels: ActionLabelsI18n, featuresName: string[]) {
this.create = {
permission: 'create',
icon: Icons.add,
@@ -94,7 +89,7 @@ export class RbdSnapshotActionsModel {
getCloneDisableDesc(featuresName: string[]): string | undefined {
if (!featuresName?.includes('layering')) {
- return this.i18n('Parent image must support Layering');
+ return $localize`Parent image must support Layering`;
}
return undefined;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts
index fc08cba0704..1ea292e0b4f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts
@@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModalModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
import { MockComponent } from 'ng-mocks';
import { ToastrModule } from 'ngx-toastr';
@@ -13,7 +12,6 @@ import { Subject, throwError as observableThrowError } from 'rxjs';
import {
configureTestBed,
expectItemTasks,
- i18nProviders,
PermissionHelper
} from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
@@ -71,8 +69,7 @@ describe('RbdSnapshotListComponent', () => {
],
providers: [
{ provide: AuthStorageService, useValue: fakeAuthStorageService },
- TaskListService,
- i18nProviders
+ TaskListService
]
},
[CriticalConfirmationModalComponent]
@@ -98,7 +95,6 @@ describe('RbdSnapshotListComponent', () => {
beforeEach(() => {
fixture.detectChanges();
- const i18n = TestBed.inject(I18n);
const modalService = TestBed.inject(ModalService);
const actionLabelsI18n = TestBed.inject(ActionLabelsI18n);
called = false;
@@ -116,7 +112,6 @@ describe('RbdSnapshotListComponent', () => {
notificationService,
null,
null,
- i18n,
actionLabelsI18n
);
spyOn(rbdService, 'deleteSnapshot').and.returnValue(observableThrowError({ status: 500 }));
@@ -210,7 +205,6 @@ describe('RbdSnapshotListComponent', () => {
null,
null,
null,
- TestBed.inject(I18n),
TestBed.inject(ActionLabelsI18n)
);
ref.componentInstance.onSubmit = new Subject();
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts
index 8c3a1fc4337..1559a9854f9 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts
@@ -1,7 +1,6 @@
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as moment from 'moment';
import { of } from 'rxjs';
@@ -80,7 +79,6 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
private notificationService: NotificationService,
private summaryService: SummaryService,
private taskListService: TaskListService,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
@@ -89,39 +87,39 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
cellTransformation: CellTemplate.executing,
flexGrow: 2
},
{
- name: this.i18n('Size'),
+ name: $localize`Size`,
prop: 'size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Provisioned'),
+ name: $localize`Provisioned`,
prop: 'disk_usage',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('State'),
+ name: $localize`State`,
prop: 'is_protected',
flexGrow: 1,
cellTransformation: CellTemplate.badge,
customTemplateConfig: {
map: {
- true: { value: this.i18n('PROTECTED'), class: 'badge-success' },
- false: { value: this.i18n('UNPROTECTED'), class: 'badge-info' }
+ true: { value: $localize`PROTECTED`, class: 'badge-success' },
+ false: { value: $localize`UNPROTECTED`, class: 'badge-info' }
}
}
},
{
- name: this.i18n('Created'),
+ name: $localize`Created`,
prop: 'timestamp',
flexGrow: 1,
pipe: this.cdDatePipe
@@ -132,7 +130,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
ngOnChanges() {
const imageSpec = new ImageSpec(this.poolName, this.namespace, this.rbdName);
- const actions = new RbdSnapshotActionsModel(this.i18n, this.actionLabels, this.featuresName);
+ const actions = new RbdSnapshotActionsModel(this.actionLabels, this.featuresName);
actions.create.click = () => this.openCreateSnapshotModal();
actions.rename.click = () => this.openEditSnapshotModal();
actions.protect.click = () => this.toggleProtection();
@@ -266,8 +264,8 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
const snapshotName = this.selection.selected[0].name;
const imageSpec = new ImageSpec(this.poolName, this.namespace, this.rbdName).toString();
const initialState = {
- titleText: this.i18n('RBD snapshot rollback'),
- buttonText: this.i18n('Rollback'),
+ titleText: $localize`RBD snapshot rollback`,
+ buttonText: $localize`Rollback`,
bodyTpl: this.rollbackTpl,
bodyData: {
snapName: `${imageSpec}@${snapshotName}`
@@ -283,7 +281,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
deleteSnapshotModal() {
const snapshotName = this.selection.selected[0].name;
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.i18n('RBD snapshot'),
+ itemDescription: $localize`RBD snapshot`,
itemNames: [snapshotName],
submitAction: () => this._asyncTask('deleteSnapshot', 'rbd/snap/delete', snapshotName)
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts
index a448a9cd6e8..d975a1c4128 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts
@@ -9,11 +9,7 @@ import * as moment from 'moment';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- expectItemTasks,
- i18nProviders
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, expectItemTasks } from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { ExecutingTask } from '../../../shared/models/executing-task';
@@ -40,7 +36,7 @@ describe('RbdTrashListComponent', () => {
NgbNavModule,
ToastrModule.forRoot()
],
- providers: [TaskListService, i18nProviders]
+ providers: [TaskListService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts
index 9b6b3b44b89..63b4d085bb3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import * as moment from 'moment';
@@ -62,7 +61,6 @@ export class RbdTrashListComponent implements OnInit {
private cdDatePipe: CdDatePipe,
private taskListService: TaskListService,
private taskWrapper: TaskWrapperService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
@@ -84,34 +82,34 @@ export class RbdTrashListComponent implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('ID'),
+ name: $localize`ID`,
prop: 'id',
flexGrow: 1,
cellTransformation: CellTemplate.executing
},
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 1
},
{
- name: this.i18n('Pool'),
+ name: $localize`Pool`,
prop: 'pool_name',
flexGrow: 1
},
{
- name: this.i18n('Namespace'),
+ name: $localize`Namespace`,
prop: 'namespace',
flexGrow: 1
},
{
- name: this.i18n('Status'),
+ name: $localize`Status`,
prop: 'deferment_end_time',
flexGrow: 1,
cellTemplate: this.expiresTpl
},
{
- name: this.i18n('Deleted At'),
+ name: $localize`Deleted At`,
prop: 'deletion_time',
flexGrow: 1,
pipe: this.cdDatePipe
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
index cb0dd58c40a..22fc800585c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
@@ -7,7 +7,7 @@ import { NgbActiveModal, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import * as moment from 'moment';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTrashMoveModalComponent } from './rbd-trash-move-modal.component';
@@ -27,7 +27,7 @@ describe('RbdTrashMoveModalComponent', () => {
NgbPopoverModule
],
declarations: [RbdTrashMoveModalComponent],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts
index fbecde705cc..852c785edae 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts
@@ -10,7 +10,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { Permission } from '../../../shared/models/permissions';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
@@ -30,7 +30,7 @@ describe('RbdTrashPurgeModalComponent', () => {
RouterTestingModule
],
declarations: [RbdTrashPurgeModalComponent],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
index 7878e7e8139..1577afbb996 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
@@ -10,7 +10,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal.component';
@@ -28,7 +28,7 @@ describe('RbdTrashRestoreModalComponent', () => {
SharedModule,
RouterTestingModule
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts
index bdc0dcf250d..ea6ca381e9d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.spec.ts
@@ -4,11 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
import { SharedModule } from '../../../shared/shared.module';
@@ -25,8 +21,7 @@ describe('CephfsClientsComponent', () => {
SharedModule,
HttpClientTestingModule
],
- declarations: [CephfsClientsComponent],
- providers: i18nProviders
+ declarations: [CephfsClientsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts
index 305dcbca4e9..5d128fb7dd0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts
@@ -1,7 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { CephfsService } from '../../../shared/api/cephfs.service';
import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -48,7 +47,6 @@ export class CephfsClientsComponent implements OnInit {
private modalService: ModalService,
private notificationService: NotificationService,
private authStorageService: AuthStorageService,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().cephfs;
@@ -63,12 +61,12 @@ export class CephfsClientsComponent implements OnInit {
ngOnInit() {
this.columns = [
- { prop: 'id', name: this.i18n('id') },
- { prop: 'type', name: this.i18n('type') },
- { prop: 'state', name: this.i18n('state') },
- { prop: 'version', name: this.i18n('version') },
- { prop: 'hostname', name: this.i18n('Host') },
- { prop: 'root', name: this.i18n('root') }
+ { prop: 'id', name: $localize`id` },
+ { prop: 'type', name: $localize`type` },
+ { prop: 'state', name: $localize`state` },
+ { prop: 'version', name: $localize`version` },
+ { prop: 'hostname', name: $localize`Host` },
+ { prop: 'root', name: $localize`root` }
];
}
@@ -83,7 +81,7 @@ export class CephfsClientsComponent implements OnInit {
this.modalRef.close();
this.notificationService.show(
NotificationType.success,
- this.i18n(`Evicted client '{{clientId}}'`, { clientId: clientId })
+ $localize`Evicted client '${clientId}'`
);
},
() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts
index 1d80097c92b..130439e52a2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts
@@ -1,7 +1,7 @@
import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { CephfsDetailComponent } from './cephfs-detail.component';
@@ -34,8 +34,7 @@ describe('CephfsDetailComponent', () => {
configureTestBed({
imports: [SharedModule],
- declarations: [CephfsDetailComponent, CephfsChartStubComponent],
- providers: i18nProviders
+ declarations: [CephfsDetailComponent, CephfsChartStubComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts
index d45fb70bf9c..655aefa18b1 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
@@ -35,11 +34,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
objectValues = Object.values;
- constructor(
- private dimlessBinary: DimlessBinaryPipe,
- private dimless: DimlessPipe,
- private i18n: I18n
- ) {}
+ constructor(private dimlessBinary: DimlessBinaryPipe, private dimless: DimlessPipe) {}
ngOnChanges() {
this.setStandbys();
@@ -48,7 +43,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
private setStandbys() {
this.standbys = [
{
- key: this.i18n('Standby daemons'),
+ key: $localize`Standby daemons`,
value: this.data.standbys
}
];
@@ -57,19 +52,19 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
ngOnInit() {
this.columns = {
ranks: [
- { prop: 'rank', name: this.i18n('Rank') },
- { prop: 'state', name: this.i18n('State') },
- { prop: 'mds', name: this.i18n('Daemon') },
- { prop: 'activity', name: this.i18n('Activity'), cellTemplate: this.activityTmpl },
- { prop: 'dns', name: this.i18n('Dentries'), pipe: this.dimless },
- { prop: 'inos', name: this.i18n('Inodes'), pipe: this.dimless }
+ { prop: 'rank', name: $localize`Rank` },
+ { prop: 'state', name: $localize`State` },
+ { prop: 'mds', name: $localize`Daemon` },
+ { prop: 'activity', name: $localize`Activity`, cellTemplate: this.activityTmpl },
+ { prop: 'dns', name: $localize`Dentries`, pipe: this.dimless },
+ { prop: 'inos', name: $localize`Inodes`, pipe: this.dimless }
],
pools: [
- { prop: 'pool', name: this.i18n('Pool') },
- { prop: 'type', name: this.i18n('Type') },
- { prop: 'size', name: this.i18n('Size'), pipe: this.dimlessBinary },
+ { prop: 'pool', name: $localize`Pool` },
+ { prop: 'type', name: $localize`Type` },
+ { prop: 'size', name: $localize`Size`, pipe: this.dimlessBinary },
{
- name: this.i18n('Usage'),
+ name: $localize`Usage`,
cellTemplate: this.poolUsageTpl,
comparator: (_valueA: any, _valueB: any, rowA: any, rowB: any) => {
const valA = rowA.used / rowA.avail;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
index 4382f630ad7..124fad18c2b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
@@ -12,7 +12,6 @@ import { Observable, of } from 'rxjs';
import {
configureTestBed,
- i18nProviders,
modalServiceShow,
PermissionHelper
} from '../../../../testing/unit-test-helper';
@@ -375,7 +374,7 @@ describe('CephfsDirectoriesComponent', () => {
NgbModalModule
],
declarations: [CephfsDirectoriesComponent],
- providers: [i18nProviders, NgbActiveModal]
+ providers: [NgbActiveModal]
},
[CriticalConfirmationModalComponent, FormModalComponent, ConfirmationModalComponent]
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts
index df6ae3a250f..13c9c87e164 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts
@@ -2,7 +2,6 @@ import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@an
import { Validators } from '@angular/forms';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import {
ITreeOptions,
TreeComponent,
@@ -110,7 +109,6 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
private modalService: ModalService,
private cephfsService: CephfsService,
private cdDatePipe: CdDatePipe,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n,
private notificationService: NotificationService,
private dimlessBinaryPipe: DimlessBinaryPipe
@@ -141,18 +139,18 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
columns: [
{
prop: 'row.name',
- name: this.i18n('Name'),
+ name: $localize`Name`,
flexGrow: 1
},
{
prop: 'row.value',
- name: this.i18n('Value'),
+ name: $localize`Value`,
sortable: false,
flexGrow: 1
},
{
prop: 'row.originPath',
- name: this.i18n('Origin'),
+ name: $localize`Origin`,
sortable: false,
cellTemplate: this.originTmpl,
flexGrow: 1
@@ -195,18 +193,18 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
columns: [
{
prop: 'name',
- name: this.i18n('Name'),
+ name: $localize`Name`,
flexGrow: 1
},
{
prop: 'path',
- name: this.i18n('Path'),
+ name: $localize`Path`,
isHidden: true,
flexGrow: 2
},
{
prop: 'created',
- name: this.i18n('Created'),
+ name: $localize`Created`,
flexGrow: 1,
pipe: this.cdDatePipe
}
@@ -352,7 +350,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
}
return {
row: {
- name: quotaKey === 'max_bytes' ? this.i18n('Max size') : this.i18n('Max files'),
+ name: quotaKey === 'max_bytes' ? $localize`Max size` : $localize`Max files`,
value: valueConvertFn(value),
originPath: value ? dir.path : ''
},
@@ -422,26 +420,23 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
path
),
message: nextMax.value
- ? this.i18n('The inherited {{quotaValue}} is the maximum value to be used.', {
- quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path)
- })
+ ? $localize`The inherited ${this.getQuotaValueFromPathMsg(
+ nextMax.value,
+ nextMax.path
+ )} is the maximum value to be used.`
: undefined,
fields: [this.getQuotaFormField(selection.row.name, key, value, nextMax.value)],
- submitButtonText: this.i18n('Save'),
+ submitButtonText: $localize`Save`,
onSubmit: (values: CephfsQuotas) => this.updateQuota(values)
});
}
private getModalQuotaTitle(action: string, path: string): string {
- return this.i18n(`{{action}} CephFS {{quotaName}} quota for '{{path}}'`, {
- action,
- quotaName: this.getQuotaName(),
- path
- });
+ return $localize`${action} CephFS ${this.getQuotaName()} quota for '${path}'`;
}
private getQuotaName(): string {
- return this.isBytesQuotaSelected() ? this.i18n('size') : this.i18n('files');
+ return this.isBytesQuotaSelected() ? $localize`size` : $localize`files`;
}
private isBytesQuotaSelected(): boolean {
@@ -449,11 +444,9 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
}
private getQuotaValueFromPathMsg(value: number, path: string): string {
- return this.i18n(`{{quotaName}} quota {{value}} from '{{path}}'`, {
- value: this.isBytesQuotaSelected() ? this.dimlessBinaryPipe.transform(value) : value,
- quotaName: this.getQuotaName(),
- path
- });
+ value = this.isBytesQuotaSelected() ? this.dimlessBinaryPipe.transform(value) : value;
+
+ return $localize`${this.getQuotaName()} quota ${value} from '${path}'`;
}
private getQuotaFormField(
@@ -477,8 +470,8 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
};
if (!isBinary) {
field.errors = {
- min: this.i18n(`Value has to be at least {{value}} or more`, { value: 0 }),
- max: this.i18n(`Value has to be at most {{value}} or less`, { value: maxValue })
+ min: $localize`Value has to be at least 0 or more`,
+ max: $localize`Value has to be at most ${maxValue} or less`
};
}
return field;
@@ -492,7 +485,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
? this.actionLabels.SET
: values[key] === 0
? this.actionLabels.UNSET
- : this.i18n('Updated');
+ : $localize`Updated`;
this.cephfsService.updateQuota(this.id, path, values).subscribe(() => {
if (onSuccess) {
onSuccess();
@@ -512,23 +505,21 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
const nextMax = selection.nextTreeMaximum;
const dirValue = selection.dirValue;
+ const quotaValue = this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path);
+ const conclusion =
+ nextMax.value > 0
+ ? nextMax.value > dirValue
+ ? $localize`in order to inherit ${quotaValue}`
+ : $localize`which isn't used because of the inheritance of ${quotaValue}`
+ : $localize`in order to have no quota on the directory`;
+
this.modalRef = this.modalService.show(ConfirmationModalComponent, {
titleText: this.getModalQuotaTitle(this.actionLabels.UNSET, path),
buttonText: this.actionLabels.UNSET,
- description: this.i18n(`{{action}} {{quotaValue}} {{conclusion}}.`, {
- action: this.actionLabels.UNSET,
- quotaValue: this.getQuotaValueFromPathMsg(dirValue, path),
- conclusion:
- nextMax.value > 0
- ? nextMax.value > dirValue
- ? this.i18n('in order to inherit {{quotaValue}}', {
- quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path)
- })
- : this.i18n(`which isn't used because of the inheritance of {{quotaValue}}`, {
- quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path)
- })
- : this.i18n('in order to have no quota on the directory')
- }),
+ description: $localize`${this.actionLabels.UNSET} ${this.getQuotaValueFromPathMsg(
+ dirValue,
+ path
+ )} ${conclusion}.`,
onSubmit: () => this.updateQuota({ [key]: 0 }, () => this.modalRef.close())
});
}
@@ -537,8 +528,8 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
// Create a snapshot. Auto-generate a snapshot name by default.
const path = this.selectedDir.path;
this.modalService.show(FormModalComponent, {
- titleText: this.i18n('Create Snapshot'),
- message: this.i18n('Please enter the name of the snapshot.'),
+ titleText: $localize`Create Snapshot`,
+ message: $localize`Please enter the name of the snapshot.`,
fields: [
{
type: 'text',
@@ -547,15 +538,12 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
required: true
}
],
- submitButtonText: this.i18n('Create Snapshot'),
+ submitButtonText: $localize`Create Snapshot`,
onSubmit: (values: CephfsSnapshot) => {
this.cephfsService.mkSnapshot(this.id, path, values.name).subscribe((name) => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Created snapshot '{{name}}' for '{{path}}'`, {
- name: name,
- path: path
- })
+ $localize`Created snapshot '${name}' for '${path}'`
);
this.forceDirRefresh();
});
@@ -668,7 +656,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
deleteSnapshotModal() {
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.i18n('CephFs Snapshot'),
+ itemDescription: $localize`CephFs Snapshot`,
itemNames: this.snapshot.selection.selected.map((snapshot: CephfsSnapshot) => snapshot.name),
submitAction: () => this.deleteSnapshot()
});
@@ -681,10 +669,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
this.cephfsService.rmSnapshot(this.id, path, name).subscribe(() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Deleted snapshot '{{name}}' for '{{path}}'`, {
- name: name,
- path: path
- })
+ $localize`Deleted snapshot '${name}' for '${path}'`
);
});
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts
index f0d0803295d..a8f87b6ba29 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts
@@ -3,7 +3,7 @@ import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { SharedModule } from '../../../shared/shared.module';
import { CephfsListComponent } from './cephfs-list.component';
@@ -20,8 +20,7 @@ describe('CephfsListComponent', () => {
configureTestBed({
imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule],
- declarations: [CephfsListComponent, CephfsTabsStubComponent],
- providers: i18nProviders
+ declarations: [CephfsListComponent, CephfsTabsStubComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
index 9b4ece957fd..4b19803d870 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
@@ -1,7 +1,5 @@
import { Component, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { CephfsService } from '../../../shared/api/cephfs.service';
import { ListWithDetails } from '../../../shared/classes/list-with-details.class';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
@@ -20,29 +18,25 @@ export class CephfsListComponent extends ListWithDetails implements OnInit {
filesystems: any = [];
selection = new CdTableSelection();
- constructor(
- private cephfsService: CephfsService,
- private cdDatePipe: CdDatePipe,
- private i18n: I18n
- ) {
+ constructor(private cephfsService: CephfsService, private cdDatePipe: CdDatePipe) {
super();
}
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'mdsmap.fs_name',
flexGrow: 2
},
{
- name: this.i18n('Created'),
+ name: $localize`Created`,
prop: 'mdsmap.created',
flexGrow: 2,
pipe: this.cdDatePipe
},
{
- name: this.i18n('Enabled'),
+ name: $localize`Enabled`,
prop: 'mdsmap.enabled',
flexGrow: 1,
cellTransformation: CellTemplate.checkIcon
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
index d165e589261..714f4e467bf 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
@@ -8,7 +8,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CephfsService } from '../../../shared/api/cephfs.service';
import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
import { SharedModule } from '../../../shared/shared.module';
@@ -91,8 +91,7 @@ describe('CephfsTabsComponent', () => {
CephfsDetailComponent,
CephfsDirectoriesComponent,
CephfsClientsComponent
- ],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts
index 40b05d829a4..5e079e81440 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { DataTableModule } from '../../../../shared/datatable/datatable.module';
import { SharedModule } from '../../../../shared/shared.module';
import { ConfigurationDetailsComponent } from './configuration-details.component';
@@ -11,8 +11,7 @@ describe('ConfigurationDetailsComponent', () => {
configureTestBed({
declarations: [ConfigurationDetailsComponent],
- imports: [DataTableModule, SharedModule],
- providers: [i18nProviders]
+ imports: [DataTableModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts
index d80544bd02c..df0e6d16261 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Component({
@@ -12,18 +11,16 @@ export class ConfigurationDetailsComponent implements OnChanges {
@Input()
selection: any;
flags = {
- runtime: this.i18n('The value can be updated at runtime.'),
- no_mon_update: this.i18n(`Daemons/clients do not pull this value from the
+ runtime: $localize`The value can be updated at runtime.`,
+ no_mon_update: $localize`Daemons/clients do not pull this value from the
monitor config database. We disallow setting this option via 'ceph config
set ...'. This option should be configured via ceph.conf or via the
- command line.`),
- startup: this.i18n('Option takes effect only during daemon startup.'),
- cluster_create: this.i18n('Option only affects cluster creation.'),
- create: this.i18n('Option only affects daemon creation.')
+ command line.`,
+ startup: $localize`Option takes effect only during daemon startup.`,
+ cluster_create: $localize`Option only affects cluster creation.`,
+ create: $localize`Option only affects daemon creation.`
};
- constructor(private i18n: I18n) {}
-
ngOnChanges() {
if (this.selection) {
this.selection.services = _.split(this.selection.services, ',');
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts
index 070455fbb45..d6fd507f839 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { ConfigFormModel } from '../../../../shared/components/config-option/config-option.model';
import { SharedModule } from '../../../../shared/shared.module';
import { ConfigurationFormComponent } from './configuration-form.component';
@@ -27,8 +27,7 @@ describe('ConfigurationFormComponent', () => {
providers: [
{
provide: ActivatedRoute
- },
- i18nProviders
+ }
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts
index 771180f1394..aa9ab7b839c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, ValidatorFn } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ConfigurationService } from '../../../../shared/api/configuration.service';
@@ -34,8 +33,7 @@ export class ConfigurationFormComponent extends CdForm implements OnInit {
private route: ActivatedRoute,
private router: Router,
private configService: ConfigurationService,
- private notificationService: NotificationService,
- private i18n: I18n
+ private notificationService: NotificationService
) {
super();
this.createForm();
@@ -157,7 +155,7 @@ export class ConfigurationFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n('Updated config option {{name}}', { name: request.name })
+ $localize`Updated config option ${request.name}`
);
this.router.navigate(['/configuration']);
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts
index 32cee6c2a3f..0aa03948562 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts
@@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { ConfigurationDetailsComponent } from './configuration-details/configuration-details.component';
import { ConfigurationComponent } from './configuration.component';
@@ -25,8 +25,7 @@ describe('ConfigurationComponent', () => {
NgbNavModule,
HttpClientTestingModule,
RouterTestingModule
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts
index 74971b32c6f..f32c1b0e966 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts
@@ -1,7 +1,5 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { ConfigurationService } from '../../../shared/api/configuration.service';
import { ListWithDetails } from '../../../shared/classes/list-with-details.class';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -28,7 +26,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
selection = new CdTableSelection();
filters: CdTableColumn[] = [
{
- name: this.i18n('Level'),
+ name: $localize`Level`,
prop: 'level',
filterOptions: ['basic', 'advanced', 'dev'],
filterInitValue: 'basic',
@@ -45,7 +43,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
}
},
{
- name: this.i18n('Service'),
+ name: $localize`Service`,
prop: 'services',
filterOptions: ['mon', 'mgr', 'osd', 'mds', 'common', 'mds_client', 'rgw'],
filterPredicate: (row, value) => {
@@ -53,7 +51,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
}
},
{
- name: this.i18n('Source'),
+ name: $localize`Source`,
prop: 'source',
filterOptions: ['mon'],
filterPredicate: (row, value) => {
@@ -64,7 +62,7 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
}
},
{
- name: this.i18n('Modified'),
+ name: $localize`Modified`,
prop: 'modified',
filterOptions: ['yes', 'no'],
filterPredicate: (row, value) => {
@@ -89,7 +87,6 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
constructor(
private authStorageService: AuthStorageService,
private configurationService: ConfigurationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
@@ -108,18 +105,18 @@ export class ConfigurationComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.columns = [
- { canAutoResize: true, prop: 'name', name: this.i18n('Name') },
- { prop: 'desc', name: this.i18n('Description'), cellClass: 'wrap' },
+ { canAutoResize: true, prop: 'name', name: $localize`Name` },
+ { prop: 'desc', name: $localize`Description`, cellClass: 'wrap' },
{
prop: 'value',
- name: this.i18n('Current value'),
+ name: $localize`Current value`,
cellClass: 'wrap',
cellTemplate: this.confValTpl
},
- { prop: 'default', name: this.i18n('Default'), cellClass: 'wrap' },
+ { prop: 'default', name: $localize`Default`, cellClass: 'wrap' },
{
prop: 'can_update_at_runtime',
- name: this.i18n('Editable'),
+ name: $localize`Editable`,
cellTransformation: CellTemplate.checkIcon,
flexGrow: 0.4,
cellClass: 'text-center'
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts
index a70ccd0b802..df2a06ba427 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- TabHelper
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, TabHelper } from '../../../../../testing/unit-test-helper';
import { CoreModule } from '../../../../core/core.module';
import { Permissions } from '../../../../shared/models/permissions';
import { SharedModule } from '../../../../shared/shared.module';
@@ -33,9 +29,7 @@ describe('HostDetailsComponent', () => {
CephSharedModule,
SharedModule,
ToastrModule.forRoot()
- ],
- declarations: [],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts
index 7015108ad2a..9586beadde0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { LoadingPanelComponent } from '../../../../shared/components/loading-panel/loading-panel.component';
import { SharedModule } from '../../../../shared/shared.module';
import { HostFormComponent } from './host-form.component';
@@ -23,7 +23,6 @@ describe('HostFormComponent', () => {
ReactiveFormsModule,
ToastrModule.forRoot()
],
- providers: [i18nProviders],
declarations: [HostFormComponent]
},
[LoadingPanelComponent]
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts
index 5bb66497d3a..d0118fe114c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts
@@ -2,8 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { HostService } from '../../../../shared/api/host.service';
import { ActionLabelsI18n, URLVerbs } from '../../../../shared/constants/app.constants';
import { CdForm } from '../../../../shared/forms/cd-form';
@@ -25,13 +23,12 @@ export class HostFormComponent extends CdForm implements OnInit {
constructor(
private router: Router,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n,
private hostService: HostService,
private taskWrapper: TaskWrapperService
) {
super();
- this.resource = this.i18n('host');
+ this.resource = $localize`host`;
this.action = this.actionLabels.CREATE;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
index 18e9fd5f1ef..bd6444d726e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CoreModule } from '../../../core/core.module';
import { HostService } from '../../../shared/api/host.service';
import { Permissions } from '../../../shared/models/permissions';
@@ -38,8 +38,7 @@ describe('HostsComponent', () => {
CephModule,
CoreModule
],
- providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, i18nProviders],
- declarations: []
+ providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
index 089024fbbd7..d1bea0bdd52 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { HostService } from '../../../shared/api/host.service';
import { ListWithDetails } from '../../../shared/classes/list-with-details.class';
@@ -56,7 +55,6 @@ export class HostsComponent extends ListWithDetails implements OnInit {
private hostService: HostService,
private cephShortVersionPipe: CephShortVersionPipe,
private joinPipe: JoinPipe,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
private actionLabels: ActionLabelsI18n,
private modalService: ModalService,
@@ -75,7 +73,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
click: () => {
this.depCheckerService.checkOrchestratorOrModal(
this.actionLabels.CREATE,
- this.i18n('Host'),
+ $localize`Host`,
() => {
this.router.navigate([this.urlBuilder.getCreate()]);
}
@@ -89,7 +87,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
click: () => {
this.depCheckerService.checkOrchestratorOrModal(
this.actionLabels.EDIT,
- this.i18n('Host'),
+ $localize`Host`,
() => this.editAction()
);
},
@@ -104,7 +102,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
click: () => {
this.depCheckerService.checkOrchestratorOrModal(
this.actionLabels.DELETE,
- this.i18n('Host'),
+ $localize`Host`,
() => this.deleteAction()
);
},
@@ -119,24 +117,24 @@ export class HostsComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Hostname'),
+ name: $localize`Hostname`,
prop: 'hostname',
flexGrow: 1
},
{
- name: this.i18n('Services'),
+ name: $localize`Services`,
prop: 'services',
flexGrow: 3,
cellTemplate: this.servicesTpl
},
{
- name: this.i18n('Labels'),
+ name: $localize`Labels`,
prop: 'labels',
flexGrow: 1,
pipe: this.joinPipe
},
{
- name: this.i18n('Version'),
+ name: $localize`Version`,
prop: 'ceph_version',
flexGrow: 1,
pipe: this.cephShortVersionPipe
@@ -155,33 +153,30 @@ export class HostsComponent extends ListWithDetails implements OnInit {
return { enabled: true, name: label };
});
this.modalService.show(FormModalComponent, {
- titleText: this.i18n('Edit Host: {{hostname}}', host),
+ titleText: $localize`Edit Host: ${host.hostname}`,
fields: [
{
type: 'select-badges',
name: 'labels',
value: host['labels'],
- label: this.i18n('Labels'),
+ label: $localize`Labels`,
typeConfig: {
customBadges: true,
options: allLabels,
- messages: new SelectMessages(
- {
- empty: this.i18n('There are no labels.'),
- filter: this.i18n('Filter or add labels'),
- add: this.i18n('Add label')
- },
- this.i18n
- )
+ messages: new SelectMessages({
+ empty: $localize`There are no labels.`,
+ filter: $localize`Filter or add labels`,
+ add: $localize`Add label`
+ })
}
}
],
- submitButtonText: this.i18n('Edit Host'),
+ submitButtonText: $localize`Edit Host`,
onSubmit: (values: any) => {
this.hostService.update(host['hostname'], values.labels).subscribe(() => {
this.notificationService.show(
NotificationType.success,
- this.i18n('Updated Host "{{hostname}}"', host)
+ $localize`Updated Host "${host.hostname}"`
);
// Reload the data table content.
this.table.refreshBtn();
@@ -193,9 +188,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
getEditDisableDesc(selection: CdTableSelection): string | undefined {
if (selection && selection.hasSingleSelection && !selection.first().sources.orchestrator) {
- return this.i18n(
- 'Host editing is disabled because the selected host is not managed by Orchestrator.'
- );
+ return $localize`Host editing is disabled because the selected host is not managed by Orchestrator.`;
}
return undefined;
}
@@ -220,9 +213,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
selection.hasSelection &&
!selection.selected.every((selected) => selected.sources.orchestrator)
) {
- return this.i18n(
- 'Host deletion is disabled because a selected host is not managed by Orchestrator.'
- );
+ return $localize`Host deletion is disabled because a selected host is not managed by Orchestrator.`;
}
return undefined;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts
index 695b3377a15..1ce48f6fd00 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts
@@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { InventoryDevicesComponent } from './inventory-devices.component';
@@ -22,7 +22,6 @@ describe('InventoryDevicesComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [i18nProviders],
declarations: [InventoryDevicesComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts
index 3cc281f7e1a..4b99c747396 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts
@@ -8,7 +8,6 @@ import {
ViewChild
} from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
@@ -71,7 +70,6 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
constructor(
private authStorageService: AuthStorageService,
private dimlessBinary: DimlessBinaryPipe,
- private i18n: I18n,
private modalService: ModalService,
private notificationService: NotificationService,
private orchService: OrchestratorService
@@ -84,7 +82,7 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
permission: 'update',
icon: Icons.show,
click: () => this.identifyDevice(),
- name: this.i18n('Identify'),
+ name: $localize`Identify`,
disable: () => !this.selection.hasSingleSelection,
canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection,
visible: () => _.isString(this.selectionType)
@@ -92,17 +90,17 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
];
const columns = [
{
- name: this.i18n('Hostname'),
+ name: $localize`Hostname`,
prop: 'hostname',
flexGrow: 1
},
{
- name: this.i18n('Device path'),
+ name: $localize`Device path`,
prop: 'path',
flexGrow: 1
},
{
- name: this.i18n('Type'),
+ name: $localize`Type`,
prop: 'human_readable_type',
flexGrow: 1,
cellTransformation: CellTemplate.badge,
@@ -114,30 +112,30 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
}
},
{
- name: this.i18n('Available'),
+ name: $localize`Available`,
prop: 'available',
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
- name: this.i18n('Vendor'),
+ name: $localize`Vendor`,
prop: 'sys_api.vendor',
flexGrow: 1
},
{
- name: this.i18n('Model'),
+ name: $localize`Model`,
prop: 'sys_api.model',
flexGrow: 1
},
{
- name: this.i18n('Size'),
+ name: $localize`Size`,
prop: 'sys_api.size',
flexGrow: 1,
pipe: this.dimlessBinary
},
{
- name: this.i18n('OSDs'),
+ name: $localize`OSDs`,
prop: 'osd_ids',
flexGrow: 1,
cellTransformation: CellTemplate.badge,
@@ -186,8 +184,8 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
const hostname = selected.hostname;
const device = selected.path || selected.device_id;
this.modalService.show(FormModalComponent, {
- titleText: this.i18n(`Identify device {{device}}`, { device }),
- message: this.i18n('Please enter the duration how long to blink the LED.'),
+ titleText: $localize`Identify device ${device}`,
+ message: $localize`Please enter the duration how long to blink the LED.`,
fields: [
{
type: 'select',
@@ -196,24 +194,21 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
required: true,
typeConfig: {
options: [
- { text: this.i18n('1 minute'), value: 60 },
- { text: this.i18n('2 minutes'), value: 120 },
- { text: this.i18n('5 minutes'), value: 300 },
- { text: this.i18n('10 minutes'), value: 600 },
- { text: this.i18n('15 minutes'), value: 900 }
+ { text: $localize`1 minute`, value: 60 },
+ { text: $localize`2 minutes`, value: 120 },
+ { text: $localize`5 minutes`, value: 300 },
+ { text: $localize`10 minutes`, value: 600 },
+ { text: $localize`15 minutes`, value: 900 }
]
}
}
],
- submitButtonText: this.i18n('Execute'),
+ submitButtonText: $localize`Execute`,
onSubmit: (values: any) => {
this.orchService.identifyDevice(hostname, device, values.duration).subscribe(() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Identifying '{{device}}' started on host '{{hostname}}'`, {
- hostname,
- device
- })
+ $localize`Identifying '${device}' started on host '${hostname}'`
);
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts
index 51de5164bef..3c97845e8ef 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts
@@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { OrchestratorService } from '../../../shared/api/orchestrator.service';
import { SharedModule } from '../../../shared/shared.module';
import { InventoryDevicesComponent } from './inventory-devices/inventory-devices.component';
@@ -27,7 +27,6 @@ describe('InventoryComponent', () => {
RouterTestingModule,
ToastrModule.forRoot()
],
- providers: [i18nProviders],
declarations: [InventoryComponent, InventoryDevicesComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts
index f33e17cd11d..ff6473ed133 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-details/mgr-module-details.component.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { MgrModuleDetailsComponent } from './mgr-module-details.component';
@@ -11,8 +11,7 @@ describe('MgrModuleDetailsComponent', () => {
configureTestBed({
declarations: [MgrModuleDetailsComponent],
- imports: [HttpClientTestingModule, SharedModule],
- providers: [i18nProviders]
+ imports: [HttpClientTestingModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts
index 18cbb7609bd..18168a686e6 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { LoadingPanelComponent } from '../../../../shared/components/loading-panel/loading-panel.component';
import { SharedModule } from '../../../../shared/shared.module';
import { MgrModuleFormComponent } from './mgr-module-form.component';
@@ -23,8 +23,7 @@ describe('MgrModuleFormComponent', () => {
RouterTestingModule,
SharedModule,
ToastrModule.forRoot()
- ],
- providers: i18nProviders
+ ]
},
[LoadingPanelComponent]
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts
index ea92c9fc550..715ee5035c8 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin as observableForkJoin } from 'rxjs';
@@ -29,8 +28,7 @@ export class MgrModuleFormComponent extends CdForm implements OnInit {
private router: Router,
private formBuilder: CdFormBuilder,
private mgrModuleService: MgrModuleService,
- private notificationService: NotificationService,
- private i18n: I18n
+ private notificationService: NotificationService
) {
super();
}
@@ -129,7 +127,7 @@ export class MgrModuleFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated options for module '{{name}}'.`, { name: this.moduleName })
+ $localize`Updated options for module '${this.moduleName}'.`
);
this.goToListView();
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts
index dbeca1db812..f340bd83264 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf, throwError as observableThrowError } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper';
import { MgrModuleService } from '../../../../shared/api/mgr-module.service';
import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component';
import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
@@ -36,7 +32,7 @@ describe('MgrModuleListComponent', () => {
NgbNavModule,
ToastrModule.forRoot()
],
- providers: [MgrModuleService, NotificationService, i18nProviders]
+ providers: [MgrModuleService, NotificationService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts
index 4db0f6fd1d8..8e1da89d0f5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts
@@ -1,6 +1,5 @@
import { Component, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { BlockUI, NgBlockUI } from 'ng-block-ui';
import { timer as observableTimer } from 'rxjs';
@@ -37,26 +36,25 @@ export class MgrModuleListComponent extends ListWithDetails {
constructor(
private authStorageService: AuthStorageService,
private mgrModuleService: MgrModuleService,
- private notificationService: NotificationService,
- private i18n: I18n
+ private notificationService: NotificationService
) {
super();
this.permission = this.authStorageService.getPermissions().configOpt;
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 1
},
{
- name: this.i18n('Enabled'),
+ name: $localize`Enabled`,
prop: 'enabled',
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
- name: this.i18n('Always-On'),
+ name: $localize`Always-On`,
prop: 'always_on',
isHidden: true,
flexGrow: 1,
@@ -68,7 +66,7 @@ export class MgrModuleListComponent extends ListWithDetails {
this.selection.first() && encodeURIComponent(this.selection.first().name);
this.tableActions = [
{
- name: this.i18n('Edit'),
+ name: $localize`Edit`,
permission: 'update',
disable: () => {
if (!this.selection.hasSelection) {
@@ -81,14 +79,14 @@ export class MgrModuleListComponent extends ListWithDetails {
icon: Icons.edit
},
{
- name: this.i18n('Enable'),
+ name: $localize`Enable`,
permission: 'update',
click: () => this.updateModuleState(),
disable: () => this.isTableActionDisabled('enabled'),
icon: Icons.start
},
{
- name: this.i18n('Disable'),
+ name: $localize`Disable`,
permission: 'update',
click: () => this.updateModuleState(),
disable: () => this.isTableActionDisabled('disabled'),
@@ -146,7 +144,7 @@ export class MgrModuleListComponent extends ListWithDetails {
if (this.selection.hasSelection) {
const selected = this.selection.first();
if (selected.always_on) {
- return this.i18n('This Manager module is always on.');
+ return $localize`This Manager module is always on.`;
}
}
@@ -197,7 +195,7 @@ export class MgrModuleListComponent extends ListWithDetails {
this.notificationService.suspendToasties(true);
// Block the whole UI to prevent user interactions until
// the connection to the backend is reestablished
- this.blockUI.start(this.i18n('Reconnecting, please wait ...'));
+ this.blockUI.start($localize`Reconnecting, please wait ...`);
fnWaitUntilReconnected();
}
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts
index d15be4a3598..1df4af8810f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts
@@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { MonitorService } from '../../../shared/api/monitor.service';
import { MonitorComponent } from './monitor.component';
@@ -17,7 +17,7 @@ describe('MonitorComponent', () => {
imports: [HttpClientTestingModule],
declarations: [MonitorComponent],
schemas: [NO_ERRORS_SCHEMA],
- providers: [MonitorService, i18nProviders]
+ providers: [MonitorService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts
index 441351b729a..82d765dac5b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts
@@ -1,6 +1,5 @@
import { Component } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { MonitorService } from '../../../shared/api/monitor.service';
@@ -18,15 +17,15 @@ export class MonitorComponent {
interval: any;
- constructor(private monitorService: MonitorService, private i18n: I18n) {
+ constructor(private monitorService: MonitorService) {
this.inQuorum = {
columns: [
- { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink },
- { prop: 'rank', name: this.i18n('Rank') },
- { prop: 'public_addr', name: this.i18n('Public Address') },
+ { prop: 'name', name: $localize`Name`, cellTransformation: CellTemplate.routerLink },
+ { prop: 'rank', name: $localize`Rank` },
+ { prop: 'public_addr', name: $localize`Public Address` },
{
prop: 'cdOpenSessions',
- name: this.i18n('Open Sessions'),
+ name: $localize`Open Sessions`,
cellTransformation: CellTemplate.sparkline,
comparator: (dataA: any, dataB: any) => {
// We get the last value of time series to compare:
@@ -45,9 +44,9 @@ export class MonitorComponent {
this.notInQuorum = {
columns: [
- { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink },
- { prop: 'rank', name: this.i18n('Rank') },
- { prop: 'public_addr', name: this.i18n('Public Address') }
+ { prop: 'name', name: $localize`Name`, cellTransformation: CellTemplate.routerLink },
+ { prop: 'rank', name: $localize`Rank` },
+ { prop: 'public_addr', name: $localize`Public Address` }
]
};
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts
index 6922d99dbbd..1f6ecd143d4 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-creation-preview-modal/osd-creation-preview-modal.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { OsdCreationPreviewModalComponent } from './osd-creation-preview-modal.component';
@@ -22,7 +22,7 @@ describe('OsdCreationPreviewModalComponent', () => {
RouterTestingModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders],
+ providers: [NgbActiveModal],
declarations: [OsdCreationPreviewModalComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
index 0ed14a1aea9..0d55de450ed 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
@@ -5,7 +5,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { OsdService } from '../../../../shared/api/osd.service';
import { SharedModule } from '../../../../shared/shared.module';
import { TablePerformanceCounterComponent } from '../../../performance-counter/table-performance-counter/table-performance-counter.component';
@@ -29,8 +29,7 @@ describe('OsdDetailsComponent', () => {
SmartListComponent,
TablePerformanceCounterComponent,
OsdPerformanceHistogramComponent
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts
index 893f9814987..7aac4146f42 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts
@@ -5,12 +5,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- FixtureHelper,
- i18nProviders,
- Mocks
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, FixtureHelper, Mocks } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model';
import { InventoryDevicesComponent } from '../../inventory/inventory-devices/inventory-devices.component';
@@ -41,7 +36,6 @@ describe('OsdDevicesSelectionGroupsComponent', () => {
SharedModule,
ToastrModule.forRoot()
],
- providers: [i18nProviders],
declarations: [OsdDevicesSelectionGroupsComponent, InventoryDevicesComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts
index 8c41b75482a..3693bc558cc 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts
@@ -1,6 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Icons } from '../../../../shared/enum/icons.enum';
@@ -42,12 +41,12 @@ export class OsdDevicesSelectionGroupsComponent implements OnInit, OnChanges {
addButtonTooltip: String;
tooltips = {
- noAvailDevices: this.i18n('No available devices'),
- addPrimaryFirst: this.i18n('Please add primary devices first'),
- addByFilters: this.i18n('Add devices by using filters')
+ noAvailDevices: $localize`No available devices`,
+ addPrimaryFirst: $localize`Please add primary devices first`,
+ addByFilters: $localize`Add devices by using filters`
};
- constructor(private modalService: ModalService, private i18n: I18n) {}
+ constructor(private modalService: ModalService) {}
ngOnInit() {
this.updateAddButtonTooltip();
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts
index 6847104c67d..baa9e230e83 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.spec.ts
@@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders, Mocks } from '../../../../../testing/unit-test-helper';
+import { configureTestBed, Mocks } from '../../../../../testing/unit-test-helper';
import { CdTableColumnFiltersChange } from '../../../../shared/models/cd-table-column-filters-change';
import { SharedModule } from '../../../../shared/shared.module';
import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model';
@@ -37,7 +37,7 @@ describe('OsdDevicesSelectionModalComponent', () => {
RouterTestingModule,
ToastrModule.forRoot()
],
- providers: [NgbActiveModal, i18nProviders],
+ providers: [NgbActiveModal],
declarations: [OsdDevicesSelectionModalComponent, InventoryDevicesComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts
index b73a495af8e..78d472da16a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts
@@ -7,7 +7,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { NotificationType } from '../../../../shared/enum/notification-type.enum';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -34,7 +34,7 @@ describe('OsdFlagsModalComponent', () => {
ToastrModule.forRoot()
],
declarations: [OsdFlagsModalComponent],
- providers: [i18nProviders, NgbActiveModal]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts
index e2cc01a764d..78ca001ce7a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { OsdService } from '../../../../shared/api/osd.service';
@@ -24,96 +23,90 @@ export class OsdFlagsModalComponent implements OnInit {
allFlags = {
noin: {
code: 'noin',
- name: this.i18n('No In'),
+ name: $localize`No In`,
value: false,
- description: this.i18n(
- 'OSDs that were previously marked out will not be marked back in when they start'
- )
+ description: $localize`OSDs that were previously marked out will not be marked back in when they start`
},
noout: {
code: 'noout',
- name: this.i18n('No Out'),
+ name: $localize`No Out`,
value: false,
- description: this.i18n(
- 'OSDs will not automatically be marked out after the configured interval'
- )
+ description: $localize`OSDs will not automatically be marked out after the configured interval`
},
noup: {
code: 'noup',
- name: this.i18n('No Up'),
+ name: $localize`No Up`,
value: false,
- description: this.i18n('OSDs are not allowed to start')
+ description: $localize`OSDs are not allowed to start`
},
nodown: {
code: 'nodown',
- name: this.i18n('No Down'),
+ name: $localize`No Down`,
value: false,
- description: this.i18n(
- 'OSD failure reports are being ignored, such that the monitors will not mark OSDs down'
- )
+ description: $localize`OSD failure reports are being ignored, such that the monitors will not mark OSDs down`
},
pause: {
code: 'pause',
- name: this.i18n('Pause'),
+ name: $localize`Pause`,
value: false,
- description: this.i18n('Pauses reads and writes')
+ description: $localize`Pauses reads and writes`
},
noscrub: {
code: 'noscrub',
- name: this.i18n('No Scrub'),
+ name: $localize`No Scrub`,
value: false,
- description: this.i18n('Scrubbing is disabled')
+ description: $localize`Scrubbing is disabled`
},
'nodeep-scrub': {
code: 'nodeep-scrub',
- name: this.i18n('No Deep Scrub'),
+ name: $localize`No Deep Scrub`,
value: false,
- description: this.i18n('Deep Scrubbing is disabled')
+ description: $localize`Deep Scrubbing is disabled`
},
nobackfill: {
code: 'nobackfill',
- name: this.i18n('No Backfill'),
+ name: $localize`No Backfill`,
value: false,
- description: this.i18n('Backfilling of PGs is suspended')
+ description: $localize`Backfilling of PGs is suspended`
},
norebalance: {
code: 'norebalance',
- name: this.i18n('No Rebalance'),
+ name: $localize`No Rebalance`,
value: false,
- description: this.i18n('OSD will choose not to backfill unless PG is also degraded')
+ description: $localize`OSD will choose not to backfill unless PG is also degraded`
},
norecover: {
code: 'norecover',
- name: this.i18n('No Recover'),
+ name: $localize`No Recover`,
value: false,
- description: this.i18n('Recovery of PGs is suspended')
+ description: $localize`Recovery of PGs is suspended`
},
sortbitwise: {
code: 'sortbitwise',
- name: this.i18n('Bitwise Sort'),
+ name: $localize`Bitwise Sort`,
value: false,
- description: this.i18n('Use bitwise sort'),
+ description: $localize`Use bitwise sort`,
disabled: true
},
purged_snapdirs: {
code: 'purged_snapdirs',
- name: this.i18n('Purged Snapdirs'),
+ name: $localize`Purged Snapdirs`,
value: false,
- description: this.i18n('OSDs have converted snapsets'),
+ description: $localize`OSDs have converted snapsets`,
disabled: true
},
recovery_deletes: {
code: 'recovery_deletes',
- name: this.i18n('Recovery Deletes'),
+ name: $localize`Recovery Deletes`,
value: false,
- description: this.i18n('Deletes performed during recovery instead of peering'),
+ description: $localize`Deletes performed during recovery instead of peering`,
disabled: true
},
pglog_hardlimit: {
code: 'pglog_hardlimit',
- name: this.i18n('PG Log Hard Limit'),
+ name: $localize`PG Log Hard Limit`,
value: false,
- description: this.i18n('Puts a hard limit on pg log length'),
+ description: $localize`Puts a hard limit on pg log length`,
disabled: true
}
};
@@ -124,8 +117,7 @@ export class OsdFlagsModalComponent implements OnInit {
public activeModal: NgbActiveModal,
private authStorageService: AuthStorageService,
private osdService: OsdService,
- private notificationService: NotificationService,
- private i18n: I18n
+ private notificationService: NotificationService
) {
this.permissions = this.authStorageService.getPermissions();
}
@@ -151,7 +143,7 @@ export class OsdFlagsModalComponent implements OnInit {
this.osdService.updateFlags(newFlags).subscribe(
() => {
- this.notificationService.show(NotificationType.success, this.i18n('Updated OSD Flags'));
+ this.notificationService.show(NotificationType.success, $localize`Updated OSD Flags`);
this.activeModal.close();
},
() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts
index 0acf0f3a1c7..4ca688acc0d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.spec.ts
@@ -10,8 +10,7 @@ import { BehaviorSubject, of } from 'rxjs';
import {
configureTestBed,
FixtureHelper,
- FormHelper,
- i18nProviders
+ FormHelper
} from '../../../../../testing/unit-test-helper';
import { OrchestratorService } from '../../../../shared/api/orchestrator.service';
import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
@@ -104,7 +103,6 @@ describe('OsdFormComponent', () => {
ReactiveFormsModule,
ToastrModule.forRoot()
],
- providers: [i18nProviders],
declarations: [OsdFormComponent, OsdDevicesSelectionGroupsComponent, InventoryDevicesComponent]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts
index 291a87c75c6..7a3538e6e20 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { OrchestratorService } from '../../../../shared/api/orchestrator.service';
@@ -66,18 +65,17 @@ export class OsdFormComponent extends CdForm implements OnInit {
constructor(
public actionLabels: ActionLabelsI18n,
private authStorageService: AuthStorageService,
- private i18n: I18n,
private orchService: OrchestratorService,
private router: Router,
private modalService: ModalService
) {
super();
- this.resource = this.i18n('OSDs');
+ this.resource = $localize`OSDs`;
this.action = this.actionLabels.CREATE;
this.features = {
encrypted: {
key: 'encrypted',
- desc: this.i18n('Encryption')
+ desc: $localize`Encryption`
}
};
this.featureList = _.map(this.features, (o, key) => Object.assign(o, { key: key }));
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
index 0e74f583005..81e1890e7a3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
@@ -91,8 +91,7 @@
class="custom-control-input"
name="preserve"
id="preserve"
- formControlName="preserve"
- autofocus>
+ formControlName="preserve">
<label class="custom-control-label"
for="preserve"
i18n>Preserve OSD ID(s) for replacement.</label>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
index 44792948d69..f928e4de4b0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
@@ -10,11 +10,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { EMPTY, of } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper';
import { CoreModule } from '../../../../core/core.module';
import { OrchestratorService } from '../../../../shared/api/orchestrator.service';
import { OsdService } from '../../../../shared/api/osd.service';
@@ -103,12 +99,10 @@ describe('OsdListComponent', () => {
CoreModule,
RouterTestingModule
],
- declarations: [],
providers: [
{ provide: AuthStorageService, useValue: fakeAuthStorageService },
TableActionsComponent,
- ModalService,
- i18nProviders
+ ModalService
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
index 67224ce6871..af298a9e5b1 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
@@ -3,7 +3,6 @@ import { FormControl } from '@angular/forms';
import { Router } from '@angular/router';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin as observableForkJoin, Observable } from 'rxjs';
@@ -87,7 +86,6 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
private osdService: OsdService,
private dimlessBinaryPipe: DimlessBinaryPipe,
private modalService: ModalService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
private router: Router,
private depCheckerService: DepCheckerService,
@@ -105,7 +103,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
click: () => {
this.depCheckerService.checkOrchestratorOrModal(
this.actionLabels.CREATE,
- this.i18n('OSD'),
+ $localize`OSD`,
() => {
this.router.navigate([this.urlBuilder.getCreate()]);
}
@@ -144,21 +142,21 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
{
name: this.actionLabels.MARK_OUT,
permission: 'update',
- click: () => this.showConfirmationModal(this.i18n('out'), this.osdService.markOut),
+ click: () => this.showConfirmationModal($localize`out`, this.osdService.markOut),
disable: () => this.isNotSelectedOrInState('out'),
icon: Icons.left
},
{
name: this.actionLabels.MARK_IN,
permission: 'update',
- click: () => this.showConfirmationModal(this.i18n('in'), this.osdService.markIn),
+ click: () => this.showConfirmationModal($localize`in`, this.osdService.markIn),
disable: () => this.isNotSelectedOrInState('in'),
icon: Icons.right
},
{
name: this.actionLabels.MARK_DOWN,
permission: 'update',
- click: () => this.showConfirmationModal(this.i18n('down'), this.osdService.markDown),
+ click: () => this.showConfirmationModal($localize`down`, this.osdService.markDown),
disable: () => this.isNotSelectedOrInState('down'),
icon: Icons.down
},
@@ -167,9 +165,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
- this.i18n('Mark'),
- this.i18n('OSD lost'),
- this.i18n('marked lost'),
+ $localize`Mark`,
+ $localize`OSD lost`,
+ $localize`marked lost`,
(ids: number[]) => {
return this.osdService.safeToDestroy(JSON.stringify(ids));
},
@@ -184,9 +182,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
- this.i18n('Purge'),
- this.i18n('OSD'),
- this.i18n('purged'),
+ $localize`Purge`,
+ $localize`OSD`,
+ $localize`purged`,
(ids: number[]) => {
return this.osdService.safeToDestroy(JSON.stringify(ids));
},
@@ -204,9 +202,9 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
- this.i18n('destroy'),
- this.i18n('OSD'),
- this.i18n('destroyed'),
+ $localize`destroy`,
+ $localize`OSD`,
+ $localize`destroyed`,
(ids: number[]) => {
return this.osdService.safeToDestroy(JSON.stringify(ids));
},
@@ -232,21 +230,21 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.clusterWideActions = [
{
- name: this.i18n('Flags'),
+ name: $localize`Flags`,
icon: Icons.flag,
click: () => this.configureFlagsAction(),
permission: 'read',
visible: () => this.permissions.osd.read
},
{
- name: this.i18n('Recovery Priority'),
+ name: $localize`Recovery Priority`,
icon: Icons.deepCheck,
click: () => this.configureQosParamsAction(),
permission: 'read',
visible: () => this.permissions.configOpt.read
},
{
- name: this.i18n('PG scrub'),
+ name: $localize`PG scrub`,
icon: Icons.analyse,
click: () => this.configurePgScrubAction(),
permission: 'read',
@@ -254,11 +252,11 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
}
];
this.columns = [
- { prop: 'host.name', name: this.i18n('Host') },
- { prop: 'id', name: this.i18n('ID'), flexGrow: 1, cellTransformation: CellTemplate.bold },
+ { prop: 'host.name', name: $localize`Host` },
+ { prop: 'id', name: $localize`ID`, flexGrow: 1, cellTransformation: CellTemplate.bold },
{
prop: 'collectedStates',
- name: this.i18n('Status'),
+ name: $localize`Status`,
flexGrow: 1,
cellTransformation: CellTemplate.badge,
customTemplateConfig: {
@@ -273,7 +271,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
},
{
prop: 'tree.device_class',
- name: this.i18n('Device class'),
+ name: $localize`Device class`,
flexGrow: 1.2,
cellTransformation: CellTemplate.badge,
customTemplateConfig: {
@@ -285,34 +283,34 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
},
{
prop: 'stats.numpg',
- name: this.i18n('PGs'),
+ name: $localize`PGs`,
flexGrow: 1
},
{
prop: 'stats.stat_bytes',
- name: this.i18n('Size'),
+ name: $localize`Size`,
flexGrow: 1,
pipe: this.dimlessBinaryPipe
},
- { prop: 'stats.usage', name: this.i18n('Usage'), cellTemplate: this.osdUsageTpl },
+ { prop: 'stats.usage', name: $localize`Usage`, cellTemplate: this.osdUsageTpl },
{
prop: 'stats_history.out_bytes',
- name: this.i18n('Read bytes'),
+ name: $localize`Read bytes`,
cellTransformation: CellTemplate.sparkline
},
{
prop: 'stats_history.in_bytes',
- name: this.i18n('Write bytes'),
+ name: $localize`Write bytes`,
cellTransformation: CellTemplate.sparkline
},
{
prop: 'stats.op_r',
- name: this.i18n('Read ops'),
+ name: $localize`Read ops`,
cellTransformation: CellTemplate.perSecond
},
{
prop: 'stats.op_w',
- name: this.i18n('Write ops'),
+ name: $localize`Write ops`,
cellTransformation: CellTemplate.perSecond
}
];
@@ -379,26 +377,22 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
const selectedOsd = _.filter(this.osds, ['id', this.selection.first().id]).pop();
this.modalService.show(FormModalComponent, {
- titleText: this.i18n('Edit OSD: {{id}}', {
- id: selectedOsd.id
- }),
+ titleText: $localize`Edit OSD: ${selectedOsd.id}`,
fields: [
{
type: 'text',
name: 'deviceClass',
value: selectedOsd.tree.device_class,
- label: this.i18n('Device class'),
+ label: $localize`Device class`,
required: true
}
],
- submitButtonText: this.i18n('Edit OSD'),
+ submitButtonText: $localize`Edit OSD`,
onSubmit: (values: any) => {
this.osdService.update(selectedOsd.id, values.deviceClass).subscribe(() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated OSD '{{id}}'`, {
- id: selectedOsd.id
- })
+ $localize`Updated OSD '${selectedOsd.id}'`
);
this.getOsdList();
});
@@ -425,8 +419,8 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
showConfirmationModal(markAction: string, onSubmit: (id: number) => Observable<any>) {
this.bsModalRef = this.modalService.show(ConfirmationModalComponent, {
- titleText: this.i18n('Mark OSD {{markAction}}', { markAction: markAction }),
- buttonText: this.i18n('Mark {{markAction}}', { markAction: markAction }),
+ titleText: $localize`Mark OSD ${markAction}`,
+ buttonText: $localize`Mark ${markAction}`,
bodyTpl: this.markOsdConfirmationTpl,
bodyContext: {
markActionDescription: markAction
@@ -454,12 +448,12 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
this.depCheckerService.checkOrchestratorOrModal(
this.actionLabels.DELETE,
- this.i18n('OSD'),
+ $localize`OSD`,
() => {
this.showCriticalConfirmationModal(
- this.i18n('delete'),
- this.i18n('OSD'),
- this.i18n('deleted'),
+ $localize`delete`,
+ $localize`OSD`,
+ $localize`deleted`,
(ids: number[]) => {
return this.osdService.safeToDelete(JSON.stringify(ids));
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts
index 083398d1ce0..8b9d39268e2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.spec.ts
@@ -8,7 +8,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { ConfigurationService } from '../../../../shared/api/configuration.service';
import { NotificationType } from '../../../../shared/enum/notification-type.enum';
import { NotificationService } from '../../../../shared/services/notification.service';
@@ -29,7 +29,7 @@ describe('OsdPgScrubModalComponent', () => {
ToastrModule.forRoot()
],
declarations: [OsdPgScrubModalComponent],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts
index e2b4c1d4450..8c21b6d4177 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component.ts
@@ -1,7 +1,6 @@
import { Component, ViewChild } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { forkJoin as observableForkJoin } from 'rxjs';
import { ConfigOptionComponent } from '../../../../shared/components/config-option/config-option.component';
@@ -38,11 +37,10 @@ export class OsdPgScrubModalComponent {
public activeModal: NgbActiveModal,
private authStorageService: AuthStorageService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
this.osdPgScrubForm = new CdFormGroup({});
- this.resource = this.i18n('PG scrub options');
+ this.resource = $localize`PG scrub options`;
this.action = this.actionLabels.EDIT;
this.permissions = this.authStorageService.getPermissions();
}
@@ -58,7 +56,7 @@ export class OsdPgScrubModalComponent {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n('Updated PG scrub options')
+ $localize`Updated PG scrub options`
);
this.activeModal.close();
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
index 5c08024a86b..c6351ea8a72 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
@@ -8,7 +8,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { ConfigurationService } from '../../../../shared/api/configuration.service';
import { SharedModule } from '../../../../shared/shared.module';
import { OsdRecvSpeedModalComponent } from './osd-recv-speed-modal.component';
@@ -27,7 +27,7 @@ describe('OsdRecvSpeedModalComponent', () => {
ToastrModule.forRoot()
],
declarations: [OsdRecvSpeedModalComponent],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
let configOptions: any[] = [];
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts
index 4eaffd27fbc..f4b165b2eea 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ConfigurationService } from '../../../../shared/api/configuration.service';
@@ -31,7 +30,6 @@ export class OsdRecvSpeedModalComponent implements OnInit {
private authStorageService: AuthStorageService,
private configService: ConfigurationService,
private notificationService: NotificationService,
- private i18n: I18n,
private osdService: OsdService
) {
this.permissions = this.authStorageService.getPermissions();
@@ -42,28 +40,28 @@ export class OsdRecvSpeedModalComponent implements OnInit {
});
this.priorityAttrs = {
osd_max_backfills: {
- text: this.i18n('Max Backfills'),
+ text: $localize`Max Backfills`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_max_active: {
- text: this.i18n('Recovery Max Active'),
+ text: $localize`Recovery Max Active`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_max_single_start: {
- text: this.i18n('Recovery Max Single Start'),
+ text: $localize`Recovery Max Single Start`,
desc: '',
patternHelpText: '',
maxValue: undefined,
minValue: undefined
},
osd_recovery_sleep: {
- text: this.i18n('Recovery Sleep'),
+ text: $localize`Recovery Sleep`,
desc: '',
patternHelpText: '',
maxValue: undefined,
@@ -104,7 +102,7 @@ export class OsdRecvSpeedModalComponent implements OnInit {
if (Object.entries(configOptionValues).length === 4) {
this.osdRecvSpeedForm.controls.customizePriority.setValue(true);
return callbackFn(
- Object({ name: 'custom', text: this.i18n('Custom'), values: configOptionValues })
+ Object({ name: 'custom', text: $localize`Custom`, values: configOptionValues })
);
}
@@ -189,7 +187,7 @@ export class OsdRecvSpeedModalComponent implements OnInit {
if (this.osdRecvSpeedForm.getValue('customizePriority')) {
const customPriority = {
name: 'custom',
- text: this.i18n('Custom'),
+ text: $localize`Custom`,
values: values
};
this.setPriority(customPriority);
@@ -224,9 +222,9 @@ export class OsdRecvSpeedModalComponent implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated OSD recovery speed priority '{{value}}'`, {
- value: this.osdRecvSpeedForm.getValue('priority')
- })
+ $localize`Updated OSD recovery speed priority '${this.osdRecvSpeedForm.getValue(
+ 'priority'
+ )}'`
);
this.activeModal.close();
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts
index 7b98b6d0340..abd92bbe012 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { OsdService } from '../../../../shared/api/osd.service';
import { BackButtonComponent } from '../../../../shared/components/back-button/back-button.component';
import { ModalComponent } from '../../../../shared/components/modal/modal.component';
@@ -26,7 +26,7 @@ describe('OsdReweightModalComponent', () => {
SubmitButtonComponent,
BackButtonComponent
],
- providers: [OsdService, NgbActiveModal, CdFormBuilder, i18nProviders]
+ providers: [OsdService, NgbActiveModal, CdFormBuilder]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts
index a20df3bb3a2..a2c2b1c8794 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.spec.ts
@@ -4,7 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { OsdService } from '../../../../shared/api/osd.service';
import { JoinPipe } from '../../../../shared/pipes/join.pipe';
import { NotificationService } from '../../../../shared/services/notification.service';
@@ -34,8 +34,7 @@ describe('OsdScrubModalComponent', () => {
NgbActiveModal,
JoinPipe,
{ provide: OsdService, useValue: fakeService },
- { provide: NotificationService, useValue: fakeService },
- i18nProviders
+ { provide: NotificationService, useValue: fakeService }
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts
index c23fb500537..e7306bfa66a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { forkJoin } from 'rxjs';
import { OsdService } from '../../../../shared/api/osd.service';
@@ -24,7 +23,6 @@ export class OsdScrubModalComponent implements OnInit {
public activeModal: NgbActiveModal,
private osdService: OsdService,
private notificationService: NotificationService,
- private i18n: I18n,
private joinPipe: JoinPipe
) {}
@@ -39,10 +37,9 @@ export class OsdScrubModalComponent implements OnInit {
this.notificationService.show(
NotificationType.success,
- this.i18n('{{operation}} was initialized in the following OSD(s): {{id}}', {
- operation: operation,
- id: this.joinPipe.transform(this.selected)
- })
+ $localize`${operation} was initialized in the following OSD(s): ${this.joinPipe.transform(
+ this.selected
+ )}`
);
this.activeModal.close();
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts
index c551d599bb2..558473d2204 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper';
import { CoreModule } from '../../../../core/core.module';
import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../../shared/shared.module';
@@ -35,9 +31,7 @@ describe('ActiveAlertListComponent', () => {
DashboardModule,
CephModule,
CoreModule
- ],
- declarations: [],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts
index bcd1f006aa0..7c0e437d7a2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/active-alert-list/active-alert-list.component.ts
@@ -1,7 +1,5 @@
import { Component, Inject, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { PrometheusService } from '../../../../shared/api/prometheus.service';
import { CellTemplate } from '../../../../shared/enum/cell-template.enum';
import { Icons } from '../../../../shared/enum/icons.enum';
@@ -44,7 +42,6 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On
private authStorageService: AuthStorageService,
public prometheusAlertService: PrometheusAlertService,
private urlBuilder: URLBuilderService,
- private i18n: I18n,
private cdDatePipe: CdDatePipe,
@Inject(PrometheusService) prometheusService: PrometheusService,
@Inject(SummaryService) summaryService: SummaryService,
@@ -61,7 +58,7 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On
icon: Icons.add,
routerLink: () =>
'/monitoring' + this.urlBuilder.getCreateFrom(this.selection.first().fingerprint),
- name: this.i18n('Create Silence')
+ name: $localize`Create Silence`
}
];
}
@@ -70,31 +67,31 @@ export class ActiveAlertListComponent extends PrometheusListHelper implements On
super.ngOnInit();
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'labels.alertname',
flexGrow: 2
},
{
- name: this.i18n('Job'),
+ name: $localize`Job`,
prop: 'labels.job',
flexGrow: 2
},
{
- name: this.i18n('Severity'),
+ name: $localize`Severity`,
prop: 'labels.severity'
},
{
- name: this.i18n('State'),
+ name: $localize`State`,
prop: 'status.state',
cellTransformation: CellTemplate.classAdding
},
{
- name: this.i18n('Started'),
+ name: $localize`Started`,
prop: 'startsAt',
pipe: this.cdDatePipe
},
{
- name: this.i18n('URL'),
+ name: $localize`URL`,
prop: 'generatorURL',
sortable: false,
cellTemplate: this.externalLinkTpl
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts
index 1c1c53486aa..5f1b294f2dd 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { PrometheusService } from '../../../../shared/api/prometheus.service';
import { SettingsService } from '../../../../shared/api/settings.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -25,7 +25,7 @@ describe('RulesListComponent', () => {
RouterTestingModule,
ToastrModule.forRoot()
],
- providers: [PrometheusService, SettingsService, i18nProviders]
+ providers: [PrometheusService, SettingsService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts
index 809d7703df8..e98aaabe74c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/rules-list/rules-list.component.ts
@@ -1,7 +1,5 @@
import { Component, Inject, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { PrometheusService } from '../../../../shared/api/prometheus.service';
import { CdTableColumn } from '../../../../shared/models/cd-table-column';
import { PrometheusRule } from '../../../../shared/models/prometheus-alerts';
@@ -28,7 +26,6 @@ export class RulesListComponent extends PrometheusListHelper implements OnInit {
hideKeys = ['alerts', 'type'];
constructor(
- private i18n: I18n,
public prometheusAlertService: PrometheusAlertService,
@Inject(PrometheusService) prometheusService: PrometheusService,
@Inject(SummaryService) summaryService: SummaryService,
@@ -40,12 +37,12 @@ export class RulesListComponent extends PrometheusListHelper implements OnInit {
ngOnInit() {
super.ngOnInit();
this.columns = [
- { prop: 'name', name: this.i18n('Name') },
- { prop: 'labels.severity', name: this.i18n('Severity') },
- { prop: 'group', name: this.i18n('Group') },
- { prop: 'duration', name: this.i18n('Duration'), pipe: new DurationPipe() },
- { prop: 'query', name: this.i18n('Query'), isHidden: true },
- { prop: 'annotations.description', name: this.i18n('Description') }
+ { prop: 'name', name: $localize`Name` },
+ { prop: 'labels.severity', name: $localize`Severity` },
+ { prop: 'group', name: $localize`Group` },
+ { prop: 'duration', name: $localize`Duration`, pipe: new DurationPipe() },
+ { prop: 'query', name: $localize`Query`, isHidden: true },
+ { prop: 'annotations.description', name: $localize`Description` }
];
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
index 365fcf1f74a..ee3d5e956e3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
@@ -14,7 +14,6 @@ import {
configureTestBed,
FixtureHelper,
FormHelper,
- i18nProviders,
PrometheusHelper
} from '../../../../../testing/unit-test-helper';
import { NotFoundComponent } from '../../../../core/not-found/not-found.component';
@@ -64,7 +63,6 @@ describe('SilenceFormComponent', () => {
ReactiveFormsModule
],
providers: [
- i18nProviders,
{
provide: ActivatedRoute,
useValue: { params: { subscribe: (fn: Function) => fn(params) } }
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts
index aa241505c85..0212ac0ebf2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.ts
@@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import * as moment from 'moment';
@@ -46,23 +45,23 @@ export class SilenceFormComponent {
id: string;
action: string;
- resource = this.i18n('silence');
+ resource = $localize`silence`;
matchers: AlertmanagerSilenceMatcher[] = [];
matcherMatch: AlertmanagerSilenceMatcherMatch = undefined;
matcherConfig = [
{
- tooltip: this.i18n('Attribute name'),
+ tooltip: $localize`Attribute name`,
icon: this.icons.paragraph,
attribute: 'name'
},
{
- tooltip: this.i18n('Value'),
+ tooltip: $localize`Value`,
icon: this.icons.terminal,
attribute: 'value'
},
{
- tooltip: this.i18n('Regular expression'),
+ tooltip: $localize`Regular expression`,
icon: this.icons.magic,
attribute: 'isRegex'
}
@@ -71,7 +70,6 @@ export class SilenceFormComponent {
datetimeFormat = 'YYYY-MM-DD HH:mm';
constructor(
- private i18n: I18n,
private router: Router,
private authStorageService: AuthStorageService,
private formBuilder: CdFormBuilder,
@@ -206,9 +204,7 @@ export class SilenceFormComponent {
this.rules = [];
this.notificationService.show(
NotificationType.info,
- this.i18n(
- 'Please add your Prometheus host to the dashboard configuration and refresh the page'
- ),
+ $localize`Please add your Prometheus host to the dashboard configuration and refresh the page`,
undefined,
undefined,
'Prometheus'
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
index c428f7ca4b4..a5e1a250bc6 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
@@ -7,11 +7,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper';
import { PrometheusService } from '../../../../shared/api/prometheus.service';
import { CriticalConfirmationModalComponent } from '../../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
import { TableActionsComponent } from '../../../../shared/datatable/table-actions/table-actions.component';
@@ -36,8 +32,7 @@ describe('SilenceListComponent', () => {
HttpClientTestingModule,
NgbNavModule
],
- declarations: [SilenceListComponent, PrometheusTabsComponent],
- providers: [i18nProviders]
+ declarations: [SilenceListComponent, PrometheusTabsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts
index daba3e2a8d6..af48f5fdba6 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts
@@ -1,7 +1,6 @@
import { Component, Inject } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { SortDirection, SortPropDir } from '@swimlane/ngx-datatable';
import { Observable, Subscriber } from 'rxjs';
@@ -52,7 +51,6 @@ export class SilenceListComponent extends PrometheusListHelper {
constructor(
private authStorageService: AuthStorageService,
- private i18n: I18n,
private cdDatePipe: CdDatePipe,
private modalService: ModalService,
private notificationService: NotificationService,
@@ -116,32 +114,32 @@ export class SilenceListComponent extends PrometheusListHelper {
];
this.columns = [
{
- name: this.i18n('ID'),
+ name: $localize`ID`,
prop: 'id',
flexGrow: 3
},
{
- name: this.i18n('Created by'),
+ name: $localize`Created by`,
prop: 'createdBy',
flexGrow: 2
},
{
- name: this.i18n('Started'),
+ name: $localize`Started`,
prop: 'startsAt',
pipe: this.cdDatePipe
},
{
- name: this.i18n('Updated'),
+ name: $localize`Updated`,
prop: 'updatedAt',
pipe: this.cdDatePipe
},
{
- name: this.i18n('Ends'),
+ name: $localize`Ends`,
prop: 'endsAt',
pipe: this.cdDatePipe
},
{
- name: this.i18n('Status'),
+ name: $localize`Status`,
prop: 'status.state',
cellTransformation: CellTemplate.classAdding
}
@@ -167,7 +165,7 @@ export class SilenceListComponent extends PrometheusListHelper {
expireSilence() {
const id = this.selection.first().id;
- const i18nSilence = this.i18n('Silence');
+ const i18nSilence = $localize`Silence`;
const applicationName = 'Prometheus';
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
itemDescription: i18nSilence,
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts
index 08d408fbac1..c888fb5bb60 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts
@@ -11,7 +11,6 @@ import {
configureTestBed,
FixtureHelper,
FormHelper,
- i18nProviders,
PrometheusHelper
} from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
@@ -34,7 +33,7 @@ describe('SilenceMatcherModalComponent', () => {
RouterTestingModule,
ReactiveFormsModule
],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts
index 20683f0d284..23fe0950889 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts
@@ -4,7 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import * as _ from 'lodash';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { CoreModule } from '../../../../core/core.module';
import { CephServiceService } from '../../../../shared/api/ceph-service.service';
import { HostService } from '../../../../shared/api/host.service';
@@ -77,9 +77,7 @@ describe('ServiceDaemonListComponent', () => {
};
configureTestBed({
- imports: [HttpClientTestingModule, CephModule, CoreModule, SharedModule],
- declarations: [],
- providers: [i18nProviders]
+ imports: [HttpClientTestingModule, CephModule, CoreModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts
index e2758013297..16c23f3b579 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts
@@ -11,7 +11,6 @@ import {
ViewChildren
} from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Observable, Subscription } from 'rxjs';
@@ -51,7 +50,6 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
private daemonsTableTplsSub: Subscription;
constructor(
- private i18n: I18n,
private hostService: HostService,
private cephServiceService: CephServiceService,
private orchService: OrchestratorService
@@ -60,25 +58,25 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
ngOnInit() {
this.columns = [
{
- name: this.i18n('Hostname'),
+ name: $localize`Hostname`,
prop: 'hostname',
flexGrow: 1,
filterable: true
},
{
- name: this.i18n('Daemon type'),
+ name: $localize`Daemon type`,
prop: 'daemon_type',
flexGrow: 1,
filterable: true
},
{
- name: this.i18n('Daemon ID'),
+ name: $localize`Daemon ID`,
prop: 'daemon_id',
flexGrow: 1,
filterable: true
},
{
- name: this.i18n('Container ID'),
+ name: $localize`Container ID`,
prop: 'container_id',
flexGrow: 3,
filterable: true,
@@ -88,13 +86,13 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
}
},
{
- name: this.i18n('Container Image name'),
+ name: $localize`Container Image name`,
prop: 'container_image_name',
flexGrow: 3,
filterable: true
},
{
- name: this.i18n('Container Image ID'),
+ name: $localize`Container Image ID`,
prop: 'container_image_id',
flexGrow: 3,
filterable: true,
@@ -104,20 +102,20 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
}
},
{
- name: this.i18n('Version'),
+ name: $localize`Version`,
prop: 'version',
flexGrow: 1,
filterable: true
},
{
- name: this.i18n('Status'),
+ name: $localize`Status`,
prop: 'status_desc',
flexGrow: 1,
filterable: true,
cellTemplate: this.statusTpl
},
{
- name: this.i18n('Last Refreshed'),
+ name: $localize`Last Refreshed`,
prop: 'last_refresh',
flexGrow: 2
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts
index 1faa2bed845..ea65965a85c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-details/service-details.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
import { SummaryService } from '../../../../shared/services/summary.service';
import { SharedModule } from '../../../../shared/shared.module';
@@ -18,15 +18,7 @@ describe('ServiceDetailsComponent', () => {
configureTestBed({
imports: [HttpClientTestingModule, RouterTestingModule, SharedModule, NgbNavModule],
declarations: [ServiceDetailsComponent, ServiceDaemonListComponent],
- providers: [
- i18nProviders,
- {
- provide: SummaryService,
- useValue: {
- subscribeOnce: jest.fn()
- }
- }
- ]
+ providers: [{ provide: SummaryService, useValue: { subscribeOnce: jest.fn() } }]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts
index 6a2f4d34377..b007f1ee097 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CoreModule } from '../../../core/core.module';
import { CephServiceService } from '../../../shared/api/ceph-service.service';
import { OrchestratorService } from '../../../shared/api/orchestrator.service';
@@ -60,8 +60,7 @@ describe('ServicesComponent', () => {
HttpClientTestingModule,
RouterTestingModule
],
- providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, i18nProviders],
- declarations: []
+ providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts
index 4f23794f244..4f83b0c944c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts
@@ -1,7 +1,5 @@
import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { CephServiceService } from '../../../shared/api/ceph-service.service';
import { OrchestratorService } from '../../../shared/api/orchestrator.service';
import { ListWithDetails } from '../../../shared/classes/list-with-details.class';
@@ -41,7 +39,6 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI
constructor(
private authStorageService: AuthStorageService,
- private i18n: I18n,
private orchService: OrchestratorService,
private cephServiceService: CephServiceService
) {
@@ -52,17 +49,17 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI
ngOnInit() {
const columns = [
{
- name: this.i18n('Service'),
+ name: $localize`Service`,
prop: 'service_name',
flexGrow: 1
},
{
- name: this.i18n('Container image name'),
+ name: $localize`Container image name`,
prop: 'status.container_image_name',
flexGrow: 3
},
{
- name: this.i18n('Container image ID'),
+ name: $localize`Container image ID`,
prop: 'status.container_image_id',
flexGrow: 3,
cellTransformation: CellTemplate.truncate,
@@ -71,19 +68,19 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI
}
},
{
- name: this.i18n('Running'),
+ name: $localize`Running`,
prop: 'status.running',
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
- name: this.i18n('Size'),
+ name: $localize`Size`,
prop: 'status.size',
flexGrow: 1
},
{
- name: this.i18n('Last Refreshed'),
+ name: $localize`Last Refreshed`,
prop: 'status.last_refresh',
flexGrow: 1
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts
index 0f0133512b0..5ffb046cf16 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.spec.ts
@@ -8,7 +8,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { MgrModuleService } from '../../../shared/api/mgr-module.service';
import { TelemetryService } from '../../../shared/api/telemetry.service';
import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component';
@@ -56,8 +56,7 @@ describe('TelemetryComponent', () => {
RouterTestingModule,
SharedModule,
ToastrModule.forRoot()
- ],
- providers: i18nProviders
+ ]
},
[LoadingPanelComponent]
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts
index 40c00795e36..2abbade4847 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { ValidatorFn, Validators } from '@angular/forms';
import { Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin as observableForkJoin } from 'rxjs';
@@ -50,7 +49,6 @@ export class TelemetryComponent extends CdForm implements OnInit {
private notificationService: NotificationService,
private router: Router,
private telemetryService: TelemetryService,
- private i18n: I18n,
private textToDownloadService: TextToDownloadService,
private telemetryNotificationService: TelemetryNotificationService
) {
@@ -151,11 +149,9 @@ export class TelemetryComponent extends CdForm implements OnInit {
this.mgrModuleService.updateConfig('telemetry', config).subscribe(
() => {
this.disableModule(
- this.i18n(
- `Your settings have been applied successfully. \
-Due to privacy/legal reasons the Telemetry module is now disabled until you \
-complete the next step and accept the license.`
- ),
+ $localize`Your settings have been applied successfully. \
+ Due to privacy/legal reasons the Telemetry module is now disabled until you \
+ complete the next step and accept the license.`,
() => {
this.getReport();
}
@@ -203,7 +199,7 @@ complete the next step and accept the license.`
this.telemetryNotificationService.setVisibility(false);
this.notificationService.show(
NotificationType.success,
- this.i18n('The Telemetry module has been configured and activated successfully.')
+ $localize`The Telemetry module has been configured and activated successfully.`
);
this.router.navigate(['']);
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
index 6728b41d3a1..24fa1b5b338 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
@@ -6,7 +6,7 @@ import { By } from '@angular/platform-browser';
import * as _ from 'lodash';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { HealthService } from '../../../shared/api/health.service';
import { Permissions } from '../../../shared/models/permissions';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -59,7 +59,6 @@ describe('HealthComponent', () => {
],
schemas: [NO_ERRORS_SCHEMA],
providers: [
- i18nProviders,
{ provide: AuthStorageService, useValue: fakeAuthStorageService },
PgCategoryService,
RefreshIntervalService
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts
index 6089f4faef3..8268d1320fe 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts
@@ -1,6 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
@@ -65,7 +64,6 @@ export class HealthComponent implements OnInit, OnDestroy {
constructor(
private healthService: HealthService,
- private i18n: I18n,
private authStorageService: AuthStorageService,
private pgCategoryService: PgCategoryService,
private featureToggles: FeatureTogglesService,
@@ -101,14 +99,14 @@ export class HealthComponent implements OnInit, OnDestroy {
this.healthData.client_perf.write_op_per_sec + this.healthData.client_perf.read_op_per_sec;
ratioLabels.push(
- `${this.i18n('Writes')} (${this.calcPercentage(
+ `${$localize`Writes`} (${this.calcPercentage(
this.healthData.client_perf.write_op_per_sec,
total
)}%)`
);
ratioData.push(this.healthData.client_perf.write_op_per_sec);
ratioLabels.push(
- `${this.i18n('Reads')} (${this.calcPercentage(
+ `${$localize`Reads`} (${this.calcPercentage(
this.healthData.client_perf.read_op_per_sec,
total
)}%)`
@@ -132,17 +130,17 @@ export class HealthComponent implements OnInit, OnDestroy {
chart.dataset[0].data = [data.df.stats.total_used_raw_bytes, data.df.stats.total_avail_bytes];
chart.labels = [
- `${this.dimlessBinary.transform(data.df.stats.total_used_raw_bytes)} ${this.i18n(
- 'Used'
- )} (${percentUsed}%)`,
- `${this.dimlessBinary.transform(
+ $localize`${this.dimlessBinary.transform(
+ data.df.stats.total_used_raw_bytes
+ )} Used (${percentUsed}%)`,
+ $localize`${this.dimlessBinary.transform(
data.df.stats.total_bytes - data.df.stats.total_used_raw_bytes
- )} ${this.i18n('Avail.')} (${percentAvailable}%)`
+ )} Avail. (${percentAvailable}%)`
];
chart.options.title.text = `${this.dimlessBinary.transform(
data.df.stats.total_bytes
- )} ${this.i18n('total')}`;
+ )} ${$localize`total`}`;
}
preparePgStatus(chart: Record<string, any>, data: Record<string, any>) {
@@ -164,10 +162,10 @@ export class HealthComponent implements OnInit, OnDestroy {
.map((categoryType) => categoryPgAmount[categoryType]);
chart.labels = [
- `${this.i18n('Clean')} (${this.calcPercentage(categoryPgAmount['clean'], totalPgs)}%)`,
- `${this.i18n('Working')} (${this.calcPercentage(categoryPgAmount['working'], totalPgs)}%)`,
- `${this.i18n('Warning')} (${this.calcPercentage(categoryPgAmount['warning'], totalPgs)}%)`,
- `${this.i18n('Unknown')} (${this.calcPercentage(categoryPgAmount['unknown'], totalPgs)}%)`
+ `${$localize`Clean`} (${this.calcPercentage(categoryPgAmount['clean'], totalPgs)}%)`,
+ `${$localize`Working`} (${this.calcPercentage(categoryPgAmount['working'], totalPgs)}%)`,
+ `${$localize`Warning`} (${this.calcPercentage(categoryPgAmount['warning'], totalPgs)}%)`,
+ `${$localize`Unknown`} (${this.calcPercentage(categoryPgAmount['unknown'], totalPgs)}%)`
];
}
@@ -180,16 +178,16 @@ export class HealthComponent implements OnInit, OnDestroy {
data.pg_info.object_stats.num_objects_unfound;
chart.labels = [
- `${this.i18n('Healthy')} (${this.calcPercentage(healthy, totalReplicas)}%)`,
- `${this.i18n('Misplaced')} (${this.calcPercentage(
+ `${$localize`Healthy`} (${this.calcPercentage(healthy, totalReplicas)}%)`,
+ `${$localize`Misplaced`} (${this.calcPercentage(
data.pg_info.object_stats.num_objects_misplaced,
totalReplicas
)}%)`,
- `${this.i18n('Degraded')} (${this.calcPercentage(
+ `${$localize`Degraded`} (${this.calcPercentage(
data.pg_info.object_stats.num_objects_degraded,
totalReplicas
)}%)`,
- `${this.i18n('Unfound')} (${this.calcPercentage(
+ `${$localize`Unfound`} (${this.calcPercentage(
data.pg_info.object_stats.num_objects_unfound,
totalReplicas
)}%)`
@@ -204,7 +202,7 @@ export class HealthComponent implements OnInit, OnDestroy {
chart.options.title.text = `${this.dimless.transform(
data.pg_info.object_stats.num_objects
- )} ${this.i18n('total')} (${this.dimless.transform(totalReplicas)} ${this.i18n('replicas')})`;
+ )} ${$localize`total`} (${this.dimless.transform(totalReplicas)} ${$localize`replicas`})`;
chart.options.maintainAspectRatio = window.innerWidth >= 375;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
index 32e05b04114..68d951bd01c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { MdsSummaryPipe } from './mds-summary.pipe';
describe('MdsSummaryPipe', () => {
let pipe: MdsSummaryPipe;
configureTestBed({
- providers: [MdsSummaryPipe, i18nProviders]
+ providers: [MdsSummaryPipe]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts
index 7bd1014d8de..68853cb0bee 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts
@@ -1,14 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'mdsSummary'
})
export class MdsSummaryPipe implements PipeTransform {
- constructor(private i18n: I18n) {}
-
transform(value: any): any {
if (!value) {
return '';
@@ -24,10 +21,10 @@ export class MdsSummaryPipe implements PipeTransform {
});
if (value.standbys && !value.filesystems) {
- contentLine1 = `${standbys} ${this.i18n('up')}`;
- contentLine2 = this.i18n('no filesystems');
+ contentLine1 = `${standbys} ${$localize`up`}`;
+ contentLine2 = $localize`no filesystems`;
} else if (value.filesystems.length === 0) {
- contentLine1 = this.i18n('no filesystems');
+ contentLine1 = $localize`no filesystems`;
} else {
_.each(value.filesystems, (fs) => {
_.each(fs.mdsmap.info, (mds) => {
@@ -39,24 +36,22 @@ export class MdsSummaryPipe implements PipeTransform {
});
});
- contentLine1 = `${active} ${this.i18n('active')}`;
- contentLine2 = `${standbys + standbyReplay} ${this.i18n('standby')}`;
+ contentLine1 = `${active} ${$localize`active`}`;
+ contentLine2 = `${standbys + standbyReplay} ${$localize`standby`}`;
}
const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', ');
const standbyTitleText = !standbyHoverText
? ''
- : `${this.i18n('standby daemons')}: ${standbyHoverText}`;
+ : `${$localize`standby daemons`}: ${standbyHoverText}`;
const fsLength = value.filesystems ? value.filesystems.length : 0;
const infoObject = fsLength > 0 ? value.filesystems[0].mdsmap.info : {};
const activeHoverText = Object.values(infoObject)
.map((info: any): string => info.name)
.join(', ');
- let activeTitleText = !activeHoverText
- ? ''
- : `${this.i18n('active daemon')}: ${activeHoverText}`;
+ let activeTitleText = !activeHoverText ? '' : `${$localize`active daemon`}: ${activeHoverText}`;
// There is always one standbyreplay to replace active daemon, if active one is down
if (!active && fsLength > 0) {
- activeTitleText = `${standbyReplay} ${this.i18n('standbyReplay')}`;
+ activeTitleText = `${standbyReplay} ${$localize`standbyReplay`}`;
}
const mgrSummary = [
{
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
index 84dea633592..a81530c54d8 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { MgrSummaryPipe } from './mgr-summary.pipe';
describe('MgrSummaryPipe', () => {
let pipe: MgrSummaryPipe;
configureTestBed({
- providers: [MgrSummaryPipe, i18nProviders]
+ providers: [MgrSummaryPipe]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts
index c99cd864635..286d5dd337f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts
@@ -1,23 +1,20 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'mgrSummary'
})
export class MgrSummaryPipe implements PipeTransform {
- constructor(private i18n: I18n) {}
-
transform(value: any): any {
if (!value) {
return '';
}
- let activeCount = this.i18n('n/a');
+ let activeCount = $localize`n/a`;
const activeTitleText = _.isUndefined(value.active_name)
? ''
- : `${this.i18n('active daemon')}: ${value.active_name}`;
+ : `${$localize`active daemon`}: ${value.active_name}`;
// There is always one standbyreplay to replace active daemon, if active one is down
if (activeTitleText.length > 0) {
activeCount = '1';
@@ -25,11 +22,11 @@ export class MgrSummaryPipe implements PipeTransform {
const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', ');
const standbyTitleText = !standbyHoverText
? ''
- : `${this.i18n('standby daemons')}: ${standbyHoverText}`;
+ : `${$localize`standby daemons`}: ${standbyHoverText}`;
const standbyCount = value.standbys.length;
const mgrSummary = [
{
- content: `${activeCount} ${this.i18n('active')}`,
+ content: `${activeCount} ${$localize`active`}`,
class: 'popover-info',
titleText: activeTitleText
}
@@ -41,7 +38,7 @@ export class MgrSummaryPipe implements PipeTransform {
titleText: ''
});
mgrSummary.push({
- content: `${standbyCount} ${this.i18n('standby')}`,
+ content: `${standbyCount} ${$localize`standby`}`,
class: 'popover-info',
titleText: standbyTitleText
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts
index 5d64cd6c91e..15374674190 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.spec.ts
@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { MonSummaryPipe } from './mon-summary.pipe';
describe('MonSummaryPipe', () => {
let pipe: MonSummaryPipe;
configureTestBed({
- providers: [MonSummaryPipe, i18nProviders]
+ providers: [MonSummaryPipe]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts
index 31339f52e29..399045d5de3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mon-summary.pipe.ts
@@ -1,21 +1,16 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
@Pipe({
name: 'monSummary'
})
export class MonSummaryPipe implements PipeTransform {
- constructor(private i18n: I18n) {}
-
transform(value: any): any {
if (!value) {
return '';
}
- const result = `${value.monmap.mons.length.toString()} (${this.i18n(
- 'quorum'
- )} ${value.quorum.join(', ')})`;
+ const result = $localize`${value.monmap.mons.length.toString()} (quorum \
+${value.quorum.join(', ')})`;
return result;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts
index 20914d52a55..13456e26343 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.spec.ts
@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { OsdSummaryPipe } from './osd-summary.pipe';
describe('OsdSummaryPipe', () => {
let pipe: OsdSummaryPipe;
configureTestBed({
- providers: [OsdSummaryPipe, i18nProviders]
+ providers: [OsdSummaryPipe]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts
index c007c313cf3..05fc7ad7f80 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/osd-summary.pipe.ts
@@ -1,14 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'osdSummary'
})
export class OsdSummaryPipe implements PipeTransform {
- constructor(private i18n: I18n) {}
-
transform(value: any): any {
if (!value) {
return '';
@@ -27,7 +24,7 @@ export class OsdSummaryPipe implements PipeTransform {
const osdSummary = [
{
- content: `${value.osds.length} ${this.i18n('total')}`,
+ content: `${value.osds.length} ${$localize`total`}`,
class: ''
}
];
@@ -36,7 +33,7 @@ export class OsdSummaryPipe implements PipeTransform {
class: 'card-text-line-break'
});
osdSummary.push({
- content: `${upCount} ${this.i18n('up')}, ${inCount} ${this.i18n('in')}`,
+ content: `${upCount} ${$localize`up`}, ${inCount} ${$localize`in`}`,
class: ''
});
@@ -48,9 +45,9 @@ export class OsdSummaryPipe implements PipeTransform {
class: 'card-text-line-break'
});
- const downText = downCount > 0 ? `${downCount} ${this.i18n('down')}` : '';
+ const downText = downCount > 0 ? `${downCount} ${$localize`down`}` : '';
const separator = downCount > 0 && outCount > 0 ? ', ' : '';
- const outText = outCount > 0 ? `${outCount} ${this.i18n('out')}` : '';
+ const outText = outCount > 0 ? `${outCount} ${$localize`out`}` : '';
osdSummary.push({
content: `${downText}${separator}${outText}`,
class: 'card-text-error'
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts
index bde06ba857b..cec861ba47f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.spec.ts
@@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { Nfs501Component } from './nfs-501.component';
@@ -12,8 +12,7 @@ describe('Nfs501Component', () => {
configureTestBed({
declarations: [Nfs501Component],
- imports: [HttpClientTestingModule, RouterTestingModule, SharedModule],
- providers: i18nProviders
+ imports: [HttpClientTestingModule, RouterTestingModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts
index 985b3b3f531..4654a5ca5c6 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.ts
@@ -1,8 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { SummaryService } from '../../../shared/services/summary.service';
@@ -13,14 +11,13 @@ import { SummaryService } from '../../../shared/services/summary.service';
})
export class Nfs501Component implements OnInit, OnDestroy {
docsUrl: string;
- message = this.i18n('The NFS Ganesha service is not configured.');
+ message = $localize`The NFS Ganesha service is not configured.`;
routeParamsSubscribe: any;
constructor(
private route: ActivatedRoute,
private summaryService: SummaryService,
- private cephReleaseNamePipe: CephReleaseNamePipe,
- private i18n: I18n
+ private cephReleaseNamePipe: CephReleaseNamePipe
) {}
ngOnInit() {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts
index 9b8f7da73e0..2411aa22eff 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts
@@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import * as _ from 'lodash';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { NfsDetailsComponent } from './nfs-details.component';
@@ -18,8 +18,7 @@ describe('NfsDetailsComponent', () => {
configureTestBed({
declarations: [NfsDetailsComponent],
- imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule],
- providers: i18nProviders
+ imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts
index c6a3ba0eca9..a7760400f09 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts
@@ -1,7 +1,5 @@
import { Component, Input, OnChanges } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { CdTableColumn } from '../../../shared/models/cd-table-column';
@Component({
@@ -19,20 +17,20 @@ export class NfsDetailsComponent implements OnChanges {
clientsColumns: CdTableColumn[];
clients: any[] = [];
- constructor(private i18n: I18n) {
+ constructor() {
this.clientsColumns = [
{
- name: this.i18n('Addresses'),
+ name: $localize`Addresses`,
prop: 'addresses',
flexGrow: 2
},
{
- name: this.i18n('Access Type'),
+ name: $localize`Access Type`,
prop: 'access_type',
flexGrow: 1
},
{
- name: this.i18n('Squash'),
+ name: $localize`Squash`,
prop: 'squash',
flexGrow: 1
}
@@ -46,25 +44,25 @@ export class NfsDetailsComponent implements OnChanges {
this.clients = this.selectedItem.clients;
this.data = {};
- this.data[this.i18n('Cluster')] = this.selectedItem.cluster_id;
- this.data[this.i18n('Daemons')] = this.selectedItem.daemons;
- this.data[this.i18n('NFS Protocol')] = this.selectedItem.protocols.map(
+ this.data[$localize`Cluster`] = this.selectedItem.cluster_id;
+ this.data[$localize`Daemons`] = this.selectedItem.daemons;
+ this.data[$localize`NFS Protocol`] = this.selectedItem.protocols.map(
(protocol: string) => 'NFSv' + protocol
);
- this.data[this.i18n('Pseudo')] = this.selectedItem.pseudo;
- this.data[this.i18n('Access Type')] = this.selectedItem.access_type;
- this.data[this.i18n('Squash')] = this.selectedItem.squash;
- this.data[this.i18n('Transport')] = this.selectedItem.transports;
- this.data[this.i18n('Path')] = this.selectedItem.path;
+ this.data[$localize`Pseudo`] = this.selectedItem.pseudo;
+ this.data[$localize`Access Type`] = this.selectedItem.access_type;
+ this.data[$localize`Squash`] = this.selectedItem.squash;
+ this.data[$localize`Transport`] = this.selectedItem.transports;
+ this.data[$localize`Path`] = this.selectedItem.path;
if (this.selectedItem.fsal.name === 'CEPH') {
- this.data[this.i18n('Storage Backend')] = this.i18n('CephFS');
- this.data[this.i18n('CephFS User')] = this.selectedItem.fsal.user_id;
- this.data[this.i18n('CephFS Filesystem')] = this.selectedItem.fsal.fs_name;
- this.data[this.i18n('Security Label')] = this.selectedItem.fsal.sec_label_xattr;
+ this.data[$localize`Storage Backend`] = $localize`CephFS`;
+ this.data[$localize`CephFS User`] = this.selectedItem.fsal.user_id;
+ this.data[$localize`CephFS Filesystem`] = this.selectedItem.fsal.fs_name;
+ this.data[$localize`Security Label`] = this.selectedItem.fsal.sec_label_xattr;
} else {
- this.data[this.i18n('Storage Backend')] = this.i18n('Object Gateway');
- this.data[this.i18n('Object Gateway User')] = this.selectedItem.fsal.rgw_user_id;
+ this.data[$localize`Storage Backend`] = $localize`Object Gateway`;
+ this.data[$localize`Object Gateway User`] = this.selectedItem.fsal.rgw_user_id;
}
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts
index 4fd4e2f1f08..e85e655626a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.spec.ts
@@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CdFormBuilder } from '../../../shared/forms/cd-form-builder';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
import { SharedModule } from '../../../shared/shared.module';
@@ -14,8 +14,7 @@ describe('NfsFormClientComponent', () => {
configureTestBed({
declarations: [NfsFormClientComponent],
- imports: [ReactiveFormsModule, SharedModule, HttpClientTestingModule],
- providers: i18nProviders
+ imports: [ReactiveFormsModule, SharedModule, HttpClientTestingModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts
index 6415b1f80d9..3ed39cff7c2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts
@@ -1,7 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormArray, FormControl, NgForm, Validators } from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { NfsService } from '../../../shared/api/nfs.service';
@@ -24,7 +23,7 @@ export class NfsFormClientComponent implements OnInit {
nfsAccessType: any[] = this.nfsService.nfsAccessType;
icons = Icons;
- constructor(private nfsService: NfsService, private i18n: I18n) {}
+ constructor(private nfsService: NfsService) {}
ngOnInit() {
_.forEach(this.clients, (client) => {
@@ -35,9 +34,9 @@ export class NfsFormClientComponent implements OnInit {
getNoAccessTypeDescr() {
if (this.form.getValue('access_type')) {
- return `${this.form.getValue('access_type')} ${this.i18n('(inherited from global config)')}`;
+ return `${this.form.getValue('access_type')} ${$localize`(inherited from global config)`}`;
}
- return this.i18n('-- Select the access type --');
+ return $localize`-- Select the access type --`;
}
getAccessTypeHelp(index: number) {
@@ -49,9 +48,9 @@ export class NfsFormClientComponent implements OnInit {
getNoSquashDescr() {
if (this.form.getValue('squash')) {
- return `${this.form.getValue('squash')} (${this.i18n('inherited from global config')})`;
+ return `${this.form.getValue('squash')} (${$localize`inherited from global config`})`;
}
- return this.i18n('-- Select what kind of user id squashing is performed --');
+ return $localize`-- Select what kind of user id squashing is performed --`;
}
addClient() {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
index ee424ae51b1..f17ee20a3de 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
@@ -9,7 +9,7 @@ import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component';
import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { SummaryService } from '../../../shared/services/summary.service';
@@ -39,7 +39,6 @@ describe('NfsFormComponent', () => {
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ cluster_id: undefined, export_id: undefined })
},
- i18nProviders,
SummaryService,
CephReleaseNamePipe
]
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
index 8744ff51cdf..4a62907fbec 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
@@ -2,7 +2,6 @@ import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin, Observable, of } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, mergeMap } from 'rxjs/operators';
@@ -65,10 +64,7 @@ export class NfsFormComponent extends CdForm implements OnInit {
docsUrl: string;
daemonsSelections: SelectOption[] = [];
- daemonsMessages = new SelectMessages(
- { noOptions: this.i18n('There are no daemons available.') },
- this.i18n
- );
+ daemonsMessages = new SelectMessages({ noOptions: $localize`There are no daemons available.` });
pathDataSource = (text$: Observable<string>) => {
return text$.pipe(
@@ -98,12 +94,11 @@ export class NfsFormComponent extends CdForm implements OnInit {
private cephReleaseNamePipe: CephReleaseNamePipe,
private taskWrapper: TaskWrapperService,
private cdRef: ChangeDetectorRef,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
this.permission = this.authStorageService.getPermissions().pool;
- this.resource = this.i18n('NFS export');
+ this.resource = $localize`NFS export`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
index 046e2789c5f..1748b725582 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
@@ -10,7 +10,6 @@ import { of } from 'rxjs';
import {
configureTestBed,
expectItemTasks,
- i18nProviders,
PermissionHelper
} from '../../../../testing/unit-test-helper';
import { NfsService } from '../../../shared/api/nfs.service';
@@ -44,7 +43,7 @@ describe('NfsListComponent', () => {
NgbNavModule,
ToastrModule.forRoot()
],
- providers: [TaskListService, i18nProviders]
+ providers: [TaskListService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts
index cf3994f0cac..6cebd9f1ebe 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnDestroy, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
@@ -62,7 +61,6 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr
constructor(
private authStorageService: AuthStorageService,
- private i18n: I18n,
private modalService: ModalService,
private nfsService: NfsService,
private taskListService: TaskListService,
@@ -105,34 +103,34 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr
ngOnInit() {
this.columns = [
{
- name: this.i18n('Path'),
+ name: $localize`Path`,
prop: 'path',
flexGrow: 2,
cellTransformation: CellTemplate.executing
},
{
- name: this.i18n('Pseudo'),
+ name: $localize`Pseudo`,
prop: 'pseudo',
flexGrow: 2
},
{
- name: this.i18n('Cluster'),
+ name: $localize`Cluster`,
prop: 'cluster_id',
flexGrow: 2
},
{
- name: this.i18n('Daemons'),
+ name: $localize`Daemons`,
prop: 'daemons',
flexGrow: 2
},
{
- name: this.i18n('Storage Backend'),
+ name: $localize`Storage Backend`,
prop: 'fsal',
flexGrow: 2,
cellTemplate: this.nfsFsal
},
{
- name: this.i18n('Access Type'),
+ name: $localize`Access Type`,
prop: 'access_type',
flexGrow: 2
}
@@ -209,7 +207,7 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr
const export_id = this.selection.first().export_id;
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.i18n('NFS export'),
+ itemDescription: $localize`NFS export`,
itemNames: [`${cluster_id}:${export_id}`],
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts
index ed553e1b407..3f3affe6858 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts
@@ -3,7 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { TablePerformanceCounterComponent } from '../table-performance-counter/table-performance-counter.component';
import { PerformanceCounterComponent } from './performance-counter.component';
@@ -14,8 +14,7 @@ describe('PerformanceCounterComponent', () => {
configureTestBed({
declarations: [PerformanceCounterComponent, TablePerformanceCounterComponent],
- imports: [RouterTestingModule, SharedModule, HttpClientTestingModule, BrowserAnimationsModule],
- providers: i18nProviders
+ imports: [RouterTestingModule, SharedModule, HttpClientTestingModule, BrowserAnimationsModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
index ae369f28281..4ca483cf671 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { AppModule } from '../../../app.module';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
import { TablePerformanceCounterComponent } from './table-performance-counter.component';
@@ -12,8 +12,7 @@ describe('TablePerformanceCounterComponent', () => {
let httpTesting: HttpTestingController;
configureTestBed({
- imports: [AppModule, HttpClientTestingModule],
- providers: i18nProviders
+ imports: [AppModule, HttpClientTestingModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts
index ac6ea523576..0e069833697 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts
@@ -1,7 +1,5 @@
import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
@@ -33,22 +31,22 @@ export class TablePerformanceCounterComponent implements OnInit {
@Input()
serviceId: string;
- constructor(private performanceCounterService: PerformanceCounterService, private i18n: I18n) {}
+ constructor(private performanceCounterService: PerformanceCounterService) {}
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 1
},
{
- name: this.i18n('Description'),
+ name: $localize`Description`,
prop: 'description',
flexGrow: 1
},
{
- name: this.i18n('Value'),
+ name: $localize`Value`,
prop: 'value',
cellTemplate: this.valueTpl,
flexGrow: 1
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts
index 62bdbebc367..2ecdfe9b5d2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.spec.ts
@@ -11,7 +11,6 @@ import {
configureTestBed,
FixtureHelper,
FormHelper,
- i18nProviders,
Mocks
} from '../../../../testing/unit-test-helper';
import { CrushRuleService } from '../../../shared/api/crush-rule.service';
@@ -79,7 +78,7 @@ describe('CrushRuleFormComponent', () => {
PoolModule,
NgBootstrapFormValidationModule.forRoot()
],
- providers: [CrushRuleService, NgbActiveModal, i18nProviders]
+ providers: [CrushRuleService, NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts
index dcf60e4cd88..be4f85e0290 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/crush-rule-form-modal/crush-rule-form-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CrushRuleService } from '../../../shared/api/crush-rule.service';
@@ -36,12 +35,11 @@ export class CrushRuleFormModalComponent extends CrushNodeSelectionClass impleme
public activeModal: NgbActiveModal,
private taskWrapper: TaskWrapperService,
private crushRuleService: CrushRuleService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
this.action = this.actionLabels.CREATE;
- this.resource = this.i18n('Crush Rule');
+ this.resource = $localize`Crush Rule`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts
index 7499a3148cd..1ea007a1e32 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.spec.ts
@@ -12,7 +12,6 @@ import {
configureTestBed,
FixtureHelper,
FormHelper,
- i18nProviders,
Mocks
} from '../../../../testing/unit-test-helper';
import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service';
@@ -37,7 +36,7 @@ describe('ErasureCodeProfileFormModalComponent', () => {
PoolModule,
NgBootstrapFormValidationModule.forRoot()
],
- providers: [ErasureCodeProfileService, NgbActiveModal, i18nProviders]
+ providers: [ErasureCodeProfileService, NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts
index 814b1696fe0..4cda73509f5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service';
import { CrushNodeSelectionClass } from '../../../shared/classes/crush.node.selection.class';
@@ -48,12 +47,11 @@ export class ErasureCodeProfileFormModalComponent extends CrushNodeSelectionClas
public activeModal: NgbActiveModal,
private taskWrapper: TaskWrapperService,
private ecpService: ErasureCodeProfileService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
this.action = this.actionLabels.CREATE;
- this.resource = this.i18n('EC Profile');
+ this.resource = $localize`EC Profile`;
this.createForm();
this.setJerasureDefaults();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts
index 9bb3f2422df..188f65d7905 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper';
import { Permissions } from '../../../shared/models/permissions';
import { SharedModule } from '../../../shared/shared.module';
import { RbdConfigurationListComponent } from '../../block/rbd-configuration-list/rbd-configuration-list.component';
@@ -23,8 +23,7 @@ describe('PoolDetailsComponent', () => {
HttpClientTestingModule,
RouterTestingModule
],
- declarations: [PoolDetailsComponent, RbdConfigurationListComponent],
- providers: [i18nProviders]
+ declarations: [PoolDetailsComponent, RbdConfigurationListComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
index bf517a84dcc..74242d9ec2a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { PoolService } from '../../../shared/api/pool.service';
@@ -24,36 +23,36 @@ export class PoolDetailsComponent implements OnChanges {
cacheTiers: any[];
selectedPoolConfiguration: RbdConfigurationEntry[];
- constructor(private i18n: I18n, private poolService: PoolService) {
+ constructor(private poolService: PoolService) {
this.cacheTierColumns = [
{
prop: 'pool_name',
- name: this.i18n('Name'),
+ name: $localize`Name`,
flexGrow: 3
},
{
prop: 'cache_mode',
- name: this.i18n('Cache Mode'),
+ name: $localize`Cache Mode`,
flexGrow: 2
},
{
prop: 'cache_min_evict_age',
- name: this.i18n('Min Evict Age'),
+ name: $localize`Min Evict Age`,
flexGrow: 2
},
{
prop: 'cache_min_flush_age',
- name: this.i18n('Min Flush Age'),
+ name: $localize`Min Flush Age`,
flexGrow: 2
},
{
prop: 'target_max_bytes',
- name: this.i18n('Target Max Bytes'),
+ name: $localize`Target Max Bytes`,
flexGrow: 2
},
{
prop: 'target_max_objects',
- name: this.i18n('Target Max Objects'),
+ name: $localize`Target Max Objects`,
flexGrow: 2
}
];
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts
index 88d5664d6b6..c0cd2438672 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts
@@ -1,7 +1,5 @@
import { Validators } from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { SelectMessages } from '../../../shared/components/select/select-messages.model';
import { Pool } from '../pool';
@@ -11,29 +9,26 @@ export class PoolFormData {
crushInfo = false;
applications: any;
- constructor(i18n: I18n) {
+ constructor() {
this.poolTypes = ['erasure', 'replicated'];
this.applications = {
selected: [],
default: ['cephfs', 'rbd', 'rgw'],
available: [], // Filled during runtime
validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)],
- messages: new SelectMessages(
- {
- empty: i18n('No applications added'),
- selectionLimit: {
- text: i18n('Applications limit reached'),
- tooltip: i18n('A pool can only have up to four applications definitions.')
- },
- customValidations: {
- pattern: i18n(`Allowed characters '_a-zA-Z0-9'`),
- maxlength: i18n('Maximum length is 128 characters')
- },
- filter: i18n('Filter or add applications'),
- add: i18n('Add application')
+ messages: new SelectMessages({
+ empty: $localize`No applications added`,
+ selectionLimit: {
+ text: $localize`Applications limit reached`,
+ tooltip: $localize`A pool can only have up to four applications definitions.`
+ },
+ customValidations: {
+ pattern: $localize`Allowed characters '_a-zA-Z0-9'`,
+ maxlength: $localize`Maximum length is 128 characters`
},
- i18n
- )
+ filter: $localize`Filter or add applications'`,
+ add: $localize`Add application`
+ })
};
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
index af8999a807c..0ca5df70d8c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
@@ -21,7 +21,6 @@ import {
configureTestBed,
FixtureHelper,
FormHelper,
- i18nProviders,
Mocks,
modalServiceShow
} from '../../../../testing/unit-test-helper';
@@ -152,8 +151,7 @@ describe('PoolFormComponent', () => {
ErasureCodeProfileService,
NgbActiveModal,
SelectBadgesComponent,
- { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } },
- i18nProviders
+ { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } }
]
},
[CriticalConfirmationModalComponent]
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
index f57b70a1231..7691b5e494b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
@@ -3,7 +3,6 @@ import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbNav, NgbTooltip } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Observable, Subscription } from 'rxjs';
@@ -66,7 +65,7 @@ export class PoolFormComponent extends CdForm implements OnInit {
editing = false;
isReplicated = false;
isErasure = false;
- data = new PoolFormData(this.i18n);
+ data = new PoolFormData();
externalPgChange = false;
current: Record<string, any> = {
rules: []
@@ -96,13 +95,12 @@ export class PoolFormComponent extends CdForm implements OnInit {
private taskWrapper: TaskWrapperService,
private ecpService: ErasureCodeProfileService,
private crushRuleService: CrushRuleService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
this.editing = this.router.url.startsWith(`/pool/${URLVerbs.EDIT}`);
this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
- this.resource = this.i18n('pool');
+ this.resource = $localize`pool`;
this.authenticate();
this.createForm();
}
@@ -632,7 +630,7 @@ export class PoolFormComponent extends CdForm implements OnInit {
getTabs: () => this.ecpInfoTabs,
tabPosition: 'used-by-pools',
nameAttribute: 'name',
- itemDescription: this.i18n('erasure code profile'),
+ itemDescription: $localize`erasure code profile`,
reloadFn: () => this.reloadECPs(),
deleteFn: (name) => this.ecpService.delete(name),
taskName: 'ecp/delete'
@@ -720,7 +718,7 @@ export class PoolFormComponent extends CdForm implements OnInit {
getTabs: () => this.crushInfoTabs,
tabPosition: 'used-by-pools',
nameAttribute: 'rule_name',
- itemDescription: this.i18n('crush rule'),
+ itemDescription: $localize`crush rule`,
reloadFn: () => this.reloadCrushRules(),
deleteFn: (name) => this.crushRuleService.delete(name),
taskName: 'crushRule/delete'
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
index 048802fc1af..1dbd72afb2b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
@@ -8,11 +8,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import {
- configureTestBed,
- expectItemTasks,
- i18nProviders
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, expectItemTasks } from '../../../../testing/unit-test-helper';
import { ConfigurationService } from '../../../shared/api/configuration.service';
import { PoolService } from '../../../shared/api/pool.service';
import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -57,7 +53,7 @@ describe('PoolListComponent', () => {
NgbNavModule,
HttpClientTestingModule
],
- providers: [i18nProviders, PgCategoryService]
+ providers: [PgCategoryService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts
index ede82bb58cc..eae76ef70c7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ConfigurationService } from '../../../shared/api/configuration.service';
@@ -66,7 +65,6 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
private authStorageService: AuthStorageService,
private taskListService: TaskListService,
private modalService: ModalService,
- private i18n: I18n,
private pgCategoryService: PgCategoryService,
private dimlessPipe: DimlessPipe,
private urlBuilder: URLBuilderService,
@@ -119,23 +117,23 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
this.columns = [
{
prop: 'pool_name',
- name: this.i18n('Name'),
+ name: $localize`Name`,
flexGrow: 4,
cellTransformation: CellTemplate.executing
},
{
prop: 'type',
- name: this.i18n('Type'),
+ name: $localize`Type`,
flexGrow: 2
},
{
prop: 'application_metadata',
- name: this.i18n('Applications'),
+ name: $localize`Applications`,
flexGrow: 3
},
{
prop: 'pg_status',
- name: this.i18n('PG Status'),
+ name: $localize`PG Status`,
flexGrow: 3,
cellClass: ({ row, column, value }): any => {
return this.getPgStatusCellClass(row, column, value);
@@ -143,35 +141,35 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
},
{
prop: 'size',
- name: this.i18n('Replica Size'),
+ name: $localize`Replica Size`,
flexGrow: 2,
cellClass: 'text-right'
},
{
prop: 'last_change',
- name: this.i18n('Last Change'),
+ name: $localize`Last Change`,
flexGrow: 2,
cellClass: 'text-right'
},
{
prop: 'erasure_code_profile',
- name: this.i18n('Erasure Coded Profile'),
+ name: $localize`Erasure Coded Profile`,
flexGrow: 2
},
{
prop: 'crush_rule',
- name: this.i18n('Crush Ruleset'),
+ name: $localize`Crush Ruleset`,
flexGrow: 3
},
{
- name: this.i18n('Usage'),
+ name: $localize`Usage`,
prop: 'usage',
cellTemplate: this.poolUsageTpl,
flexGrow: 3
},
{
prop: 'stats.rd_bytes.rates',
- name: this.i18n('Read bytes'),
+ name: $localize`Read bytes`,
comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) =>
compare('stats.rd_bytes.latest', rowA, rowB),
cellTransformation: CellTemplate.sparkline,
@@ -179,7 +177,7 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
},
{
prop: 'stats.wr_bytes.rates',
- name: this.i18n('Write bytes'),
+ name: $localize`Write bytes`,
comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) =>
compare('stats.wr_bytes.latest', rowA, rowB),
cellTransformation: CellTemplate.sparkline,
@@ -187,14 +185,14 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
},
{
prop: 'stats.rd.rate',
- name: this.i18n('Read ops'),
+ name: $localize`Read ops`,
flexGrow: 1,
pipe: this.dimlessPipe,
cellTransformation: CellTemplate.perSecond
},
{
prop: 'stats.wr.rate',
- name: this.i18n('Write ops'),
+ name: $localize`Write ops`,
flexGrow: 1,
pipe: this.dimlessPipe,
cellTransformation: CellTemplate.perSecond
@@ -295,9 +293,7 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
getDisableDesc(): string | undefined {
if (!this.monAllowPoolDelete) {
- return this.i18n(
- 'Pool deletion is disabled by the mon_allow_pool_delete configuration setting.'
- );
+ return $localize`Pool deletion is disabled by the mon_allow_pool_delete configuration setting.`;
}
return undefined;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts
index 565caab1563..75941b9e30b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.spec.ts
@@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { Rgw501Component } from './rgw-501.component';
@@ -12,8 +12,7 @@ describe('Rgw501Component', () => {
configureTestBed({
declarations: [Rgw501Component],
- imports: [HttpClientTestingModule, RouterTestingModule, SharedModule],
- providers: i18nProviders
+ imports: [HttpClientTestingModule, RouterTestingModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts
index 68799f5ee36..60f2c67fa90 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-details/rgw-bucket-details.component.spec.ts
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { SharedModule } from '../../../shared/shared.module';
import { RgwBucketDetailsComponent } from './rgw-bucket-details.component';
@@ -11,8 +11,7 @@ describe('RgwBucketDetailsComponent', () => {
configureTestBed({
declarations: [RgwBucketDetailsComponent],
- imports: [SharedModule],
- providers: [i18nProviders]
+ imports: [SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts
index acaecac88ba..5a9e3e221ad 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts
@@ -8,7 +8,7 @@ import * as _ from 'lodash';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { RgwBucketService } from '../../../shared/api/rgw-bucket.service';
import { RgwSiteService } from '../../../shared/api/rgw-site.service';
import { RgwUserService } from '../../../shared/api/rgw-user.service';
@@ -36,8 +36,7 @@ describe('RgwBucketFormComponent', () => {
RouterTestingModule,
SharedModule,
ToastrModule.forRoot()
- ],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
@@ -204,7 +203,7 @@ describe('RgwBucketFormComponent', () => {
component.submit();
expect(notificationService.show).toHaveBeenCalledWith(
NotificationType.success,
- `Created Object Gateway bucket ''`
+ `Created Object Gateway bucket 'null'`
);
});
@@ -215,7 +214,7 @@ describe('RgwBucketFormComponent', () => {
component.submit();
expect(notificationService.show).toHaveBeenCalledWith(
NotificationType.success,
- `Updated Object Gateway bucket ''.`
+ `Updated Object Gateway bucket 'null'.`
);
});
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts
index 21531ed7344..484a2bf0a0f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { AbstractControl, AsyncValidatorFn, ValidationErrors, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin } from 'rxjs';
@@ -52,13 +51,12 @@ export class RgwBucketFormComponent extends CdForm implements OnInit {
private rgwSiteService: RgwSiteService,
private rgwUserService: RgwUserService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
this.editing = this.router.url.startsWith(`/rgw/bucket/${URLVerbs.EDIT}`);
this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
- this.resource = this.i18n('bucket');
+ this.resource = $localize`bucket`;
this.createForm();
}
@@ -114,7 +112,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit {
const placementTargets = data['getPlacementTargets'];
this.zonegroup = placementTargets['zonegroup'];
_.forEach(placementTargets['placement_targets'], (placementTarget) => {
- placementTarget['description'] = `${placementTarget['name']} (${this.i18n('pool')}: ${
+ placementTarget['description'] = `${placementTarget['name']} (${$localize`pool`}: ${
placementTarget['data_pool']
})`;
this.placementTargets.push(placementTarget);
@@ -189,7 +187,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated Object Gateway bucket '{{bid}}'.`, values)
+ $localize`Updated Object Gateway bucket '${values.bid}'.`
);
this.goToListView();
},
@@ -215,7 +213,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Created Object Gateway bucket '{{bid}}'`, values)
+ $localize`Created Object Gateway bucket '${values.bid}'`
);
this.goToListView();
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts
index b3ea48a0935..a41ff3c169d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
import { RgwBucketService } from '../../../shared/api/rgw-bucket.service';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
@@ -31,8 +27,7 @@ describe('RgwBucketListComponent', () => {
SharedModule,
NgbNavModule,
HttpClientTestingModule
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts
index aceaffe07ee..f35b19f8280 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts
@@ -7,7 +7,6 @@ import {
ViewChild
} from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
@@ -58,7 +57,6 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit {
private dimlessPipe: DimlessPipe,
private rgwBucketService: RgwBucketService,
private modalService: ModalService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
public actionLabels: ActionLabelsI18n,
private ngZone: NgZone,
@@ -96,35 +94,35 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'bid',
flexGrow: 2
},
{
- name: this.i18n('Owner'),
+ name: $localize`Owner`,
prop: 'owner',
flexGrow: 2.5
},
{
- name: this.i18n('Used Capacity'),
+ name: $localize`Used Capacity`,
prop: 'bucket_size',
flexGrow: 0.6,
pipe: this.dimlessBinaryPipe
},
{
- name: this.i18n('Capacity Limit %'),
+ name: $localize`Capacity Limit %`,
prop: 'size_usage',
cellTemplate: this.bucketSizeTpl,
flexGrow: 0.8
},
{
- name: this.i18n('Objects'),
+ name: $localize`Objects`,
prop: 'num_objects',
flexGrow: 0.6,
pipe: this.dimlessPipe
},
{
- name: this.i18n('Object Limit %'),
+ name: $localize`Object Limit %`,
prop: 'object_usage',
cellTemplate: this.bucketObjectTpl,
flexGrow: 0.8
@@ -183,9 +181,7 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit {
deleteAction() {
this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.selection.hasSingleSelection
- ? this.i18n('bucket')
- : this.i18n('buckets'),
+ itemDescription: this.selection.hasSingleSelection ? $localize`bucket` : $localize`buckets`,
itemNames: this.selection.selected.map((bucket: any) => bucket['bid']),
submitActionObservable: () => {
return new Observable((observer: Subscriber<any>) => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
index 8dce412135a..4ee44b72922 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper';
import { RgwSiteService } from '../../../shared/api/rgw-site.service';
import { Permissions } from '../../../shared/models/permissions';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -37,8 +37,7 @@ describe('RgwDaemonListComponent', () => {
PerformanceCounterModule,
SharedModule,
RouterTestingModule
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts
index 7a43cfeeadf..8d8be533a2d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts
@@ -1,7 +1,5 @@
import { Component, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
import { RgwSiteService } from '../../../shared/api/rgw-site.service';
import { ListWithDetails } from '../../../shared/classes/list-with-details.class';
@@ -26,7 +24,6 @@ export class RgwDaemonListComponent extends ListWithDetails implements OnInit {
private rgwDaemonService: RgwDaemonService,
private authStorageService: AuthStorageService,
private cephShortVersionPipe: CephShortVersionPipe,
- private i18n: I18n,
private rgwSiteService: RgwSiteService
) {
super();
@@ -36,17 +33,17 @@ export class RgwDaemonListComponent extends ListWithDetails implements OnInit {
this.grafanaPermission = this.authStorageService.getPermissions().grafana;
this.columns = [
{
- name: this.i18n('ID'),
+ name: $localize`ID`,
prop: 'id',
flexGrow: 2
},
{
- name: this.i18n('Hostname'),
+ name: $localize`Hostname`,
prop: 'server_hostname',
flexGrow: 2
},
{
- name: this.i18n('Version'),
+ name: $localize`Version`,
prop: 'version',
flexGrow: 1,
pipe: this.cephShortVersionPipe
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts
index 9c457bec9c4..3b92991f3d3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserCapabilityModalComponent } from './rgw-user-capability-modal.component';
@@ -15,7 +15,7 @@ describe('RgwUserCapabilityModalComponent', () => {
configureTestBed({
declarations: [RgwUserCapabilityModalComponent],
imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts
index cb4ca385545..3b1ce3fc81c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core';
import { Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -33,10 +32,9 @@ export class RgwUserCapabilityModalComponent {
constructor(
private formBuilder: CdFormBuilder,
public activeModal: NgbActiveModal,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
- this.resource = this.i18n('capability');
+ this.resource = $localize`capability`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts
index 9dcf79a3c03..4156a4ada20 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts
@@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders, TabHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, TabHelper } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserS3Key } from '../models/rgw-user-s3-key';
import { RgwUserDetailsComponent } from './rgw-user-details.component';
@@ -15,8 +15,7 @@ describe('RgwUserDetailsComponent', () => {
configureTestBed({
declarations: [RgwUserDetailsComponent],
- imports: [BrowserAnimationsModule, HttpClientTestingModule, SharedModule, NgbNavModule],
- providers: [i18nProviders]
+ imports: [BrowserAnimationsModule, HttpClientTestingModule, SharedModule, NgbNavModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts
index f2cd8faa18b..276950c8d6e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { RgwUserService } from '../../../shared/api/rgw-user.service';
@@ -38,28 +37,24 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit {
icons = Icons;
- constructor(
- private rgwUserService: RgwUserService,
- private modalService: ModalService,
- private i18n: I18n
- ) {}
+ constructor(private rgwUserService: RgwUserService, private modalService: ModalService) {}
ngOnInit() {
this.keysColumns = [
{
- name: this.i18n('Username'),
+ name: $localize`Username`,
prop: 'username',
flexGrow: 1
},
{
- name: this.i18n('Type'),
+ name: $localize`Type`,
prop: 'type',
flexGrow: 1
}
];
this.maxBucketsMap = {
- '-1': this.i18n('Disabled'),
- 0: this.i18n('Unlimited')
+ '-1': $localize`Disabled`,
+ 0: $localize`Unlimited`
};
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts
index c41e7384d28..f434aae26a5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts
@@ -8,7 +8,7 @@ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { RgwUserService } from '../../../shared/api/rgw-user.service';
import { NotificationType } from '../../../shared/enum/notification-type.enum';
import { NotificationService } from '../../../shared/services/notification.service';
@@ -33,8 +33,7 @@ describe('RgwUserFormComponent', () => {
SharedModule,
ToastrModule.forRoot(),
NgbTooltipModule
- ],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
@@ -295,7 +294,7 @@ describe('RgwUserFormComponent', () => {
component.onSubmit();
expect(notificationService.show).toHaveBeenCalledWith(
NotificationType.success,
- `Created Object Gateway user ''`
+ `Created Object Gateway user 'null'`
);
});
@@ -306,7 +305,7 @@ describe('RgwUserFormComponent', () => {
component.onSubmit();
expect(notificationService.show).toHaveBeenCalledWith(
NotificationType.success,
- `Updated Object Gateway user ''`
+ `Updated Object Gateway user 'null'`
);
});
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts
index 00a799f180f..8055daf029a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { AbstractControl, ValidationErrors, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { concat as observableConcat, forkJoin as observableForkJoin, Observable } from 'rxjs';
@@ -55,14 +54,13 @@ export class RgwUserFormComponent extends CdForm implements OnInit {
private rgwUserService: RgwUserService,
private modalService: ModalService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
- this.resource = this.i18n('user');
- this.subuserLabel = this.i18n('subuser');
- this.s3keyLabel = this.i18n('S3 Key');
- this.capabilityLabel = this.i18n('capability');
+ this.resource = $localize`user`;
+ this.subuserLabel = $localize`subuser`;
+ this.s3keyLabel = $localize`S3 Key`;
+ this.capabilityLabel = $localize`capability`;
this.createForm();
}
@@ -250,12 +248,12 @@ export class RgwUserFormComponent extends CdForm implements OnInit {
const args = this._getUpdateArgs();
this.submitObservables.push(this.rgwUserService.update(uid, args));
}
- notificationTitle = this.i18n(`Updated Object Gateway user '{{uid}}'`, { uid: uid });
+ notificationTitle = $localize`Updated Object Gateway user '${uid}'`;
} else {
// Add
const args = this._getCreateArgs();
this.submitObservables.push(this.rgwUserService.create(args));
- notificationTitle = this.i18n(`Created Object Gateway user '{{uid}}'`, { uid: uid });
+ notificationTitle = $localize`Created Object Gateway user '${uid}'`;
}
// Check if user quota has been modified.
if (this._isUserQuotaDirty()) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts
index a893a0db1fe..c037065e03c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.spec.ts
@@ -4,11 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserListComponent } from './rgw-user-list.component';
@@ -20,8 +16,7 @@ describe('RgwUserListComponent', () => {
configureTestBed({
declarations: [RgwUserListComponent],
imports: [BrowserAnimationsModule, RouterTestingModule, HttpClientTestingModule, SharedModule],
- schemas: [NO_ERRORS_SCHEMA],
- providers: i18nProviders
+ schemas: [NO_ERRORS_SCHEMA]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts
index 4bad8007d7d..d5ed7c17e84 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts
@@ -1,6 +1,5 @@
import { Component, NgZone, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
import { RgwUserService } from '../../../shared/api/rgw-user.service';
@@ -42,7 +41,6 @@ export class RgwUserListComponent extends ListWithDetails {
private authStorageService: AuthStorageService,
private rgwUserService: RgwUserService,
private modalService: ModalService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
public actionLabels: ActionLabelsI18n,
private ngZone: NgZone
@@ -51,35 +49,35 @@ export class RgwUserListComponent extends ListWithDetails {
this.permission = this.authStorageService.getPermissions().rgw;
this.columns = [
{
- name: this.i18n('Username'),
+ name: $localize`Username`,
prop: 'uid',
flexGrow: 1
},
{
- name: this.i18n('Full name'),
+ name: $localize`Full name`,
prop: 'display_name',
flexGrow: 1
},
{
- name: this.i18n('Email address'),
+ name: $localize`Email address`,
prop: 'email',
flexGrow: 1
},
{
- name: this.i18n('Suspended'),
+ name: $localize`Suspended`,
prop: 'suspended',
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
- name: this.i18n('Max. buckets'),
+ name: $localize`Max. buckets`,
prop: 'max_buckets',
flexGrow: 1,
cellTransformation: CellTemplate.map,
customTemplateConfig: {
- '-1': this.i18n('Disabled'),
- 0: this.i18n('Unlimited')
+ '-1': $localize`Disabled`,
+ 0: $localize`Unlimited`
}
}
];
@@ -140,7 +138,7 @@ export class RgwUserListComponent extends ListWithDetails {
deleteAction() {
this.modalService.show(CriticalConfirmationModalComponent, {
- itemDescription: this.selection.hasSingleSelection ? this.i18n('user') : this.i18n('users'),
+ itemDescription: this.selection.hasSingleSelection ? $localize`user` : $localize`users`,
itemNames: this.selection.selected.map((user: any) => user['uid']),
submitActionObservable: (): Observable<any> => {
return new Observable((observer: Subscriber<any>) => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts
index 0f124dcb2ff..9c42e1c6d29 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserS3KeyModalComponent } from './rgw-user-s3-key-modal.component';
@@ -15,7 +15,7 @@ describe('RgwUserS3KeyModalComponent', () => {
configureTestBed({
declarations: [RgwUserS3KeyModalComponent],
imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts
index bc762794d68..c06129d39fc 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core';
import { Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -32,10 +31,9 @@ export class RgwUserS3KeyModalComponent {
constructor(
private formBuilder: CdFormBuilder,
public activeModal: NgbActiveModal,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
- this.resource = this.i18n('S3 Key');
+ this.resource = $localize`S3 Key`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts
index 4c883468e7f..4ebe26a298d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserSubuserModalComponent } from './rgw-user-subuser-modal.component';
@@ -15,7 +15,7 @@ describe('RgwUserSubuserModalComponent', () => {
configureTestBed({
declarations: [RgwUserSubuserModalComponent],
imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts
index 663c7f93779..3a534497001 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, Output } from '@angular/core';
import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -33,10 +32,9 @@ export class RgwUserSubuserModalComponent {
constructor(
private formBuilder: CdFormBuilder,
public bsModalRef: NgbActiveModal,
- private i18n: I18n,
private actionLabels: ActionLabelsI18n
) {
- this.resource = this.i18n('Subuser');
+ this.resource = $localize`Subuser`;
this.createForm();
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts
index af2c873bcdb..4d5e8fc4176 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserSwiftKeyModalComponent } from './rgw-user-swift-key-modal.component';
@@ -16,7 +16,7 @@ describe('RgwUserSwiftKeyModalComponent', () => {
configureTestBed({
declarations: [RgwUserSwiftKeyModalComponent],
imports: [ToastrModule.forRoot(), FormsModule, SharedModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts
index aa34f6b7c7f..306e81be81f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-swift-key-modal/rgw-user-swift-key-modal.component.ts
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -16,12 +15,8 @@ export class RgwUserSwiftKeyModalComponent {
resource: string;
action: string;
- constructor(
- public activeModal: NgbActiveModal,
- private i18n: I18n,
- public actionLabels: ActionLabelsI18n
- ) {
- this.resource = this.i18n('Swift Key');
+ constructor(public activeModal: NgbActiveModal, public actionLabels: ActionLabelsI18n) {
+ this.resource = $localize`Swift Key`;
this.action = this.actionLabels.SHOW;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts
index 2d136e799f9..37518b18693 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { DeviceListComponent } from './device-list.component';
@@ -11,8 +11,7 @@ describe('DeviceListComponent', () => {
configureTestBed({
declarations: [DeviceListComponent],
- imports: [SharedModule, HttpClientTestingModule],
- providers: [i18nProviders]
+ imports: [SharedModule, HttpClientTestingModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts
index cc59e674f48..22ce27ff673 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts
@@ -1,8 +1,6 @@
import { DatePipe } from '@angular/common';
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { HostService } from '../../../shared/api/host.service';
import { OsdService } from '../../../shared/api/osd.service';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
@@ -36,43 +34,42 @@ export class DeviceListComponent implements OnChanges, OnInit {
constructor(
private hostService: HostService,
- private i18n: I18n,
private datePipe: DatePipe,
private osdService: OsdService
) {}
ngOnInit() {
this.columns = [
- { prop: 'devid', name: this.i18n('Device ID'), minWidth: 200 },
+ { prop: 'devid', name: $localize`Device ID`, minWidth: 200 },
{
prop: 'state',
- name: this.i18n('State of Health'),
+ name: $localize`State of Health`,
flexGrow: 1,
cellTransformation: CellTemplate.badge,
customTemplateConfig: {
map: {
- good: { value: this.i18n('Good'), class: 'badge-success' },
- warning: { value: this.i18n('Warning'), class: 'badge-warning' },
- bad: { value: this.i18n('Bad'), class: 'badge-danger' },
- stale: { value: this.i18n('Stale'), class: 'badge-info' },
- unknown: { value: this.i18n('Unknown'), class: 'badge-dark' }
+ good: { value: $localize`Good`, class: 'badge-success' },
+ warning: { value: $localize`Warning`, class: 'badge-warning' },
+ bad: { value: $localize`Bad`, class: 'badge-danger' },
+ stale: { value: $localize`Stale`, class: 'badge-info' },
+ unknown: { value: $localize`Unknown`, class: 'badge-dark' }
}
}
},
{
prop: 'life_expectancy_weeks',
- name: this.i18n('Life Expectancy'),
+ name: $localize`Life Expectancy`,
cellTemplate: this.lifeExpectancyTemplate
},
{
prop: 'life_expectancy_stamp',
- name: this.i18n('Prediction Creation Date'),
+ name: $localize`Prediction Creation Date`,
cellTemplate: this.lifeExpectancyTimestampTemplate,
pipe: this.datePipe,
isHidden: true
},
- { prop: 'location', name: this.i18n('Device Name'), cellTemplate: this.locationTemplate },
- { prop: 'readableDaemons', name: this.i18n('Daemons') }
+ { prop: 'location', name: $localize`Device Name`, cellTemplate: this.locationTemplate },
+ { prop: 'readableDaemons', name: $localize`Daemons` }
];
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts
index 138115750f8..ac79d93fff7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts
@@ -8,7 +8,7 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import * as _ from 'lodash';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { OsdService } from '../../../shared/api/osd.service';
import { HddSmartDataV1, NvmeSmartDataV1, SmartDataResult } from '../../../shared/models/smart';
import { SharedModule } from '../../../shared/shared.module';
@@ -81,8 +81,7 @@ describe('OsdSmartListComponent', () => {
configureTestBed({
declarations: [SmartListComponent],
- imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule],
- providers: [i18nProviders]
+ imports: [BrowserAnimationsModule, SharedModule, HttpClientTestingModule, NgbNavModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts
index 7c29c98fda3..f02a537c08c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { HostService } from '../../../shared/api/host.service';
@@ -33,11 +32,7 @@ export class SmartListComponent implements OnInit, OnChanges {
smartDataColumns: CdTableColumn[];
- constructor(
- private i18n: I18n,
- private osdService: OsdService,
- private hostService: HostService
- ) {}
+ constructor(private osdService: OsdService, private hostService: HostService) {}
isSmartError(data: any): data is SmartError {
return _.get(data, 'error') !== undefined;
@@ -57,16 +52,12 @@ export class SmartListComponent implements OnInit, OnChanges {
if (this.isSmartError(smartData)) {
let userMessage = '';
if (smartData.smartctl_error_code === -22) {
- userMessage = this.i18n(
- `Smartctl has received an unknown argument (error code {{code}}). \
+ userMessage = $localize`Smartctl has received an unknown argument \
+(error code ${smartData.smartctl_error_code}). \
You may be using an incompatible version of smartmontools. Version >= 7.0 of \
-smartmontools is required to successfully retrieve data.`,
- { code: smartData.smartctl_error_code }
- );
+smartmontools is required to successfully retrieve data.`;
} else {
- userMessage = this.i18n('An error with error code {{code}} occurred.', {
- code: smartData.smartctl_error_code
- });
+ userMessage = $localize`An error with error code ${smartData.smartctl_error_code} occurred.`;
}
const _result: SmartErrorResult = {
error: smartData.error,
@@ -152,13 +143,13 @@ smartmontools is required to successfully retrieve data.`,
ngOnInit() {
this.smartDataColumns = [
- { prop: 'id', name: this.i18n('ID') },
- { prop: 'name', name: this.i18n('Name') },
- { prop: 'raw.value', name: this.i18n('Raw') },
- { prop: 'thresh', name: this.i18n('Threshold') },
- { prop: 'value', name: this.i18n('Value') },
- { prop: 'when_failed', name: this.i18n('When Failed') },
- { prop: 'worst', name: this.i18n('Worst') }
+ { prop: 'id', name: $localize`ID` },
+ { prop: 'name', name: $localize`Name` },
+ { prop: 'raw.value', name: $localize`Raw` },
+ { prop: 'thresh', name: $localize`Threshold` },
+ { prop: 'value', name: $localize`Value` },
+ { prop: 'when_failed', name: $localize`When Failed` },
+ { prop: 'worst', name: $localize`Worst` }
];
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts
index eae34d33f9d..36bef19ef88 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { AuthService } from '../../../shared/api/auth.service';
import { ComponentsModule } from '../../../shared/components/components.module';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
@@ -33,8 +33,7 @@ describe('LoginPasswordFormComponent', () => {
ToastrModule.forRoot(),
SharedModule
],
- declarations: [LoginPasswordFormComponent],
- providers: i18nProviders
+ declarations: [LoginPasswordFormComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts
index e952faf38d8..18c2c02a49d 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login-password-form/login-password-form.component.ts
@@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { AuthService } from '../../../shared/api/auth.service';
import { UserService } from '../../../shared/api/user.service';
import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
@@ -19,7 +17,6 @@ import { UserPasswordFormComponent } from '../user-password-form/user-password-f
})
export class LoginPasswordFormComponent extends UserPasswordFormComponent {
constructor(
- public i18n: I18n,
public actionLabels: ActionLabelsI18n,
public notificationService: NotificationService,
public userService: UserService,
@@ -30,7 +27,6 @@ export class LoginPasswordFormComponent extends UserPasswordFormComponent {
public authService: AuthService
) {
super(
- i18n,
actionLabels,
notificationService,
userService,
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts
index 7d1fe5b80bb..1f918bb06fb 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { RoleDetailsComponent } from './role-details.component';
@@ -14,8 +14,7 @@ describe('RoleDetailsComponent', () => {
configureTestBed({
imports: [SharedModule, RouterTestingModule, HttpClientTestingModule, NgbNavModule],
- declarations: [RoleDetailsComponent],
- providers: i18nProviders
+ declarations: [RoleDetailsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts
index 6ee91494104..8470836fbcd 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts
@@ -1,6 +1,5 @@
import { Component, Input, OnChanges, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
@@ -21,39 +20,37 @@ export class RoleDetailsComponent implements OnChanges, OnInit {
columns: CdTableColumn[];
scopes_permissions: Array<any> = [];
- constructor(private i18n: I18n) {}
-
ngOnInit() {
this.columns = [
{
prop: 'scope',
- name: this.i18n('Scope'),
+ name: $localize`Scope`,
flexGrow: 2
},
{
prop: 'read',
- name: this.i18n('Read'),
+ name: $localize`Read`,
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'create',
- name: this.i18n('Create'),
+ name: $localize`Create`,
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'update',
- name: this.i18n('Update'),
+ name: $localize`Update`,
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'delete',
- name: this.i18n('Delete'),
+ name: $localize`Delete`,
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts
index 54786e73761..cd2109c0293 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts
@@ -8,7 +8,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { RoleService } from '../../../shared/api/role.service';
import { ScopeService } from '../../../shared/api/scope.service';
import { LoadingPanelComponent } from '../../../shared/components/loading-panel/loading-panel.component';
@@ -41,8 +41,7 @@ describe('RoleFormComponent', () => {
ToastrModule.forRoot(),
SharedModule
],
- declarations: [RoleFormComponent, FakeComponent],
- providers: i18nProviders
+ declarations: [RoleFormComponent, FakeComponent]
},
[LoadingPanelComponent]
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts
index e042a4f2f26..08d8f463b02 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { forkJoin as observableForkJoin } from 'rxjs';
@@ -50,11 +49,10 @@ export class RoleFormComponent extends CdForm implements OnInit {
private roleService: RoleService,
private scopeService: ScopeService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n
) {
super();
- this.resource = this.i18n('role');
+ this.resource = $localize`role`;
this.createForm();
this.listenToChanges();
}
@@ -74,14 +72,14 @@ export class RoleFormComponent extends CdForm implements OnInit {
this.columns = [
{
prop: 'scope',
- name: this.i18n('All'),
+ name: $localize`All`,
flexGrow: 2,
cellTemplate: this.cellScopeCheckboxTpl,
headerTemplate: this.headerPermissionCheckboxTpl
},
{
prop: 'read',
- name: this.i18n('Read'),
+ name: $localize`Read`,
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
@@ -89,7 +87,7 @@ export class RoleFormComponent extends CdForm implements OnInit {
},
{
prop: 'create',
- name: this.i18n('Create'),
+ name: $localize`Create`,
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
@@ -97,7 +95,7 @@ export class RoleFormComponent extends CdForm implements OnInit {
},
{
prop: 'update',
- name: this.i18n('Update'),
+ name: $localize`Update`,
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
@@ -105,7 +103,7 @@ export class RoleFormComponent extends CdForm implements OnInit {
},
{
prop: 'delete',
- name: this.i18n('Delete'),
+ name: $localize`Delete`,
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
@@ -281,7 +279,7 @@ export class RoleFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Created role '{{role_name}}'`, { role_name: roleFormModel.name })
+ $localize`Created role '${roleFormModel.name}'`
);
this.router.navigate(['/user-management/roles']);
},
@@ -297,7 +295,7 @@ export class RoleFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated role '{{role_name}}'`, { role_name: roleFormModel.name })
+ $localize`Updated role '${roleFormModel.name}'`
);
this.router.navigate(['/user-management/roles']);
},
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts
index dc3c71c38ed..bc6d1fdfc3c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { RoleDetailsComponent } from '../role-details/role-details.component';
@@ -30,8 +26,7 @@ describe('RoleListComponent', () => {
NgbNavModule,
RouterTestingModule,
HttpClientTestingModule
- ],
- providers: i18nProviders
+ ]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts
index f1cd8753868..ecf254051fa 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { forkJoin } from 'rxjs';
import { RoleService } from '../../../shared/api/role.service';
@@ -48,7 +47,6 @@ export class RoleListComponent extends ListWithDetails implements OnInit {
private authStorageService: AuthStorageService,
private modalService: ModalService,
private notificationService: NotificationService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
public actionLabels: ActionLabelsI18n
) {
@@ -88,18 +86,18 @@ export class RoleListComponent extends ListWithDetails implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 3
},
{
- name: this.i18n('Description'),
+ name: $localize`Description`,
prop: 'description',
flexGrow: 5,
pipe: this.emptyPipe
},
{
- name: this.i18n('System Role'),
+ name: $localize`System Role`,
prop: 'system',
cellClass: 'text-center',
flexGrow: 1,
@@ -126,10 +124,7 @@ export class RoleListComponent extends ListWithDetails implements OnInit {
() => {
this.getRoles();
this.modalRef.close();
- this.notificationService.show(
- NotificationType.success,
- this.i18n(`Deleted role '{{role_name}}'`, { role_name: role })
- );
+ this.notificationService.show(NotificationType.success, $localize`Deleted role '${role}'`);
},
() => {
this.modalRef.componentInstance.stopLoadingSpinner();
@@ -154,21 +149,18 @@ export class RoleListComponent extends ListWithDetails implements OnInit {
type: 'text',
name: 'newName',
value: `${name}_clone`,
- label: this.i18n('New name'),
+ label: $localize`New name`,
required: true
}
],
- titleText: this.i18n('Clone Role'),
- submitButtonText: this.i18n('Clone Role'),
+ titleText: $localize`Clone Role`,
+ submitButtonText: $localize`Clone Role`,
onSubmit: (values: object) => {
this.roleService.clone(name, values['newName']).subscribe(() => {
this.getRoles();
this.notificationService.show(
NotificationType.success,
- this.i18n(`Cloned role '{{dst_name}}' from '{{src_name}}'`, {
- src_name: name,
- dst_name: values['newName']
- })
+ $localize`Cloned role '${values['newName']}' from '${name}'`
);
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts
index 9eb6bde2aec..fb16065527c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts
@@ -9,7 +9,7 @@ import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { RoleService } from '../../../shared/api/role.service';
import { SettingsService } from '../../../shared/api/settings.service';
import { UserService } from '../../../shared/api/user.service';
@@ -55,8 +55,7 @@ describe('UserFormComponent', () => {
SharedModule,
NgbPopoverModule
],
- declarations: [UserFormComponent, FakeComponent],
- providers: i18nProviders
+ declarations: [UserFormComponent, FakeComponent]
},
[LoadingPanelComponent]
);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts
index 6568f474229..c3e1b227779 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts
@@ -3,7 +3,6 @@ import { Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import * as moment from 'moment';
import { forkJoin as observableForkJoin } from 'rxjs';
@@ -47,7 +46,7 @@ export class UserFormComponent extends CdForm implements OnInit {
userFormMode = UserFormMode;
mode: UserFormMode;
allRoles: Array<UserFormRoleModel>;
- messages = new SelectMessages({ empty: this.i18n('There are no roles.') }, this.i18n);
+ messages = new SelectMessages({ empty: $localize`There are no roles.` });
action: string;
resource: string;
passwordPolicyHelpText = '';
@@ -66,16 +65,15 @@ export class UserFormComponent extends CdForm implements OnInit {
private roleService: RoleService,
private userService: UserService,
private notificationService: NotificationService,
- private i18n: I18n,
public actionLabels: ActionLabelsI18n,
private passwordPolicyService: PasswordPolicyService,
private formBuilder: CdFormBuilder,
private settingsService: SettingsService
) {
super();
- this.resource = this.i18n('user');
+ this.resource = $localize`user`;
this.createForm();
- this.messages = new SelectMessages({ empty: this.i18n('There are no roles.') }, this.i18n);
+ this.messages = new SelectMessages({ empty: $localize`There are no roles.` });
}
createForm() {
@@ -210,7 +208,7 @@ export class UserFormComponent extends CdForm implements OnInit {
() => {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Created user '{{username}}'`, { username: userFormModel.username })
+ $localize`Created user '${userFormModel.username}'`
);
this.router.navigate(['/user-management/users']);
},
@@ -223,8 +221,8 @@ export class UserFormComponent extends CdForm implements OnInit {
editAction() {
if (this.isUserRemovingNeededRolePermissions()) {
const initialState = {
- titleText: this.i18n('Update user'),
- buttonText: this.i18n('Continue'),
+ titleText: $localize`Update user`,
+ buttonText: $localize`Continue`,
bodyTpl: this.removeSelfUserReadUpdatePermissionTpl,
onSubmit: () => {
this.modalRef.close();
@@ -279,13 +277,13 @@ export class UserFormComponent extends CdForm implements OnInit {
this.authService.logout(() => {
this.notificationService.show(
NotificationType.info,
- this.i18n('You were automatically logged out because your roles have been changed.')
+ $localize`You were automatically logged out because your roles have been changed.`
);
});
} else {
this.notificationService.show(
NotificationType.success,
- this.i18n(`Updated user '{{username}}'`, { username: userFormModel.username })
+ $localize`Updated user '${userFormModel.username}'`
);
this.router.navigate(['/user-management/users']);
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts
index f5ead615831..7cc70765a15 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- PermissionHelper
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { UserTabsComponent } from '../user-tabs/user-tabs.component';
@@ -29,8 +25,7 @@ describe('UserListComponent', () => {
RouterTestingModule,
HttpClientTestingModule
],
- declarations: [UserListComponent, UserTabsComponent],
- providers: i18nProviders
+ declarations: [UserListComponent, UserTabsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts
index cadc8c929ed..c9b21f267a4 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { UserService } from '../../../shared/api/user.service';
import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -46,7 +45,6 @@ export class UserListComponent implements OnInit {
private modalService: ModalService,
private notificationService: NotificationService,
private authStorageService: AuthStorageService,
- private i18n: I18n,
private urlBuilder: URLBuilderService,
private cdDatePipe: CdDatePipe,
public actionLabels: ActionLabelsI18n
@@ -77,36 +75,36 @@ export class UserListComponent implements OnInit {
ngOnInit() {
this.columns = [
{
- name: this.i18n('Username'),
+ name: $localize`Username`,
prop: 'username',
flexGrow: 1
},
{
- name: this.i18n('Name'),
+ name: $localize`Name`,
prop: 'name',
flexGrow: 1,
pipe: this.emptyPipe
},
{
- name: this.i18n('Email'),
+ name: $localize`Email`,
prop: 'email',
flexGrow: 1,
pipe: this.emptyPipe
},
{
- name: this.i18n('Roles'),
+ name: $localize`Roles`,
prop: 'roles',
flexGrow: 1,
cellTemplate: this.userRolesTpl
},
{
- name: this.i18n('Enabled'),
+ name: $localize`Enabled`,
prop: 'enabled',
flexGrow: 1,
cellTransformation: CellTemplate.checkIcon
},
{
- name: this.i18n('Password expiration date'),
+ name: $localize`Password expiration date`,
prop: 'pwdExpirationDate',
flexGrow: 1,
pipe: this.cdDatePipe
@@ -136,7 +134,7 @@ export class UserListComponent implements OnInit {
this.modalRef.close();
this.notificationService.show(
NotificationType.success,
- this.i18n(`Deleted user '{{username}}'`, { username: username })
+ $localize`Deleted user '${username}'`
);
},
() => {
@@ -151,8 +149,8 @@ export class UserListComponent implements OnInit {
if (sessionUsername === username) {
this.notificationService.show(
NotificationType.error,
- this.i18n(`Failed to delete user '{{username}}'`, { username: username }),
- this.i18n(`You are currently logged in as '{{username}}'.`, { username: username })
+ $localize`Failed to delete user '${username}'`,
+ $localize`You are currently logged in as '${username}'.`
);
return;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts
index faaa3057c92..7adaebaba3b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
import { ComponentsModule } from '../../../shared/components/components.module';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -31,8 +31,7 @@ describe('UserPasswordFormComponent', () => {
ToastrModule.forRoot(),
SharedModule
],
- declarations: [UserPasswordFormComponent],
- providers: i18nProviders
+ declarations: [UserPasswordFormComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts
index cf08a134fb3..e7ef06c15a5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts
@@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { Validators } from '@angular/forms';
import { Router } from '@angular/router';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { UserService } from '../../../shared/api/user.service';
@@ -31,7 +30,6 @@ export class UserPasswordFormComponent {
icons = Icons;
constructor(
- public i18n: I18n,
public actionLabels: ActionLabelsI18n,
public notificationService: NotificationService,
public userService: UserService,
@@ -41,7 +39,7 @@ export class UserPasswordFormComponent {
public passwordPolicyService: PasswordPolicyService
) {
this.action = this.actionLabels.CHANGE;
- this.resource = this.i18n('password');
+ this.resource = $localize`password`;
this.createForm();
}
@@ -115,7 +113,7 @@ export class UserPasswordFormComponent {
* Override this in derived classes to change the behaviour.
*/
onPasswordChange() {
- this.notificationService.show(NotificationType.success, this.i18n('Updated user password"'));
+ this.notificationService.show(NotificationType.success, $localize`Updated user password"`);
this.router.navigate(['/login']);
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts
index 3d1d440824f..587925bf46b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { PipesModule } from '../../../shared/pipes/pipes.module';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -19,7 +19,7 @@ describe('WorkbenchLayoutComponent', () => {
imports: [RouterTestingModule, ToastrModule.forRoot(), PipesModule, HttpClientTestingModule],
declarations: [WorkbenchLayoutComponent],
schemas: [NO_ERRORS_SCHEMA],
- providers: [AuthStorageService, i18nProviders, RbdService]
+ providers: [AuthStorageService, RbdService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts
index 5ad4535474a..5305d2abae4 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/layouts/workbench-layout/workbench-layout.component.ts
@@ -3,13 +3,15 @@ import { Router } from '@angular/router';
import { Subscription } from 'rxjs';
+import { FaviconService } from '../../../shared/services/favicon.service';
import { SummaryService } from '../../../shared/services/summary.service';
import { TaskManagerService } from '../../../shared/services/task-manager.service';
@Component({
selector: 'cd-workbench-layout',
templateUrl: './workbench-layout.component.html',
- styleUrls: ['./workbench-layout.component.scss']
+ styleUrls: ['./workbench-layout.component.scss'],
+ providers: [FaviconService]
})
export class WorkbenchLayoutComponent implements OnInit, OnDestroy {
private subs = new Subscription();
@@ -17,12 +19,14 @@ export class WorkbenchLayoutComponent implements OnInit, OnDestroy {
constructor(
private router: Router,
private summaryService: SummaryService,
- private taskManagerService: TaskManagerService
+ private taskManagerService: TaskManagerService,
+ private faviconService: FaviconService
) {}
ngOnInit() {
this.subs.add(this.summaryService.startPolling());
this.subs.add(this.taskManagerService.init(this.summaryService));
+ this.faviconService.init();
}
ngOnDestroy() {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts
index 3111d482b02..e7c2d97f35a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { ExecutingTask } from '../../../shared/models/executing-task';
import { SummaryService } from '../../../shared/services/summary.service';
import { SharedModule } from '../../../shared/shared.module';
@@ -17,8 +17,7 @@ describe('NotificationsComponent', () => {
configureTestBed({
imports: [HttpClientTestingModule, SharedModule, ToastrModule.forRoot(), RouterTestingModule],
- declarations: [NotificationsComponent],
- providers: i18nProviders
+ declarations: [NotificationsComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts
index 493fc920238..39bdf0c8183 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { CrushRuleService } from './crush-rule.service';
describe('CrushRuleService', () => {
@@ -11,7 +11,7 @@ describe('CrushRuleService', () => {
configureTestBed({
imports: [HttpClientTestingModule],
- providers: [CrushRuleService, i18nProviders]
+ providers: [CrushRuleService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts
index 74d061a0205..e4e7bb60540 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/crush-rule.service.ts
@@ -1,8 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { CrushRuleConfig } from '../models/crush-rule';
@Injectable({
@@ -13,12 +11,12 @@ export class CrushRuleService {
formTooltips = {
// Copied from /doc/rados/operations/crush-map.rst
- root: this.i18n(`The name of the node under which data should be placed.`),
- failure_domain: this.i18n(`The type of CRUSH nodes across which we should separate replicas.`),
- device_class: this.i18n(`The device class data should be placed on.`)
+ root: $localize`The name of the node under which data should be placed.`,
+ failure_domain: $localize`The type of CRUSH nodes across which we should separate replicas.`,
+ device_class: $localize`The device class data should be placed on.`
};
- constructor(private http: HttpClient, private i18n: I18n) {}
+ constructor(private http: HttpClient) {}
create(rule: CrushRuleConfig) {
return this.http.post(this.apiPath, rule, { observe: 'response' });
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts
index 591ca879b6d..88888b5222e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { ErasureCodeProfile } from '../models/erasure-code-profile';
import { ErasureCodeProfileService } from './erasure-code-profile.service';
@@ -13,7 +13,7 @@ describe('ErasureCodeProfileService', () => {
configureTestBed({
imports: [HttpClientTestingModule],
- providers: [ErasureCodeProfileService, i18nProviders]
+ providers: [ErasureCodeProfileService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts
index f99841250f5..47817367e72 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts
@@ -1,7 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { Observable } from 'rxjs';
import { ErasureCodeProfile } from '../models/erasure-code-profile';
@@ -14,25 +13,25 @@ export class ErasureCodeProfileService {
formTooltips = {
// Copied from /doc/rados/operations/erasure-code.*.rst
- k: this.i18n(`Each object is split in data-chunks parts, each stored on a different OSD.`),
+ k: $localize`Each object is split in data-chunks parts, each stored on a different OSD.`,
- m: this.i18n(`Compute coding chunks for each object and store them on different OSDs.
- The number of coding chunks is also the number of OSDs that can be down without losing data.`),
+ m: $localize`Compute coding chunks for each object and store them on different OSDs.
+ The number of coding chunks is also the number of OSDs that can be down without losing data.`,
plugins: {
jerasure: {
- description: this.i18n(`The jerasure plugin is the most generic and flexible plugin,
- it is also the default for Ceph erasure coded pools.`),
- technique: this.i18n(`The more flexible technique is reed_sol_van : it is enough to set k
+ description: $localize`The jerasure plugin is the most generic and flexible plugin,
+ it is also the default for Ceph erasure coded pools.`,
+ technique: $localize`The more flexible technique is reed_sol_van : it is enough to set k
and m. The cauchy_good technique can be faster but you need to chose the packetsize
carefully. All of reed_sol_r6_op, liberation, blaum_roth, liber8tion are RAID6 equivalents
- in the sense that they can only be configured with m=2.`),
- packetSize: this.i18n(`The encoding will be done on packets of bytes size at a time.
+ in the sense that they can only be configured with m=2.`,
+ packetSize: $localize`The encoding will be done on packets of bytes size at a time.
Chosing the right packet size is difficult.
- The jerasure documentation contains extensive information on this topic.`)
+ The jerasure documentation contains extensive information on this topic.`
},
lrc: {
- description: this.i18n(`With the jerasure plugin, when an erasure coded object is stored on
+ description: $localize`With the jerasure plugin, when an erasure coded object is stored on
multiple OSDs, recovering from the loss of one OSD requires reading from all the others.
For instance if jerasure is configured with k=8 and m=4, losing one OSD requires reading
from the eleven others to repair.
@@ -40,45 +39,43 @@ export class ErasureCodeProfileService {
The lrc erasure code plugin creates local parity chunks to be able to recover using
less OSDs. For instance if lrc is configured with k=8, m=4 and l=4, it will create
an additional parity chunk for every four OSDs. When a single OSD is lost, it can be
- recovered with only four OSDs instead of eleven.`),
- l: this.i18n(`Group the coding and data chunks into sets of size locality. For instance,
+ recovered with only four OSDs instead of eleven.`,
+ l: $localize`Group the coding and data chunks into sets of size locality. For instance,
for k=4 and m=2, when locality=3 two groups of three are created. Each set can
- be recovered without reading chunks from another set.`),
- crushLocality: this.i18n(`The type of the crush bucket in which each set of chunks defined
+ be recovered without reading chunks from another set.`,
+ crushLocality: $localize`The type of the crush bucket in which each set of chunks defined
by l will be stored. For instance, if it is set to rack, each group of l chunks will be
placed in a different rack. It is used to create a CRUSH rule step such as step choose
- rack. If it is not set, no such grouping is done.`)
+ rack. If it is not set, no such grouping is done.`
},
isa: {
- description: this.i18n(
- `The isa plugin encapsulates the ISA library. It only runs on Intel processors.`
- ),
- technique: this.i18n(`The ISA plugin comes in two Reed Solomon forms.
- If reed_sol_van is set, it is Vandermonde, if cauchy is set, it is Cauchy.`)
+ description: $localize`The isa plugin encapsulates the ISA library. It only runs on Intel processors.`,
+ technique: $localize`The ISA plugin comes in two Reed Solomon forms.
+ If reed_sol_van is set, it is Vandermonde, if cauchy is set, it is Cauchy.`
},
shec: {
- description: this.i18n(`The shec plugin encapsulates the multiple SHEC library.
- It allows ceph to recover data more efficiently than Reed Solomon codes.`),
- c: this.i18n(`The number of parity chunks each of which includes each data chunk in its
+ description: $localize`The shec plugin encapsulates the multiple SHEC library.
+ It allows ceph to recover data more efficiently than Reed Solomon codes.`,
+ c: $localize`The number of parity chunks each of which includes each data chunk in its
calculation range. The number is used as a durability estimator. For instance, if c=2,
- 2 OSDs can be down without losing data.`)
+ 2 OSDs can be down without losing data.`
}
},
- crushRoot: this.i18n(`The name of the crush bucket used for the first step of the CRUSH rule.
- For instance step take default.`),
+ crushRoot: $localize`The name of the crush bucket used for the first step of the CRUSH rule.
+ For instance step take default.`,
- crushFailureDomain: this.i18n(`Ensure that no two chunks are in a bucket with the same failure
+ crushFailureDomain: $localize`Ensure that no two chunks are in a bucket with the same failure
domain. For instance, if the failure domain is host no two chunks will be stored on the same
- host. It is used to create a CRUSH rule step such as step chooseleaf host.`),
+ host. It is used to create a CRUSH rule step such as step chooseleaf host.`,
- crushDeviceClass: this.i18n(`Restrict placement to devices of a specific class
- (e.g., ssd or hdd), using the crush device class names in the CRUSH map.`),
+ crushDeviceClass: $localize`Restrict placement to devices of a specific class
+ (e.g., ssd or hdd), using the crush device class names in the CRUSH map.`,
- directory: this.i18n(`Set the directory name from which the erasure code plugin is loaded.`)
+ directory: $localize`Set the directory name from which the erasure code plugin is loaded.`
};
- constructor(private http: HttpClient, private i18n: I18n) {}
+ constructor(private http: HttpClient) {}
list(): Observable<ErasureCodeProfile[]> {
return this.http.get<ErasureCodeProfile[]>(this.apiPath);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts
index a960500705a..b90e816d979 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { NfsService } from './nfs.service';
describe('NfsService', () => {
@@ -9,7 +9,7 @@ describe('NfsService', () => {
let httpTesting: HttpTestingController;
configureTestBed({
- providers: [NfsService, i18nProviders],
+ providers: [NfsService],
imports: [HttpClientTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
index f5de5bd412b..e9858416919 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
@@ -1,8 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
@Injectable({
providedIn: 'root'
})
@@ -13,43 +11,40 @@ export class NfsService {
nfsAccessType = [
{
value: 'RW',
- help: this.i18n('Allows all operations')
+ help: $localize`Allows all operations`
},
{
value: 'RO',
- help: this.i18n('Allows only operations that do not modify the server')
+ help: $localize`Allows only operations that do not modify the server`
},
{
value: 'MDONLY',
- help: this.i18n('Does not allow read or write operations, but allows any other operation')
+ help: $localize`Does not allow read or write operations, but allows any other operation`
},
{
value: 'MDONLY_RO',
- help: this.i18n(
- 'Does not allow read, write, or any operation that modifies file \
- attributes or directory content'
- )
+ help: $localize`Does not allow read, write, or any operation that modifies file attributes or directory content`
},
{
value: 'NONE',
- help: this.i18n('Allows no access at all')
+ help: $localize`Allows no access at all`
}
];
nfsFsal = [
{
value: 'CEPH',
- descr: this.i18n('CephFS')
+ descr: $localize`CephFS`
},
{
value: 'RGW',
- descr: this.i18n('Object Gateway')
+ descr: $localize`Object Gateway`
}
];
nfsSquash = ['no_root_squash', 'root_id_squash', 'root_squash', 'all_squash'];
- constructor(private http: HttpClient, private i18n: I18n) {}
+ constructor(private http: HttpClient) {}
list() {
return this.http.get(`${this.apiPath}/export`);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts
index 41527a428ea..94c957e49c6 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/orchestrator.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { OrchestratorService } from './orchestrator.service';
describe('OrchestratorService', () => {
@@ -10,7 +10,7 @@ describe('OrchestratorService', () => {
const apiPath = 'api/orchestrator';
configureTestBed({
- providers: [OrchestratorService, i18nProviders],
+ providers: [OrchestratorService],
imports: [HttpClientTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts
index 4c8e7eeedeb..e96a13ae306 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { OsdService } from './osd.service';
describe('OsdService', () => {
@@ -9,7 +9,7 @@ describe('OsdService', () => {
let httpTesting: HttpTestingController;
configureTestBed({
- providers: [OsdService, i18nProviders],
+ providers: [OsdService],
imports: [HttpClientTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
index ea407605da6..cc088d0e95f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
@@ -1,7 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { map } from 'rxjs/operators';
@@ -19,7 +18,7 @@ export class OsdService {
KNOWN_PRIORITIES: [
{
name: null,
- text: this.i18n('-- Select the priority --'),
+ text: $localize`-- Select the priority --`,
values: {
osd_max_backfills: null,
osd_recovery_max_active: null,
@@ -29,7 +28,7 @@ export class OsdService {
},
{
name: 'low',
- text: this.i18n('Low'),
+ text: $localize`Low`,
values: {
osd_max_backfills: 1,
osd_recovery_max_active: 1,
@@ -39,7 +38,7 @@ export class OsdService {
},
{
name: 'default',
- text: this.i18n('Default'),
+ text: $localize`Default`,
values: {
osd_max_backfills: 1,
osd_recovery_max_active: 3,
@@ -49,7 +48,7 @@ export class OsdService {
},
{
name: 'high',
- text: this.i18n('High'),
+ text: $localize`High`,
values: {
osd_max_backfills: 4,
osd_recovery_max_active: 4,
@@ -60,7 +59,7 @@ export class OsdService {
]
};
- constructor(private http: HttpClient, private i18n: I18n, private deviceService: DeviceService) {}
+ constructor(private http: HttpClient, private deviceService: DeviceService) {}
create(driveGroups: Object[]) {
const request = {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts
index 197864d22a7..c0e7cb0eabb 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { RbdConfigurationSourceField } from '../models/configuration';
import { RbdConfigurationService } from '../services/rbd-configuration.service';
import { PoolService } from './pool.service';
@@ -12,7 +12,7 @@ describe('PoolService', () => {
const apiPath = 'api/pool';
configureTestBed({
- providers: [PoolService, RbdConfigurationService, i18nProviders],
+ providers: [PoolService, RbdConfigurationService],
imports: [HttpClientTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts
index a9f3a36a437..72af80b977d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.spec.ts
@@ -1,7 +1,7 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { ImageSpec } from '../models/image-spec';
import { RbdConfigurationService } from '../services/rbd-configuration.service';
import { RbdService } from './rbd.service';
@@ -11,7 +11,7 @@ describe('RbdService', () => {
let httpTesting: HttpTestingController;
configureTestBed({
- providers: [RbdService, RbdConfigurationService, i18nProviders],
+ providers: [RbdService, RbdConfigurationService],
imports: [HttpClientTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts
index d1ed14d57a2..6b73b47c3b8 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts
@@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { AlertPanelComponent } from './alert-panel.component';
describe('AlertPanelComponent', () => {
@@ -11,8 +11,7 @@ describe('AlertPanelComponent', () => {
configureTestBed({
declarations: [AlertPanelComponent],
- imports: [NgbAlertModule],
- providers: [i18nProviders]
+ imports: [NgbAlertModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts
index d457a0ed7ef..f72aa73c112 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts
@@ -1,7 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { Icons } from '../../enum/icons.enum';
@Component({
@@ -27,27 +25,25 @@ export class AlertPanelComponent implements OnInit {
icons = Icons;
- constructor(private i18n: I18n) {}
-
ngOnInit() {
switch (this.type) {
case 'warning':
- this.title = this.title || this.i18n('Warning');
+ this.title = this.title || $localize`Warning`;
this.typeIcon = this.typeIcon || Icons.warning;
this.bootstrapClass = this.bootstrapClass || 'warning';
break;
case 'error':
- this.title = this.title || this.i18n('Error');
+ this.title = this.title || $localize`Error`;
this.typeIcon = this.typeIcon || Icons.destroyCircle;
this.bootstrapClass = this.bootstrapClass || 'danger';
break;
case 'info':
- this.title = this.title || this.i18n('Information');
+ this.title = this.title || $localize`Information`;
this.typeIcon = this.typeIcon || Icons.infoCircle;
this.bootstrapClass = this.bootstrapClass || 'info';
break;
case 'success':
- this.title = this.title || this.i18n('Success');
+ this.title = this.title || $localize`Success`;
this.typeIcon = this.typeIcon || Icons.check;
this.bootstrapClass = this.bootstrapClass || 'success';
break;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts
index 150e0567a16..7b62b625683 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { BackButtonComponent } from './back-button.component';
describe('BackButtonComponent', () => {
@@ -10,8 +10,7 @@ describe('BackButtonComponent', () => {
configureTestBed({
imports: [RouterTestingModule],
- declarations: [BackButtonComponent],
- providers: [i18nProviders]
+ declarations: [BackButtonComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
index c66910a5ea2..dca77404a0d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
@@ -6,11 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal, NgbModalModule, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import {
- configureTestBed,
- FixtureHelper,
- i18nProviders
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, FixtureHelper } from '../../../../testing/unit-test-helper';
import { ModalService } from '../../services/modal.service';
import { BackButtonComponent } from '../back-button/back-button.component';
import { ModalComponent } from '../modal/modal.component';
@@ -84,7 +80,7 @@ describe('ConfirmationModalComponent', () => {
],
schemas: [NO_ERRORS_SCHEMA],
imports: [ReactiveFormsModule, MockModule, RouterTestingModule, NgbModalModule],
- providers: [NgbActiveModal, i18nProviders, SubmitButtonComponent]
+ providers: [NgbActiveModal, SubmitButtonComponent]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts
index fbf10aa4594..653b00bc4aa 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts
@@ -5,12 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { NgBootstrapFormValidationModule } from 'ng-bootstrap-form-validation';
-import {
- configureTestBed,
- FixtureHelper,
- FormHelper,
- i18nProviders
-} from '../../../../testing/unit-test-helper';
+import { configureTestBed, FixtureHelper, FormHelper } from '../../../../testing/unit-test-helper';
import { CdValidators } from '../../forms/cd-validators';
import { SharedModule } from '../../shared.module';
import { FormModalComponent } from './form-modal.component';
@@ -58,7 +53,7 @@ describe('InputModalComponent', () => {
ReactiveFormsModule,
SharedModule
],
- providers: [i18nProviders, NgbActiveModal]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts
index a4017941229..b8dad67a46b 100755
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CdFormBuilder } from '../../forms/cd-form-builder';
@@ -31,8 +30,7 @@ export class FormModalComponent implements OnInit {
public activeModal: NgbActiveModal,
private formBuilder: CdFormBuilder,
private formatter: FormatterService,
- private dimlessBinaryPipe: DimlessBinaryPipe,
- private i18n: I18n
+ private dimlessBinaryPipe: DimlessBinaryPipe
) {}
ngOnInit() {
@@ -86,12 +84,12 @@ export class FormModalComponent implements OnInit {
if (['binaryMin', 'binaryMax'].includes(error)) {
// binaryMin and binaryMax return a function that take I18n to
// provide a translated error message.
- return errorContext(this.i18n);
+ return errorContext();
}
if (error === 'required') {
- return this.i18n('This field is required.');
+ return $localize`This field is required.`;
}
- return this.i18n('An error occurred.');
+ return $localize`An error occurred.`;
}
onSubmitForm(values: any) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
index 0568fc5806a..fb7747cabf5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
@@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SummaryService } from '../../../shared/services/summary.service';
import { SettingsService } from '../../api/settings.service';
import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe';
@@ -21,7 +21,7 @@ describe('GrafanaComponent', () => {
configureTestBed({
declarations: [GrafanaComponent, AlertPanelComponent, LoadingPanelComponent],
imports: [NgbAlertModule, HttpClientTestingModule, RouterTestingModule, FormsModule],
- providers: [CephReleaseNamePipe, SettingsService, SummaryService, i18nProviders]
+ providers: [CephReleaseNamePipe, SettingsService, SummaryService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts
index afb41361890..827210ccb6b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts
@@ -1,8 +1,6 @@
import { Component, Input, OnChanges, OnInit } from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { Icons } from '../../../shared/enum/icons.enum';
import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { SummaryService } from '../../../shared/services/summary.service';
@@ -44,128 +42,127 @@ export class GrafanaComponent implements OnInit, OnChanges {
private summaryService: SummaryService,
private sanitizer: DomSanitizer,
private settingsService: SettingsService,
- private cephReleaseNamePipe: CephReleaseNamePipe,
- private i18n: I18n
+ private cephReleaseNamePipe: CephReleaseNamePipe
) {
this.grafanaTimes = [
{
- name: this.i18n('Last 5 minutes'),
+ name: $localize`Last 5 minutes`,
value: 'from=now-5m&to=now'
},
{
- name: this.i18n('Last 15 minutes'),
+ name: $localize`Last 15 minutes`,
value: 'from=now-15m&to=now'
},
{
- name: this.i18n('Last 30 minutes'),
+ name: $localize`Last 30 minutes`,
value: 'from=now-30m&to=now'
},
{
- name: this.i18n('Last 1 hour (Default)'),
+ name: $localize`Last 1 hour (Default)`,
value: 'from=now-1h&to=now'
},
{
- name: this.i18n('Last 3 hours'),
+ name: $localize`Last 3 hours`,
value: 'from=now-3h&to=now'
},
{
- name: this.i18n('Last 6 hours'),
+ name: $localize`Last 6 hours`,
value: 'from=now-6h&to=now'
},
{
- name: this.i18n('Last 12 hours'),
+ name: $localize`Last 12 hours`,
value: 'from=now-12h&to=now'
},
{
- name: this.i18n('Last 24 hours'),
+ name: $localize`Last 24 hours`,
value: 'from=now-24h&to=now'
},
{
- name: this.i18n('Yesterday'),
+ name: $localize`Yesterday`,
value: 'from=now-1d%2Fd&to=now-1d%2Fd'
},
{
- name: this.i18n('Today'),
+ name: $localize`Today`,
value: 'from=now%2Fd&to=now%2Fd'
},
{
- name: this.i18n('Today so far'),
+ name: $localize`Today so far`,
value: 'from=now%2Fd&to=now'
},
{
- name: this.i18n('Day before yesterday'),
+ name: $localize`Day before yesterday`,
value: 'from=now-2d%2Fd&to=now-2d%2Fd'
},
{
- name: this.i18n('Last 2 days'),
+ name: $localize`Last 2 days`,
value: 'from=now-2d&to=now'
},
{
- name: this.i18n('This day last week'),
+ name: $localize`This day last week`,
value: 'from=now-7d%2Fd&to=now-7d%2Fd'
},
{
- name: this.i18n('Previous week'),
+ name: $localize`Previous week`,
value: 'from=now-1w%2Fw&to=now-1w%2Fw'
},
{
- name: this.i18n('This week'),
+ name: $localize`This week`,
value: 'from=now%2Fw&to=now%2Fw'
},
{
- name: this.i18n('This week so far'),
+ name: $localize`This week so far`,
value: 'from=now%2Fw&to=now'
},
{
- name: this.i18n('Last 7 days'),
+ name: $localize`Last 7 days`,
value: 'from=now-7d&to=now'
},
{
- name: this.i18n('Previous month'),
+ name: $localize`Previous month`,
value: 'from=now-1M%2FM&to=now-1M%2FM'
},
{
- name: this.i18n('This month'),
+ name: $localize`This month`,
value: 'from=now%2FM&to=now%2FM'
},
{
- name: this.i18n('This month so far'),
+ name: $localize`This month so far`,
value: 'from=now%2FM&to=now'
},
{
- name: this.i18n('Last 30 days'),
+ name: $localize`Last 30 days`,
value: 'from=now-30d&to=now'
},
{
- name: this.i18n('Last 90 days'),
+ name: $localize`Last 90 days`,
value: 'from=now-90d&to=now'
},
{
- name: this.i18n('Last 6 months'),
+ name: $localize`Last 6 months`,
value: 'from=now-6M&to=now'
},
{
- name: this.i18n('Last 1 year'),
+ name: $localize`Last 1 year`,
value: 'from=now-1y&to=now'
},
{
- name: this.i18n('Previous year'),
+ name: $localize`Previous year`,
value: 'from=now-1y%2Fy&to=now-1y%2Fy'
},
{
- name: this.i18n('This year'),
+ name: $localize`This year`,
value: 'from=now%2Fy&to=now%2Fy'
},
{
- name: this.i18n('This year so far'),
+ name: $localize`This year so far`,
value: 'from=now%2Fy&to=now'
},
{
- name: this.i18n('Last 2 years'),
+ name: $localize`Last 2 years`,
value: 'from=now-2y&to=now'
},
{
- name: this.i18n('Last 5 years'),
+ name: $localize`Last 5 years`,
value: 'from=now-5y&to=now'
}
];
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts
index fa3790b18fb..857595f07d0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.spec.ts
@@ -8,7 +8,7 @@ import { ClickOutsideModule } from 'ng-click-outside';
import { ToastrModule } from 'ngx-toastr';
import { SimplebarAngularModule } from 'simplebar-angular';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { PrometheusService } from '../../api/prometheus.service';
import { RbdService } from '../../api/rbd.service';
import { SettingsService } from '../../api/settings.service';
@@ -39,14 +39,7 @@ describe('NotificationsSidebarComponent', () => {
ClickOutsideModule
],
declarations: [NotificationsSidebarComponent],
- providers: [
- i18nProviders,
- PrometheusService,
- SettingsService,
- SummaryService,
- NotificationService,
- RbdService
- ]
+ providers: [PrometheusService, SettingsService, SummaryService, NotificationService, RbdService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts
index 2bcf2ae317f..ef4ed3eb12c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-modal/orchestrator-doc-modal.component.spec.ts
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { ComponentsModule } from '../components.module';
import { OrchestratorDocModalComponent } from './orchestrator-doc-modal.component';
@@ -14,7 +14,7 @@ describe('OrchestratorDocModalComponent', () => {
configureTestBed({
imports: [ComponentsModule, HttpClientTestingModule, RouterTestingModule],
- providers: [NgbActiveModal, i18nProviders]
+ providers: [NgbActiveModal]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts
index e2c7935127b..27b42fa707e 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/orchestrator-doc-panel/orchestrator-doc-panel.component.spec.ts
@@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe';
import { SummaryService } from '../../services/summary.service';
import { ComponentsModule } from '../components.module';
@@ -14,7 +14,7 @@ describe('OrchestratorDocPanelComponent', () => {
configureTestBed({
imports: [ComponentsModule, HttpClientTestingModule, RouterTestingModule],
- providers: [CephReleaseNamePipe, SummaryService, i18nProviders]
+ providers: [CephReleaseNamePipe, SummaryService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts
index 8986901b3b4..c71d058fb04 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.spec.ts
@@ -2,9 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule, Validators } from '@angular/forms';
import { NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SelectMessages } from '../select/select-messages.model';
import { SelectComponent } from '../select/select.component';
import { SelectBadgesComponent } from './select-badges.component';
@@ -15,8 +14,7 @@ describe('SelectBadgesComponent', () => {
configureTestBed({
declarations: [SelectBadgesComponent, SelectComponent],
- imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule],
- providers: i18nProviders
+ imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule]
});
beforeEach(() => {
@@ -35,8 +33,7 @@ describe('SelectBadgesComponent', () => {
{ name: 'option1', description: '', selected: false, enabled: true },
{ name: 'option2', description: '', selected: false, enabled: true }
];
- const i18n = TestBed.inject(I18n);
- const messages = new SelectMessages({ empty: 'foo bar' }, i18n);
+ const messages = new SelectMessages({ empty: 'foo bar' });
const selectionLimit = 2;
const customBadges = true;
const customBadgeValidators = [Validators.required];
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts
index 9c4e381aa9b..17d05ed4b48 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts
@@ -1,8 +1,6 @@
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { ValidatorFn } from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { Icons } from '../../../shared/enum/icons.enum';
import { SelectMessages } from '../select/select-messages.model';
import { SelectOption } from '../select/select-option.model';
@@ -19,7 +17,7 @@ export class SelectBadgesComponent {
@Input()
options: Array<SelectOption> = [];
@Input()
- messages = new SelectMessages({}, this.i18n);
+ messages = new SelectMessages({});
@Input()
selectionLimit: number;
@Input()
@@ -34,6 +32,4 @@ export class SelectBadgesComponent {
cdSelect: SelectComponent;
icons = Icons;
-
- constructor(private i18n: I18n) {}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts
index 3f1f9fd264f..6362b4e26cb 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select-messages.model.ts
@@ -1,9 +1,6 @@
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
export class SelectMessages {
- i18n: I18n;
-
empty: string;
selectionLimit: any;
customValidations = {};
@@ -11,17 +8,15 @@ export class SelectMessages {
add: string;
noOptions: string;
- constructor(messages: {}, i18n: I18n) {
- this.i18n = i18n;
-
- this.empty = this.i18n('No items selected.');
+ constructor(messages: {}) {
+ this.empty = $localize`No items selected.`;
this.selectionLimit = {
- tooltip: this.i18n('Deselect item to select again'),
- text: this.i18n('Selection limit reached')
+ tooltip: $localize`Deselect item to select again`,
+ text: $localize`Selection limit reached`
};
- this.filter = this.i18n('Filter tags');
- this.add = this.i18n('Add badge'); // followed by " '{{filter.value}}'"
- this.noOptions = this.i18n('There are no items available.');
+ this.filter = $localize`Filter tags`;
+ this.add = $localize`Add badge`; // followed by " '{{filter.value}}'"
+ this.noOptions = $localize`There are no items available.`;
_.merge(this, messages);
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts
index 45bb8d38ba7..4d1e78624e7 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.spec.ts
@@ -3,7 +3,7 @@ import { ReactiveFormsModule, Validators } from '@angular/forms';
import { NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { SelectOption } from './select-option.model';
import { SelectComponent } from './select.component';
@@ -19,8 +19,7 @@ describe('SelectComponent', () => {
configureTestBed({
declarations: [SelectComponent],
- imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule],
- providers: i18nProviders
+ imports: [NgbPopoverModule, NgbTooltipModule, ReactiveFormsModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts
index ad3a97c09a3..e4b780fcdf9 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/select/select.component.ts
@@ -1,7 +1,6 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import { FormControl, ValidatorFn } from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Icons } from '../../../shared/enum/icons.enum';
@@ -22,7 +21,7 @@ export class SelectComponent implements OnInit, OnChanges {
@Input()
options: Array<SelectOption> = [];
@Input()
- messages = new SelectMessages({}, this.i18n);
+ messages = new SelectMessages({});
@Input()
selectionLimit: number;
@Input()
@@ -39,8 +38,6 @@ export class SelectComponent implements OnInit, OnChanges {
filteredOptions: Array<SelectOption> = [];
icons = Icons;
- constructor(private i18n: I18n) {}
-
ngOnInit() {
this.initFilter();
if (this.data.length > 0) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts
index 2aac8532111..484770b0905 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.spec.ts
@@ -13,7 +13,6 @@ describe('SparklineComponent', () => {
configureTestBed({
declarations: [SparklineComponent],
schemas: [NO_ERRORS_SCHEMA],
- imports: [],
providers: [DimlessBinaryPipe, FormatterService]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts
index 7f2b4725193..cc9fa591c31 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.spec.ts
@@ -5,7 +5,7 @@ import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../../testing/unit-test-helper';
import { UserFormModel } from '../../../core/auth/user-form/user-form.model';
import { MgrModuleService } from '../../api/mgr-module.service';
import { UserService } from '../../api/user.service';
@@ -59,7 +59,7 @@ describe('TelemetryActivationNotificationComponent', () => {
configureTestBed({
declarations: [TelemetryNotificationComponent],
imports: [NgbAlertModule, HttpClientTestingModule, ToastrModule.forRoot(), PipesModule],
- providers: [MgrModuleService, UserService, i18nProviders]
+ providers: [MgrModuleService, UserService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts
index 4b881e2f8e0..ce3e97fd516 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/telemetry-notification/telemetry-notification.component.ts
@@ -1,7 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { UserFormModel } from '../../../core/auth/user-form/user-form.model';
import { MgrModuleService } from '../../api/mgr-module.service';
import { UserService } from '../../api/user.service';
@@ -23,8 +21,7 @@ export class TelemetryNotificationComponent implements OnInit, OnDestroy {
private authStorageService: AuthStorageService,
private userService: UserService,
private notificationService: NotificationService,
- private telemetryNotificationService: TelemetryNotificationService,
- private i18n: I18n
+ private telemetryNotificationService: TelemetryNotificationService
) {}
ngOnInit() {
@@ -59,10 +56,9 @@ export class TelemetryNotificationComponent implements OnInit, OnDestroy {
localStorage.setItem('telemetry_notification_hidden', 'true');
this.notificationService.show(
NotificationType.success,
- this.i18n('Telemetry activation reminder muted'),
- this.i18n(
- 'You can activate the module on the Telemetry configuration page (<b>Dashboard Settings</b> -> <b>Telemetry configuration</b>) at any time.'
- )
+ $localize`Telemetry activation reminder muted`,
+ $localize`You can activate the module on the Telemetry configuration \
+page (<b>Dashboard Settings</b> -> <b>Telemetry configuration</b>) at any time.`
);
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts
index 802c0d96f34..5f8d310d9c5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
export class AppConstants {
public static readonly organization = 'ceph';
public static readonly projectName = 'Ceph Dashboard';
@@ -109,52 +107,52 @@ export class ActionLabelsI18n {
UNSET: string;
UPDATE: string;
- constructor(private i18n: I18n) {
+ constructor() {
/* Create a new item */
- this.CREATE = this.i18n('Create');
+ this.CREATE = $localize`Create`;
/* Destroy an existing item */
- this.DELETE = this.i18n('Delete');
+ this.DELETE = $localize`Delete`;
/* Add an existing item to a container */
- this.ADD = this.i18n('Add');
- this.SET = this.i18n('Set');
+ this.ADD = $localize`Add`;
+ this.SET = $localize`Set`;
/* Remove an item from a container WITHOUT deleting it */
- this.REMOVE = this.i18n('Remove');
- this.UNSET = this.i18n('Unset');
+ this.REMOVE = $localize`Remove`;
+ this.UNSET = $localize`Unset`;
/* Make changes to an existing item */
- this.EDIT = this.i18n('Edit');
- this.UPDATE = this.i18n('Update');
- this.CANCEL = this.i18n('Cancel');
+ this.EDIT = $localize`Edit`;
+ this.UPDATE = $localize`Update`;
+ this.CANCEL = $localize`Cancel`;
/* Non-standard actions */
- this.CLONE = this.i18n('Clone');
- this.COPY = this.i18n('Copy');
- this.DEEP_SCRUB = this.i18n('Deep Scrub');
- this.DESTROY = this.i18n('Destroy');
- this.EVICT = this.i18n('Evict');
- this.FLATTEN = this.i18n('Flatten');
- this.MARK_DOWN = this.i18n('Mark Down');
- this.MARK_IN = this.i18n('Mark In');
- this.MARK_LOST = this.i18n('Mark Lost');
- this.MARK_OUT = this.i18n('Mark Out');
- this.PROTECT = this.i18n('Protect');
- this.PURGE = this.i18n('Purge');
- this.RENAME = this.i18n('Rename');
- this.RESTORE = this.i18n('Restore');
- this.REWEIGHT = this.i18n('Reweight');
- this.ROLLBACK = this.i18n('Rollback');
- this.SCRUB = this.i18n('Scrub');
- this.SHOW = this.i18n('Show');
- this.TRASH = this.i18n('Move to Trash');
- this.UNPROTECT = this.i18n('Unprotect');
- this.CHANGE = this.i18n('Change');
+ this.CLONE = $localize`Clone`;
+ this.COPY = $localize`Copy`;
+ this.DEEP_SCRUB = $localize`Deep Scrub`;
+ this.DESTROY = $localize`Destroy`;
+ this.EVICT = $localize`Evict`;
+ this.FLATTEN = $localize`Flatten`;
+ this.MARK_DOWN = $localize`Mark Down`;
+ this.MARK_IN = $localize`Mark In`;
+ this.MARK_LOST = $localize`Mark Lost`;
+ this.MARK_OUT = $localize`Mark Out`;
+ this.PROTECT = $localize`Protect`;
+ this.PURGE = $localize`Purge`;
+ this.RENAME = $localize`Rename`;
+ this.RESTORE = $localize`Restore`;
+ this.REWEIGHT = $localize`Reweight`;
+ this.ROLLBACK = $localize`Rollback`;
+ this.SCRUB = $localize`Scrub`;
+ this.SHOW = $localize`Show`;
+ this.TRASH = $localize`Move to Trash`;
+ this.UNPROTECT = $localize`Unprotect`;
+ this.CHANGE = $localize`Change`;
/* Prometheus wording */
- this.RECREATE = this.i18n('Recreate');
- this.EXPIRE = this.i18n('Expire');
+ this.RECREATE = $localize`Recreate`;
+ this.EXPIRE = $localize`Expire`;
}
}
@@ -194,47 +192,47 @@ export class SucceededActionLabelsI18n {
RECREATED: string;
EXPIRED: string;
- constructor(private i18n: I18n) {
+ constructor() {
/* Create a new item */
- this.CREATED = this.i18n('Created');
+ this.CREATED = $localize`Created`;
/* Destroy an existing item */
- this.DELETED = this.i18n('Deleted');
+ this.DELETED = $localize`Deleted`;
/* Add an existing item to a container */
- this.ADDED = this.i18n('Added');
+ this.ADDED = $localize`Added`;
/* Remove an item from a container WITHOUT deleting it */
- this.REMOVED = this.i18n('Removed');
+ this.REMOVED = $localize`Removed`;
/* Make changes to an existing item */
- this.EDITED = this.i18n('Edited');
- this.CANCELED = this.i18n('Canceled');
+ this.EDITED = $localize`Edited`;
+ this.CANCELED = $localize`Canceled`;
/* Non-standard actions */
- this.CLONED = this.i18n('Cloned');
- this.COPIED = this.i18n('Copied');
- this.DEEP_SCRUBBED = this.i18n('Deep Scrubbed');
- this.DESTROYED = this.i18n('Destroyed');
- this.FLATTENED = this.i18n('Flattened');
- this.MARKED_DOWN = this.i18n('Marked Down');
- this.MARKED_IN = this.i18n('Marked In');
- this.MARKED_LOST = this.i18n('Marked Lost');
- this.MARKED_OUT = this.i18n('Marked Out');
- this.PROTECTED = this.i18n('Protected');
- this.PURGED = this.i18n('Purged');
- this.RENAMED = this.i18n('Renamed');
- this.RESTORED = this.i18n('Restored');
- this.REWEIGHTED = this.i18n('Reweighted');
- this.ROLLED_BACK = this.i18n('Rolled back');
- this.SCRUBBED = this.i18n('Scrubbed');
- this.SHOWED = this.i18n('Showed');
- this.TRASHED = this.i18n('Moved to Trash');
- this.UNPROTECTED = this.i18n('Unprotected');
- this.CHANGE = this.i18n('Change');
+ this.CLONED = $localize`Cloned`;
+ this.COPIED = $localize`Copied`;
+ this.DEEP_SCRUBBED = $localize`Deep Scrubbed`;
+ this.DESTROYED = $localize`Destroyed`;
+ this.FLATTENED = $localize`Flattened`;
+ this.MARKED_DOWN = $localize`Marked Down`;
+ this.MARKED_IN = $localize`Marked In`;
+ this.MARKED_LOST = $localize`Marked Lost`;
+ this.MARKED_OUT = $localize`Marked Out`;
+ this.PROTECTED = $localize`Protected`;
+ this.PURGED = $localize`Purged`;
+ this.RENAMED = $localize`Renamed`;
+ this.RESTORED = $localize`Restored`;
+ this.REWEIGHTED = $localize`Reweighted`;
+ this.ROLLED_BACK = $localize`Rolled back`;
+ this.SCRUBBED = $localize`Scrubbed`;
+ this.SHOWED = $localize`Showed`;
+ this.TRASHED = $localize`Moved to Trash`;
+ this.UNPROTECTED = $localize`Unprotected`;
+ this.CHANGE = $localize`Change`;
/* Prometheus wording */
- this.RECREATED = this.i18n('Recreated');
- this.EXPIRED = this.i18n('Expired');
+ this.RECREATED = $localize`Recreated`;
+ this.EXPIRED = $localize`Expired`;
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts
index e4f09edd03c..e50fd86332c 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.spec.ts
@@ -1,18 +1,8 @@
-import { TestBed } from '@angular/core/testing';
-
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { Copy2ClipboardButtonDirective } from './copy2clipboard-button.directive';
describe('Copy2clipboardButtonDirective', () => {
- configureTestBed({
- providers: [i18nProviders]
- });
-
it('should create an instance', () => {
- const i18n = TestBed.inject(I18n);
- const directive = new Copy2ClipboardButtonDirective(null, null, null, i18n);
+ const directive = new Copy2ClipboardButtonDirective(null, null, null);
expect(directive).toBeTruthy();
});
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts
index ff5218acb70..78e4767e539 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts
@@ -1,6 +1,5 @@
import { Directive, ElementRef, HostListener, Input, OnInit, Renderer2 } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { ToastrService } from 'ngx-toastr';
@Directive({
@@ -13,15 +12,14 @@ export class Copy2ClipboardButtonDirective implements OnInit {
constructor(
private elementRef: ElementRef,
private renderer: Renderer2,
- private toastr: ToastrService,
- private i18n: I18n
+ private toastr: ToastrService
) {}
ngOnInit() {
const iElement = this.renderer.createElement('i');
this.renderer.addClass(iElement, 'fa');
this.renderer.addClass(iElement, 'fa-clipboard');
- this.renderer.setAttribute(iElement, 'title', this.i18n('Copy to clipboard'));
+ this.renderer.setAttribute(iElement, 'title', $localize`Copy to clipboard`);
this.renderer.appendChild(this.elementRef.nativeElement, iElement);
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts
index d30233a69b9..ed9299124ae 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.spec.ts
@@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser';
import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { AlertPanelComponent } from '../components/alert-panel/alert-panel.component';
import { LoadingPanelComponent } from '../components/loading-panel/loading-panel.component';
import { CdForm } from '../forms/cd-form';
@@ -31,8 +31,7 @@ describe('FormLoadingDirective', () => {
configureTestBed(
{
declarations: [TestComponent],
- imports: [SharedModule, NgbAlertModule],
- providers: [i18nProviders]
+ imports: [SharedModule, NgbAlertModule]
},
[LoadingPanelComponent, AlertPanelComponent]
);
@@ -48,7 +47,7 @@ describe('FormLoadingDirective', () => {
});
it('should create an instance', () => {
- const directive = new FormLoadingDirective(null, null, null, null);
+ const directive = new FormLoadingDirective(null, null, null);
expect(directive).toBeTruthy();
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts
index 9b063948520..e83614b84a5 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/form-loading.directive.ts
@@ -6,8 +6,6 @@ import {
ViewContainerRef
} from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { AlertPanelComponent } from '../components/alert-panel/alert-panel.component';
import { LoadingPanelComponent } from '../components/loading-panel/loading-panel.component';
import { LoadingStatus } from '../forms/cd-form';
@@ -19,8 +17,7 @@ export class FormLoadingDirective {
constructor(
private templateRef: TemplateRef<any>,
private viewContainer: ViewContainerRef,
- private componentFactoryResolver: ComponentFactoryResolver,
- private i18n: I18n
+ private componentFactoryResolver: ComponentFactoryResolver
) {}
@Input('cdFormLoading') set cdFormLoading(condition: LoadingStatus) {
@@ -32,7 +29,7 @@ export class FormLoadingDirective {
switch (condition) {
case LoadingStatus.Loading:
factory = this.componentFactoryResolver.resolveComponentFactory(LoadingPanelComponent);
- content = this.resolveNgContent(this.i18n(`Loading form data...`));
+ content = this.resolveNgContent($localize`Loading form data...`);
this.viewContainer.createComponent(factory, null, null, content);
break;
case LoadingStatus.Ready:
@@ -40,7 +37,7 @@ export class FormLoadingDirective {
break;
case LoadingStatus.Error:
factory = this.componentFactoryResolver.resolveComponentFactory(AlertPanelComponent);
- content = this.resolveNgContent(this.i18n(`Form data could not be loaded.`));
+ content = this.resolveNgContent($localize`Form data could not be loaded.`);
const componentRef = this.viewContainer.createComponent(factory, null, null, content);
(<AlertPanelComponent>componentRef.instance).type = 'error';
break;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/color.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/color.enum.ts
new file mode 100644
index 00000000000..0378827b286
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/color.enum.ts
@@ -0,0 +1,6 @@
+export enum Color {
+ // HEALTH
+ HEALTH_ERR = '#ff0000',
+ HEALTH_WARN = '#ffa500',
+ HEALTH_OK = '#00bb00'
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts
index b0cd8133eda..bcc5629a9e0 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts
@@ -6,7 +6,6 @@ import {
Validators
} from '@angular/forms';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Observable, of as observableOf, timer as observableTimer } from 'rxjs';
import { map, switchMapTo, take } from 'rxjs/operators';
@@ -333,7 +332,7 @@ export class CdValidators {
* be called in a static one.
*/
static binaryMin(bytes: number): ValidatorFn {
- return (control: AbstractControl): { [key: string]: (i18n: I18n) => string } | null => {
+ return (control: AbstractControl): { [key: string]: () => string } | null => {
const formatterService = new FormatterService();
const currentBytes = new FormatterService().toBytes(control.value);
if (bytes <= currentBytes) {
@@ -341,7 +340,7 @@ export class CdValidators {
}
const value = new DimlessBinaryPipe(formatterService).transform(bytes);
return {
- binaryMin: (i18n: I18n) => i18n(`Size has to be at least {{value}} or more`, { value })
+ binaryMin: () => $localize`Size has to be at least ${value} or more`
};
};
}
@@ -353,7 +352,7 @@ export class CdValidators {
* be called in a static one.
*/
static binaryMax(bytes: number): ValidatorFn {
- return (control: AbstractControl): { [key: string]: (i18n: I18n) => string } | null => {
+ return (control: AbstractControl): { [key: string]: () => string } | null => {
const formatterService = new FormatterService();
const currentBytes = formatterService.toBytes(control.value);
if (bytes >= currentBytes) {
@@ -361,7 +360,7 @@ export class CdValidators {
}
const value = new DimlessBinaryPipe(formatterService).transform(bytes);
return {
- binaryMax: (i18n: I18n) => i18n(`Size has to be at most {{value}} or less`, { value })
+ binaryMax: () => $localize`Size has to be at most ${value} or less`
};
};
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts
index 5293059e75d..a0b8019a7ca 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.spec.ts
@@ -1,20 +1,10 @@
-import { TestBed } from '@angular/core/testing';
-
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { BooleanTextPipe } from './boolean-text.pipe';
describe('BooleanTextPipe', () => {
let pipe: BooleanTextPipe;
- configureTestBed({
- providers: [i18nProviders]
- });
-
beforeEach(() => {
- const i18n = TestBed.inject(I18n);
- pipe = new BooleanTextPipe(i18n);
+ pipe = new BooleanTextPipe();
});
it('create an instance', () => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts
index dba4e8bc010..70432f9be5d 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/boolean-text.pipe.ts
@@ -1,17 +1,13 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
@Pipe({
name: 'booleanText'
})
export class BooleanTextPipe implements PipeTransform {
- constructor(private i18n: I18n) {}
-
transform(
value: any,
- truthyText: string = this.i18n('Yes'),
- falsyText: string = this.i18n('No')
+ truthyText: string = $localize`Yes`,
+ falsyText: string = $localize`No`
): string {
return Boolean(value) ? truthyText : falsyText;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts
index 4b95022668c..7da99de4b29 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/health-color.pipe.ts
@@ -1,18 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';
+import { Color } from '../enum/color.enum';
+
@Pipe({
name: 'healthColor'
})
export class HealthColorPipe implements PipeTransform {
transform(value: any): any {
- if (value === 'HEALTH_OK') {
- return { color: '#00bb00' };
- } else if (value === 'HEALTH_WARN') {
- return { color: '#ffa500' };
- } else if (value === 'HEALTH_ERR') {
- return { color: '#ff0000' };
- } else {
- return null;
- }
+ return Color[value] ? { color: Color[value] } : null;
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts
index f658365e2d2..9d36defb937 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.spec.ts
@@ -1,20 +1,10 @@
-import { TestBed } from '@angular/core/testing';
-
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { NotAvailablePipe } from './not-available.pipe';
describe('NotAvailablePipe', () => {
let pipe: NotAvailablePipe;
- configureTestBed({
- providers: [i18nProviders]
- });
-
beforeEach(() => {
- const i18n = TestBed.inject(I18n);
- pipe = new NotAvailablePipe(i18n);
+ pipe = new NotAvailablePipe();
});
it('create an instance', () => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts
index 75cb8a5cf0c..17184c38ae1 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/not-available.pipe.ts
@@ -1,15 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
@Pipe({
name: 'notAvailable'
})
export class NotAvailablePipe implements PipeTransform {
- constructor(private i18n: I18n) {}
transform(value: any): any {
if (value === '') {
- return this.i18n('n/a');
+ return $localize`n/a`;
}
return value;
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts
index 9467cc3f7ba..2b37ffafaa3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts
@@ -5,7 +5,7 @@ import { Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { AppModule } from '../../app.module';
import { NotificationType } from '../enum/notification-type.enum';
import { CdNotification, CdNotificationConfig } from '../models/cd-notification';
@@ -62,7 +62,6 @@ describe('ApiInterceptorService', () => {
imports: [AppModule, HttpClientTestingModule],
providers: [
NotificationService,
- i18nProviders,
{
provide: ToastrService,
useValue: {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.spec.ts
new file mode 100644
index 00000000000..7c7184e5abb
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.spec.ts
@@ -0,0 +1,22 @@
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { TestBed } from '@angular/core/testing';
+
+import { configureTestBed } from '../../../testing/unit-test-helper';
+import { FaviconService } from './favicon.service';
+
+describe('FaviconService', () => {
+ let service: FaviconService;
+
+ configureTestBed({
+ imports: [HttpClientTestingModule],
+ providers: [FaviconService]
+ });
+
+ beforeEach(() => {
+ service = TestBed.inject(FaviconService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts
new file mode 100644
index 00000000000..e9847ca06fe
--- /dev/null
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts
@@ -0,0 +1,74 @@
+import { DOCUMENT } from '@angular/common';
+import { Inject, Injectable, OnDestroy } from '@angular/core';
+
+import { Subscription } from 'rxjs';
+
+import { Color } from '../enum/color.enum';
+import { SummaryService } from './summary.service';
+
+@Injectable()
+export class FaviconService implements OnDestroy {
+ sub: Subscription;
+ oldStatus: string;
+ url: string;
+
+ constructor(
+ @Inject(DOCUMENT) private document: HTMLDocument,
+ private summaryService: SummaryService
+ ) {}
+
+ init() {
+ this.url = this.document.getElementById('cdFavicon')?.getAttribute('href');
+
+ this.sub = this.summaryService.subscribe((summary) => {
+ this.changeIcon(summary.health_status);
+ });
+ }
+
+ changeIcon(status?: string) {
+ if (status === this.oldStatus) {
+ return;
+ }
+
+ this.oldStatus = status;
+
+ const favicon = this.document.getElementById('cdFavicon');
+ const faviconSize = 16;
+ const radius = faviconSize / 4;
+
+ const canvas = this.document.createElement('canvas');
+ canvas.width = faviconSize;
+ canvas.height = faviconSize;
+
+ const context = canvas.getContext('2d');
+ const img = this.document.createElement('img');
+ img.src = this.url;
+
+ img.onload = () => {
+ // Draw Original Favicon as Background
+ context.drawImage(img, 0, 0, faviconSize, faviconSize);
+
+ // Cut notification circle area
+ context.save();
+ context.globalCompositeOperation = 'destination-out';
+ context.beginPath();
+ context.arc(canvas.width - radius, radius, radius + 2, 0, 2 * Math.PI);
+ context.fill();
+ context.restore();
+
+ // Draw Notification Circle
+ context.beginPath();
+ context.arc(canvas.width - radius, radius, radius, 0, 2 * Math.PI);
+ context.fillStyle = Color[status] || 'transparent';
+ context.fill();
+
+ // Replace favicon
+ favicon.setAttribute('href', canvas.toDataURL('image/png'));
+ };
+ }
+
+ ngOnDestroy() {
+ this.changeIcon();
+ this.sub?.unsubscribe();
+ }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts
index fa235acefc6..226fa4712fc 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts
@@ -4,7 +4,7 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import * as _ from 'lodash';
import { ToastrService } from 'ngx-toastr';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { RbdService } from '../api/rbd.service';
import { NotificationType } from '../enum/notification-type.enum';
import { CdNotificationConfig } from '../models/cd-notification';
@@ -27,7 +27,6 @@ describe('NotificationService', () => {
TaskMessageService,
{ provide: ToastrService, useValue: toastFakeService },
{ provide: CdDatePipe, useValue: { transform: (d: any) => d } },
- i18nProviders,
RbdService
],
imports: [HttpClientTestingModule]
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts
index cae1993b58b..ff88fcb6206 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.spec.ts
@@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing';
import { of as observableOf } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { SettingsService } from '../api/settings.service';
import { SharedModule } from '../shared.module';
import { PasswordPolicyService } from './password-policy.service';
@@ -33,8 +33,7 @@ describe('PasswordPolicyService', () => {
};
configureTestBed({
- imports: [HttpClientTestingModule, SharedModule],
- providers: [i18nProviders]
+ imports: [HttpClientTestingModule, SharedModule]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts
index e3030b10a67..c768a36aa94 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/password-policy.service.ts
@@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@@ -12,7 +11,7 @@ import { CdPwdPolicySettings } from '../models/cd-pwd-policy-settings';
providedIn: 'root'
})
export class PasswordPolicyService {
- constructor(private i18n: I18n, private settingsService: SettingsService) {}
+ constructor(private settingsService: SettingsService) {}
getHelpText(): Observable<string> {
return this.settingsService.getStandardSettings().pipe(
@@ -20,27 +19,19 @@ export class PasswordPolicyService {
const settings = new CdPwdPolicySettings(resp);
let helpText: string[] = [];
if (settings.pwdPolicyEnabled) {
- helpText.push(this.i18n('Required rules for passwords:'));
+ helpText.push($localize`Required rules for passwords:`);
const i18nHelp: { [key: string]: string } = {
- pwdPolicyCheckLengthEnabled: this.i18n('Must contain at least {{length}} characters', {
- length: settings.pwdPolicyMinLength
- }),
- pwdPolicyCheckOldpwdEnabled: this.i18n('Must not be the same as the previous one'),
- pwdPolicyCheckUsernameEnabled: this.i18n('Cannot contain the username'),
- pwdPolicyCheckExclusionListEnabled: this.i18n('Cannot contain any configured keyword'),
- pwdPolicyCheckRepetitiveCharsEnabled: this.i18n(
- 'Cannot contain any repetitive characters e.g. "aaa"'
- ),
- pwdPolicyCheckSequentialCharsEnabled: this.i18n(
- 'Cannot contain any sequential characters e.g. "abc"'
- ),
- pwdPolicyCheckComplexityEnabled: this.i18n(
- `Must consist of characters from the following groups:
+ pwdPolicyCheckLengthEnabled: $localize`Must contain at least ${settings.pwdPolicyMinLength} characters`,
+ pwdPolicyCheckOldpwdEnabled: $localize`Must not be the same as the previous one`,
+ pwdPolicyCheckUsernameEnabled: $localize`Cannot contain the username`,
+ pwdPolicyCheckExclusionListEnabled: $localize`Cannot contain any configured keyword`,
+ pwdPolicyCheckRepetitiveCharsEnabled: $localize`Cannot contain any repetitive characters e.g. "aaa"`,
+ pwdPolicyCheckSequentialCharsEnabled: $localize`Cannot contain any sequential characters e.g. "abc"`,
+ pwdPolicyCheckComplexityEnabled: $localize`Must consist of characters from the following groups:
* Alphabetic a-z, A-Z
* Numbers 0-9
* Special chars: !"#$%& '()*+,-./:;<=>?@[\\]^_\`{{|}}~
* Any other characters (signs)`
- )
};
helpText = helpText.concat(
_.keys(i18nHelp)
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts
index ee76530ecc5..c4ffc5e8444 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert-formatter.spec.ts
@@ -3,11 +3,7 @@ import { TestBed } from '@angular/core/testing';
import { ToastrModule } from 'ngx-toastr';
-import {
- configureTestBed,
- i18nProviders,
- PrometheusHelper
-} from '../../../testing/unit-test-helper';
+import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper';
import { NotificationType } from '../enum/notification-type.enum';
import { CdNotificationConfig } from '../models/cd-notification';
import { PrometheusCustomAlert } from '../models/prometheus-alerts';
@@ -22,7 +18,7 @@ describe('PrometheusAlertFormatter', () => {
configureTestBed({
imports: [ToastrModule.forRoot(), SharedModule, HttpClientTestingModule],
- providers: [PrometheusAlertFormatter, i18nProviders]
+ providers: [PrometheusAlertFormatter]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
index cefbb78be0b..eaca61b48a3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
@@ -4,11 +4,7 @@ import { TestBed } from '@angular/core/testing';
import { ToastrModule } from 'ngx-toastr';
import { Observable, of } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PrometheusHelper
-} from '../../../testing/unit-test-helper';
+import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper';
import { PrometheusService } from '../api/prometheus.service';
import { NotificationType } from '../enum/notification-type.enum';
import { CdNotificationConfig } from '../models/cd-notification';
@@ -27,7 +23,7 @@ describe('PrometheusAlertService', () => {
configureTestBed({
imports: [ToastrModule.forRoot(), SharedModule, HttpClientTestingModule],
- providers: [PrometheusAlertService, PrometheusAlertFormatter, i18nProviders]
+ providers: [PrometheusAlertService, PrometheusAlertFormatter]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts
index de3130a9dc8..6500d51f26a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts
@@ -4,11 +4,7 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ToastrModule, ToastrService } from 'ngx-toastr';
import { of, throwError } from 'rxjs';
-import {
- configureTestBed,
- i18nProviders,
- PrometheusHelper
-} from '../../../testing/unit-test-helper';
+import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper';
import { PrometheusService } from '../api/prometheus.service';
import { NotificationType } from '../enum/notification-type.enum';
import { CdNotificationConfig } from '../models/cd-notification';
@@ -38,7 +34,6 @@ describe('PrometheusNotificationService', () => {
providers: [
PrometheusNotificationService,
PrometheusAlertFormatter,
- i18nProviders,
{ provide: ToastrService, useValue: toastFakeService }
]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts
index 5e92b52a59e..57f0442c43f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts
@@ -1,10 +1,6 @@
import { TestBed } from '@angular/core/testing';
-import {
- configureTestBed,
- i18nProviders,
- PrometheusHelper
-} from '../../../testing/unit-test-helper';
+import { configureTestBed, PrometheusHelper } from '../../../testing/unit-test-helper';
import { PrometheusRule } from '../models/prometheus-alerts';
import { SharedModule } from '../shared.module';
import { PrometheusSilenceMatcherService } from './prometheus-silence-matcher.service';
@@ -15,8 +11,7 @@ describe('PrometheusSilenceMatcherService', () => {
let rules: PrometheusRule[];
configureTestBed({
- imports: [SharedModule],
- providers: [i18nProviders]
+ imports: [SharedModule]
});
const addMatcher = (name: string, value: any) => ({
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts
index dbd0da04eb1..c819a16f426 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts
@@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import {
@@ -20,8 +19,6 @@ export class PrometheusSilenceMatcherService {
severity: 'labels.severity'
};
- constructor(private i18n: I18n) {}
-
singleMatch(
matcher: AlertmanagerSilenceMatcher,
rules: PrometheusRule[]
@@ -65,18 +62,17 @@ export class PrometheusSilenceMatcherService {
private getMatchText(rules: number, alerts: number): string {
const msg = {
- noRule: this.i18n('Your matcher seems to match no currently defined rule or active alert.'),
- noAlerts: this.i18n('no active alerts'),
- alert: this.i18n('1 active alert'),
- alerts: this.i18n('{{n}} active alerts', { n: alerts }),
- rule: this.i18n('Matches 1 rule'),
- rules: this.i18n('Matches {{n}} rules', { n: rules })
+ noRule: $localize`Your matcher seems to match no currently defined rule or active alert.`,
+ noAlerts: $localize`no active alerts`,
+ alert: $localize`1 active alert`,
+ alerts: $localize`${alerts} active alerts`,
+ rule: $localize`Matches 1 rule`,
+ rules: $localize`Matches ${rules} rules`
};
- return rules
- ? this.i18n('{{rules}} with {{alerts}}.', {
- rules: rules > 1 ? msg.rules : msg.rule,
- alerts: alerts ? (alerts > 1 ? msg.alerts : msg.alert) : msg.noAlerts
- })
- : msg.noRule;
+
+ const rule = rules > 1 ? msg.rules : msg.rule;
+ const alert = alerts ? (alerts > 1 ? msg.alerts : msg.alert) : msg.noAlerts;
+
+ return rules ? $localize`${rule} with ${alert}.` : msg.noRule;
}
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts
index e1db61a5ebb..15b2e4e7e14 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.spec.ts
@@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { RbdConfigurationType } from '../models/configuration';
import { RbdConfigurationService } from './rbd-configuration.service';
@@ -8,7 +8,7 @@ describe('RbdConfigurationService', () => {
let service: RbdConfigurationService;
configureTestBed({
- providers: [RbdConfigurationService, i18nProviders]
+ providers: [RbdConfigurationService]
});
beforeEach(() => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts
index 10a0ac7060e..4499718e1fa 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-configuration.service.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import {
RbdConfigurationExtraField,
RbdConfigurationSection,
@@ -19,82 +17,82 @@ import {
export class RbdConfigurationService {
readonly sections: RbdConfigurationSection[];
- constructor(private i18n: I18n) {
+ constructor() {
this.sections = [
{
- heading: this.i18n('Quality of Service'),
+ heading: $localize`Quality of Service`,
class: 'quality-of-service',
options: [
{
name: 'rbd_qos_bps_limit',
- displayName: this.i18n('BPS Limit'),
- description: this.i18n('The desired limit of IO bytes per second.'),
+ displayName: $localize`BPS Limit`,
+ description: $localize`The desired limit of IO bytes per second.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_iops_limit',
- displayName: this.i18n('IOPS Limit'),
- description: this.i18n('The desired limit of IO operations per second.'),
+ displayName: $localize`IOPS Limit`,
+ description: $localize`The desired limit of IO operations per second.`,
type: RbdConfigurationType.iops
},
{
name: 'rbd_qos_read_bps_limit',
- displayName: this.i18n('Read BPS Limit'),
- description: this.i18n('The desired limit of read bytes per second.'),
+ displayName: $localize`Read BPS Limit`,
+ description: $localize`The desired limit of read bytes per second.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_read_iops_limit',
- displayName: this.i18n('Read IOPS Limit'),
- description: this.i18n('The desired limit of read operations per second.'),
+ displayName: $localize`Read IOPS Limit`,
+ description: $localize`The desired limit of read operations per second.`,
type: RbdConfigurationType.iops
},
{
name: 'rbd_qos_write_bps_limit',
- displayName: this.i18n('Write BPS Limit'),
- description: this.i18n('The desired limit of write bytes per second.'),
+ displayName: $localize`Write BPS Limit`,
+ description: $localize`The desired limit of write bytes per second.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_write_iops_limit',
- displayName: this.i18n('Write IOPS Limit'),
- description: this.i18n('The desired limit of write operations per second.'),
+ displayName: $localize`Write IOPS Limit`,
+ description: $localize`The desired limit of write operations per second.`,
type: RbdConfigurationType.iops
},
{
name: 'rbd_qos_bps_burst',
- displayName: this.i18n('BPS Burst'),
- description: this.i18n('The desired burst limit of IO bytes.'),
+ displayName: $localize`BPS Burst`,
+ description: $localize`The desired burst limit of IO bytes.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_iops_burst',
- displayName: this.i18n('IOPS Burst'),
- description: this.i18n('The desired burst limit of IO operations.'),
+ displayName: $localize`IOPS Burst`,
+ description: $localize`The desired burst limit of IO operations.`,
type: RbdConfigurationType.iops
},
{
name: 'rbd_qos_read_bps_burst',
- displayName: this.i18n('Read BPS Burst'),
- description: this.i18n('The desired burst limit of read bytes.'),
+ displayName: $localize`Read BPS Burst`,
+ description: $localize`The desired burst limit of read bytes.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_read_iops_burst',
- displayName: this.i18n('Read IOPS Burst'),
- description: this.i18n('The desired burst limit of read operations.'),
+ displayName: $localize`Read IOPS Burst`,
+ description: $localize`The desired burst limit of read operations.`,
type: RbdConfigurationType.iops
},
{
name: 'rbd_qos_write_bps_burst',
- displayName: this.i18n('Write BPS Burst'),
- description: this.i18n('The desired burst limit of write bytes.'),
+ displayName: $localize`Write BPS Burst`,
+ description: $localize`The desired burst limit of write bytes.`,
type: RbdConfigurationType.bps
},
{
name: 'rbd_qos_write_iops_burst',
- displayName: this.i18n('Write IOPS Burst'),
- description: this.i18n('The desired burst limit of write operations.'),
+ displayName: $localize`Write IOPS Burst`,
+ description: $localize`The desired burst limit of write operations.`,
type: RbdConfigurationType.iops
}
] as RbdConfigurationExtraField[]
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts
index 1d11fc5561f..51be8659137 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/refresh-interval.service.spec.ts
@@ -8,7 +8,6 @@ describe('RefreshIntervalService', () => {
let service: RefreshIntervalService;
configureTestBed({
- imports: [],
providers: [RefreshIntervalService]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts
index e52459b0b85..5ec08671eca 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts
@@ -4,11 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { of } from 'rxjs';
-import {
- configureTestBed,
- expectItemTasks,
- i18nProviders
-} from '../../../testing/unit-test-helper';
+import { configureTestBed, expectItemTasks } from '../../../testing/unit-test-helper';
import { RbdService } from '../api/rbd.service';
import { ExecutingTask } from '../models/executing-task';
import { SummaryService } from './summary.service';
@@ -29,7 +25,7 @@ describe('TaskListService', () => {
};
configureTestBed({
- providers: [TaskListService, TaskMessageService, SummaryService, i18nProviders, RbdService],
+ providers: [TaskListService, TaskMessageService, SummaryService, RbdService],
imports: [HttpClientTestingModule, RouterTestingModule]
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts
index 9d037aecb9b..920d79dd73a 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts
@@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing';
import * as _ from 'lodash';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { RbdService } from '../api/rbd.service';
import { FinishedTask } from '../models/finished-task';
import { TaskException } from '../models/task-exception';
@@ -14,7 +14,7 @@ describe('TaskManagerMessageService', () => {
let finishedTask: FinishedTask;
configureTestBed({
- providers: [TaskMessageService, i18nProviders, RbdService],
+ providers: [TaskMessageService, RbdService],
imports: [HttpClientTestingModule]
});
@@ -247,7 +247,7 @@ describe('TaskManagerMessageService', () => {
finishedTask.name = 'rbd/trash/restore';
testMessages(
new TaskMessageOperation('Restoring', 'restore', 'Restored'),
- `image '${metadata.image_id_spec}' ` + `into '${metadata.new_image_name}'`
+ `image '${metadata.image_id_spec}' into '${metadata.new_image_name}'`
);
testErrorCode(17, `Image name '${metadata.new_image_name}' is already in use.`);
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts
index 3047a287db3..026765a14ce 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
-import { I18n } from '@ngx-translate/i18n-polyfill';
-
import { Components } from '../enum/components.enum';
import { FinishedTask } from '../models/finished-task';
import { ImageSpec } from '../models/image-spec';
@@ -20,17 +18,12 @@ export class TaskMessageOperation {
}
class TaskMessage {
- i18n: I18n;
-
operation: TaskMessageOperation;
involves: (object: any) => string;
errors: (metadata: any) => object;
failure(metadata: any): string {
- return this.i18n('Failed to {{failure}} {{metadata}}', {
- failure: this.operation.failure,
- metadata: this.involves(metadata)
- });
+ return $localize`Failed to ${this.operation.failure} ${this.involves(metadata)}`;
}
running(metadata: any): string {
@@ -42,12 +35,10 @@ class TaskMessage {
}
constructor(
- i18n: I18n,
operation: TaskMessageOperation,
involves: (metadata: any) => string,
errors?: (metadata: any) => object
) {
- this.i18n = i18n;
this.operation = operation;
this.involves = involves;
this.errors = errors || (() => ({}));
@@ -58,14 +49,12 @@ class TaskMessage {
providedIn: 'root'
})
export class TaskMessageService {
- constructor(private i18n: I18n) {}
-
defaultMessage = this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Executing'), this.i18n('execute'), this.i18n('Executed')),
+ new TaskMessageOperation($localize`Executing`, $localize`execute`, $localize`Executed`),
(metadata) => {
return (
(metadata && (Components[metadata.component] || metadata.component)) ||
- this.i18n('unknown task')
+ $localize`unknown task`
);
},
() => {
@@ -74,48 +63,23 @@ export class TaskMessageService {
);
commonOperations = {
- create: new TaskMessageOperation(
- this.i18n('Creating'),
- this.i18n('create'),
- this.i18n('Created')
- ),
- update: new TaskMessageOperation(
- this.i18n('Updating'),
- this.i18n('update'),
- this.i18n('Updated')
- ),
- delete: new TaskMessageOperation(
- this.i18n('Deleting'),
- this.i18n('delete'),
- this.i18n('Deleted')
- ),
- add: new TaskMessageOperation(this.i18n('Adding'), this.i18n('add'), this.i18n('Added')),
- remove: new TaskMessageOperation(
- this.i18n('Removing'),
- this.i18n('remove'),
- this.i18n('Removed')
- ),
- import: new TaskMessageOperation(
- this.i18n('Importing'),
- this.i18n('import'),
- this.i18n('Imported')
- )
+ create: new TaskMessageOperation($localize`Creating`, $localize`create`, $localize`Created`),
+ update: new TaskMessageOperation($localize`Updating`, $localize`update`, $localize`Updated`),
+ delete: new TaskMessageOperation($localize`Deleting`, $localize`delete`, $localize`Deleted`),
+ add: new TaskMessageOperation($localize`Adding`, $localize`add`, $localize`Added`),
+ remove: new TaskMessageOperation($localize`Removing`, $localize`remove`, $localize`Removed`),
+ import: new TaskMessageOperation($localize`Importing`, $localize`import`, $localize`Imported`)
};
rbd = {
- default: (metadata: any) =>
- this.i18n(`RBD '{{id}}'`, {
- id: `${metadata.image_spec}`
- }),
+ default: (metadata: any) => $localize`RBD '${metadata.image_spec}'`,
create: (metadata: any) => {
const id = new ImageSpec(
metadata.pool_name,
metadata.namespace,
metadata.image_name
).toString();
- return this.i18n(`RBD '{{id}}'`, {
- id: id
- });
+ return $localize`RBD '${id}'`;
},
child: (metadata: any) => {
const id = new ImageSpec(
@@ -123,9 +87,7 @@ export class TaskMessageService {
metadata.child_namespace,
metadata.child_image_name
).toString();
- return this.i18n(`RBD '{{id}}'`, {
- id: id
- });
+ return $localize`RBD '${id}'`;
},
destination: (metadata: any) => {
const id = new ImageSpec(
@@ -133,31 +95,21 @@ export class TaskMessageService {
metadata.dest_namespace,
metadata.dest_image_name
).toString();
- return this.i18n(`RBD '{{id}}'`, {
- id: id
- });
+ return $localize`RBD '${id}'`;
},
snapshot: (metadata: any) =>
- this.i18n(`RBD snapshot '{{id}}'`, {
- id: `${metadata.image_spec}@${metadata.snapshot_name}`
- })
+ $localize`RBD snapshot '${metadata.image_spec}@${metadata.snapshot_name}'`
};
rbd_mirroring = {
- site_name: () => this.i18n('mirroring site name'),
- bootstrap: () => this.i18n('bootstrap token'),
- pool: (metadata: any) =>
- this.i18n(`mirror mode for pool '{{id}}'`, {
- id: `${metadata.pool_name}`
- }),
- pool_peer: (metadata: any) =>
- this.i18n(`mirror peer for pool '{{id}}'`, {
- id: `${metadata.pool_name}`
- })
+ site_name: () => $localize`mirroring site name`,
+ bootstrap: () => $localize`bootstrap token`,
+ pool: (metadata: any) => $localize`mirror mode for pool '${metadata.pool_name}'`,
+ pool_peer: (metadata: any) => $localize`mirror peer for pool '${metadata.pool_name}'`
};
grafana = {
- update_dashboards: () => this.i18n('all dashboards')
+ update_dashboards: () => $localize`all dashboards`
};
messages = {
@@ -169,10 +121,9 @@ export class TaskMessageService {
this.host(metadata)
),
// OSD tasks
- 'osd/create': this.newTaskMessage(this.commonOperations.create, (metadata) =>
- this.i18n(`OSDs (DriveGroups: {{tracking_id}})`, {
- tracking_id: metadata.tracking_id
- })
+ 'osd/create': this.newTaskMessage(
+ this.commonOperations.create,
+ (metadata) => $localize`OSDs (DriveGroups: ${metadata.tracking_id})`
),
'osd/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
this.osd(metadata)
@@ -182,18 +133,14 @@ export class TaskMessageService {
this.commonOperations.create,
(metadata) => this.pool(metadata),
(metadata) => ({
- '17': this.i18n('Name is already used by {{pool_name}}.', {
- pool_name: this.pool(metadata)
- })
+ '17': $localize`Name is already used by ${this.pool(metadata)}.`
})
),
'pool/edit': this.newTaskMessage(
this.commonOperations.update,
(metadata) => this.pool(metadata),
(metadata) => ({
- '17': this.i18n('Name is already used by {{pool_name}}.', {
- pool_name: this.pool(metadata)
- })
+ '17': $localize`Name is already used by ${this.pool(metadata)}.`
})
),
'pool/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
@@ -204,9 +151,7 @@ export class TaskMessageService {
this.commonOperations.create,
(metadata) => this.ecp(metadata),
(metadata) => ({
- '17': this.i18n('Name is already used by {{name}}.', {
- name: this.ecp(metadata)
- })
+ '17': $localize`Name is already used by ${this.ecp(metadata)}.`
})
),
'ecp/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
@@ -217,9 +162,7 @@ export class TaskMessageService {
this.commonOperations.create,
(metadata) => this.crushRule(metadata),
(metadata) => ({
- '17': this.i18n('Name is already used by {{name}}.', {
- name: this.crushRule(metadata)
- })
+ '17': $localize`Name is already used by ${this.crushRule(metadata)}.`
})
),
'crushRule/delete': this.newTaskMessage(this.commonOperations.delete, (metadata) =>
@@ -230,55 +173,37 @@ export class TaskMessageService {
this.commonOperations.create,
this.rbd.create,
(metadata) => ({
- '17': this.i18n('Name is already used by {{rbd_name}}.', {
- rbd_name: this.rbd.create(metadata)
- })
+ '17': $localize`Name is already used by ${this.rbd.create(metadata)}.`
})
),
'rbd/edit': this.newTaskMessage(this.commonOperations.update, this.rbd.default, (metadata) => ({
- '17': this.i18n('Name is already used by {{rbd_name}}.', {
- rbd_name: this.rbd.default(metadata)
- })
+ '17': $localize`Name is already used by ${this.rbd.default(metadata)}.`
})),
'rbd/delete': this.newTaskMessage(
this.commonOperations.delete,
this.rbd.default,
(metadata) => ({
- '16': this.i18n('{{rbd_name}} is busy.', {
- rbd_name: this.rbd.default(metadata)
- }),
- '39': this.i18n('{{rbd_name}} contains snapshots.', {
- rbd_name: this.rbd.default(metadata)
- })
+ '16': $localize`${this.rbd.default(metadata)} is busy.`,
+ '39': $localize`${this.rbd.default(metadata)} contains snapshots.`
})
),
'rbd/clone': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Cloning'), this.i18n('clone'), this.i18n('Cloned')),
+ new TaskMessageOperation($localize`Cloning`, $localize`clone`, $localize`Cloned`),
this.rbd.child,
(metadata) => ({
- '17': this.i18n('Name is already used by {{rbd_name}}.', {
- rbd_name: this.rbd.child(metadata)
- }),
- '22': this.i18n('Snapshot of {{rbd_name}} must be protected.', {
- rbd_name: this.rbd.child(metadata)
- })
+ '17': $localize`Name is already used by ${this.rbd.child(metadata)}.`,
+ '22': $localize`Snapshot of ${this.rbd.child(metadata)} must be protected.`
})
),
'rbd/copy': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Copying'), this.i18n('copy'), this.i18n('Copied')),
+ new TaskMessageOperation($localize`Copying`, $localize`copy`, $localize`Copied`),
this.rbd.destination,
(metadata) => ({
- '17': this.i18n('Name is already used by {{rbd_name}}.', {
- rbd_name: this.rbd.destination(metadata)
- })
+ '17': $localize`Name is already used by ${this.rbd.destination(metadata)}.`
})
),
'rbd/flatten': this.newTaskMessage(
- new TaskMessageOperation(
- this.i18n('Flattening'),
- this.i18n('flatten'),
- this.i18n('Flattened')
- ),
+ new TaskMessageOperation($localize`Flattening`, $localize`flatten`, $localize`Flattened`),
this.rbd.default
),
// RBD snapshot tasks
@@ -286,78 +211,60 @@ export class TaskMessageService {
this.commonOperations.create,
this.rbd.snapshot,
(metadata) => ({
- '17': this.i18n('Name is already used by {{snap_name}}.', {
- snap_name: this.rbd.snapshot(metadata)
- })
+ '17': $localize`Name is already used by ${this.rbd.snapshot(metadata)}.`
})
),
'rbd/snap/edit': this.newTaskMessage(
this.commonOperations.update,
this.rbd.snapshot,
(metadata) => ({
- '16': this.i18n('Cannot unprotect {{snap_name}} because it contains child images.', {
- snap_name: this.rbd.snapshot(metadata)
- })
+ '16': $localize`Cannot unprotect ${this.rbd.snapshot(
+ metadata
+ )} because it contains child images.`
})
),
'rbd/snap/delete': this.newTaskMessage(
this.commonOperations.delete,
this.rbd.snapshot,
(metadata) => ({
- '16': this.i18n(`Cannot delete {{snap_name}} because it's protected.`, {
- snap_name: this.rbd.snapshot(metadata)
- })
+ '16': $localize`Cannot delete ${this.rbd.snapshot(metadata)} because it's protected.`
})
),
'rbd/snap/rollback': this.newTaskMessage(
new TaskMessageOperation(
- this.i18n('Rolling back'),
- this.i18n('rollback'),
- this.i18n('Rolled back')
+ $localize`Rolling back`,
+ $localize`rollback`,
+ $localize`Rolled back`
),
this.rbd.snapshot
),
// RBD trash tasks
'rbd/trash/move': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Moving'), this.i18n('move'), this.i18n('Moved')),
- (metadata) =>
- this.i18n(`image '{{id}}' to trash`, {
- id: metadata.image_spec
- }),
+ new TaskMessageOperation($localize`Moving`, $localize`move`, $localize`Moved`),
+ (metadata) => $localize`image '${metadata.image_spec}' to trash`,
() => ({
- 2: this.i18n('Could not find image.')
+ 2: $localize`Could not find image.`
})
),
'rbd/trash/restore': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Restoring'), this.i18n('restore'), this.i18n('Restored')),
- (metadata) =>
- this.i18n(`image '{{id}}' into '{{new_id}}'`, {
- id: metadata.image_id_spec,
- new_id: metadata.new_image_name
- }),
+ new TaskMessageOperation($localize`Restoring`, $localize`restore`, $localize`Restored`),
+ (metadata) => $localize`image '${metadata.image_id_spec}' into '${metadata.new_image_name}'`,
(metadata) => ({
- 17: this.i18n(`Image name '{{id}}' is already in use.`, {
- id: metadata.new_image_name
- })
+ 17: $localize`Image name '${metadata.new_image_name}' is already in use.`
})
),
'rbd/trash/remove': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Deleting'), this.i18n('delete'), this.i18n('Deleted')),
- (metadata) =>
- this.i18n(`image '{{id}}'`, {
- id: `${metadata.image_id_spec}`
- })
+ new TaskMessageOperation($localize`Deleting`, $localize`delete`, $localize`Deleted`),
+ (metadata) => $localize`image '${metadata.image_id_spec}'`
),
'rbd/trash/purge': this.newTaskMessage(
- new TaskMessageOperation(this.i18n('Purging'), this.i18n('purge'), this.i18n('Purged')),
+ new TaskMessageOperation($localize`Purging`, $localize`purge`, $localize`Purged`),
(metadata) => {
- let message = this.i18n('all pools');
+ let message = $localize`all pools`;
if (metadata.pool_name) {
message = `'${metadata.pool_name}'`;
}
- return this.i18n('images from {{message}}', {
- message: message
- });
+ return $localize`images from ${message}`;
}
),
// RBD mirroring tasks
@@ -380,7 +287,7 @@ export class TaskMessageService {
this.commonOperations.update,
this.rbd_mirroring.pool,
() => ({
- 16: this.i18n('Cannot disable mirroring because it contains a peer.')
+ 16: $localize`Cannot disable mirroring because it contains a peer.`
})
),
'rbd/mirroring/peer/add': this.newTaskMessage(
@@ -423,12 +330,8 @@ export class TaskMessageService {
),
// Orchestrator tasks
'orchestrator/identify_device': this.newTaskMessage(
- new TaskMessageOperation(
- this.i18n('Identifying'),
- this.i18n('identify'),
- this.i18n('Identified')
- ),
- (metadata) => this.i18n(`device '{{device}}' on host '{{hostname}}'`, metadata)
+ new TaskMessageOperation($localize`Identifying`, $localize`identify`, $localize`Identified`),
+ (metadata) => $localize`device '${metadata.device}' on host '${metadata.hostname}'`
)
};
@@ -437,43 +340,37 @@ export class TaskMessageService {
involves: (metadata: any) => string,
errors?: (metadata: any) => object
) {
- return new TaskMessage(this.i18n, operation, involves, errors);
+ return new TaskMessage(operation, involves, errors);
}
host(metadata: any) {
- return this.i18n(`host '{{hostname}}'`, {
- hostname: metadata.hostname
- });
+ return $localize`host '${metadata.hostname}'`;
}
osd(metadata: any) {
- return this.i18n(`OSD '{{svc_id}}'`, {
- svc_id: metadata.svc_id
- });
+ return $localize`OSD '${metadata.svc_id}'`;
}
pool(metadata: any) {
- return this.i18n(`pool '{{pool_name}}'`, {
- pool_name: metadata.pool_name
- });
+ return $localize`pool '${metadata.pool_name}'`;
}
ecp(metadata: any) {
- return this.i18n(`erasure code profile '{{name}}'`, { name: metadata.name });
+ return $localize`erasure code profile '${metadata.name}'`;
}
crushRule(metadata: any) {
- return this.i18n(`crush rule '{{name}}'`, { name: metadata.name });
+ return $localize`crush rule '${metadata.name}'`;
}
iscsiTarget(metadata: any) {
- return this.i18n(`target '{{target_iqn}}'`, { target_iqn: metadata.target_iqn });
+ return $localize`target '${metadata.target_iqn}'`;
}
nfs(metadata: any) {
- return this.i18n(`NFS {{nfs_id}}`, {
- nfs_id: `'${metadata.cluster_id}:${metadata.export_id ? metadata.export_id : metadata.path}'`
- });
+ return $localize`NFS '${metadata.cluster_id}\:${
+ metadata.export_id ? metadata.export_id : metadata.path
+ }'`;
}
_getTaskTitle(task: Task) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts
index 698b2affa2c..2d64dd191da 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts
@@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ToastrModule } from 'ngx-toastr';
import { Observable } from 'rxjs';
-import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '../../../testing/unit-test-helper';
import { FinishedTask } from '../models/finished-task';
import { SharedModule } from '../shared.module';
import { NotificationService } from './notification.service';
@@ -18,7 +18,7 @@ describe('TaskWrapperService', () => {
configureTestBed({
imports: [HttpClientTestingModule, ToastrModule.forRoot(), SharedModule, RouterTestingModule],
- providers: [TaskWrapperService, i18nProviders]
+ providers: [TaskWrapperService]
});
beforeEach(inject([TaskWrapperService], (wrapper: TaskWrapperService) => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/index.html b/src/pybind/mgr/dashboard/frontend/src/index.html
index f314e2c53a8..bfd6d3ecd83 100644
--- a/src/pybind/mgr/dashboard/frontend/src/index.html
+++ b/src/pybind/mgr/dashboard/frontend/src/index.html
@@ -9,7 +9,7 @@
</script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="icon" type="image/x-icon" href="favicon.ico">
+ <link rel="icon" type="image/x-icon" id="cdFavicon" href="favicon.ico">
</head>
<body>
<noscript>
diff --git a/src/pybind/mgr/dashboard/frontend/src/setupJest.ts b/src/pybind/mgr/dashboard/frontend/src/setupJest.ts
index 9ff62e11236..8fc004375a2 100644
--- a/src/pybind/mgr/dashboard/frontend/src/setupJest.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/setupJest.ts
@@ -1,3 +1,5 @@
+import '@angular/localize/init';
+
import 'jest-preset-angular';
import './jestGlobalMocks';
diff --git a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts
index da024dc1990..c260a6fe0c1 100644
--- a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts
@@ -1,11 +1,10 @@
-import { DebugElement, LOCALE_ID, TRANSLATIONS, TRANSLATIONS_FORMAT, Type } from '@angular/core';
+import { DebugElement, Type } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AbstractControl } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
import { NgbModal, NgbNav, NgbNavItem } from '@ng-bootstrap/ng-bootstrap';
-import { I18n } from '@ngx-translate/i18n-polyfill';
import { configureTestSuite } from 'ng-bullet';
import { InventoryDevice } from '../app/ceph/cluster/inventory/inventory-devices/inventory-device.model';
@@ -339,24 +338,6 @@ export class PrometheusHelper {
}
}
-const XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
-<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
- <file source-language="en" datatype="plaintext" original="ng2.template">
- <body>
- </body>
- </file>
-</xliff>
-`;
-
-const i18nProviders = [
- { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' },
- { provide: TRANSLATIONS, useValue: XLIFF },
- { provide: LOCALE_ID, useValue: 'en' },
- I18n
-];
-
-export { i18nProviders };
-
export function expectItemTasks(item: any, executing: string, percentage?: number) {
if (executing) {
executing = executing + '...';
diff --git a/src/pybind/mgr/orchestrator/__init__.py b/src/pybind/mgr/orchestrator/__init__.py
index fa32bc4850d..2d6cba8a156 100644
--- a/src/pybind/mgr/orchestrator/__init__.py
+++ b/src/pybind/mgr/orchestrator/__init__.py
@@ -14,5 +14,6 @@ from ._interface import \
OrchestratorValidationError, OrchestratorError, NoOrchestrator, \
ServiceDescription, InventoryFilter, HostSpec, \
DaemonDescription, \
+ OrchestratorEvent, set_exception_subject, \
InventoryHost, DeviceLightLoc, \
UpgradeStatusSpec
diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py
index 7ca1438310b..ab9b5539b0e 100644
--- a/src/pybind/mgr/orchestrator/_interface.py
+++ b/src/pybind/mgr/orchestrator/_interface.py
@@ -15,6 +15,7 @@ import time
import uuid
from collections import namedtuple, OrderedDict
+from contextlib import contextmanager
from functools import wraps
import yaml
@@ -46,6 +47,10 @@ class OrchestratorError(Exception):
It's not intended for programming errors or orchestrator internal errors.
"""
+ def __init__(self, msg, event_kind_subject: Optional[Tuple[str, str]]=None):
+ super(Exception, self).__init__(msg)
+ # See OrchestratorEvent.subject
+ self.event_subject = event_kind_subject
class NoOrchestrator(OrchestratorError):
@@ -62,6 +67,16 @@ class OrchestratorValidationError(OrchestratorError):
"""
+@contextmanager
+def set_exception_subject(kind, subject, overwrite=False):
+ try:
+ yield
+ except OrchestratorError as e:
+ if overwrite or hasattr(e, 'event_subject'):
+ e.event_subject = (kind, subject)
+ raise
+
+
def handle_exception(prefix, cmd_args, desc, perm, func):
@wraps(func)
def wrapper(*args, **kwargs):
@@ -1222,7 +1237,9 @@ class DaemonDescription(object):
started=None,
last_configured=None,
osdspec_affinity=None,
- last_deployed=None):
+ last_deployed=None,
+ events: Optional[List['OrchestratorEvent']]=None):
+
# Host is at the same granularity as InventoryHost
self.hostname: str = hostname
@@ -1262,6 +1279,8 @@ class DaemonDescription(object):
# Affinity to a certain OSDSpec
self.osdspec_affinity = osdspec_affinity # type: Optional[str]
+ self.events: List[OrchestratorEvent] = events or []
+
def name(self):
return '%s.%s' % (self.daemon_type, self.daemon_id)
@@ -1339,6 +1358,9 @@ class DaemonDescription(object):
if getattr(self, k):
out[k] = getattr(self, k).strftime(DATEFMT)
+ if self.events:
+ out['events'] = [e.to_json() for e in self.events]
+
empty = [k for k, v in out.items() if v is None]
for e in empty:
del out[e]
@@ -1348,11 +1370,13 @@ class DaemonDescription(object):
@handle_type_error
def from_json(cls, data):
c = data.copy()
+ event_strs = c.pop('events', [])
for k in ['last_refresh', 'created', 'started', 'last_deployed',
'last_configured']:
if k in c:
c[k] = datetime.datetime.strptime(c[k], DATEFMT)
- return cls(**c)
+ events = [OrchestratorEvent.from_json(e) for e in event_strs]
+ return cls(events=events, **c)
def __copy__(self):
# feel free to change this:
@@ -1387,7 +1411,8 @@ class ServiceDescription(object):
last_refresh=None,
created=None,
size=0,
- running=0):
+ running=0,
+ events: Optional[List['OrchestratorEvent']]=None):
# Not everyone runs in containers, but enough people do to
# justify having the container_image_id (image hash) and container_image
# (image name)
@@ -1414,6 +1439,8 @@ class ServiceDescription(object):
self.spec: ServiceSpec = spec
+ self.events: List[OrchestratorEvent] = events or []
+
def service_type(self):
return self.spec.service_type
@@ -1430,13 +1457,15 @@ class ServiceDescription(object):
'size': self.size,
'running': self.running,
'last_refresh': self.last_refresh,
- 'created': self.created
+ 'created': self.created,
}
for k in ['last_refresh', 'created']:
if getattr(self, k):
status[k] = getattr(self, k).strftime(DATEFMT)
status = {k: v for (k, v) in status.items() if v is not None}
out['status'] = status
+ if self.events:
+ out['events'] = [e.to_json() for e in self.events]
return out
@classmethod
@@ -1444,13 +1473,15 @@ class ServiceDescription(object):
def from_json(cls, data: dict):
c = data.copy()
status = c.pop('status', {})
+ event_strs = c.pop('events', [])
spec = ServiceSpec.from_json(c)
c_status = status.copy()
for k in ['last_refresh', 'created']:
if k in c_status:
c_status[k] = datetime.datetime.strptime(c_status[k], DATEFMT)
- return cls(spec=spec, **c_status)
+ events = [OrchestratorEvent.from_json(e) for e in event_strs]
+ return cls(spec=spec, events=events, **c_status)
@staticmethod
def yaml_representer(dumper: 'yaml.SafeDumper', data: 'DaemonDescription'):
@@ -1558,6 +1589,60 @@ class DeviceLightLoc(namedtuple('DeviceLightLoc', ['host', 'dev', 'path'])):
__slots__ = ()
+class OrchestratorEvent:
+ """
+ Similar to K8s Events.
+
+ Some form of "important" log message attached to something.
+ """
+ INFO = 'INFO'
+ ERROR = 'ERROR'
+ regex_v1 = re.compile(r'^([^ ]+) ([^:]+):([^ ]+) \[([^\]]+)\] "(.*)"$')
+
+ def __init__(self, created: Union[str, datetime.datetime], kind, subject, level, message):
+ if isinstance(created, str):
+ created = datetime.datetime.strptime(created, DATEFMT)
+ self.created: datetime.datetime = created
+
+ assert kind in "service daemon".split()
+ self.kind: str = kind
+
+ # service name, or daemon danem or something
+ self.subject: str = subject
+
+ # Events are not meant for debugging. debugs should end in the log.
+ assert level in "INFO ERROR".split()
+ self.level = level
+
+ self.message: str = message
+
+ __slots__ = ('created', 'kind', 'subject', 'level', 'message')
+
+ def kind_subject(self) -> str:
+ return f'{self.kind}:{self.subject}'
+
+ def to_json(self) -> str:
+ # Make a long list of events readable.
+ created = self.created.strftime(DATEFMT)
+ return f'{created} {self.kind_subject()} [{self.level}] "{self.message}"'
+
+
+ @classmethod
+ @handle_type_error
+ def from_json(cls, data) -> "OrchestratorEvent":
+ """
+ >>> OrchestratorEvent.from_json('''2020-06-10T10:20:25.691255 daemon:crash.ubuntu [INFO] "Deployed crash.ubuntu on host 'ubuntu'"''').to_json()
+ '2020-06-10T10:20:25.691255 daemon:crash.ubuntu [INFO] "Deployed crash.ubuntu on host \\'ubuntu\\'"'
+
+ :param data:
+ :return:
+ """
+ match = cls.regex_v1.match(data)
+ if match:
+ return cls(*match.groups())
+ raise ValueError(f'Unable to match: "{data}"')
+
+
def _mk_orch_methods(cls):
# Needs to be defined outside of for.
# Otherwise meth is always bound to last key
diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py
index 3096d0fe890..cd72bf4b975 100644
--- a/src/pybind/mgr/orchestrator/module.py
+++ b/src/pybind/mgr/orchestrator/module.py
@@ -310,7 +310,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule):
out = []
table = PrettyTable(
- ['HOST', 'PATH', 'TYPE', 'SIZE', 'DEVICE', 'AVAIL',
+ ['HOST', 'PATH', 'TYPE', 'SIZE', 'DEVICE_ID', 'MODEL', 'VENDOR', 'ROTATIONAL', 'AVAIL',
'REJECT REASONS'],
border=False)
table.align = 'l'
@@ -326,6 +326,9 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule):
d.human_readable_type,
format_bytes(d.sys_api.get('size', 0), 5),
d.device_id,
+ d.sys_api.get('model') or 'n/a',
+ d.sys_api.get('vendor') or 'n/a',
+ d.sys_api.get('rotational') or 'n/a',
d.available,
', '.join(d.rejected_reasons)
)
@@ -1278,14 +1281,14 @@ Usage:
raise_if_exception(e1)
assert False
except ZeroDivisionError as e:
- assert e.args == ('hello', 'world')
+ assert e.args == ('hello, world',)
e2 = self.remote('selftest', 'remote_from_orchestrator_cli_self_test', "OrchestratorError")
try:
raise_if_exception(e2)
assert False
except OrchestratorError as e:
- assert e.args == ('hello', 'world')
+ assert e.args == ('hello, world',)
c = TrivialReadCompletion(result=True)
assert c.has_result
diff --git a/src/pybind/mgr/orchestrator/tests/test_orchestrator.py b/src/pybind/mgr/orchestrator/tests/test_orchestrator.py
index f2ce931de21..1dd6a964a90 100644
--- a/src/pybind/mgr/orchestrator/tests/test_orchestrator.py
+++ b/src/pybind/mgr/orchestrator/tests/test_orchestrator.py
@@ -250,6 +250,9 @@ daemon_id: ubuntu
hostname: ubuntu
status: 1
status_desc: starting
+events:
+- 2020-06-10T10:08:22.933241 daemon:crash.ubuntu [INFO] "Deployed crash.ubuntu on
+ host 'ubuntu'"
---
service_type: crash
service_name: crash
@@ -262,6 +265,8 @@ status:
last_refresh: '2020-06-10T10:57:40.715637'
running: 1
size: 1
+events:
+- 2020-06-10T10:37:31.139159 service:crash [INFO] "service was created"
"""
types = (DaemonDescription, ServiceDescription)
diff --git a/src/pybind/mgr/osd_support/__init__.py b/src/pybind/mgr/osd_support/__init__.py
index 88ed2b9f57c..f4f9e26e064 100644
--- a/src/pybind/mgr/osd_support/__init__.py
+++ b/src/pybind/mgr/osd_support/__init__.py
@@ -1 +1,7 @@
+import os
+
+if 'UNITTEST' in os.environ:
+ import tests
+ tests.mock_ceph_modules() # type: ignore
+
from .module import OSDSupport
diff --git a/src/pybind/mgr/osd_support/module.py b/src/pybind/mgr/osd_support/module.py
index 5b743200e00..a219ca868cc 100644
--- a/src/pybind/mgr/osd_support/module.py
+++ b/src/pybind/mgr/osd_support/module.py
@@ -188,10 +188,13 @@ class OSDSupport(MgrModule):
self.run = False
self.event.set()
+ def get_osds_in_cluster(self) -> List[str]:
+ osd_map = self.get_osdmap()
+ return [x.get('osd') for x in osd_map.dump().get('osds', [])]
+
def osds_not_in_cluster(self, osd_ids: List[int]) -> Set[int]:
self.log.info(f"Checking if provided osds <{osd_ids}> exist in the cluster")
- osd_map = self.get_osdmap()
- cluster_osds = [x.get('osd') for x in osd_map.dump().get('osds', [])]
+ cluster_osds = self.get_osds_in_cluster()
not_in_cluster = set()
for osd_id in osd_ids:
if int(osd_id) not in cluster_osds:
@@ -235,7 +238,7 @@ class OSDSupport(MgrModule):
osd_df = self.osd_df()
osd_nodes = osd_df.get('nodes', [])
for osd_node in osd_nodes:
- if osd_node.get('id', None) == int(osd_id):
+ if osd_node.get('id') == int(osd_id):
return osd_node.get('pgs', -1)
return -1
@@ -243,8 +246,9 @@ class OSDSupport(MgrModule):
osd_df = self.osd_df()
osd_nodes = osd_df.get('nodes', [])
for osd_node in osd_nodes:
- if osd_node.get('id', None) == int(osd_id):
- return float(osd_node.get('crush_weight'))
+ if osd_node.get('id') == int(osd_id):
+ if 'crush_weight' in osd_node:
+ return float(osd_node.get('crush_weight'))
return -1.0
def reweight_osd(self, osd_id: int, weight: float = 0.0) -> bool:
diff --git a/src/pybind/mgr/osd_support/tests/__init__.py b/src/pybind/mgr/osd_support/tests/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/pybind/mgr/osd_support/tests/__init__.py
diff --git a/src/pybind/mgr/osd_support/tests/fixtures.py b/src/pybind/mgr/osd_support/tests/fixtures.py
new file mode 100644
index 00000000000..e948a3af14c
--- /dev/null
+++ b/src/pybind/mgr/osd_support/tests/fixtures.py
@@ -0,0 +1,14 @@
+from osd_support import OSDSupport
+import pytest
+
+from tests import mock
+
+
+@pytest.yield_fixture()
+def osd_support_module():
+ with mock.patch("osd_support.module.OSDSupport.get_osdmap"), \
+ mock.patch("osd_support.module.OSDSupport.osd_df"), \
+ mock.patch("osd_support.module.OSDSupport.mon_command", return_value=(0, '', '')):
+ m = OSDSupport.__new__(OSDSupport)
+ m.__init__('osd_support', 0, 0)
+ yield m
diff --git a/src/pybind/mgr/osd_support/tests/test_osd_support.py b/src/pybind/mgr/osd_support/tests/test_osd_support.py
new file mode 100644
index 00000000000..208a3e896d5
--- /dev/null
+++ b/src/pybind/mgr/osd_support/tests/test_osd_support.py
@@ -0,0 +1,144 @@
+import pytest
+from .fixtures import osd_support_module as osdsf
+from tests import mock
+
+
+class TestOSDSupport:
+
+ def test_init(self, osdsf):
+ assert osdsf.osd_ids == set()
+ assert osdsf.emptying_osds == set()
+ assert osdsf.check_osds == set()
+ assert osdsf.empty == set()
+
+ def test_osds_not_in_cluster(self, osdsf):
+ assert osdsf.osds_not_in_cluster([1, 2]) == {1, 2}
+
+ @mock.patch("osd_support.module.OSDSupport.get_osds_in_cluster")
+ def test_osds_in_cluster(self, osds_in_cluster, osdsf):
+ osds_in_cluster.return_value = [1]
+ assert osdsf.osds_not_in_cluster([1, 2]) == {2}
+
+ @pytest.mark.parametrize(
+ "is_empty, osd_ids, expected",
+ [
+ (False, {1, 2}, []),
+ (True, {1, 2}, [1, 2]),
+ (None, {1, 2}, []),
+ ]
+ )
+ def test_empty_osd(self, osdsf, is_empty, osd_ids, expected):
+ with mock.patch("osd_support.module.OSDSupport.is_empty", return_value=is_empty):
+ assert osdsf.empty_osds(osd_ids) == expected
+
+ @pytest.mark.parametrize(
+ "pg_count, expected",
+ [
+ (0, True),
+ (1, False),
+ (-1, False),
+ (9999999999999, False),
+ ]
+ )
+ def test_is_emtpy(self, pg_count, expected, osdsf):
+ with mock.patch("osd_support.module.OSDSupport.get_pg_count", return_value=pg_count):
+ assert osdsf.is_empty(1) == expected
+
+ @pytest.mark.parametrize(
+ "osd_ids, reweight_out, expected",
+ [
+ ({1}, [False], False),
+ ({1}, [True], True),
+ ({1, 2}, [True, True], True),
+ ({1, 2}, [True, False], False),
+ ]
+ )
+ def test_reweight_osds(self, osdsf, osd_ids, reweight_out, expected):
+ with mock.patch("osd_support.module.OSDSupport.reweight_osd", side_effect=reweight_out):
+ assert osdsf.reweight_osds(osd_ids) == expected
+
+ @pytest.mark.parametrize(
+ "osd_id, osd_df, expected",
+ [
+ # missing 'nodes' key
+ (1, dict(nodes=[]), -1),
+ # missing 'pgs' key
+ (1, dict(nodes=[dict(id=1)]), -1),
+ # id != osd_id
+ (1, dict(nodes=[dict(id=999, pgs=1)]), -1),
+ # valid
+ (1, dict(nodes=[dict(id=1, pgs=1)]), 1),
+ ]
+ )
+ def test_get_pg_count(self, osdsf, osd_id, osd_df, expected):
+ with mock.patch("osd_support.module.OSDSupport.osd_df", return_value=osd_df):
+ assert osdsf.get_pg_count(osd_id) == expected
+
+ @pytest.mark.parametrize(
+ "osd_id, osd_df, expected",
+ [
+ # missing 'nodes' key
+ (1, dict(nodes=[]), -1.0),
+ # missing 'crush_weight' key
+ (1, dict(nodes=[dict(id=1)]), -1.0),
+ # id != osd_id
+ (1, dict(nodes=[dict(id=999, crush_weight=1)]), -1.0),
+ # valid
+ (1, dict(nodes=[dict(id=1, crush_weight=1)]), float(1)),
+ ]
+ )
+ def test_get_osd_weight(self, osdsf, osd_id, osd_df, expected):
+ with mock.patch("osd_support.module.OSDSupport.osd_df", return_value=osd_df):
+ assert osdsf.get_osd_weight(osd_id) == expected
+
+ @pytest.mark.parametrize(
+ "osd_id, initial_osd_weight, mon_cmd_return, weight, expected",
+ [
+ # is already weighted correctly
+ (1, 1.0, (0, '', ''), 1.0, True),
+ # needs reweight, no errors in mon_cmd
+ (1, 2.0, (0, '', ''), 1.0, True),
+ # needs reweight, errors in mon_cmd
+ (1, 2.0, (1, '', ''), 1.0, False),
+ ]
+ )
+ def test_reweight_osd(self, osdsf, osd_id, initial_osd_weight, mon_cmd_return, weight, expected):
+ with mock.patch("osd_support.module.OSDSupport.get_osd_weight", return_value=initial_osd_weight),\
+ mock.patch("osd_support.module.OSDSupport.mon_command", return_value=mon_cmd_return):
+ assert osdsf.reweight_osd(osd_id, weight=weight) == expected
+
+ @pytest.mark.parametrize(
+ "osd_ids, ok_to_stop, expected",
+ [
+ # no osd_ids provided
+ ({}, [], set()),
+ # all osds are ok_to_stop
+ ({1, 2}, [True], {1, 2}),
+ # osds are ok_to_stop after the second iteration
+ ({1, 2}, [False, True], {2}),
+ # osds are never ok_to_stop, (taking the sample size `(len(osd_ids))` into account),
+ # expected to get a empty set()
+ ({1, 2}, [False, False], set()),
+ ]
+ )
+ def test_find_stop_threshold(self, osdsf, osd_ids, ok_to_stop, expected):
+ with mock.patch("osd_support.module.OSDSupport.ok_to_stop", side_effect=ok_to_stop):
+ assert osdsf.find_osd_stop_threshold(osd_ids) == expected
+
+ @pytest.mark.parametrize(
+ "osd_ids, mon_cmd_return, expected",
+ [
+ # ret is 0
+ ([1], (0, '', ''), True),
+ # no input yields True
+ ([], (0, '', ''), True),
+ # ret is != 0
+ ([1], (-1, '', ''), False),
+ # no input, but ret != 0
+ ([], (-1, '', ''), False),
+ ]
+ )
+ def test_ok_to_stop(self, osdsf, osd_ids, mon_cmd_return, expected):
+ with mock.patch("osd_support.module.OSDSupport.mon_command", return_value=mon_cmd_return):
+ assert osdsf.ok_to_stop(osd_ids) == expected
+
diff --git a/src/pybind/mgr/selftest/module.py b/src/pybind/mgr/selftest/module.py
index c6decf2fc8c..6603a603e7e 100644
--- a/src/pybind/mgr/selftest/module.py
+++ b/src/pybind/mgr/selftest/module.py
@@ -431,11 +431,11 @@ class Module(MgrModule):
import orchestrator
if what == 'OrchestratorError':
c = orchestrator.TrivialReadCompletion(result=None)
- c.fail(orchestrator.OrchestratorError('hello', 'world'))
+ c.fail(orchestrator.OrchestratorError('hello, world'))
return c
elif what == "ZeroDivisionError":
c = orchestrator.TrivialReadCompletion(result=None)
- c.fail(ZeroDivisionError('hello', 'world'))
+ c.fail(ZeroDivisionError('hello, world'))
return c
assert False, repr(what)
diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py
index a0cdbecccf3..76d660ae652 100644
--- a/src/pybind/mgr/volumes/module.py
+++ b/src/pybind/mgr/volumes/module.py
@@ -256,7 +256,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
{
'cmd': 'nfs export create cephfs '
'name=fsname,type=CephString '
- 'name=attach,type=CephString '
+ 'name=clusterid,type=CephString '
'name=binding,type=CephString '
'name=readonly,type=CephBool,req=false '
'name=path,type=CephString,req=false ',
@@ -265,7 +265,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
},
{
'cmd': 'nfs export delete '
- 'name=attach,type=CephString '
+ 'name=clusterid,type=CephString '
'name=binding,type=CephString ',
'desc': "Delete a cephfs export",
'perm': 'rw'
@@ -507,11 +507,11 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
def _cmd_nfs_export_create_cephfs(self, inbuf, cmd):
#TODO Extend export creation for rgw.
- return self.fs_export.create_export(fs_name=cmd['fsname'], cluster_id=cmd['attach'],
+ return self.fs_export.create_export(fs_name=cmd['fsname'], cluster_id=cmd['clusterid'],
pseudo_path=cmd['binding'], read_only=cmd.get('readonly', False), path=cmd.get('path', '/'))
def _cmd_nfs_export_delete(self, inbuf, cmd):
- return self.fs_export.delete_export(cluster_id=cmd['attach'], pseudo_path=cmd['binding'])
+ return self.fs_export.delete_export(cluster_id=cmd['clusterid'], pseudo_path=cmd['binding'])
def _cmd_nfs_export_ls(self, inbuf, cmd):
return self.fs_export.list_exports(cluster_id=cmd['clusterid'], detailed=cmd.get('detailed', False))
diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py
index 85da04bf297..2386dca2bad 100644
--- a/src/python-common/ceph/deployment/drive_group.py
+++ b/src/python-common/ceph/deployment/drive_group.py
@@ -143,7 +143,7 @@ class DriveGroupSpec(ServiceSpec):
"db_slots", "wal_slots", "block_db_size", "placement", "service_id", "service_type",
"data_devices", "db_devices", "wal_devices", "journal_devices",
"data_directories", "osds_per_device", "objectstore", "osd_id_claims",
- "journal_size", "unmanaged"
+ "journal_size", "unmanaged", "filter_logic"
]
def __init__(self,
@@ -165,6 +165,7 @@ class DriveGroupSpec(ServiceSpec):
journal_size=None, # type: Optional[int]
service_type=None, # type: Optional[str]
unmanaged=False, # type: bool
+ filter_logic='AND' # type: str
):
assert service_type is None or service_type == 'osd'
super(DriveGroupSpec, self).__init__('osd', service_id=service_id,
@@ -215,6 +216,10 @@ class DriveGroupSpec(ServiceSpec):
#: See :ref:`orchestrator-osd-replace`
self.osd_id_claims = osd_id_claims or dict()
+ #: The logic gate we use to match disks with filters.
+ #: defaults to 'AND'
+ self.filter_logic = filter_logic.upper()
+
@classmethod
def _from_json_impl(cls, json_drive_group):
# type: (dict) -> DriveGroupSpec
@@ -297,6 +302,9 @@ class DriveGroupSpec(ServiceSpec):
if self.block_db_size is not None and type(self.block_db_size) != int:
raise DriveGroupValidationError('block_db_size must be of type int')
+ if self.filter_logic not in ['AND', 'OR']:
+ raise DriveGroupValidationError('filter_logic must be either <AND> or <OR>')
+
def __repr__(self):
keys = [
key for key in self._supported_features if getattr(self, key) is not None
diff --git a/src/python-common/ceph/deployment/drive_selection/selector.py b/src/python-common/ceph/deployment/drive_selection/selector.py
index cdc21caa52f..921f125616c 100644
--- a/src/python-common/ceph/deployment/drive_selection/selector.py
+++ b/src/python-common/ceph/deployment/drive_selection/selector.py
@@ -134,11 +134,19 @@ class DriveSelection(object):
if disk in devices:
continue
- if not all(m.compare(disk) for m in FilterGenerator(device_filter)):
- logger.debug(
- "Ignoring disk {}. Filter did not match".format(
- disk.path))
- continue
+ if self.spec.filter_logic == 'AND':
+ if not all(m.compare(disk) for m in FilterGenerator(device_filter)):
+ logger.debug(
+ "Ignoring disk {}. Not all filter did match the disk".format(
+ disk.path))
+ continue
+
+ if self.spec.filter_logic == 'OR':
+ if not any(m.compare(disk) for m in FilterGenerator(device_filter)):
+ logger.debug(
+ "Ignoring disk {}. No filter matched the disk".format(
+ disk.path))
+ continue
logger.debug('Adding disk {}'.format(disk.path))
devices.append(disk)
diff --git a/src/python-common/ceph/tests/test_drive_group.py b/src/python-common/ceph/tests/test_drive_group.py
index ba3cd6ec949..85b2f3c217c 100644
--- a/src/python-common/ceph/tests/test_drive_group.py
+++ b/src/python-common/ceph/tests/test_drive_group.py
@@ -43,6 +43,16 @@ placement:
host_pattern: '*'
data_devices:
limit: 1
+"""),
+
+ yaml.safe_load("""
+service_type: osd
+service_id: mydg
+placement:
+ host_pattern: '*'
+data_devices:
+ all: True
+filter_logic: XOR
""")
)
])
@@ -182,3 +192,19 @@ def test_ceph_volume_command_7():
sel = drive_selection.DriveSelection(spec, inventory)
cmd = translate.to_ceph_volume(sel, ['0', '1']).run()
assert cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --osd-ids 0 1 --yes --no-systemd'
+
+
+def test_ceph_volume_command_8():
+ spec = DriveGroupSpec(placement=PlacementSpec(host_pattern='*'),
+ data_devices=DeviceSelection(rotational=True, model='INTEL SSDS'),
+ db_devices=DeviceSelection(model='INTEL SSDP'),
+ filter_logic='OR',
+ osd_id_claims={}
+ )
+ inventory = _mk_inventory(_mk_device(rotational=True, size='1.82 TB', model='ST2000DM001-1ER1') + # data
+ _mk_device(rotational=False, size="223.0 GB", model='INTEL SSDSC2KG24') + # data
+ _mk_device(rotational=False, size="349.0 GB", model='INTEL SSDPED1K375GA') # wal/db
+ )
+ sel = drive_selection.DriveSelection(spec, inventory)
+ cmd = translate.to_ceph_volume(sel, []).run()
+ assert cmd == 'lvm batch --no-auto /dev/sda /dev/sdb --db-devices /dev/sdc --yes --no-systemd'
diff --git a/src/python-common/ceph/tests/test_service_spec.py b/src/python-common/ceph/tests/test_service_spec.py
index 7d12ff5d358..5f15ae45a90 100644
--- a/src/python-common/ceph/tests/test_service_spec.py
+++ b/src/python-common/ceph/tests/test_service_spec.py
@@ -151,6 +151,7 @@ spec:
model: MC-55-44-XZ
db_devices:
model: SSD-123-foo
+ filter_logic: AND
objectstore: bluestore
wal_devices:
model: NVME-QQQQ-987
diff --git a/src/python-common/ceph/tests/utils.py b/src/python-common/ceph/tests/utils.py
index ebba43094bc..04b8a4e3895 100644
--- a/src/python-common/ceph/tests/utils.py
+++ b/src/python-common/ceph/tests/utils.py
@@ -8,12 +8,14 @@ except ImportError:
def _mk_device(rotational=True,
locked=False,
- size="394.27 GB"):
+ size="394.27 GB",
+ vendor='Vendor',
+ model='Model'):
return [Device(
path='??',
sys_api={
"rotational": '1' if rotational else '0',
- "vendor": "Vendor",
+ "vendor": vendor,
"human_readable_size": size,
"partitions": {},
"locked": int(locked),
@@ -21,7 +23,7 @@ def _mk_device(rotational=True,
"removable": "0",
"path": "??",
"support_discard": "",
- "model": "Model",
+ "model": model,
"ro": "0",
"nr_requests": "128",
"size": 423347879936 # ignore coversion from human_readable_size
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index 2bdc9726c87..f550afac0e2 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -1342,28 +1342,19 @@ int set_user_quota(OPT opt_cmd, RGWUser& user, RGWUserAdminOpState& op_state, in
return 0;
}
-int check_min_obj_stripe_size(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, rgw_obj& obj, uint64_t min_stripe_size, bool *need_rewrite)
+int check_min_obj_stripe_size(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, rgw::sal::RGWObject* obj, uint64_t min_stripe_size, bool *need_rewrite)
{
- map<string, bufferlist> attrs;
- uint64_t obj_size;
-
RGWObjectCtx obj_ctx(store);
- RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj);
- RGWRados::Object::Read read_op(&op_target);
-
- read_op.params.attrs = &attrs;
- read_op.params.obj_size = &obj_size;
-
- int ret = read_op.prepare(null_yield);
+ int ret = obj->get_obj_attrs(&obj_ctx, null_yield);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << dendl;
return ret;
}
map<string, bufferlist>::iterator iter;
- iter = attrs.find(RGW_ATTR_MANIFEST);
- if (iter == attrs.end()) {
- *need_rewrite = (obj_size >= min_stripe_size);
+ iter = obj->get_attrs().find(RGW_ATTR_MANIFEST);
+ if (iter == obj->get_attrs().attrs.end()) {
+ *need_rewrite = (obj->get_obj_size() >= min_stripe_size);
return 0;
}
@@ -3100,8 +3091,8 @@ int main(int argc, const char **argv)
map<int, string> temp_url_keys;
string bucket_id;
string new_bucket_name;
- Formatter *formatter = NULL;
- Formatter *zone_formatter = nullptr;
+ std::unique_ptr<Formatter> formatter;
+ std::unique_ptr<Formatter> zone_formatter;
int purge_data = false;
int pretty_format = false;
int show_log_entries = true;
@@ -3763,21 +3754,21 @@ int main(int argc, const char **argv)
}
if (format == "xml")
- formatter = new XMLFormatter(pretty_format);
+ formatter = make_unique<XMLFormatter>(new XMLFormatter(pretty_format));
else if (format == "json")
- formatter = new JSONFormatter(pretty_format);
+ formatter = make_unique<JSONFormatter>(new JSONFormatter(pretty_format));
else {
cerr << "unrecognized format: " << format << std::endl;
exit(1);
}
- zone_formatter = new JSONFormatter_PrettyZone(pretty_format);
+ zone_formatter = std::make_unique<JSONFormatter_PrettyZone>(new JSONFormatter_PrettyZone(pretty_format));
realm_name = g_conf()->rgw_realm;
zone_name = g_conf()->rgw_zone;
zonegroup_name = g_conf()->rgw_zonegroup;
- RGWStreamFlusher f(formatter, cout);
+ RGWStreamFlusher f(formatter.get(), cout);
// not a raw op if 'period update' needs to commit to master
bool raw_period_update = opt_cmd == OPT::PERIOD_UPDATE && !commit;
@@ -3955,7 +3946,7 @@ int main(int argc, const char **argv)
cerr << "period init failed: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("period", period, formatter);
+ encode_json("period", period, formatter.get());
formatter->flush(cout);
}
break;
@@ -3966,7 +3957,7 @@ int main(int argc, const char **argv)
return -ret;
}
formatter->open_object_section("period_get_current");
- encode_json("current_period", period_id, formatter);
+ encode_json("current_period", period_id, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -3980,7 +3971,7 @@ int main(int argc, const char **argv)
return -ret;
}
formatter->open_object_section("periods_list");
- encode_json("periods", periods, formatter);
+ encode_json("periods", periods, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -3989,7 +3980,7 @@ int main(int argc, const char **argv)
{
int ret = update_period(realm_id, realm_name, period_id, period_epoch,
commit, remote, url, access_key, secret_key,
- formatter, yes_i_really_mean_it);
+ formatter.get(), yes_i_really_mean_it);
if (ret < 0) {
return -ret;
}
@@ -4035,7 +4026,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("period", period, formatter);
+ encode_json("period", period, formatter.get());
formatter->flush(cout);
}
break;
@@ -4078,16 +4069,16 @@ int main(int argc, const char **argv)
set_quota_info(period_config.bucket_quota, opt_cmd,
max_size, max_objects,
have_max_size, have_max_objects);
- encode_json("bucket quota", period_config.bucket_quota, formatter);
+ encode_json("bucket quota", period_config.bucket_quota, formatter.get());
} else if (quota_scope == "user") {
set_quota_info(period_config.user_quota, opt_cmd,
max_size, max_objects,
have_max_size, have_max_objects);
- encode_json("user quota", period_config.user_quota, formatter);
+ encode_json("user quota", period_config.user_quota, formatter.get());
} else if (quota_scope.empty() && opt_cmd == OPT::GLOBAL_QUOTA_GET) {
// if no scope is given for GET, print both
- encode_json("bucket quota", period_config.bucket_quota, formatter);
- encode_json("user quota", period_config.user_quota, formatter);
+ encode_json("bucket quota", period_config.bucket_quota, formatter.get());
+ encode_json("user quota", period_config.user_quota, formatter.get());
} else {
cerr << "ERROR: invalid quota scope specification. Please specify "
"either --quota-scope=bucket, or --quota-scope=user" << std::endl;
@@ -4137,7 +4128,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("realm", realm, formatter);
+ encode_json("realm", realm, formatter.get());
formatter->flush(cout);
}
break;
@@ -4173,7 +4164,7 @@ int main(int argc, const char **argv)
}
return -ret;
}
- encode_json("realm", realm, formatter);
+ encode_json("realm", realm, formatter.get());
formatter->flush(cout);
}
break;
@@ -4207,8 +4198,8 @@ int main(int argc, const char **argv)
return -ret;
}
formatter->open_object_section("realms_list");
- encode_json("default_info", default_id, formatter);
- encode_json("realms", realms, formatter);
+ encode_json("default_info", default_id, formatter.get());
+ encode_json("realms", realms, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -4226,8 +4217,8 @@ int main(int argc, const char **argv)
return -ret;
}
formatter->open_object_section("realm_periods_list");
- encode_json("current_period", period_id, formatter);
- encode_json("periods", periods, formatter);
+ encode_json("current_period", period_id, formatter.get());
+ encode_json("periods", periods, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -4306,7 +4297,7 @@ int main(int argc, const char **argv)
cerr << "failed to set realm " << realm_name << " as default: " << cpp_strerror(-ret) << std::endl;
}
}
- encode_json("realm", realm, formatter);
+ encode_json("realm", realm, formatter.get());
formatter->flush(cout);
}
break;
@@ -4395,7 +4386,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("realm", realm, formatter);
+ encode_json("realm", realm, formatter.get());
formatter->flush(cout);
}
break;
@@ -4455,7 +4446,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4487,7 +4478,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4540,7 +4531,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4565,8 +4556,8 @@ int main(int argc, const char **argv)
cerr << "could not determine default zonegroup: " << cpp_strerror(-ret) << std::endl;
}
formatter->open_object_section("zonegroups_list");
- encode_json("default_info", default_zonegroup, formatter);
- encode_json("zonegroups", zonegroups, formatter);
+ encode_json("default_info", default_zonegroup, formatter.get());
+ encode_json("zonegroups", zonegroups, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -4638,7 +4629,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4685,7 +4676,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4723,7 +4714,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("zonegroup", zonegroup, formatter);
+ encode_json("zonegroup", zonegroup, formatter.get());
formatter->flush(cout);
}
break;
@@ -4759,7 +4750,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("placement_targets", zonegroup.placement_targets, formatter);
+ encode_json("placement_targets", zonegroup.placement_targets, formatter.get());
formatter->flush(cout);
}
break;
@@ -4782,7 +4773,7 @@ int main(int argc, const char **argv)
cerr << "failed to find a zonegroup placement target named '" << placement_id << "'" << std::endl;
return -ENOENT;
}
- encode_json("placement_targets", p->second, formatter);
+ encode_json("placement_targets", p->second, formatter.get());
formatter->flush(cout);
}
break;
@@ -4858,7 +4849,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("placement_targets", zonegroup.placement_targets, formatter);
+ encode_json("placement_targets", zonegroup.placement_targets, formatter.get());
formatter->flush(cout);
}
break;
@@ -4933,7 +4924,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zone", zone, formatter);
+ encode_json("zone", zone, formatter.get());
formatter->flush(cout);
}
break;
@@ -5010,7 +5001,7 @@ int main(int argc, const char **argv)
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("zone", zone, formatter);
+ encode_json("zone", zone, formatter.get());
formatter->flush(cout);
}
break;
@@ -5093,7 +5084,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zone", zone, formatter);
+ encode_json("zone", zone, formatter.get());
formatter->flush(cout);
}
break;
@@ -5118,8 +5109,8 @@ int main(int argc, const char **argv)
cerr << "could not determine default zone: " << cpp_strerror(-ret) << std::endl;
}
formatter->open_object_section("zones_list");
- encode_json("default_info", default_zone, formatter);
- encode_json("zones", zones, formatter);
+ encode_json("default_info", default_zone, formatter.get());
+ encode_json("zones", zones, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -5220,7 +5211,7 @@ int main(int argc, const char **argv)
}
}
- encode_json("zone", zone, formatter);
+ encode_json("zone", zone, formatter.get());
formatter->flush(cout);
}
break;
@@ -5364,7 +5355,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("zone", zone, formatter);
+ encode_json("zone", zone, formatter.get());
formatter->flush(cout);
}
break;
@@ -5376,7 +5367,7 @@ int main(int argc, const char **argv)
cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("placement_pools", zone.placement_pools, formatter);
+ encode_json("placement_pools", zone.placement_pools, formatter.get());
formatter->flush(cout);
}
break;
@@ -5398,7 +5389,7 @@ int main(int argc, const char **argv)
cerr << "ERROR: zone placement target '" << placement_id << "' not found" << std::endl;
return -ENOENT;
}
- encode_json("placement_pools", p->second, formatter);
+ encode_json("placement_pools", p->second, formatter.get());
formatter->flush(cout);
}
default:
@@ -5711,7 +5702,7 @@ int main(int argc, const char **argv)
{
int ret = update_period(realm_id, realm_name, period_id, period_epoch,
commit, remote, url, access_key, secret_key,
- formatter, yes_i_really_mean_it);
+ formatter.get(), yes_i_really_mean_it);
if (ret < 0) {
return -ret;
}
@@ -5739,7 +5730,7 @@ int main(int argc, const char **argv)
return -ret;
}
- encode_json("period", period, formatter);
+ encode_json("period", period, formatter.get());
formatter->flush(cout);
}
return 0;
@@ -5766,7 +5757,7 @@ int main(int argc, const char **argv)
if (ret < 0) {
return -ret;
}
- show_role_info(role, formatter);
+ show_role_info(role, formatter.get());
return 0;
}
case OPT::ROLE_DELETE:
@@ -5794,7 +5785,7 @@ int main(int argc, const char **argv)
if (ret < 0) {
return -ret;
}
- show_role_info(role, formatter);
+ show_role_info(role, formatter.get());
return 0;
}
case OPT::ROLE_MODIFY:
@@ -5837,7 +5828,7 @@ int main(int argc, const char **argv)
if (ret < 0) {
return -ret;
}
- show_roles_info(result, formatter);
+ show_roles_info(result, formatter.get());
return 0;
}
case OPT::ROLE_POLICY_PUT:
@@ -5890,7 +5881,7 @@ int main(int argc, const char **argv)
return -ret;
}
std::vector<string> policy_names = role.get_role_policy_names();
- show_policy_names(policy_names, formatter);
+ show_policy_names(policy_names, formatter.get());
return 0;
}
case OPT::ROLE_POLICY_GET:
@@ -5914,7 +5905,7 @@ int main(int argc, const char **argv)
if (ret < 0) {
return -ret;
}
- show_perm_policy(perm_policy, formatter);
+ show_perm_policy(perm_policy, formatter.get());
return 0;
}
case OPT::ROLE_POLICY_DELETE:
@@ -5956,7 +5947,7 @@ int main(int argc, const char **argv)
cerr << "could not fetch user info: " << err_msg << std::endl;
return -ret;
}
- show_user_info(info, formatter);
+ show_user_info(info, formatter.get());
}
if (opt_cmd == OPT::POLICY) {
@@ -6070,7 +6061,7 @@ int main(int argc, const char **argv)
for (vector<rgw_bucket_dir_entry>::iterator iter = result.begin(); iter != result.end(); ++iter) {
rgw_bucket_dir_entry& entry = *iter;
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
}
formatter->flush(cout);
} while (truncated && count < max_entries);
@@ -6254,7 +6245,7 @@ int main(int argc, const char **argv)
if (show_log_entries) {
- rgw_format_ops_log_entry(entry, formatter);
+ rgw_format_ops_log_entry(entry, formatter.get());
formatter->flush(cout);
}
next:
@@ -6435,7 +6426,7 @@ next:
cerr << "ERROR: failed reading olh: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("olh", olh, formatter);
+ encode_json("olh", olh, formatter.get());
formatter->flush(cout);
}
@@ -6465,8 +6456,8 @@ next:
return -ret;
}
formatter->open_object_section("result");
- encode_json("is_truncated", is_truncated, formatter);
- encode_json("log", log, formatter);
+ encode_json("is_truncated", is_truncated, formatter.get());
+ encode_json("log", log, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -6499,7 +6490,7 @@ next:
return -ret;
}
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
formatter->flush(cout);
}
@@ -6577,7 +6568,7 @@ next:
list<rgw_cls_bi_entry>::iterator iter;
for (iter = entries.begin(); iter != entries.end(); ++iter) {
rgw_cls_bi_entry& entry = *iter;
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
marker = entry.idx;
}
formatter->flush(cout);
@@ -6710,17 +6701,18 @@ next:
return -ret;
}
- rgw_obj obj(bucket, object);
- obj.key.set_instance(object_version);
+ rgw::sal::RGWRadosBucket rbucket(store, bucket);
+ rgw::sal::RGWRadosObject obj(store, object, &rbucket);
+ obj.set_instance(object_version);
bool need_rewrite = true;
if (min_rewrite_stripe_size > 0) {
- ret = check_min_obj_stripe_size(store, bucket_info, obj, min_rewrite_stripe_size, &need_rewrite);
+ ret = check_min_obj_stripe_size(store, bucket_info, &obj, min_rewrite_stripe_size, &need_rewrite);
if (ret < 0) {
ldout(store->ctx(), 0) << "WARNING: check_min_obj_stripe_size failed, r=" << ret << dendl;
}
}
if (need_rewrite) {
- ret = store->getRados()->rewrite_obj(bucket_info, obj, dpp(), null_yield);
+ ret = store->getRados()->rewrite_obj(bucket_info, &obj, dpp(), null_yield);
if (ret < 0) {
cerr << "ERROR: object rewrite returned: " << cpp_strerror(-ret) << std::endl;
return -ret;
@@ -6838,11 +6830,12 @@ next:
(end_epoch > 0 && end_epoch < (uint64_t)ut.sec())) {
formatter->dump_string("status", "Skipped");
} else {
- rgw_obj obj(bucket, key);
+ rgw::sal::RGWRadosBucket rbucket(store, bucket);
+ rgw::sal::RGWRadosObject obj(store, key, &rbucket);
bool need_rewrite = true;
if (min_rewrite_stripe_size > 0) {
- r = check_min_obj_stripe_size(store, bucket_info, obj, min_rewrite_stripe_size, &need_rewrite);
+ r = check_min_obj_stripe_size(store, bucket_info, &obj, min_rewrite_stripe_size, &need_rewrite);
if (r < 0) {
ldout(store->ctx(), 0) << "WARNING: check_min_obj_stripe_size failed, r=" << r << dendl;
}
@@ -6850,7 +6843,7 @@ next:
if (!need_rewrite) {
formatter->dump_string("status", "Skipped");
} else {
- r = store->getRados()->rewrite_obj(bucket_info, obj, dpp(), null_yield);
+ r = store->getRados()->rewrite_obj(bucket_info, &obj, dpp(), null_yield);
if (r == 0) {
formatter->dump_string("status", "Success");
} else {
@@ -6896,7 +6889,7 @@ next:
}
return br.execute(num_shards, max_entries,
- verbose, &cout, formatter);
+ verbose, &cout, formatter.get());
}
if (opt_cmd == OPT::RESHARD_ADD) {
@@ -6958,7 +6951,7 @@ next:
}
for (auto iter=entries.begin(); iter != entries.end(); ++iter) {
cls_rgw_reshard_entry& entry = *iter;
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
entry.get_key(&marker);
}
count += entries.size();
@@ -6999,7 +6992,7 @@ next:
return -r;
}
- show_reshard_status(status, formatter);
+ show_reshard_status(status, formatter.get());
}
if (opt_cmd == OPT::RESHARD_PROCESS) {
@@ -7122,17 +7115,17 @@ next:
bufferlist& bl = iter->second;
bool handled = false;
if (iter->first == RGW_ATTR_MANIFEST) {
- handled = decode_dump<RGWObjManifest>("manifest", bl, formatter);
+ handled = decode_dump<RGWObjManifest>("manifest", bl, formatter.get());
} else if (iter->first == RGW_ATTR_ACL) {
- handled = decode_dump<RGWAccessControlPolicy>("policy", bl, formatter);
+ handled = decode_dump<RGWAccessControlPolicy>("policy", bl, formatter.get());
} else if (iter->first == RGW_ATTR_ID_TAG) {
- handled = dump_string("tag", bl, formatter);
+ handled = dump_string("tag", bl, formatter.get());
} else if (iter->first == RGW_ATTR_ETAG) {
- handled = dump_string("etag", bl, formatter);
+ handled = dump_string("etag", bl, formatter.get());
} else if (iter->first == RGW_ATTR_COMPRESSION) {
- handled = decode_dump<RGWCompressionInfo>("compression", bl, formatter);
+ handled = decode_dump<RGWCompressionInfo>("compression", bl, formatter.get());
} else if (iter->first == RGW_ATTR_DELETE_AT) {
- handled = decode_dump<utime_t>("delete_at", bl, formatter);
+ handled = decode_dump<utime_t>("delete_at", bl, formatter.get());
}
if (!handled)
@@ -7141,7 +7134,7 @@ next:
formatter->open_object_section("attrs");
for (iter = other_attrs.begin(); iter != other_attrs.end(); ++iter) {
- dump_string(iter->first.c_str(), iter->second, formatter);
+ dump_string(iter->first.c_str(), iter->second, formatter.get());
}
formatter->close_section();
formatter->close_section();
@@ -7154,7 +7147,7 @@ next:
cerr << "ERROR: need to specify bucket name" << std::endl;
return EINVAL;
}
- do_check_object_locator(tenant, bucket_name, fix, remove_bad, formatter);
+ do_check_object_locator(tenant, bucket_name, fix, remove_bad, formatter.get());
} else {
RGWBucketAdminOp::check_index(store, bucket_op, f, null_yield);
}
@@ -7199,7 +7192,7 @@ next:
cls_rgw_obj_chain& chain = info.chain;
for (liter = chain.objs.begin(); liter != chain.objs.end(); ++liter) {
cls_rgw_obj& obj = *liter;
- encode_json("obj", obj, formatter);
+ encode_json("obj", obj, formatter.get());
}
formatter->close_section(); // objs
formatter->close_section(); // obj_chain
@@ -7286,7 +7279,7 @@ next:
return -EIO;
}
- encode_json("result", config, formatter);
+ encode_json("result", config, formatter.get());
formatter->flush(cout);
}
@@ -7407,7 +7400,7 @@ next:
if (!extra_info){
formatter->dump_string("job-id",it.first);
} else {
- encode_json("orphan_search_state", it.second, formatter);
+ encode_json("orphan_search_state", it.second, formatter.get());
}
}
formatter->close_section();
@@ -7483,17 +7476,17 @@ next:
{
Formatter::ObjectSection os(*formatter, "result");
- encode_json("stats", stats, formatter);
+ encode_json("stats", stats, formatter.get());
utime_t last_sync_ut(last_stats_sync);
- encode_json("last_stats_sync", last_sync_ut, formatter);
+ encode_json("last_stats_sync", last_sync_ut, formatter.get());
utime_t last_update_ut(last_stats_update);
- encode_json("last_stats_update", last_update_ut, formatter);
+ encode_json("last_stats_update", last_update_ut, formatter.get());
}
formatter->flush(cout);
}
if (opt_cmd == OPT::METADATA_GET) {
- int ret = store->ctl()->meta.mgr->get(metadata_key, formatter, null_yield);
+ int ret = store->ctl()->meta.mgr->get(metadata_key, formatter.get(), null_yield);
if (ret < 0) {
cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl;
return -ret;
@@ -7564,10 +7557,10 @@ next:
formatter->close_section();
if (max_entries_specified) {
- encode_json("truncated", truncated, formatter);
- encode_json("count", count, formatter);
+ encode_json("truncated", truncated, formatter.get());
+ encode_json("count", count, formatter.get());
if (truncated) {
- encode_json("marker", store->ctl()->meta.mgr->get_marker(handle), formatter);
+ encode_json("marker", store->ctl()->meta.mgr->get_marker(handle), formatter.get());
}
formatter->close_section();
}
@@ -7616,7 +7609,7 @@ next:
for (list<cls_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) {
cls_log_entry& entry = *iter;
- store->ctl()->meta.mgr->dump_log_entry(entry, formatter);
+ store->ctl()->meta.mgr->dump_log_entry(entry, formatter.get());
}
formatter->flush(cout);
} while (truncated);
@@ -7651,7 +7644,7 @@ next:
RGWMetadataLogInfo info;
meta_log->get_info(i, &info);
- ::encode_json("info", info, formatter);
+ ::encode_json("info", info, formatter.get());
if (specified_shard_id)
break;
@@ -7716,11 +7709,11 @@ next:
}
if (opt_cmd == OPT::SYNC_INFO) {
- sync_info(opt_effective_zone_id, opt_bucket, zone_formatter);
+ sync_info(opt_effective_zone_id, opt_bucket, zone_formatter.get());
}
if (opt_cmd == OPT::SYNC_STATUS) {
- sync_status(formatter);
+ sync_status(formatter.get());
}
if (opt_cmd == OPT::METADATA_SYNC_STATUS) {
@@ -7740,7 +7733,7 @@ next:
}
formatter->open_object_section("summary");
- encode_json("sync_status", sync_status, formatter);
+ encode_json("sync_status", sync_status, formatter.get());
uint64_t full_total = 0;
uint64_t full_complete = 0;
@@ -7755,8 +7748,8 @@ next:
}
formatter->open_object_section("full_sync");
- encode_json("total", full_total, formatter);
- encode_json("complete", full_complete, formatter);
+ encode_json("total", full_total, formatter.get());
+ encode_json("complete", full_complete, formatter.get());
formatter->close_section();
formatter->close_section();
@@ -7821,10 +7814,10 @@ next:
return -ret;
}
formatter->open_object_section("summary");
- encode_json("shard_id", shard_id, formatter);
- encode_json("marker", sync_marker, formatter);
- encode_json("pending_buckets", pending_buckets, formatter);
- encode_json("recovering_buckets", recovering_buckets, formatter);
+ encode_json("shard_id", shard_id, formatter.get());
+ encode_json("marker", sync_marker, formatter.get());
+ encode_json("pending_buckets", pending_buckets, formatter.get());
+ encode_json("recovering_buckets", recovering_buckets, formatter.get());
formatter->close_section();
formatter->flush(cout);
} else {
@@ -7835,7 +7828,7 @@ next:
}
formatter->open_object_section("summary");
- encode_json("sync_status", sync_status, formatter);
+ encode_json("sync_status", sync_status, formatter.get());
uint64_t full_total = 0;
uint64_t full_complete = 0;
@@ -7850,8 +7843,8 @@ next:
}
formatter->open_object_section("full_sync");
- encode_json("total", full_total, formatter);
- encode_json("complete", full_complete, formatter);
+ encode_json("total", full_total, formatter.get());
+ encode_json("complete", full_complete, formatter.get());
formatter->close_section();
formatter->close_section();
@@ -8024,7 +8017,7 @@ next:
map<int, rgw_bucket_shard_sync_info>& sync_status = sync.get_sync_status();
- encode_json("sync_status", sync_status, formatter);
+ encode_json("sync_status", sync_status, formatter.get());
formatter->flush(cout);
}
@@ -8086,7 +8079,7 @@ next:
for (list<rgw_bi_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) {
rgw_bi_log_entry& entry = *iter;
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
marker = entry.id;
}
@@ -8121,7 +8114,7 @@ next:
for (; shard_id < ERROR_LOGGER_SHARDS; ++shard_id) {
formatter->open_object_section("shard");
- encode_json("shard_id", shard_id, formatter);
+ encode_json("shard_id", shard_id, formatter.get());
formatter->open_array_section("entries");
int count = 0;
@@ -8153,11 +8146,11 @@ next:
continue;
}
formatter->open_object_section("entry");
- encode_json("id", cls_entry.id, formatter);
- encode_json("section", cls_entry.section, formatter);
- encode_json("name", cls_entry.name, formatter);
- encode_json("timestamp", cls_entry.timestamp, formatter);
- encode_json("info", log_entry, formatter);
+ encode_json("id", cls_entry.id, formatter.get());
+ encode_json("section", cls_entry.section, formatter.get());
+ encode_json("name", cls_entry.name, formatter.get());
+ encode_json("timestamp", cls_entry.timestamp, formatter.get());
+ encode_json("info", log_entry, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -8238,7 +8231,7 @@ next:
return -ret;
}
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::SYNC_GROUP_GET) {
@@ -8252,7 +8245,7 @@ next:
auto& groups = sync_policy.groups;
if (!opt_group_id) {
- show_result(groups, zone_formatter, cout);
+ show_result(groups, zone_formatter.get(), cout);
} else {
auto iter = sync_policy.groups.find(*opt_group_id);
if (iter == sync_policy.groups.end()) {
@@ -8260,7 +8253,7 @@ next:
return ENOENT;
}
- show_result(iter->second, zone_formatter, cout);
+ show_result(iter->second, zone_formatter.get(), cout);
}
}
@@ -8282,8 +8275,8 @@ next:
}
{
- Formatter::ObjectSection os(*zone_formatter, "result");
- encode_json("sync_policy", sync_policy, zone_formatter);
+ Formatter::ObjectSection os(*zone_formatter.get(), "result");
+ encode_json("sync_policy", sync_policy, zone_formatter.get());
}
zone_formatter->flush(cout);
@@ -8336,7 +8329,7 @@ next:
return -ret;
}
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::SYNC_GROUP_FLOW_REMOVE) {
@@ -8376,7 +8369,7 @@ next:
return -ret;
}
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::SYNC_GROUP_PIPE_CREATE ||
@@ -8459,7 +8452,7 @@ next:
return -ret;
}
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::SYNC_GROUP_PIPE_REMOVE) {
@@ -8518,7 +8511,7 @@ next:
return -ret;
}
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::SYNC_POLICY_GET) {
@@ -8529,7 +8522,7 @@ next:
}
auto& sync_policy = sync_policy_ctx.get_policy();
- show_result(sync_policy, zone_formatter, cout);
+ show_result(sync_policy, zone_formatter.get(), cout);
}
if (opt_cmd == OPT::BILOG_TRIM) {
@@ -8568,7 +8561,7 @@ next:
return -ret;
}
formatter->open_object_section("entries");
- encode_json("markers", markers, formatter);
+ encode_json("markers", markers, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -8635,12 +8628,12 @@ next:
for (list<rgw_data_change_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) {
rgw_data_change_log_entry& entry = *iter;
if (!extra_info) {
- encode_json("entry", entry.entry, formatter);
+ encode_json("entry", entry.entry, formatter.get());
} else {
- encode_json("entry", entry, formatter);
+ encode_json("entry", entry, formatter.get());
}
}
- formatter->flush(cout);
+ formatter.get()->flush(cout);
} while (truncated && count < max_entries);
formatter->close_section();
@@ -8657,7 +8650,7 @@ next:
RGWDataChangesLogInfo info;
store->svc()->datalog_rados->get_info(i, &info);
- ::encode_json("info", info, formatter);
+ ::encode_json("info", info, formatter.get());
if (specified_shard_id)
break;
@@ -8867,7 +8860,7 @@ next:
return -ret;
}
formatter->open_object_section("result");
- encode_json("entry", result, formatter);
+ encode_json("entry", result, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -8885,7 +8878,7 @@ next:
return -ret;
}
formatter->open_object_section("result");
- encode_json("entries", result, formatter);
+ encode_json("entries", result, formatter.get());
formatter->close_section();
formatter->flush(cout);
}
@@ -9032,7 +9025,7 @@ next:
cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("result", result, formatter);
+ encode_json("result", result, formatter.get());
} else {
rgw_pubsub_user_topics result;
int ret = ups.get_user_topics(&result);
@@ -9040,7 +9033,7 @@ next:
cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("result", result, formatter);
+ encode_json("result", result, formatter.get());
}
formatter->flush(cout);
}
@@ -9063,7 +9056,7 @@ next:
cerr << "ERROR: could not get topic: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("topic", topic, formatter);
+ encode_json("topic", topic, formatter.get());
formatter->flush(cout);
}
@@ -9110,7 +9103,7 @@ next:
cerr << "ERROR: could not get subscription info: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("sub", sub_conf, formatter);
+ encode_json("sub", sub_conf, formatter.get());
formatter->flush(cout);
}
@@ -9163,7 +9156,7 @@ next:
cerr << "ERROR: could not list events: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- encode_json("result", *sub, formatter);
+ encode_json("result", *sub, formatter.get());
formatter->flush(cout);
}
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc
index 8b197b2db97..1d59d1e3f4f 100644
--- a/src/rgw/rgw_bucket.cc
+++ b/src/rgw/rgw_bucket.cc
@@ -276,13 +276,13 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use
return;
}
- map<string, rgw::sal::RGWBucket*>& buckets = user_buckets.get_buckets();
- for (map<string, rgw::sal::RGWBucket*>::iterator i = buckets.begin();
+ map<string, std::unique_ptr<rgw::sal::RGWBucket>>& buckets = user_buckets.get_buckets();
+ for (auto i = buckets.begin();
i != buckets.end();
++i) {
marker = i->first;
- rgw::sal::RGWBucket* bucket = i->second;
+ auto& bucket = i->second;
RGWBucketInfo bucket_info;
real_time mtime;
@@ -1511,10 +1511,10 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
if (ret < 0)
return ret;
- map<string, rgw::sal::RGWBucket*>& m_buckets = buckets.get_buckets();
+ map<string, std::unique_ptr<rgw::sal::RGWBucket>>& m_buckets = buckets.get_buckets();
for (const auto& iter : m_buckets) {
- auto bucket = iter.second;
+ auto& bucket = iter.second;
uint32_t num_shards = 1;
uint64_t num_objects = 0;
@@ -1618,7 +1618,6 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
constexpr bool no_need_stats = false; // set need_stats to false
do {
- buckets.clear();
ret = user.list_buckets(marker, empty_end_marker, max_entries,
no_need_stats, buckets);
if (ret < 0) {
@@ -1626,7 +1625,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
}
const std::string* marker_cursor = nullptr;
- map<string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ map<string, std::unique_ptr<rgw::sal::RGWBucket>>& m = buckets.get_buckets();
for (const auto& i : m) {
const std::string& obj_name = i.first;
diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc
index 9f62edb2bb4..003f82c7284 100644
--- a/src/rgw/rgw_common.cc
+++ b/src/rgw/rgw_common.cc
@@ -1017,7 +1017,7 @@ struct perm_state_from_req_state : public perm_state_base {
perm_state_from_req_state(req_state * const _s) : perm_state_base(_s->cct,
_s->env,
_s->auth.identity.get(),
- _s->bucket_info,
+ _s->bucket->get_info(),
_s->perm_mask,
_s->defer_to_bucket_acls,
_s->bucket_access_conf),
@@ -1258,7 +1258,7 @@ bool verify_bucket_permission(const DoutPrefixProvider* dpp, struct req_state *
return verify_bucket_permission(dpp,
&ps,
- s->bucket,
+ s->bucket->get_bi(),
s->user_acl.get(),
s->bucket_acl.get(),
s->iam_policy,
@@ -1272,14 +1272,14 @@ bool verify_bucket_permission(const DoutPrefixProvider* dpp, struct req_state *
int verify_bucket_owner_or_policy(struct req_state* const s,
const uint64_t op)
{
- auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env, boost::none, op, ARN(s->bucket));
+ auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env, boost::none, op, ARN(s->bucket->get_bi()));
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
auto e = eval_or_pass(s->iam_policy,
s->env, *s->auth.identity,
- op, ARN(s->bucket));
+ op, ARN(s->bucket->get_bi()));
if (e == Effect::Deny) {
return -EACCES;
}
@@ -1483,7 +1483,7 @@ bool verify_object_permission(const DoutPrefixProvider* dpp, struct req_state *s
return verify_object_permission(dpp,
&ps,
- rgw_obj(s->bucket, s->object),
+ rgw_obj(s->bucket->get_bi(), s->object->get_key()),
s->user_acl.get(),
s->bucket_acl.get(),
s->object_acl.get(),
diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h
index d41aa616136..ca2334d62ed 100644
--- a/src/rgw/rgw_common.h
+++ b/src/rgw/rgw_common.h
@@ -45,6 +45,8 @@ namespace ceph {
namespace rgw::sal {
class RGWUser;
+ class RGWBucket;
+ class RGWObject;
}
using ceph::crypto::MD5;
@@ -1618,11 +1620,11 @@ struct req_state : DoutPrefixProvider {
string bucket_tenant;
string bucket_name;
- rgw_bucket bucket;
- rgw_obj_key object;
+ std::unique_ptr<rgw::sal::RGWBucket> bucket;
+ std::unique_ptr<rgw::sal::RGWObject> object;
string src_tenant_name;
string src_bucket_name;
- rgw_obj_key src_object;
+ std::unique_ptr<rgw::sal::RGWObject> src_object;
ACLOwner bucket_owner;
ACLOwner owner;
@@ -1634,8 +1636,6 @@ struct req_state : DoutPrefixProvider {
string redirect;
- RGWBucketInfo bucket_info;
- obj_version bucket_ep_objv;
real_time bucket_mtime;
std::map<std::string, ceph::bufferlist> bucket_attrs;
bool bucket_exists{false};
@@ -1643,7 +1643,7 @@ struct req_state : DoutPrefixProvider {
bool has_bad_meta{false};
- rgw::sal::RGWUser *user;
+ rgw::sal::RGWUser* user{nullptr};
struct {
/* TODO(rzarzynski): switch out to the static_ptr for both members. */
diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc
index 390e5bd9ed7..faf0ee6a4db 100644
--- a/src/rgw/rgw_cr_rados.cc
+++ b/src/rgw/rgw_cr_rados.cc
@@ -635,18 +635,19 @@ int RGWAsyncFetchRemoteObj::_send_request()
snprintf(buf, sizeof(buf), ".%lld", (long long)store->getRados()->instance_id());
map<string, bufferlist> attrs;
- rgw_obj src_obj(src_bucket, key);
-
- rgw_obj dest_obj(dest_bucket_info.bucket, dest_key.value_or(key));
+ rgw::sal::RGWRadosBucket bucket(store, src_bucket);
+ rgw::sal::RGWRadosObject src_obj(store, key, &bucket);
+ rgw::sal::RGWRadosBucket dest_bucket(store, dest_bucket_info);
+ rgw::sal::RGWRadosObject dest_obj(store, dest_key.value_or(key), &dest_bucket);
std::optional<uint64_t> bytes_transferred;
int r = store->getRados()->fetch_remote_obj(obj_ctx,
user_id.value_or(rgw_user()),
NULL, /* req_info */
source_zone,
- dest_obj,
- src_obj,
- dest_bucket_info, /* dest */
+ &dest_obj,
+ &src_obj,
+ &dest_bucket, /* dest */
nullptr, /* source */
dest_placement_rule,
NULL, /* real_time* src_mtime, */
@@ -694,13 +695,14 @@ int RGWAsyncStatRemoteObj::_send_request()
char buf[16];
snprintf(buf, sizeof(buf), ".%lld", (long long)store->getRados()->instance_id());
- rgw_obj src_obj(src_bucket, key);
+ rgw::sal::RGWRadosBucket bucket(store, src_bucket);
+ rgw::sal::RGWRadosObject src_obj(store, key, &bucket);
int r = store->getRados()->stat_remote_obj(obj_ctx,
rgw_user(user_id),
nullptr, /* req_info */
source_zone,
- src_obj,
+ &src_obj,
nullptr, /* source */
pmtime, /* real_time* src_mtime, */
psize, /* uint64_t * */
diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc
index deaf913559e..5e5346b864c 100644
--- a/src/rgw/rgw_data_sync.cc
+++ b/src/rgw/rgw_data_sync.cc
@@ -4935,14 +4935,14 @@ string RGWBucketPipeSyncStatusManager::status_oid(const rgw_zone_id& source_zone
string RGWBucketPipeSyncStatusManager::obj_status_oid(const rgw_bucket_sync_pipe& sync_pipe,
const rgw_zone_id& source_zone,
- const rgw_obj& obj)
+ const rgw::sal::RGWObject* obj)
{
- string prefix = object_status_oid_prefix + "." + source_zone.id + ":" + obj.bucket.get_key();
+ string prefix = object_status_oid_prefix + "." + source_zone.id + ":" + obj->get_bucket()->get_key();
if (sync_pipe.source_bucket_info.bucket !=
sync_pipe.dest_bucket_info.bucket) {
prefix += string("/") + sync_pipe.dest_bucket_info.bucket.get_key();
}
- return prefix + ":" + obj.key.name + ":" + obj.key.instance;
+ return prefix + ":" + obj->get_name() + ":" + obj->get_instance();
}
class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR {
diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h
index 18d52b03197..ec8e648cd51 100644
--- a/src/rgw/rgw_data_sync.h
+++ b/src/rgw/rgw_data_sync.h
@@ -655,7 +655,7 @@ public:
static string status_oid(const rgw_zone_id& source_zone, const rgw_bucket_sync_pair_info& bs);
static string obj_status_oid(const rgw_bucket_sync_pipe& sync_pipe,
- const rgw_zone_id& source_zone, const rgw_obj& obj); /* specific source obj sync status,
+ const rgw_zone_id& source_zone, const rgw::sal::RGWObject* obj); /* specific source obj sync status,
can be used by sync modules */
// implements DoutPrefixProvider
diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc
index 68fd775640c..a7d8f8b9122 100644
--- a/src/rgw/rgw_file.cc
+++ b/src/rgw/rgw_file.cc
@@ -1371,7 +1371,7 @@ namespace rgw {
/* start */
std::string object_name = relative_object_name();
f->write_req =
- new RGWWriteRequest(fs->get_context(), &ruser, this,
+ new RGWWriteRequest(rgwlib.get_store(), &ruser, this,
bucket_name(), object_name);
rc = rgwlib.get_fe()->start_req(f->write_req);
if (rc < 0) {
@@ -1530,7 +1530,7 @@ namespace rgw {
auto compression_type =
get_store()->svc()->zone->get_zone_params().get_compression_type(
- s->bucket_info.placement_rule);
+ s->bucket->get_placement_rule());
/* not obviously supportable */
ceph_assert(! dlo_manifest);
@@ -1538,9 +1538,8 @@ namespace rgw {
perfcounter->inc(l_rgw_put);
op_ret = -EINVAL;
- rgw_obj obj{s->bucket, s->object};
- if (s->object.empty()) {
+ if (s->object->empty()) {
ldout(s->cct, 0) << __func__ << " called on empty object" << dendl;
goto done;
}
@@ -1561,19 +1560,19 @@ namespace rgw {
aio.emplace(s->cct->_conf->rgw_put_obj_min_window_size);
- if (s->bucket_info.versioning_enabled()) {
+ if (s->bucket->versioning_enabled()) {
if (!version_id.empty()) {
- obj.key.set_instance(version_id);
+ s->object->set_instance(version_id);
} else {
- get_store()->getRados()->gen_rand_obj_instance_name(&obj);
- version_id = obj.key.instance;
+ s->object->gen_rand_obj_instance_name();
+ version_id = s->object->get_instance();
}
}
- processor.emplace(&*aio, get_store(), s->bucket_info,
+ processor.emplace(&*aio, get_store(), s->bucket.get(),
&s->dest_placement,
s->bucket_owner.get_id(),
*static_cast<RGWObjectCtx *>(s->obj_ctx),
- obj, olh_epoch, s->req_id, this, s->yield);
+ s->object->get_obj(), olh_epoch, s->req_id, this, s->yield);
op_ret = processor->prepare(s->yield);
if (op_ret < 0) {
@@ -1611,8 +1610,9 @@ namespace rgw {
return -EIO;
}
- op_ret = get_store()->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket,
- user_quota, bucket_quota, real_ofs, true);
+ op_ret = get_store()->getRados()->check_quota(s->bucket_owner.get_id(),
+ s->bucket->get_bi(), user_quota, bucket_quota,
+ real_ofs, true);
/* max_size exceed */
if (op_ret < 0)
return -EIO;
@@ -1654,8 +1654,9 @@ namespace rgw {
goto done;
}
- op_ret = get_store()->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket,
- user_quota, bucket_quota, s->obj_size, true);
+ op_ret = get_store()->getRados()->check_quota(s->bucket_owner.get_id(),
+ s->bucket->get_bi(), user_quota, bucket_quota,
+ s->obj_size, true);
/* max_size exceed */
if (op_ret < 0) {
goto done;
diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h
index b8d44ec6424..89d1ed25eef 100644
--- a/src/rgw/rgw_file.h
+++ b/src/rgw/rgw_file.h
@@ -1317,7 +1317,7 @@ public:
uint32_t d_count;
bool rcb_eof; // caller forced early stop in readdir cycle
- RGWListBucketsRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWListBucketsRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
RGWFileHandle* _rgw_fh, rgw_readdir_cb _rcb,
void* _cb_arg, RGWFileHandle::readdir_offset& _offset)
: RGWLibRequest(_cct, _user), rgw_fh(_rgw_fh), offset(_offset),
@@ -1385,10 +1385,10 @@ public:
void send_response_data(rgw::sal::RGWBucketList& buckets) override {
if (!sent_data)
return;
- map<string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ auto& m = buckets.get_buckets();
for (const auto& iter : m) {
std::string_view marker{iter.first};
- rgw::sal::RGWBucket* ent = iter.second;
+ auto& ent = iter.second;
if (! this->operator()(ent->get_name(), marker)) {
/* caller cannot accept more */
lsubdout(cct, rgw, 5) << "ListBuckets rcb failed"
@@ -1451,7 +1451,7 @@ public:
uint32_t d_count;
bool rcb_eof; // caller forced early stop in readdir cycle
- RGWReaddirRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWReaddirRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
RGWFileHandle* _rgw_fh, rgw_readdir_cb _rcb,
void* _cb_arg, RGWFileHandle::readdir_offset& _offset)
: RGWLibRequest(_cct, _user), rgw_fh(_rgw_fh), offset(_offset),
@@ -1682,7 +1682,7 @@ public:
bool valid;
bool has_children;
- RGWRMdirCheck (CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWRMdirCheck (CephContext* _cct, rgw::sal::RGWUser* _user,
const RGWFileHandle* _rgw_fh)
: RGWLibRequest(_cct, _user), rgw_fh(_rgw_fh), valid(false),
has_children(false) {
@@ -1764,7 +1764,7 @@ class RGWCreateBucketRequest : public RGWLibRequest,
public:
const std::string& bucket_name;
- RGWCreateBucketRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWCreateBucketRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
std::string& _bname)
: RGWLibRequest(_cct, _user), bucket_name(_bname) {
op = this;
@@ -1833,7 +1833,7 @@ class RGWDeleteBucketRequest : public RGWLibRequest,
public:
const std::string& bucket_name;
- RGWDeleteBucketRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWDeleteBucketRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
std::string& _bname)
: RGWLibRequest(_cct, _user), bucket_name(_bname) {
op = this;
@@ -1889,7 +1889,7 @@ public:
buffer::list& bl; /* XXX */
size_t bytes_written;
- RGWPutObjRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWPutObjRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
const std::string& _bname, const std::string& _oname,
buffer::list& _bl)
: RGWLibRequest(_cct, _user), bucket_name(_bname), obj_name(_oname),
@@ -1985,7 +1985,7 @@ public:
size_t read_resid; /* initialize to len, <= sizeof(ulp_buffer) */
bool do_hexdump = false;
- RGWReadRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWReadRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
RGWFileHandle* _rgw_fh, uint64_t off, uint64_t len,
void *_ulp_buffer)
: RGWLibRequest(_cct, _user), rgw_fh(_rgw_fh), ulp_buffer(_ulp_buffer),
@@ -2080,7 +2080,7 @@ public:
const std::string& bucket_name;
const std::string& obj_name;
- RGWDeleteObjRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWDeleteObjRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
const std::string& _bname, const std::string& _oname)
: RGWLibRequest(_cct, _user), bucket_name(_bname), obj_name(_oname) {
op = this;
@@ -2135,7 +2135,7 @@ public:
static constexpr uint32_t FLAG_NONE = 0x000;
- RGWStatObjRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWStatObjRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
const std::string& _bname, const std::string& _oname,
uint32_t _flags)
: RGWLibRequest(_cct, _user), bucket_name(_bname), obj_name(_oname),
@@ -2232,7 +2232,7 @@ public:
std::map<std::string, buffer::list> attrs;
RGWLibFS::BucketStats& bs;
- RGWStatBucketRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWStatBucketRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
const std::string& _path,
RGWLibFS::BucketStats& _stats)
: RGWLibRequest(_cct, _user), bs(_stats) {
@@ -2287,7 +2287,7 @@ public:
}
void send_response() override {
- bucket->get_creation_time() = get_state()->bucket_info.creation_time;
+ bucket->get_creation_time() = get_state()->bucket->get_info().creation_time;
bs.size = bucket->get_size();
bs.size_rounded = bucket->get_size_rounded();
bs.creation_time = bucket->get_creation_time();
@@ -2311,7 +2311,7 @@ public:
bool is_dir;
bool exact_matched;
- RGWStatLeafRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWStatLeafRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
RGWFileHandle* _rgw_fh, const std::string& _path)
: RGWLibRequest(_cct, _user), rgw_fh(_rgw_fh), path(_path),
matched(false), is_dir(false), exact_matched(false) {
@@ -2429,16 +2429,16 @@ public:
size_t bytes_written;
bool eio;
- RGWWriteRequest(CephContext* _cct, rgw::sal::RGWUser *_user, RGWFileHandle* _fh,
+ RGWWriteRequest(rgw::sal::RGWRadosStore* store, rgw::sal::RGWUser* _user, RGWFileHandle* _fh,
const std::string& _bname, const std::string& _oname)
- : RGWLibContinuedReq(_cct, _user),
+ : RGWLibContinuedReq(store->ctx(), _user),
bucket_name(_bname), obj_name(_oname),
rgw_fh(_fh), filter(nullptr), real_ofs(0),
bytes_written(0), eio(false) {
int ret = header_init();
if (ret == 0) {
- ret = init_from_header(get_state());
+ ret = init_from_header(store, get_state());
}
op = this;
}
@@ -2526,7 +2526,7 @@ public:
const std::string& src_name;
const std::string& dst_name;
- RGWCopyObjRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWCopyObjRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
RGWFileHandle* _src_parent, RGWFileHandle* _dst_parent,
const std::string& _src_name, const std::string& _dst_name)
: RGWLibRequest(_cct, _user), src_parent(_src_parent),
@@ -2560,20 +2560,20 @@ public:
src_bucket_name = src_parent->bucket_name();
// need s->src_bucket_name?
- src_object.name = src_parent->format_child_name(src_name, false);
+ src_object->set_name(src_parent->format_child_name(src_name, false));
// need s->src_object?
dest_bucket_name = dst_parent->bucket_name();
// need s->bucket.name?
- dest_object = dst_parent->format_child_name(dst_name, false);
+ dest_obj_name = dst_parent->format_child_name(dst_name, false);
// need s->object_name?
- int rc = valid_s3_object_name(dest_object);
+ int rc = valid_s3_object_name(dest_obj_name);
if (rc != 0)
return rc;
/* XXX and fixup key attr (could optimize w/string ref and
- * dest_object) */
+ * dest_obj_name) */
buffer::list ux_key;
fh_key fhk = dst_parent->make_fhk(dst_name);
rgw::encode(fhk, ux_key);
@@ -2615,7 +2615,7 @@ public:
const std::string& bucket_name;
const std::string& obj_name;
- RGWSetAttrsRequest(CephContext* _cct, rgw::sal::RGWUser *_user,
+ RGWSetAttrsRequest(CephContext* _cct, rgw::sal::RGWUser* _user,
const std::string& _bname, const std::string& _oname)
: RGWLibRequest(_cct, _user), bucket_name(_bname), obj_name(_oname) {
op = this;
@@ -2670,7 +2670,7 @@ class RGWGetClusterStatReq : public RGWLibRequest,
public RGWGetClusterStat {
public:
struct rados_cluster_stat_t& stats_req;
- RGWGetClusterStatReq(CephContext* _cct,rgw::sal::RGWUser *_user,
+ RGWGetClusterStatReq(CephContext* _cct,rgw::sal::RGWUser* _user,
rados_cluster_stat_t& _stats):
RGWLibRequest(_cct, _user), stats_req(_stats){
op = this;
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc
index 6d5137bfaba..245f9e4ddc0 100644
--- a/src/rgw/rgw_lc.cc
+++ b/src/rgw/rgw_lc.cc
@@ -1262,8 +1262,10 @@ public:
return -EINVAL;
}
+ rgw::sal::RGWRadosBucket bucket(oc.store, oc.bucket_info);
+ rgw::sal::RGWRadosObject obj(oc.store, oc.obj.key, &bucket);
int r = oc.store->getRados()->transition_obj(
- oc.rctx, oc.bucket_info, oc.obj, target_placement, o.meta.mtime,
+ oc.rctx, &bucket, obj, target_placement, o.meta.mtime,
o.versioned_epoch, oc.dpp, null_yield);
if (r < 0) {
ldpp_dout(oc.dpp, 0) << "ERROR: failed to transition obj "
diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h
index 3117f3c3468..bf1af587540 100644
--- a/src/rgw/rgw_lib.h
+++ b/src/rgw/rgw_lib.h
@@ -121,7 +121,8 @@ namespace rgw {
RGWHandler_Lib() {}
~RGWHandler_Lib() override {}
- static int init_from_header(struct req_state *s);
+ static int init_from_header(rgw::sal::RGWRadosStore *store,
+ struct req_state *s);
}; /* RGWHandler_Lib */
class RGWLibRequest : public RGWRequest,
@@ -173,7 +174,7 @@ namespace rgw {
int ret = header_init();
if (ret == 0) {
- ret = init_from_header(_s);
+ ret = init_from_header(rados_ctx->get_store(), _s);
}
return ret;
}
diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc
index 4955715c163..976869a04d7 100644
--- a/src/rgw/rgw_log.cc
+++ b/src/rgw/rgw_log.cc
@@ -27,7 +27,7 @@ static void set_param_str(struct req_state *s, const char *name, string& str)
}
string render_log_object_name(const string& format,
- struct tm *dt, string& bucket_id,
+ struct tm *dt, const string& bucket_id,
const string& bucket_name)
{
string o;
@@ -198,8 +198,10 @@ static void log_usage(struct req_state *s, const string& op_name)
bucket_name = s->bucket_name;
if (!bucket_name.empty()) {
+ bucket_name = s->bucket_name;
user = s->bucket_owner.get_id();
- if (s->bucket_info.requester_pays) {
+ if (!rgw::sal::RGWBucket::empty(s->bucket.get()) &&
+ s->bucket->get_info().requester_pays) {
payer = s->user->get_id();
}
} else {
@@ -343,14 +345,14 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
ldout(s->cct, 5) << "nothing to log for operation" << dendl;
return -EINVAL;
}
- if (s->err.ret == -ERR_NO_SUCH_BUCKET) {
+ if (s->err.ret == -ERR_NO_SUCH_BUCKET || rgw::sal::RGWBucket::empty(s->bucket.get())) {
if (!s->cct->_conf->rgw_log_nonexistent_bucket) {
- ldout(s->cct, 5) << "bucket " << s->bucket << " doesn't exist, not logging" << dendl;
+ ldout(s->cct, 5) << "bucket " << s->bucket_name << " doesn't exist, not logging" << dendl;
return 0;
}
bucket_id = "";
} else {
- bucket_id = s->bucket.bucket_id;
+ bucket_id = s->bucket->get_bucket_id();
}
entry.bucket = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
@@ -359,8 +361,8 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
return 0;
}
- if (!s->object.empty()) {
- entry.obj = s->object;
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ entry.obj = s->object->get_key();
} else {
entry.obj = rgw_obj_key("-");
}
@@ -460,7 +462,7 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
if (s->cct->_conf->rgw_ops_log_rados) {
string oid = render_log_object_name(s->cct->_conf->rgw_log_object_name, &bdt,
- s->bucket.bucket_id, entry.bucket);
+ entry.bucket_id, entry.bucket);
rgw_raw_obj obj(store->svc.zone->get_zone_params().log_pool, oid);
diff --git a/src/rgw/rgw_multi.cc b/src/rgw/rgw_multi.cc
index 2e4858c1500..3bb7b260b0c 100644
--- a/src/rgw/rgw_multi.cc
+++ b/src/rgw/rgw_multi.cc
@@ -194,7 +194,7 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, struct req_state *s,
int *next_marker, bool *truncated,
bool assume_unsorted)
{
- return list_multipart_parts(store, s->bucket_info, s->cct, upload_id,
+ return list_multipart_parts(store, s->bucket->get_info(), s->cct, upload_id,
meta_oid, num_parts, marker, parts,
next_marker, truncated, assume_unsorted);
}
diff --git a/src/rgw/rgw_notify.cc b/src/rgw/rgw_notify.cc
index 25b5c533bfd..05b576ad3cc 100644
--- a/src/rgw/rgw_notify.cc
+++ b/src/rgw/rgw_notify.cc
@@ -15,8 +15,7 @@ namespace rgw::notify {
// populate record from request
void populate_record_from_request(const req_state *s,
- const rgw_obj_key& key,
- uint64_t size,
+ const rgw::sal::RGWObject* obj,
const ceph::real_time& mtime,
const std::string& etag,
EventType event_type,
@@ -29,17 +28,17 @@ void populate_record_from_request(const req_state *s,
// configurationId is filled from notification configuration
record.bucket_name = s->bucket_name;
record.bucket_ownerIdentity = s->bucket_owner.get_id().id;
- record.bucket_arn = to_string(rgw::ARN(s->bucket));
- record.object_key = key.name;
- record.object_size = size;
+ record.bucket_arn = to_string(rgw::ARN(s->bucket->get_bi()));
+ record.object_key = obj->get_name();
+ record.object_size = obj->get_obj_size();
record.object_etag = etag;
- record.object_versionId = key.instance;
+ record.object_versionId = obj->get_instance();
// use timestamp as per key sequence id (hex encoded)
const utime_t ts(real_clock::now());
boost::algorithm::hex((const char*)&ts, (const char*)&ts + sizeof(utime_t),
std::back_inserter(record.object_sequencer));
set_event_id(record.id, etag, ts);
- record.bucket_id = s->bucket.bucket_id;
+ record.bucket_id = s->bucket->get_bucket_id();
// pass meta data
record.x_meta_map = s->info.x_meta_map;
// pass tags
@@ -51,7 +50,7 @@ bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, EventType
if (!::match(filter.events, event)) {
return false;
}
- if (!::match(filter.s3_filter.key_filter, s->object.name)) {
+ if (!::match(filter.s3_filter.key_filter, s->object->get_name())) {
return false;
}
if (!::match(filter.s3_filter.metadata_filter, s->info.x_meta_map)) {
@@ -64,14 +63,13 @@ bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, EventType
}
int publish(const req_state* s,
- const rgw_obj_key& key,
- uint64_t size,
+ rgw::sal::RGWObject* obj,
const ceph::real_time& mtime,
const std::string& etag,
EventType event_type,
rgw::sal::RGWRadosStore* store) {
RGWUserPubSub ps_user(store, s->user->get_id());
- RGWUserPubSub::Bucket ps_bucket(&ps_user, s->bucket);
+ RGWUserPubSub::Bucket ps_bucket(&ps_user, s->bucket->get_bi());
rgw_pubsub_bucket_topics bucket_topics;
auto rc = ps_bucket.get_topics(&bucket_topics);
if (rc < 0) {
@@ -79,7 +77,7 @@ int publish(const req_state* s,
return rc;
}
rgw_pubsub_s3_record record;
- populate_record_from_request(s, key, size, mtime, etag, event_type, record);
+ populate_record_from_request(s, obj, mtime, etag, event_type, record);
bool event_handled = false;
bool event_should_be_handled = false;
for (const auto& bucket_topic : bucket_topics.topics) {
@@ -94,7 +92,7 @@ int publish(const req_state* s,
record.opaque_data = topic_cfg.opaque_data;
ldout(s->cct, 20) << "notification: '" << topic_filter.s3_id <<
"' on topic: '" << topic_cfg.dest.arn_topic <<
- "' and bucket: '" << s->bucket.name <<
+ "' and bucket: '" << s->bucket->get_name() <<
"' (unique topic: '" << topic_cfg.name <<
"') apply to event of type: '" << to_string(event_type) << "'" << dendl;
try {
diff --git a/src/rgw/rgw_notify.h b/src/rgw/rgw_notify.h
index 64c75914151..fa90af2de88 100644
--- a/src/rgw/rgw_notify.h
+++ b/src/rgw/rgw_notify.h
@@ -11,6 +11,7 @@
// forward declarations
namespace rgw::sal {
class RGWRadosStore;
+ class RGWObject;
}
class RGWRados;
class req_state;
@@ -20,8 +21,7 @@ namespace rgw::notify {
// publish notification
int publish(const req_state* s,
- const rgw_obj_key& key,
- uint64_t size,
+ rgw::sal::RGWObject* obj,
const ceph::real_time& mtime,
const std::string& etag,
EventType event_type,
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 7d3c965285d..efc8606d212 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -222,9 +222,9 @@ int rgw_op_get_bucket_policy_from_attr(CephContext *cct,
return ret;
} else {
ldout(cct, 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl;
- rgw::sal::RGWRadosUser user(store);
+ rgw::sal::RGWRadosUser user(store, bucket_info.owner);
/* object exists, but policy is broken */
- int r = user.get_by_id(bucket_info.owner, null_yield);
+ int r = user.load_by_id(null_yield);
if (r < 0)
return r;
@@ -257,8 +257,8 @@ static int get_obj_policy_from_attr(CephContext *cct,
} else if (ret == -ENODATA) {
/* object exists, but policy is broken */
ldout(cct, 0) << "WARNING: couldn't find acl header for object, generating default" << dendl;
- rgw::sal::RGWRadosUser user(store);
- ret = user.get_by_id(bucket_info.owner, y);
+ rgw::sal::RGWRadosUser user(store, bucket_info.owner);
+ ret = user.load_by_id(y);
if (ret < 0)
return ret;
@@ -328,7 +328,7 @@ vector<Policy> get_iam_user_policy_from_attr(CephContext* cct,
static int get_obj_attrs(rgw::sal::RGWRadosStore *store, struct req_state *s, const rgw_obj& obj, map<string, bufferlist>& attrs, rgw_obj *target_obj = nullptr)
{
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = &attrs;
@@ -344,7 +344,7 @@ static int get_obj_head(rgw::sal::RGWRadosStore *store, struct req_state *s,
{
store->getRados()->set_prefetch_data(s->obj_ctx, obj);
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = attrs;
@@ -440,29 +440,12 @@ static int get_multipart_info(rgw::sal::RGWRadosStore *store, struct req_state *
bufferlist header;
rgw_obj meta_obj;
- meta_obj.init_ns(s->bucket, meta_oid, mp_ns);
+ meta_obj.init_ns(s->bucket->get_bi(), meta_oid, mp_ns);
meta_obj.set_in_extra_data(true);
return get_multipart_info(store, s, meta_obj, policy, attrs, upload_info);
}
-static int modify_obj_attr(rgw::sal::RGWRadosStore *store, struct req_state *s, const rgw_obj& obj, const char* attr_name, bufferlist& attr_val)
-{
- map<string, bufferlist> attrs;
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
- RGWRados::Object::Read read_op(&op_target);
-
- read_op.params.attrs = &attrs;
-
- int r = read_op.prepare(s->yield);
- if (r < 0) {
- return r;
- }
- store->getRados()->set_atomic(s->obj_ctx, read_op.state.obj);
- attrs[attr_name] = attr_val;
- return store->getRados()->set_attrs(s->obj_ctx, s->bucket_info, read_op.state.obj, attrs, NULL, s->yield);
-}
-
static int read_bucket_policy(rgw::sal::RGWRadosStore *store,
struct req_state *s,
RGWBucketInfo& bucket_info,
@@ -561,7 +544,6 @@ static int read_obj_policy(rgw::sal::RGWRadosStore *store,
int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s)
{
int ret = 0;
- rgw_obj_key obj;
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
string bi = s->info.args.get(RGW_SYS_PARAM_PREFIX "bucket-instance");
@@ -613,43 +595,33 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state*
if (!s->bucket_name.empty()) {
s->bucket_exists = true;
- auto b = rgw_bucket(rgw_bucket_key(s->bucket_tenant, s->bucket_name, s->bucket_instance_id));
-
- RGWObjVersionTracker ep_ot;
- ret = store->ctl()->bucket->read_bucket_info(b, &s->bucket_info,
- s->yield,
- RGWBucketCtl::BucketInstance::GetParams()
- .set_mtime(&s->bucket_mtime)
- .set_attrs(&s->bucket_attrs),
- &ep_ot);
+ ret = store->get_bucket(s->user, rgw_bucket(rgw_bucket_key(s->bucket_tenant, s->bucket_name, s->bucket_instance_id)), &s->bucket);
if (ret < 0) {
if (ret != -ENOENT) {
- string bucket_log;
- bucket_log = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
- ldpp_dout(s, 0) << "NOTICE: couldn't get bucket from bucket_name (name="
- << bucket_log << ")" << dendl;
- return ret;
+ string bucket_log;
+ bucket_log = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
+ ldpp_dout(s, 0) << "NOTICE: couldn't get bucket from bucket_name (name="
+ << bucket_log << ")" << dendl;
+ return ret;
}
s->bucket_exists = false;
- }
- s->bucket_ep_objv = ep_ot.read_version;
- s->bucket = s->bucket_info.bucket;
-
- if (s->bucket_exists) {
- ret = read_bucket_policy(store, s, s->bucket_info, s->bucket_attrs,
- s->bucket_acl.get(), s->bucket);
- acct_acl_user = {
- s->bucket_info.owner,
- s->bucket_acl->get_owner().get_display_name(),
- };
- } else {
return -ERR_NO_SUCH_BUCKET;
}
+ s->bucket_mtime = s->bucket->get_modification_time();
+ s->bucket_attrs = s->bucket->get_attrs().attrs;
+ ret = read_bucket_policy(store, s, s->bucket->get_info(),
+ s->bucket->get_attrs().attrs,
+ s->bucket_acl.get(), s->bucket->get_bi());
+ acct_acl_user = {
+ s->bucket->get_info().owner,
+ s->bucket_acl->get_owner().get_display_name(),
+ };
+
s->bucket_owner = s->bucket_acl->get_owner();
RGWZoneGroup zonegroup;
- int r = store->svc()->zone->get_zonegroup(s->bucket_info.zonegroup, zonegroup);
+ int r = store->svc()->zone->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
if (!r) {
if (!zonegroup.endpoints.empty()) {
s->zonegroup_endpoint = zonegroup.endpoints.front();
@@ -666,9 +638,9 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state*
ret = r;
}
- if (s->bucket_exists && !store->svc()->zone->get_zonegroup().equals(s->bucket_info.zonegroup)) {
+ if (!store->svc()->zone->get_zonegroup().equals(s->bucket->get_info().zonegroup)) {
ldpp_dout(s, 0) << "NOTICE: request for data in a different zonegroup ("
- << s->bucket_info.zonegroup << " != "
+ << s->bucket->get_info().zonegroup << " != "
<< store->svc()->zone->get_zonegroup().get_id() << ")" << dendl;
/* we now need to make sure that the operation actually requires copy source, that is
* it's a copy operation
@@ -679,26 +651,21 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state*
/* If op is get bucket location, don't redirect */
} else if (!s->local_source ||
(s->op != OP_PUT && s->op != OP_COPY) ||
- s->object.empty()) {
+ rgw::sal::RGWObject::empty(s->object.get())) {
return -ERR_PERMANENT_REDIRECT;
}
}
- /* init dest placement -- only if bucket exists, otherwise request is either not relevant, or
- * it's a create_bucket request, in which case the op will deal with the placement later */
- if (s->bucket_exists) {
- s->dest_placement.storage_class = s->info.storage_class;
- s->dest_placement.inherit_from(s->bucket_info.placement_rule);
+ /* init dest placement */
+ s->dest_placement.storage_class = s->info.storage_class;
+ s->dest_placement.inherit_from(s->bucket->get_placement_rule());
- if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) {
- ldpp_dout(s, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
- return -EINVAL;
- }
+ if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) {
+ ldpp_dout(s, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
+ return -EINVAL;
}
- if(s->bucket_exists) {
- s->bucket_access_conf = get_public_access_conf_from_attr(s->bucket_attrs);
- }
+ s->bucket_access_conf = get_public_access_conf_from_attr(s->bucket->get_attrs().attrs);
}
/* handle user ACL only for those APIs which support it */
@@ -776,20 +743,21 @@ int rgw_build_object_policies(rgw::sal::RGWRadosStore *store, struct req_state *
{
int ret = 0;
- if (!s->object.empty()) {
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
if (!s->bucket_exists) {
return -ERR_NO_SUCH_BUCKET;
}
s->object_acl = std::make_unique<RGWAccessControlPolicy>(s->cct);
- rgw_obj obj(s->bucket, s->object);
+
+ s->object->set_bucket(s->bucket.get());
- store->getRados()->set_atomic(s->obj_ctx, obj);
+ s->object->set_atomic(s->obj_ctx);
if (prefetch_data) {
- store->getRados()->set_prefetch_data(s->obj_ctx, obj);
+ s->object->set_prefetch_data(s->obj_ctx);
}
- ret = read_obj_policy(store, s, s->bucket_info, s->bucket_attrs,
- s->object_acl.get(), nullptr, s->iam_policy, s->bucket,
- s->object);
+ ret = read_obj_policy(store, s, s->bucket->get_info(), s->bucket_attrs,
+ s->object_acl.get(), nullptr, s->iam_policy, s->bucket->get_bi(),
+ s->object->get_key());
}
return ret;
@@ -818,14 +786,14 @@ static int rgw_iam_add_tags_from_bl(struct req_state* s, bufferlist& bl){
return 0;
}
-static int rgw_iam_add_existing_objtags(rgw::sal::RGWRadosStore* store, struct req_state* s, rgw_obj& obj, std::uint64_t action){
- map <string, bufferlist> attrs;
- store->getRados()->set_atomic(s->obj_ctx, obj);
- int op_ret = get_obj_attrs(store, s, obj, attrs);
+static int rgw_iam_add_existing_objtags(rgw::sal::RGWRadosStore* store, struct req_state* s, std::uint64_t action) {
+ s->object->set_atomic(s->obj_ctx);
+ int op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield);
if (op_ret < 0)
return op_ret;
- auto tags = attrs.find(RGW_ATTR_TAGS);
- if (tags != attrs.end()){
+ rgw::sal::RGWAttrs attrs = s->object->get_attrs();
+ auto tags = attrs.attrs.find(RGW_ATTR_TAGS);
+ if (tags != attrs.attrs.end()){
return rgw_iam_add_tags_from_bl(s, tags->second);
}
return 0;
@@ -940,7 +908,7 @@ template<typename F>
int retry_raced_bucket_write(RGWRados* g, req_state* s, const F& f) {
auto r = f();
for (auto i = 0u; i < 15u && r == -ECANCELED; ++i) {
- r = g->try_refresh_bucket_info(s->bucket_info, nullptr,
+ r = g->try_refresh_bucket_info(s->bucket->get_info(), nullptr,
&s->bucket_attrs);
if (r >= 0) {
r = f();
@@ -953,30 +921,30 @@ int retry_raced_bucket_write(RGWRados* g, req_state* s, const F& f) {
int RGWGetObj::verify_permission()
{
- obj = rgw_obj(s->bucket, s->object);
- store->getRados()->set_atomic(s->obj_ctx, obj);
+ s->object->set_atomic(s->obj_ctx);
+
if (get_data) {
- store->getRados()->set_prefetch_data(s->obj_ctx, obj);
+ s->object->set_prefetch_data(s->obj_ctx);
}
if (torrent.get_flag()) {
- if (obj.key.instance.empty()) {
+ if (s->object->get_instance().empty()) {
action = rgw::IAM::s3GetObjectTorrent;
} else {
action = rgw::IAM::s3GetObjectVersionTorrent;
}
} else {
- if (obj.key.instance.empty()) {
+ if (s->object->get_instance().empty()) {
action = rgw::IAM::s3GetObject;
} else {
action = rgw::IAM::s3GetObjectVersion;
}
if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG))
- rgw_iam_add_existing_objtags(store, s, obj, action);
+ rgw_iam_add_existing_objtags(store, s, action);
if (! s->iam_user_policies.empty()) {
for (auto& user_policy : s->iam_user_policies) {
if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG))
- rgw_iam_add_existing_objtags(store, s, obj, action);
+ rgw_iam_add_existing_objtags(store, s, action);
}
}
}
@@ -985,7 +953,7 @@ int RGWGetObj::verify_permission()
return -EACCES;
}
- if (s->bucket_info.obj_lock_enabled()) {
+ if (s->bucket->get_info().obj_lock_enabled()) {
get_retention = verify_object_permission(this, s, rgw::IAM::s3GetObjectRetention);
get_legal_hold = verify_object_permission(this, s, rgw::IAM::s3GetObjectLegalHold);
}
@@ -1036,20 +1004,18 @@ int RGWOp::verify_op_mask()
int RGWGetObjTags::verify_permission()
{
- auto iam_action = s->object.instance.empty()?
+ auto iam_action = s->object->get_instance().empty()?
rgw::IAM::s3GetObjectTagging:
rgw::IAM::s3GetObjectVersionTagging;
// TODO since we are parsing the bl now anyway, we probably change
// the send_response function to accept RGWObjTag instead of a bl
if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){
- rgw_obj obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
if (! s->iam_user_policies.empty()) {
for (auto& user_policy : s->iam_user_policies) {
if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) {
- rgw_obj obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
}
}
@@ -1066,22 +1032,20 @@ void RGWGetObjTags::pre_exec()
void RGWGetObjTags::execute()
{
- rgw_obj obj;
- map<string,bufferlist> attrs;
+ rgw::sal::RGWAttrs attrs;
- obj = rgw_obj(s->bucket, s->object);
+ s->object->set_atomic(s->obj_ctx);
- store->getRados()->set_atomic(s->obj_ctx, obj);
-
- op_ret = get_obj_attrs(store, s, obj, attrs);
+ op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << obj
+ ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object
<< " ret=" << op_ret << dendl;
return;
}
- auto tags = attrs.find(RGW_ATTR_TAGS);
- if(tags != attrs.end()){
+ attrs = s->object->get_attrs();
+ auto tags = attrs.attrs.find(RGW_ATTR_TAGS);
+ if(tags != attrs.attrs.end()){
has_tags = true;
tags_bl.append(tags->second);
}
@@ -1090,19 +1054,17 @@ void RGWGetObjTags::execute()
int RGWPutObjTags::verify_permission()
{
- auto iam_action = s->object.instance.empty() ?
+ auto iam_action = s->object->get_instance().empty() ?
rgw::IAM::s3PutObjectTagging:
rgw::IAM::s3PutObjectVersionTagging;
if(s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){
- auto obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
if (! s->iam_user_policies.empty()) {
for (auto& user_policy : s->iam_user_policies) {
if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) {
- rgw_obj obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
}
}
@@ -1117,15 +1079,13 @@ void RGWPutObjTags::execute()
if (op_ret < 0)
return;
- if (s->object.empty()){
+ if (rgw::sal::RGWObject::empty(s->object.get())){
op_ret= -EINVAL; // we only support tagging on existing objects
return;
}
- rgw_obj obj;
- obj = rgw_obj(s->bucket, s->object);
- store->getRados()->set_atomic(s->obj_ctx, obj);
- op_ret = modify_obj_attr(store, s, obj, RGW_ATTR_TAGS, tags_bl);
+ s->object->set_atomic(s->obj_ctx);
+ op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_TAGS, tags_bl, s->yield);
if (op_ret == -ECANCELED){
op_ret = -ERR_TAG_CONFLICT;
}
@@ -1139,20 +1099,18 @@ void RGWDeleteObjTags::pre_exec()
int RGWDeleteObjTags::verify_permission()
{
- if (!s->object.empty()) {
- auto iam_action = s->object.instance.empty() ?
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ auto iam_action = s->object->get_instance().empty() ?
rgw::IAM::s3DeleteObjectTagging:
rgw::IAM::s3DeleteObjectVersionTagging;
if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){
- auto obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
if (! s->iam_user_policies.empty()) {
for (auto& user_policy : s->iam_user_policies) {
if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) {
- auto obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
}
}
@@ -1164,17 +1122,10 @@ int RGWDeleteObjTags::verify_permission()
void RGWDeleteObjTags::execute()
{
- if (s->object.empty())
+ if (rgw::sal::RGWObject::empty(s->object.get()))
return;
- rgw_obj obj;
- obj = rgw_obj(s->bucket, s->object);
- store->getRados()->set_atomic(s->obj_ctx, obj);
- map <string, bufferlist> attrs;
- map <string, bufferlist> rmattr;
- bufferlist bl;
- rmattr[RGW_ATTR_TAGS] = bl;
- op_ret = store->getRados()->set_attrs(s->obj_ctx, s->bucket_info, obj, attrs, &rmattr, s->yield);
+ op_ret = s->object->delete_obj_attrs(s->obj_ctx, RGW_ATTR_TAGS, s->yield);
}
int RGWGetBucketTags::verify_permission()
@@ -1224,7 +1175,7 @@ void RGWPutBucketTags::execute() {
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
map<string, bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_TAGS] = tags_bl;
- return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs, &s->bucket_info.objv_tracker, s->yield);
+ return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, s->yield);
});
}
@@ -1253,10 +1204,10 @@ void RGWDeleteBucketTags::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
map<string, bufferlist> attrs = s->bucket_attrs;
attrs.erase(RGW_ATTR_TAGS);
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs, &s->bucket_info.objv_tracker, s->yield);
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, s->yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "RGWDeleteBucketTags() failed to remove RGW_ATTR_TAGS on bucket="
- << s->bucket.name
+ << s->bucket->get_name()
<< " returned err= " << op_ret << dendl;
}
return op_ret;
@@ -1301,18 +1252,18 @@ void RGWPutBucketReplication::execute() {
}
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
- auto sync_policy = (s->bucket_info.sync_policy ? *s->bucket_info.sync_policy : rgw_sync_policy_info());
+ auto sync_policy = (s->bucket->get_info().sync_policy ? *s->bucket->get_info().sync_policy : rgw_sync_policy_info());
for (auto& group : sync_policy_groups) {
sync_policy.groups[group.id] = group;
}
- s->bucket_info.set_sync_policy(std::move(sync_policy));
+ s->bucket->get_info().set_sync_policy(std::move(sync_policy));
- int ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(),
+ int ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false, real_time(),
&s->bucket_attrs);
if (ret < 0) {
- ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket_info.bucket.get_key() << ") returned ret=" << ret << dendl;
+ ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket->get_info().bucket.get_key() << ") returned ret=" << ret << dendl;
return ret;
}
@@ -1342,20 +1293,20 @@ void RGWDeleteBucketReplication::execute()
}
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
- if (!s->bucket_info.sync_policy) {
+ if (!s->bucket->get_info().sync_policy) {
return 0;
}
- rgw_sync_policy_info sync_policy = *s->bucket_info.sync_policy;
+ rgw_sync_policy_info sync_policy = *s->bucket->get_info().sync_policy;
update_sync_policy(&sync_policy);
- s->bucket_info.set_sync_policy(std::move(sync_policy));
+ s->bucket->get_info().set_sync_policy(std::move(sync_policy));
- int ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(),
+ int ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false, real_time(),
&s->bucket_attrs);
if (ret < 0) {
- ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket_info.bucket.get_key() << ") returned ret=" << ret << dendl;
+ ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket->get_key() << ") returned ret=" << ret << dendl;
return ret;
}
@@ -1394,24 +1345,24 @@ int RGWOp::init_quota()
}
/* only interested in object related ops */
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
return 0;
}
- rgw::sal::RGWRadosUser owner_user(store);
- rgw::sal::RGWUser *user;
+ rgw::sal::RGWRadosUser owner_user(store, s->bucket->get_info().owner);
+ rgw::sal::RGWUser* user;
if (s->user->get_id() == s->bucket_owner.get_id()) {
user = s->user;
} else {
- int r = owner_user.get_by_id(s->bucket_info.owner, s->yield);
+ int r = owner_user.load_by_id(s->yield);
if (r < 0)
return r;
user = &owner_user;
}
- if (s->bucket_info.quota.enabled) {
- bucket_quota = s->bucket_info.quota;
+ if (s->bucket->get_info().quota.enabled) {
+ bucket_quota = s->bucket->get_info().quota;
} else if (user->get_info().bucket_quota.enabled) {
bucket_quota = user->get_info().bucket_quota;
} else {
@@ -1615,7 +1566,7 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
obj_ctx.set_atomic(part);
store->getRados()->set_prefetch_data(&obj_ctx, part);
- RGWRados::Object op_target(store->getRados(), s->bucket_info, obj_ctx, part);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), obj_ctx, part);
RGWRados::Object::Read read_op(&op_target);
if (!swift_slo) {
@@ -1900,8 +1851,6 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
const std::string bucket_name = url_decode(prefix_view.substr(0, pos));
const std::string obj_prefix = url_decode(prefix_view.substr(pos + 1));
- rgw_bucket bucket;
-
RGWAccessControlPolicy _bucket_acl(s->cct);
RGWAccessControlPolicy *bucket_acl;
boost::optional<Policy> _bucket_policy;
@@ -1909,7 +1858,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
RGWBucketInfo bucket_info;
RGWBucketInfo *pbucket_info;
- if (bucket_name.compare(s->bucket.name) != 0) {
+ if (bucket_name.compare(s->bucket->get_name()) != 0) {
map<string, bufferlist> bucket_attrs;
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
int r = store->getRados()->get_bucket_info(store->svc(), s->user->get_tenant(),
@@ -1920,10 +1869,9 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
<< bucket_name << dendl;
return r;
}
- bucket = bucket_info.bucket;
pbucket_info = &bucket_info;
bucket_acl = &_bucket_acl;
- r = read_bucket_policy(store, s, bucket_info, bucket_attrs, bucket_acl, bucket);
+ r = read_bucket_policy(store, s, bucket_info, bucket_attrs, bucket_acl, bucket_info.bucket);
if (r < 0) {
ldpp_dout(this, 0) << "failed to read bucket policy" << dendl;
return r;
@@ -1932,8 +1880,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
bucket_info.bucket.tenant);
bucket_policy = &_bucket_policy;
} else {
- bucket = s->bucket;
- pbucket_info = &s->bucket_info;
+ pbucket_info = &s->bucket->get_info();
bucket_acl = s->bucket_acl.get();
bucket_policy = &s->iam_policy;
}
@@ -1949,6 +1896,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
if (r < 0) {
return r;
}
+ s->object->set_obj_size(s->obj_size);
r = RGWRados::Object::Read::range_to_ofs(s->obj_size, ofs, end);
if (r < 0) {
@@ -2033,7 +1981,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl)
RGWAccessControlPolicy *bucket_acl;
Policy* bucket_policy;
- if (bucket_name.compare(s->bucket.name) != 0) {
+ if (bucket_name.compare(s->bucket->get_name()) != 0) {
const auto& piter = policies.find(bucket_name);
if (piter != policies.end()) {
bucket_acl = piter->second.first;
@@ -2070,7 +2018,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl)
policies[bucket_name] = make_pair(bucket_acl, _bucket_policy);
}
} else {
- bucket = s->bucket;
+ bucket = s->bucket->get_bi();
bucket_acl = s->bucket_acl.get();
bucket_policy = s->iam_policy.get_ptr();
}
@@ -2098,6 +2046,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl)
complete_etag(etag_sum, &lo_etag);
s->obj_size = slo_info.total_size;
+ s->object->set_obj_size(slo_info.total_size);
ldpp_dout(this, 20) << "s->obj_size=" << s->obj_size << dendl;
int r = RGWRados::Object::Read::range_to_ofs(total_len, ofs, end);
@@ -2125,7 +2074,7 @@ int RGWGetObj::get_data_cb(bufferlist& bl, off_t bl_ofs, off_t bl_len)
/* garbage collection related handling */
utime_t start_time = ceph_clock_now();
if (start_time > gc_invalidate_time) {
- int r = store->getRados()->defer_gc(s->obj_ctx, s->bucket_info, obj, s->yield);
+ int r = store->getRados()->defer_gc(s->obj_ctx, s->bucket->get_info(), s->object->get_obj(), s->yield);
if (r < 0) {
ldpp_dout(this, 0) << "WARNING: could not defer gc entry for obj" << dendl;
}
@@ -2209,7 +2158,7 @@ void RGWGetObj::execute()
perfcounter->inc(l_rgw_get);
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), s->object->get_obj());
RGWRados::Object::Read read_op(&op_target);
op_ret = get_params();
@@ -2235,6 +2184,7 @@ void RGWGetObj::execute()
if (op_ret < 0)
goto done_err;
version_id = read_op.state.obj.key.instance;
+ s->object->set_obj_size(s->obj_size);
/* STAT ops don't need data, and do no i/o */
if (get_type() == RGW_OP_STAT_OBJ) {
@@ -2255,6 +2205,7 @@ void RGWGetObj::execute()
goto done_err;
}
torrent.init(s, store);
+ rgw_obj obj = s->object->get_obj();
op_ret = torrent.get_torrent_file(read_op, total_len, bl, obj);
if (op_ret < 0)
{
@@ -2279,6 +2230,7 @@ void RGWGetObj::execute()
}
if (need_decompress) {
s->obj_size = cs_info.orig_size;
+ s->object->set_obj_size(cs_info.orig_size);
decompress.emplace(s->cct, &cs_info, partial_content, filter);
filter = &*decompress;
}
@@ -2446,9 +2398,7 @@ void RGWListBuckets::execute()
read_count = max_buckets;
}
- rgw::sal::RGWRadosUser user(store, s->user->get_id());
-
- op_ret = user.list_buckets(marker, end_marker, read_count, should_get_stats(), buckets);
+ op_ret = s->user->list_buckets(marker, end_marker, read_count, should_get_stats(), buckets);
if (op_ret < 0) {
/* hmm.. something wrong here.. the user was authenticated, so it
@@ -2466,7 +2416,7 @@ void RGWListBuckets::execute()
decltype(policies_stats)::mapped_type());
}
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ std::map<std::string, std::unique_ptr<rgw::sal::RGWBucket>>& m = buckets.get_buckets();
for (const auto& kv : m) {
const auto& bucket = kv.second;
@@ -2494,7 +2444,7 @@ void RGWListBuckets::execute()
if (read_count > 0 &&
!m.empty()) {
- map<string, rgw::sal::RGWBucket*>::reverse_iterator riter = m.rbegin();
+ auto riter = m.rbegin();
marker = riter->first;
handle_listing_chunk(std::move(buckets));
@@ -2609,7 +2559,7 @@ void RGWStatAccount::execute()
decltype(policies_stats)::mapped_type());
}
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ std::map<std::string, std::unique_ptr<rgw::sal::RGWBucket>>& m = buckets.get_buckets();
for (const auto& kv : m) {
const auto& bucket = kv.second;
lastmarker = &kv.first;
@@ -2655,9 +2605,9 @@ void RGWGetBucketVersioning::execute()
return;
}
- versioned = s->bucket_info.versioned();
- versioning_enabled = s->bucket_info.versioning_enabled();
- mfa_enabled = s->bucket_info.mfa_enabled();
+ versioned = s->bucket->versioned();
+ versioning_enabled = s->bucket->versioning_enabled();
+ mfa_enabled = s->bucket->get_info().mfa_enabled();
}
int RGWSetBucketVersioning::verify_permission()
@@ -2681,12 +2631,12 @@ void RGWSetBucketVersioning::execute()
return;
}
- if (s->bucket_info.obj_lock_enabled() && versioning_status != VersioningEnabled) {
+ if (s->bucket->get_info().obj_lock_enabled() && versioning_status != VersioningEnabled) {
op_ret = -ERR_INVALID_BUCKET_STATE;
return;
}
- bool cur_mfa_status = (s->bucket_info.flags & BUCKET_MFA_ENABLED) != 0;
+ bool cur_mfa_status = s->bucket->get_info().mfa_enabled();
mfa_set_status &= (mfa_status != cur_mfa_status);
@@ -2700,9 +2650,9 @@ void RGWSetBucketVersioning::execute()
bool req_versioning_status = false;
//if requested versioning status is not the same as the one set for the bucket, return error
if (versioning_status == VersioningEnabled) {
- req_versioning_status = (s->bucket_info.flags & BUCKET_VERSIONS_SUSPENDED) != 0;
+ req_versioning_status = (s->bucket->get_info().flags & BUCKET_VERSIONS_SUSPENDED) != 0;
} else if (versioning_status == VersioningSuspended) {
- req_versioning_status = (s->bucket_info.flags & BUCKET_VERSIONS_SUSPENDED) == 0;
+ req_versioning_status = (s->bucket->get_info().flags & BUCKET_VERSIONS_SUSPENDED) == 0;
}
if (req_versioning_status && !s->mfa_verified) {
op_ret = -ERR_MFA_REQUIRED;
@@ -2723,24 +2673,24 @@ void RGWSetBucketVersioning::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [&] {
if (mfa_set_status) {
if (mfa_status) {
- s->bucket_info.flags |= BUCKET_MFA_ENABLED;
+ s->bucket->get_info().flags |= BUCKET_MFA_ENABLED;
} else {
- s->bucket_info.flags &= ~BUCKET_MFA_ENABLED;
+ s->bucket->get_info().flags &= ~BUCKET_MFA_ENABLED;
}
}
if (versioning_status == VersioningEnabled) {
- s->bucket_info.flags |= BUCKET_VERSIONED;
- s->bucket_info.flags &= ~BUCKET_VERSIONS_SUSPENDED;
+ s->bucket->get_info().flags |= BUCKET_VERSIONED;
+ s->bucket->get_info().flags &= ~BUCKET_VERSIONS_SUSPENDED;
modified = true;
} else if (versioning_status == VersioningSuspended) {
- s->bucket_info.flags |= (BUCKET_VERSIONED | BUCKET_VERSIONS_SUSPENDED);
+ s->bucket->get_info().flags |= (BUCKET_VERSIONED | BUCKET_VERSIONS_SUSPENDED);
modified = true;
} else {
return op_ret;
}
- return store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(),
- &s->bucket_attrs);
+ s->bucket->set_attrs(rgw::sal::RGWAttrs(s->bucket_attrs));
+ return s->bucket->put_instance_info(false, real_time());
});
if (!modified) {
@@ -2748,7 +2698,7 @@ void RGWSetBucketVersioning::execute()
}
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -2766,7 +2716,7 @@ void RGWGetBucketWebsite::pre_exec()
void RGWGetBucketWebsite::execute()
{
- if (!s->bucket_info.has_website) {
+ if (!s->bucket->get_info().has_website) {
op_ret = -ERR_NO_SUCH_WEBSITE_CONFIGURATION;
}
}
@@ -2797,15 +2747,15 @@ void RGWSetBucketWebsite::execute()
}
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
- s->bucket_info.has_website = true;
- s->bucket_info.website_conf = website_conf;
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false,
+ s->bucket->get_info().has_website = true;
+ s->bucket->get_info().website_conf = website_conf;
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false,
real_time(), &s->bucket_attrs);
return op_ret;
});
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -2828,20 +2778,20 @@ void RGWDeleteBucketWebsite::execute()
bufferlist in_data;
op_ret = forward_request_to_master(s, nullptr, store, in_data, nullptr);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: forward_to_master failed on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: forward_to_master failed on bucket=" << s->bucket->get_name()
<< "returned err=" << op_ret << dendl;
return;
}
}
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
- s->bucket_info.has_website = false;
- s->bucket_info.website_conf = RGWBucketWebsiteConf();
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false,
+ s->bucket->get_info().has_website = false;
+ s->bucket->get_info().website_conf = RGWBucketWebsiteConf();
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false,
real_time(), &s->bucket_attrs);
return op_ret;
});
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -2869,8 +2819,10 @@ void RGWStatBucket::execute()
return;
}
- rgw::sal::RGWRadosUser user(store, s->user->get_id());
- bucket = new rgw::sal::RGWRadosBucket(store, user, s->bucket);
+ op_ret = store->get_bucket(s->user, s->bucket->get_bi(), &bucket);
+ if (op_ret) {
+ return;
+ }
op_ret = bucket->update_container_stats();
}
@@ -2930,10 +2882,10 @@ void RGWListBucket::execute()
}
if (need_container_stats()) {
- op_ret = bucket->update_container_stats();
+ op_ret = s->bucket->update_container_stats();
}
- RGWRados::Bucket target(store->getRados(), s->bucket_info);
+ RGWRados::Bucket target(store->getRados(), s->bucket->get_info());
if (shard_id >= 0) {
target.set_shard_id(shard_id);
}
@@ -3207,13 +3159,11 @@ static void filter_out_website(std::map<std::string, ceph::bufferlist>& add_attr
void RGWCreateBucket::execute()
{
- RGWAccessControlPolicy old_policy(s->cct);
buffer::list aclbl;
buffer::list corsbl;
bool existed;
string bucket_name = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
rgw_raw_obj obj(store->svc()->zone->get_zone_params().domain_root, bucket_name);
- obj_version objv, *pobjv = NULL;
op_ret = get_params();
if (op_ret < 0)
@@ -3252,56 +3202,18 @@ void RGWCreateBucket::execute()
/* we need to make sure we read bucket info, it's not read before for this
* specific request */
- s->bucket.tenant = s->bucket_tenant;
- s->bucket.name = s->bucket_name;
- rgw::sal::RGWBucket* bucket = NULL;
- op_ret = store->get_bucket(*s->user, s->bucket, &bucket);
+ op_ret = store->get_bucket(s->user, s->bucket_tenant, s->bucket_name, &s->bucket);
if (op_ret < 0 && op_ret != -ENOENT)
return;
s->bucket_exists = (op_ret != -ENOENT);
- s->bucket_owner.set_id(s->user->get_id());
- s->bucket_owner.set_name(s->user->get_display_name());
if (s->bucket_exists) {
- s->bucket_info = bucket->get_info();
- s->bucket_attrs = bucket->get_attrs();
- delete bucket;
- int r = rgw_op_get_bucket_policy_from_attr(s->cct, store, s->bucket_info,
- s->bucket_attrs, &old_policy);
- if (r >= 0) {
- if (old_policy.get_owner().get_id().compare(s->user->get_id()) != 0) {
- op_ret = -EEXIST;
- return;
- }
- }
+ /* Initialize info from req_state */
+ info = s->bucket->get_info();
}
- RGWBucketInfo master_info;
- rgw_bucket *pmaster_bucket;
- uint32_t *pmaster_num_shards;
- real_time creation_time;
-
- if (!store->svc()->zone->is_meta_master()) {
- JSONParser jp;
- op_ret = forward_request_to_master(s, NULL, store, in_data, &jp);
- if (op_ret < 0) {
- return;
- }
-
- JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp);
- JSONDecoder::decode_json("object_ver", objv, &jp);
- JSONDecoder::decode_json("bucket_info", master_info, &jp);
- ldpp_dout(this, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl;
- ldpp_dout(this, 20) << "got creation time: << " << master_info.creation_time << dendl;
- pmaster_bucket= &master_info.bucket;
- creation_time = master_info.creation_time;
- pmaster_num_shards = &master_info.layout.current_index.layout.normal.num_shards;
- pobjv = &objv;
- obj_lock_enabled = master_info.obj_lock_enabled();
- } else {
- pmaster_bucket = NULL;
- pmaster_num_shards = NULL;
- }
+ s->bucket_owner.set_id(s->user->get_id()); /* XXX dang use s->bucket->owner */
+ s->bucket_owner.set_name(s->user->get_display_name());
string zonegroup_id;
@@ -3314,21 +3226,6 @@ void RGWCreateBucket::execute()
zonegroup_id = store->svc()->zone->get_zonegroup().get_id();
}
- if (s->bucket_exists) {
- rgw_placement_rule selected_placement_rule;
- rgw_bucket bucket;
- bucket.tenant = s->bucket_tenant;
- bucket.name = s->bucket_name;
- op_ret = store->svc()->zone->select_bucket_placement(s->user->get_info(),
- zonegroup_id,
- placement_rule,
- &selected_placement_rule, nullptr);
- if (selected_placement_rule != s->bucket_info.placement_rule) {
- op_ret = -EEXIST;
- return;
- }
- }
-
/* Encode special metadata first as we're using std::map::emplace under
* the hood. This method will add the new items only if the map doesn't
* contain such keys yet. */
@@ -3360,31 +3257,32 @@ void RGWCreateBucket::execute()
}
/* Web site of Swift API. */
- filter_out_website(attrs, rmattr_names, s->bucket_info.website_conf);
- s->bucket_info.has_website = !s->bucket_info.website_conf.is_empty();
+ filter_out_website(attrs, rmattr_names, info.website_conf);
+ info.has_website = !info.website_conf.is_empty();
}
- s->bucket.tenant = s->bucket_tenant; /* ignored if bucket exists */
- s->bucket.name = s->bucket_name;
+ rgw_bucket tmp_bucket;
+ tmp_bucket.tenant = s->bucket_tenant; /* ignored if bucket exists */
+ tmp_bucket.name = s->bucket_name;
/* Handle updates of the metadata for Swift's object versioning. */
if (swift_ver_location) {
- s->bucket_info.swift_ver_location = *swift_ver_location;
- s->bucket_info.swift_versioning = (! swift_ver_location->empty());
- }
- if (obj_lock_enabled) {
- info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
+ info.swift_ver_location = *swift_ver_location;
+ info.swift_versioning = (! swift_ver_location->empty());
}
+ /* We're replacing bucket with the newly created one */
+ ldpp_dout(this, 10) << "user=" << s->user << " bucket=" << tmp_bucket << dendl;
+ op_ret = store->create_bucket(*s->user, tmp_bucket, zonegroup_id,
+ placement_rule,
+ info.swift_ver_location,
+ pquota_info, attrs, info, ep_objv,
+ true, obj_lock_enabled, &s->bucket_exists, s->info,
+ &s->bucket);
- op_ret = store->getRados()->create_bucket(s->user->get_info(), s->bucket, zonegroup_id,
- placement_rule, s->bucket_info.swift_ver_location,
- pquota_info, attrs,
- info, pobjv, &ep_objv, creation_time,
- pmaster_bucket, pmaster_num_shards, true);
/* continue if EEXIST and create_bucket will fail below. this way we can
* recover from a partial create by retrying it. */
- ldpp_dout(this, 20) << "rgw_create_bucket returned ret=" << op_ret << " bucket=" << s->bucket << dendl;
+ ldpp_dout(this, 20) << "rgw_create_bucket returned ret=" << op_ret << " bucket=" << s->bucket.get() << dendl;
if (op_ret && op_ret != -EEXIST)
return;
@@ -3398,18 +3296,17 @@ void RGWCreateBucket::execute()
* If all is ok then update the user's list of buckets.
* Otherwise inform client about a name conflict.
*/
- if (info.owner.compare(s->user->get_id()) != 0) {
+ if (s->bucket->get_info().owner.compare(s->user->get_id()) != 0) {
op_ret = -EEXIST;
return;
}
- s->bucket = info.bucket;
}
- op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), s->bucket,
- info.creation_time, s->yield, false);
+ op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), s->bucket->get_bi(),
+ s->bucket->get_creation_time(), s->yield, false);
if (op_ret && !existed && op_ret != -EEXIST) {
/* if it exists (or previously existed), don't remove it! */
- op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), s->bucket, s->yield);
+ op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), s->bucket->get_bi(), s->yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret
<< dendl;
@@ -3425,20 +3322,17 @@ void RGWCreateBucket::execute()
* changed in the meantime, we have to refresh. */
short tries = 0;
do {
- RGWBucketInfo binfo;
map<string, bufferlist> battrs;
- op_ret = store->getRados()->get_bucket_info(store->svc(), s->bucket_tenant, s->bucket_name,
- binfo, nullptr, s->yield, &battrs);
+ op_ret = s->bucket->get_bucket_info(s->yield);
if (op_ret < 0) {
return;
- } else if (binfo.owner.compare(s->user->get_id()) != 0) {
+ } else if (!s->bucket->is_owner(s->user)) {
/* New bucket doesn't belong to the account we're operating on. */
op_ret = -EEXIST;
return;
} else {
- s->bucket_info = binfo;
- s->bucket_attrs = battrs;
+ s->bucket_attrs = s->bucket->get_attrs().attrs;
}
attrs.clear();
@@ -3449,24 +3343,24 @@ void RGWCreateBucket::execute()
}
prepare_add_del_attrs(s->bucket_attrs, rmattr_names, attrs);
populate_with_generic_attrs(s, attrs);
- op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket_info.quota);
+ op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket->get_info().quota);
if (op_ret < 0) {
return;
}
/* Handle updates of the metadata for Swift's object versioning. */
if (swift_ver_location) {
- s->bucket_info.swift_ver_location = *swift_ver_location;
- s->bucket_info.swift_versioning = (! swift_ver_location->empty());
+ s->bucket->get_info().swift_ver_location = *swift_ver_location;
+ s->bucket->get_info().swift_versioning = (! swift_ver_location->empty());
}
/* Web site of Swift API. */
- filter_out_website(attrs, rmattr_names, s->bucket_info.website_conf);
- s->bucket_info.has_website = !s->bucket_info.website_conf.is_empty();
+ filter_out_website(attrs, rmattr_names, s->bucket->get_info().website_conf);
+ s->bucket->get_info().has_website = !s->bucket->get_info().website_conf.is_empty();
/* This will also set the quota on the bucket. */
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
} while (op_ret == -ECANCELED && tries++ < 20);
@@ -3504,7 +3398,7 @@ void RGWDeleteBucket::execute()
return;
}
RGWObjVersionTracker ot;
- ot.read_version = s->bucket_ep_objv;
+ ot.read_version = s->bucket->get_version();
if (s->system_request) {
string tag = s->info.args.get(RGW_SYS_PARAM_PREFIX "tag");
@@ -3523,12 +3417,12 @@ void RGWDeleteBucket::execute()
}
}
- op_ret = store->ctl()->bucket->sync_user_stats(s->user->get_id(), s->bucket_info);
+ op_ret = s->bucket->sync_user_stats();
if ( op_ret < 0) {
ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
}
-
- op_ret = store->getRados()->check_bucket_empty(s->bucket_info, s->yield);
+
+ op_ret = s->bucket->check_empty(s->yield);
if (op_ret < 0) {
return;
}
@@ -3562,29 +3456,14 @@ void RGWDeleteBucket::execute()
}
}
- op_ret = abort_bucket_multiparts(store, s->cct, s->bucket_info, prefix, delimiter);
-
- if (op_ret < 0) {
- return;
- }
-
- op_ret = store->getRados()->delete_bucket(s->bucket_info, ot, s->yield, false);
+ op_ret = s->bucket->remove_bucket(false, prefix, delimiter, s->yield);
- if (op_ret == -ECANCELED) {
- // lost a race, either with mdlog sync or another delete bucket operation.
- // in either case, we've already called ctl.bucket->unlink_bucket()
- op_ret = 0;
- return;
- }
-
- if (op_ret == 0) {
- op_ret = store->ctl()->bucket->unlink_bucket(s->bucket_info.owner,
- s->bucket, s->yield, false);
- if (op_ret < 0) {
- ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret
- << dendl;
- }
+ if (op_ret < 0 && op_ret == -ECANCELED) {
+ // lost a race, either with mdlog sync or another delete bucket operation.
+ // in either case, we've already called ctl.bucket->unlink_bucket()
+ op_ret = 0;
}
+ return;
}
int RGWPutObj::verify_permission()
@@ -3682,10 +3561,13 @@ int RGWPutObj::verify_permission()
rgw_add_to_iam_environment(s->env, s3_kms_attr, kms_header->second);
}
+ /* Object needs a bucket from this point */
+ s->object->set_bucket(s->bucket.get());
+
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
if (usr_policy_res == Effect::Deny)
return -EACCES;
@@ -3693,7 +3575,7 @@ int RGWPutObj::verify_permission()
if (s->iam_policy) {
e = s->iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
}
if (e == Effect::Allow) {
return 0;
@@ -3854,7 +3736,7 @@ void RGWPutObj::execute()
});
op_ret = -EINVAL;
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
return;
}
@@ -3863,6 +3745,8 @@ void RGWPutObj::execute()
return;
}
+ /* Object needs a bucket from this point */
+ s->object->set_bucket(s->bucket.get());
op_ret = get_system_versioning_params(s, &olh_epoch, &version_id);
if (op_ret < 0) {
@@ -3889,7 +3773,7 @@ void RGWPutObj::execute()
if (!chunked_upload) { /* with chunked upload we don't know how big is the upload.
we also check sizes at the end anyway */
- op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket,
+ op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket->get_bi(),
user_quota, bucket_quota, s->content_length);
if (op_ret < 0) {
ldpp_dout(this, 20) << "check_quota() returned ret=" << op_ret << dendl;
@@ -3904,14 +3788,13 @@ void RGWPutObj::execute()
const bool multipart = !multipart_upload_id.empty();
auto& obj_ctx = *static_cast<RGWObjectCtx*>(s->obj_ctx);
- rgw_obj obj{s->bucket, s->object};
/* Handle object versioning of Swift API. */
if (! multipart) {
op_ret = store->getRados()->swift_versioning_copy(obj_ctx,
s->bucket_owner.get_id(),
- s->bucket_info,
- obj,
+ s->bucket.get(),
+ s->object.get(),
this,
s->yield);
if (op_ret < 0) {
@@ -3932,7 +3815,7 @@ void RGWPutObj::execute()
multipart_upload_info upload_info;
if (multipart) {
- RGWMPObj mp(s->object.name, multipart_upload_id);
+ RGWMPObj mp(s->object->get_name(), multipart_upload_id);
op_ret = get_multipart_info(store, s, mp.get_meta(), nullptr, nullptr, &upload_info);
if (op_ret < 0) {
@@ -3946,32 +3829,33 @@ void RGWPutObj::execute()
pdest_placement = &upload_info.dest_placement;
ldpp_dout(this, 20) << "dest_placement for part=" << upload_info.dest_placement << dendl;
processor.emplace<MultipartObjectProcessor>(
- &*aio, store, s->bucket_info, pdest_placement,
- s->owner.get_id(), obj_ctx, obj,
+ &*aio, store, s->bucket.get(), pdest_placement,
+ s->owner.get_id(), obj_ctx, s->object->get_obj(),
multipart_upload_id, multipart_part_num, multipart_part_str,
this, s->yield);
} else if(append) {
- if (s->bucket_info.versioned()) {
+ if (s->bucket->versioned()) {
op_ret = -ERR_INVALID_BUCKET_STATE;
return;
}
pdest_placement = &s->dest_placement;
processor.emplace<AppendObjectProcessor>(
- &*aio, store, s->bucket_info, pdest_placement, s->bucket_owner.get_id(),obj_ctx, obj,
+ &*aio, store, s->bucket.get(), pdest_placement, s->bucket_owner.get_id(),
+ obj_ctx, s->object->get_obj(),
s->req_id, position, &cur_accounted_size, this, s->yield);
} else {
- if (s->bucket_info.versioning_enabled()) {
+ if (s->bucket->versioning_enabled()) {
if (!version_id.empty()) {
- obj.key.set_instance(version_id);
+ s->object->set_instance(version_id);
} else {
- store->getRados()->gen_rand_obj_instance_name(&obj);
- version_id = obj.key.instance;
+ s->object->gen_rand_obj_instance_name();
+ version_id = s->object->get_instance();
}
}
pdest_placement = &s->dest_placement;
processor.emplace<AtomicObjectProcessor>(
- &*aio, store, s->bucket_info, pdest_placement,
- s->bucket_owner.get_id(), obj_ctx, obj, olh_epoch,
+ &*aio, store, s->bucket.get(), pdest_placement,
+ s->bucket_owner.get_id(), obj_ctx, s->object->get_obj(), olh_epoch,
s->req_id, this, s->yield);
}
@@ -3983,12 +3867,11 @@ void RGWPutObj::execute()
}
if ((! copy_source.empty()) && !copy_source_range) {
- rgw_obj_key obj_key(copy_source_object_name, copy_source_version_id);
- rgw_obj obj(copy_source_bucket_info.bucket, obj_key.name);
+ rgw::sal::RGWRadosObject obj(store, rgw_obj_key(copy_source_object_name, copy_source_version_id));
+ rgw::sal::RGWRadosBucket bucket(store, copy_source_bucket_info);
RGWObjState *astate;
- op_ret = store->getRados()->get_obj_state(&obj_ctx, copy_source_bucket_info, obj,
- &astate, true, s->yield, false);
+ op_ret = obj.get_obj_state(&obj_ctx, bucket, &astate, s->yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: get copy source obj state returned with error" << op_ret << dendl;
return;
@@ -4084,6 +3967,7 @@ void RGWPutObj::execute()
return;
}
s->obj_size = ofs;
+ s->object->set_obj_size(ofs);
perfcounter->inc(l_rgw_put_b, s->obj_size);
@@ -4092,7 +3976,7 @@ void RGWPutObj::execute()
return;
}
- op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket,
+ op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket->get_bi(),
user_quota, bucket_quota, s->obj_size);
if (op_ret < 0) {
ldpp_dout(this, 20) << "second check_quota() returned op_ret=" << op_ret << dendl;
@@ -4198,7 +4082,7 @@ void RGWPutObj::execute()
}
// send request to notification manager
- const auto ret = rgw::notify::publish(s, obj.key, s->obj_size, mtime, etag, rgw::notify::ObjectCreatedPut, store);
+ const auto ret = rgw::notify::publish(s, s->object.get(), mtime, etag, rgw::notify::ObjectCreatedPut, store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
// TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
@@ -4238,7 +4122,7 @@ void RGWPostObj::execute()
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
if (usr_policy_res == Effect::Deny) {
op_ret = -EACCES;
return;
@@ -4248,7 +4132,7 @@ void RGWPostObj::execute()
if (s->iam_policy) {
e = s->iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
}
if (e == Effect::Deny) {
op_ret = -EACCES;
@@ -4272,7 +4156,7 @@ void RGWPostObj::execute()
int len = 0;
op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(),
- s->bucket,
+ s->bucket->get_bi(),
user_quota,
bucket_quota,
s->content_length);
@@ -4295,20 +4179,21 @@ void RGWPostObj::execute()
ldpp_dout(this, 15) << "supplied_md5=" << supplied_md5 << dendl;
}
- rgw_obj obj(s->bucket, get_current_filename());
- if (s->bucket_info.versioning_enabled()) {
- store->getRados()->gen_rand_obj_instance_name(&obj);
+ std::unique_ptr<rgw::sal::RGWObject> obj =
+ s->bucket->get_object(rgw_obj_key(get_current_filename()));
+ if (s->bucket->versioning_enabled()) {
+ obj->gen_rand_obj_instance_name();
}
auto aio = rgw::make_throttle(s->cct->_conf->rgw_put_obj_min_window_size,
s->yield);
using namespace rgw::putobj;
- AtomicObjectProcessor processor(&*aio, store, s->bucket_info,
+ AtomicObjectProcessor processor(&*aio, store, s->bucket.get(),
&s->dest_placement,
s->bucket_owner.get_id(),
*static_cast<RGWObjectCtx*>(s->obj_ctx),
- obj, 0, s->req_id, this, s->yield);
+ obj->get_obj(), 0, s->req_id, this, s->yield);
op_ret = processor.prepare(s->yield);
if (op_ret < 0) {
return;
@@ -4376,9 +4261,10 @@ void RGWPostObj::execute()
}
s->obj_size = ofs;
+ s->object->set_obj_size(ofs);
- op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket,
+ op_ret = store->getRados()->check_quota(s->bucket_owner.get_id(), s->bucket->get_bi(),
user_quota, bucket_quota, s->obj_size);
if (op_ret < 0) {
return;
@@ -4427,7 +4313,7 @@ void RGWPostObj::execute()
}
} while (is_next_file_to_upload());
- const auto ret = rgw::notify::publish(s, s->object, ofs, ceph::real_clock::now(), etag, rgw::notify::ObjectCreatedPost, store);
+ const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), etag, rgw::notify::ObjectCreatedPost, store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
// TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
@@ -4599,7 +4485,7 @@ void RGWPutMetadataBucket::execute()
}
if (!placement_rule.empty() &&
- placement_rule != s->bucket_info.placement_rule) {
+ placement_rule != s->bucket->get_placement_rule()) {
op_ret = -EEXIST;
return;
}
@@ -4638,25 +4524,25 @@ void RGWPutMetadataBucket::execute()
* is able to set the bucket quota. This stays in contrast to
* account quotas that can be set only by clients holding
* reseller admin privileges. */
- op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket_info.quota);
+ op_ret = filter_out_quota_info(attrs, rmattr_names, s->bucket->get_info().quota);
if (op_ret < 0) {
return op_ret;
}
if (swift_ver_location) {
- s->bucket_info.swift_ver_location = *swift_ver_location;
- s->bucket_info.swift_versioning = (!swift_ver_location->empty());
+ s->bucket->get_info().swift_ver_location = *swift_ver_location;
+ s->bucket->get_info().swift_versioning = (!swift_ver_location->empty());
}
/* Web site of Swift API. */
- filter_out_website(attrs, rmattr_names, s->bucket_info.website_conf);
- s->bucket_info.has_website = !s->bucket_info.website_conf.is_empty();
+ filter_out_website(attrs, rmattr_names, s->bucket->get_info().website_conf);
+ s->bucket->get_info().has_website = !s->bucket->get_info().website_conf.is_empty();
/* Setting attributes also stores the provided bucket info. Due
* to this fact, the new quota settings can be serialized with
* the same call. */
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
return op_ret;
});
@@ -4680,11 +4566,10 @@ void RGWPutMetadataObject::pre_exec()
void RGWPutMetadataObject::execute()
{
- rgw_obj obj(s->bucket, s->object);
rgw_obj target_obj;
map<string, bufferlist> attrs, orig_attrs, rmattrs;
- store->getRados()->set_atomic(s->obj_ctx, obj);
+ s->object->set_atomic(s->obj_ctx);
op_ret = get_params();
if (op_ret < 0) {
@@ -4697,10 +4582,11 @@ void RGWPutMetadataObject::execute()
}
/* check if obj exists, read orig attrs */
- op_ret = get_obj_attrs(store, s, obj, orig_attrs, &target_obj);
+ op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, &target_obj);
if (op_ret < 0) {
return;
}
+ orig_attrs = s->object->get_attrs().attrs;
/* Check whether the object has expired. Swift API documentation
* stands that we should return 404 Not Found in such case. */
@@ -4722,7 +4608,7 @@ void RGWPutMetadataObject::execute()
}
}
- op_ret = store->getRados()->set_attrs(s->obj_ctx, s->bucket_info, target_obj,
+ op_ret = store->getRados()->set_attrs(s->obj_ctx, s->bucket->get_info(), target_obj,
attrs, &rmattrs, s->yield);
}
@@ -4764,7 +4650,7 @@ int RGWDeleteObj::handle_slo_manifest(bufferlist& bl)
/* Request removal of the manifest object itself. */
RGWBulkDelete::acct_path_t path;
path.bucket_name = s->bucket_name;
- path.obj_key = s->object;
+ path.obj_key = s->object->get_key();
items.push_back(path);
int ret = deleter->delete_chunk(items);
@@ -4782,14 +4668,14 @@ int RGWDeleteObj::verify_permission()
return op_ret;
}
if (s->iam_policy || ! s->iam_user_policies.empty()) {
- if (s->bucket_info.obj_lock_enabled() && bypass_governance_mode) {
+ if (s->bucket->get_info().obj_lock_enabled() && bypass_governance_mode) {
auto r = eval_user_policies(s->iam_user_policies, s->env, boost::none,
- rgw::IAM::s3BypassGovernanceRetention, ARN(s->bucket, s->object.name));
+ rgw::IAM::s3BypassGovernanceRetention, ARN(s->bucket->get_bi(), s->object->get_name()));
if (r == Effect::Deny) {
bypass_perm = false;
} else if (r == Effect::Pass && s->iam_policy) {
r = s->iam_policy->eval(s->env, *s->auth.identity, rgw::IAM::s3BypassGovernanceRetention,
- ARN(s->bucket, s->object.name));
+ ARN(s->bucket->get_bi(), s->object->get_name()));
if (r == Effect::Deny) {
bypass_perm = false;
}
@@ -4797,10 +4683,10 @@ int RGWDeleteObj::verify_permission()
}
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
- s->object.instance.empty() ?
+ s->object->get_instance().empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(s->bucket, s->object.name));
+ ARN(s->bucket->get_bi(), s->object->get_name()));
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
@@ -4808,10 +4694,10 @@ int RGWDeleteObj::verify_permission()
rgw::IAM::Effect r = Effect::Pass;
if (s->iam_policy) {
r = s->iam_policy->eval(s->env, *s->auth.identity,
- s->object.instance.empty() ?
+ s->object->get_instance().empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(s->bucket, s->object.name));
+ ARN(s->bucket->get_bi(), s->object->get_name()));
}
if (r == Effect::Allow)
return 0;
@@ -4825,8 +4711,8 @@ int RGWDeleteObj::verify_permission()
return -EACCES;
}
- if (s->bucket_info.mfa_enabled() &&
- !s->object.instance.empty() &&
+ if (s->bucket->get_info().mfa_enabled() &&
+ !s->object->get_instance().empty() &&
!s->mfa_verified) {
ldpp_dout(this, 5) << "NOTICE: object delete request with a versioned object, mfa auth not provided" << dendl;
return -ERR_MFA_REQUIRED;
@@ -4846,40 +4732,38 @@ void RGWDeleteObj::execute()
op_ret = -ERR_NO_SUCH_BUCKET;
return;
}
+ s->object->set_bucket(s->bucket.get());
- rgw_obj obj(s->bucket, s->object);
- map<string, bufferlist> attrs;
-
- bool check_obj_lock = obj.key.have_instance() && s->bucket_info.obj_lock_enabled();
+ rgw::sal::RGWAttrs attrs;
- if (!s->object.empty()) {
- op_ret = get_obj_attrs(store, s, obj, attrs);
+ bool check_obj_lock = s->object->have_instance() && s->bucket->get_info().obj_lock_enabled();
- if (need_object_expiration() || multipart_delete) {
- /* check if obj exists, read orig attrs */
- if (op_ret < 0) {
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield);
+ if (op_ret < 0) {
+ if (need_object_expiration() || multipart_delete) {
return;
}
- }
- if (check_obj_lock) {
- /* check if obj exists, read orig attrs */
- if (op_ret < 0) {
- if (op_ret == -ENOENT) {
- /* object maybe delete_marker, skip check_obj_lock*/
- check_obj_lock = false;
- } else {
- return;
- }
+ if (check_obj_lock) {
+ /* check if obj exists, read orig attrs */
+ if (op_ret == -ENOENT) {
+ /* object maybe delete_marker, skip check_obj_lock*/
+ check_obj_lock = false;
+ } else {
+ return;
+ }
}
+ } else {
+ attrs = s->object->get_attrs();
}
// ignore return value from get_obj_attrs in all other cases
op_ret = 0;
if (check_obj_lock) {
- auto aiter = attrs.find(RGW_ATTR_OBJECT_RETENTION);
- if (aiter != attrs.end()) {
+ auto aiter = attrs.attrs.find(RGW_ATTR_OBJECT_RETENTION);
+ if (aiter != attrs.attrs.end()) {
RGWObjectRetention obj_retention;
try {
decode(obj_retention, aiter->second);
@@ -4895,8 +4779,8 @@ void RGWDeleteObj::execute()
}
}
}
- aiter = attrs.find(RGW_ATTR_OBJECT_LEGAL_HOLD);
- if (aiter != attrs.end()) {
+ aiter = attrs.attrs.find(RGW_ATTR_OBJECT_LEGAL_HOLD);
+ if (aiter != attrs.attrs.end()) {
RGWObjectLegalHold obj_legal_hold;
try {
decode(obj_legal_hold, aiter->second);
@@ -4913,9 +4797,9 @@ void RGWDeleteObj::execute()
}
if (multipart_delete) {
- const auto slo_attr = attrs.find(RGW_ATTR_SLO_MANIFEST);
+ const auto slo_attr = attrs.attrs.find(RGW_ATTR_SLO_MANIFEST);
- if (slo_attr != attrs.end()) {
+ if (slo_attr != attrs.attrs.end()) {
op_ret = handle_slo_manifest(slo_attr->second);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: failed to handle slo manifest ret=" << op_ret << dendl;
@@ -4928,11 +4812,13 @@ void RGWDeleteObj::execute()
}
RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx->set_atomic(obj);
+ s->object->set_atomic(s->obj_ctx);
bool ver_restored = false;
op_ret = store->getRados()->swift_versioning_restore(*obj_ctx, s->bucket_owner.get_id(),
- s->bucket_info, obj, ver_restored, this);
+ s->bucket.get(),
+ s->object.get(),
+ ver_restored, this);
if (op_ret < 0) {
return;
}
@@ -4941,7 +4827,7 @@ void RGWDeleteObj::execute()
/* Swift's versioning mechanism hasn't found any previous version of
* the object that could be restored. This means we should proceed
* with the regular delete path. */
- RGWRados::Object del_target(store->getRados(), s->bucket_info, *obj_ctx, obj);
+ RGWRados::Object del_target(store->getRados(), s->bucket->get_info(), *obj_ctx, s->object->get_obj());
RGWRados::Object::Delete del_op(&del_target);
op_ret = get_system_versioning_params(s, &del_op.params.olh_epoch,
@@ -4951,7 +4837,7 @@ void RGWDeleteObj::execute()
}
del_op.params.bucket_owner = s->bucket_owner.get_id();
- del_op.params.versioning_status = s->bucket_info.versioning_status();
+ del_op.params.versioning_status = s->bucket->get_info().versioning_status();
del_op.params.obj_owner = s->owner;
del_op.params.unmod_since = unmod_since;
del_op.params.high_precision_time = s->system_request; /* system request uses high precision time */
@@ -4964,7 +4850,7 @@ void RGWDeleteObj::execute()
/* Check whether the object has expired. Swift API documentation
* stands that we should return 404 Not Found in such case. */
- if (need_object_expiration() && object_is_expired(attrs)) {
+ if (need_object_expiration() && object_is_expired(attrs.attrs)) {
op_ret = -ENOENT;
return;
}
@@ -4980,25 +4866,25 @@ void RGWDeleteObj::execute()
// cache the objects tags and metadata into the requests
// so it could be used in the notification mechanism
try {
- populate_tags_in_request(s, attrs);
+ populate_tags_in_request(s, attrs.attrs);
} catch (buffer::error& err) {
ldpp_dout(this, 5) << "WARNING: failed to populate delete request with object tags: " << err.what() << dendl;
}
- populate_metadata_in_request(s, attrs);
- const auto obj_state = obj_ctx->get_state(obj);
-
- const auto ret = rgw::notify::publish(s, s->object, obj_state->size , obj_state->mtime, attrs[RGW_ATTR_ETAG].to_str(),
- delete_marker && s->object.instance.empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
- store);
- if (ret < 0) {
- ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
- // TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
- // this should be global conf (probably returnign a different handler)
- // so we don't need to read the configured values before we perform it
- }
+ populate_metadata_in_request(s, attrs.attrs);
} else {
op_ret = -EINVAL;
}
+
+ s->object->set_obj_size(s->obj_size);
+ const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), attrs.attrs[RGW_ATTR_ETAG].to_str(),
+ delete_marker && s->object->get_instance().empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
+ store);
+ if (ret < 0) {
+ ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
+ // TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
+ // this should be global conf (probably returnign a different handler)
+ // so we don't need to read the configured values before we perform it
+ }
}
bool RGWCopyObj::parse_copy_location(const std::string_view& url_src,
@@ -5055,15 +4941,9 @@ int RGWCopyObj::verify_permission()
if (op_ret < 0) {
return op_ret;
}
- map<string, bufferlist> src_attrs;
- if (s->bucket_instance_id.empty()) {
- op_ret = store->getRados()->get_bucket_info(store->svc(), src_tenant_name, src_bucket_name, src_bucket_info, NULL, s->yield, &src_attrs);
- } else {
- /* will only happen in intra region sync where the source and dest bucket is the same */
- rgw_bucket b(rgw_bucket_key(src_tenant_name, src_bucket_name, s->bucket_instance_id));
- op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, src_bucket_info, NULL, &src_attrs, s->yield);
- }
+ /* This is a bit of a hack; create an empty bucket, then load it below. */
+ op_ret = store->get_bucket(s->user, RGWBucketInfo(), &src_bucket);
if (op_ret < 0) {
if (op_ret == -ENOENT) {
op_ret = -ERR_NO_SUCH_BUCKET;
@@ -5071,26 +4951,33 @@ int RGWCopyObj::verify_permission()
return op_ret;
}
- src_bucket = src_bucket_info.bucket;
+ op_ret = src_bucket->load_by_name(src_tenant_name, src_bucket_name, s->bucket_instance_id,
+ s->sysobj_ctx, s->yield);
+ if (op_ret < 0) {
+ if (op_ret == -ENOENT) {
+ op_ret = -ERR_NO_SUCH_BUCKET;
+ }
+ return op_ret;
+ }
+ src_object->set_bucket(src_bucket.get());
/* get buckets info (source and dest) */
if (s->local_source && source_zone.empty()) {
- rgw_obj src_obj(src_bucket, src_object);
- store->getRados()->set_atomic(s->obj_ctx, src_obj);
- store->getRados()->set_prefetch_data(s->obj_ctx, src_obj);
+ src_object->set_atomic(s->obj_ctx);
+ src_object->set_prefetch_data(s->obj_ctx);
rgw_placement_rule src_placement;
/* check source object permissions */
- op_ret = read_obj_policy(store, s, src_bucket_info, src_attrs, &src_acl, &src_placement.storage_class,
- src_policy, src_bucket, src_object);
+ op_ret = read_obj_policy(store, s, src_bucket->get_info(), src_bucket->get_attrs().attrs, &src_acl, &src_placement.storage_class,
+ src_policy, src_bucket->get_bi(), src_object->get_key());
if (op_ret < 0) {
return op_ret;
}
/* follow up on previous checks that required reading source object head */
if (need_to_check_storage_class) {
- src_placement.inherit_from(src_bucket_info.placement_rule);
+ src_placement.inherit_from(src_bucket->get_placement_rule());
op_ret = check_storage_class(src_placement);
if (op_ret < 0) {
@@ -5102,10 +4989,10 @@ int RGWCopyObj::verify_permission()
if (!s->auth.identity->is_admin_of(src_acl.get_owner().get_id())) {
if (src_policy) {
auto e = src_policy->eval(s->env, *s->auth.identity,
- src_object.instance.empty() ?
+ src_object->get_instance().empty() ?
rgw::IAM::s3GetObject :
rgw::IAM::s3GetObjectVersion,
- ARN(src_obj));
+ ARN(src_object->get_obj()));
if (e == Effect::Deny) {
return -EACCES;
} else if (e == Effect::Pass &&
@@ -5122,15 +5009,20 @@ int RGWCopyObj::verify_permission()
}
RGWAccessControlPolicy dest_bucket_policy(s->cct);
- map<string, bufferlist> dest_attrs;
if (src_bucket_name.compare(dest_bucket_name) == 0) { /* will only happen if s->local_source
or intra region sync */
- dest_bucket_info = src_bucket_info;
- dest_attrs = src_attrs;
+ dest_bucket = src_bucket->clone();
} else {
- op_ret = store->getRados()->get_bucket_info(store->svc(), dest_tenant_name, dest_bucket_name,
- dest_bucket_info, nullptr, s->yield, &dest_attrs);
+ op_ret = store->get_bucket(s->user, RGWBucketInfo(), &dest_bucket);
+ if (op_ret < 0) {
+ if (op_ret == -ENOENT) {
+ op_ret = -ERR_NO_SUCH_BUCKET;
+ }
+ return op_ret;
+ }
+ op_ret = dest_bucket->load_by_name(dest_tenant_name, dest_bucket_name, std::string(),
+ s->sysobj_ctx, s->yield);
if (op_ret < 0) {
if (op_ret == -ENOENT) {
op_ret = -ERR_NO_SUCH_BUCKET;
@@ -5139,18 +5031,18 @@ int RGWCopyObj::verify_permission()
}
}
- dest_bucket = dest_bucket_info.bucket;
-
- rgw_obj dest_obj(dest_bucket, dest_object);
- store->getRados()->set_atomic(s->obj_ctx, dest_obj);
+ dest_object = store->get_object(rgw_obj_key(dest_obj_name));
+ dest_object->set_bucket(dest_bucket.get());
+ dest_object->set_atomic(s->obj_ctx);
/* check dest bucket permissions */
- op_ret = read_bucket_policy(store, s, dest_bucket_info, dest_attrs,
- &dest_bucket_policy, dest_bucket);
+ op_ret = read_bucket_policy(store, s, dest_bucket->get_info(),
+ dest_bucket->get_attrs().attrs,
+ &dest_bucket_policy, dest_bucket->get_bi());
if (op_ret < 0) {
return op_ret;
}
- auto dest_iam_policy = get_iam_policy_from_attr(s->cct, store, dest_attrs, dest_bucket.tenant);
+ auto dest_iam_policy = get_iam_policy_from_attr(s->cct, store, dest_bucket->get_attrs().attrs, dest_bucket->get_tenant());
/* admin request overrides permission checks */
if (! s->auth.identity->is_admin_of(dest_policy.get_owner().get_id())){
if (dest_iam_policy != boost::none) {
@@ -5161,7 +5053,7 @@ int RGWCopyObj::verify_permission()
auto e = dest_iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3PutObject,
- ARN(dest_obj));
+ ARN(dest_object->get_obj()));
if (e == Effect::Deny) {
return -EACCES;
} else if (e == Effect::Pass &&
@@ -5247,34 +5139,29 @@ void RGWCopyObj::execute()
if (init_common() < 0)
return;
- rgw_obj src_obj(src_bucket, src_object);
- rgw_obj dst_obj(dest_bucket, dest_object);
-
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
if ( ! version_id.empty()) {
- dst_obj.key.set_instance(version_id);
- } else if (dest_bucket_info.versioning_enabled()) {
- store->getRados()->gen_rand_obj_instance_name(&dst_obj);
+ dest_object->set_instance(version_id);
+ } else if (dest_bucket->versioning_enabled()) {
+ dest_object->gen_rand_obj_instance_name();
}
- obj_ctx.set_atomic(src_obj);
- obj_ctx.set_atomic(dst_obj);
+ src_object->set_atomic(&obj_ctx);
+ dest_object->set_atomic(&obj_ctx);
encode_delete_at_attr(delete_at, attrs);
if (!s->system_request) { // no quota enforcement for system requests
// get src object size (cached in obj_ctx from verify_permission())
RGWObjState* astate = nullptr;
- op_ret = store->getRados()->get_obj_state(s->obj_ctx, src_bucket_info, src_obj,
- &astate, true, s->yield, false);
+ op_ret = src_object->get_obj_state(s->obj_ctx, *src_bucket, &astate,
+ s->yield, true);
if (op_ret < 0) {
return;
}
// enforce quota against the destination bucket owner
- op_ret = store->getRados()->check_quota(dest_bucket_info.owner,
- dest_bucket_info.bucket,
- user_quota, bucket_quota,
- astate->accounted_size);
+ op_ret = dest_bucket->check_quota(user_quota, bucket_quota,
+ astate->accounted_size);
if (op_ret < 0) {
return;
}
@@ -5285,9 +5172,9 @@ void RGWCopyObj::execute()
/* Handle object versioning of Swift API. In case of copying to remote this
* should fail gently (op_ret == 0) as the dst_obj will not exist here. */
op_ret = store->getRados()->swift_versioning_copy(obj_ctx,
- dest_bucket_info.owner,
- dest_bucket_info,
- dst_obj,
+ dest_bucket->get_info().owner,
+ dest_bucket.get(),
+ dest_object.get(),
this,
s->yield);
if (op_ret < 0) {
@@ -5298,10 +5185,10 @@ void RGWCopyObj::execute()
s->user->get_id(),
&s->info,
source_zone,
- dst_obj,
- src_obj,
- dest_bucket_info,
- src_bucket_info,
+ dest_object.get(),
+ src_object.get(),
+ dest_bucket.get(),
+ src_bucket.get(),
s->dest_placement,
&src_mtime,
&mtime,
@@ -5322,7 +5209,7 @@ void RGWCopyObj::execute()
this,
s->yield);
- const auto ret = rgw::notify::publish(s, s->object, s->obj_size, mtime, etag, rgw::notify::ObjectCreatedCopy, store);
+ const auto ret = rgw::notify::publish(s, s->object.get(), mtime, etag, rgw::notify::ObjectCreatedCopy, store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
// TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
@@ -5334,20 +5221,18 @@ void RGWCopyObj::execute()
int RGWGetACLs::verify_permission()
{
bool perm;
- if (!s->object.empty()) {
- auto iam_action = s->object.instance.empty() ?
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ auto iam_action = s->object->get_instance().empty() ?
rgw::IAM::s3GetObjectAcl :
rgw::IAM::s3GetObjectVersionAcl;
if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){
- rgw_obj obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
if (! s->iam_user_policies.empty()) {
for (auto& user_policy : s->iam_user_policies) {
if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) {
- rgw_obj obj = rgw_obj(s->bucket, s->object);
- rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ rgw_iam_add_existing_objtags(store, s, iam_action);
}
}
}
@@ -5373,7 +5258,7 @@ void RGWGetACLs::execute()
{
stringstream ss;
RGWAccessControlPolicy* const acl = \
- (!s->object.empty() ? s->object_acl.get() : s->bucket_acl.get());
+ (!rgw::sal::RGWObject::empty(s->object.get()) ? s->object_acl.get() : s->bucket_acl.get());
RGWAccessControlPolicy_S3* const s3policy = \
static_cast<RGWAccessControlPolicy_S3*>(acl);
s3policy->to_xml(ss);
@@ -5389,10 +5274,9 @@ int RGWPutACLs::verify_permission()
rgw_add_to_iam_environment(s->env, "s3:x-amz-acl", s->canned_acl);
rgw_add_grant_to_iam_environment(s->env, s);
- if (!s->object.empty()) {
- auto iam_action = s->object.instance.empty() ? rgw::IAM::s3PutObjectAcl : rgw::IAM::s3PutObjectVersionAcl;
- auto obj = rgw_obj(s->bucket, s->object);
- op_ret = rgw_iam_add_existing_objtags(store, s, obj, iam_action);
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ auto iam_action = s->object->get_instance().empty() ? rgw::IAM::s3PutObjectAcl : rgw::IAM::s3PutObjectVersionAcl;
+ op_ret = rgw_iam_add_existing_objtags(store, s, iam_action);
perm = verify_object_permission(this, s, iam_action);
} else {
perm = verify_bucket_permission(this, s, rgw::IAM::s3PutBucketAcl);
@@ -5461,7 +5345,6 @@ void RGWPutACLs::execute()
RGWACLXMLParser_S3 parser(s->cct);
RGWAccessControlPolicy_S3 new_policy(s->cct);
stringstream ss;
- rgw_obj obj;
op_ret = 0; /* XXX redundant? */
@@ -5472,7 +5355,7 @@ void RGWPutACLs::execute()
RGWAccessControlPolicy* const existing_policy = \
- (s->object.empty() ? s->bucket_acl.get() : s->object_acl.get());
+ (rgw::sal::RGWObject::empty(s->object.get()) ? s->bucket_acl.get() : s->object_acl.get());
owner = existing_policy->get_owner();
@@ -5536,7 +5419,7 @@ void RGWPutACLs::execute()
}
// forward bucket acl requests to meta master zone
- if (s->object.empty() && !store->svc()->zone->is_meta_master()) {
+ if ((rgw::sal::RGWObject::empty(s->object.get())) && !store->svc()->zone->is_meta_master()) {
bufferlist in_data;
// include acl data unless it was generated from a canned_acl
if (s->canned_acl.empty()) {
@@ -5572,16 +5455,17 @@ void RGWPutACLs::execute()
return;
}
new_policy.encode(bl);
- if (!s->object.empty()) {
- obj = rgw_obj(s->bucket, s->object);
- store->getRados()->set_atomic(s->obj_ctx, obj);
+ map<string, bufferlist> attrs;
+
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ s->object->set_atomic(s->obj_ctx);
//if instance is empty, we should modify the latest object
- op_ret = modify_obj_attr(store, s, obj, RGW_ATTR_ACL, bl);
+ op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_ACL, bl, s->yield);
} else {
map<string,bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_ACL] = bl;
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
}
if (op_ret == -ECANCELED) {
@@ -5676,7 +5560,7 @@ void RGWPutLC::execute()
}
}
- op_ret = store->getRados()->get_lc()->set_bucket_config(s->bucket_info, s->bucket_attrs, &new_config);
+ op_ret = store->getRados()->get_lc()->set_bucket_config(s->bucket->get_info(), s->bucket_attrs, &new_config);
if (op_ret < 0) {
return;
}
@@ -5694,7 +5578,7 @@ void RGWDeleteLC::execute()
}
}
- op_ret = store->getRados()->get_lc()->remove_bucket_config(s->bucket_info, s->bucket_attrs);
+ op_ret = store->getRados()->get_lc()->remove_bucket_config(s->bucket->get_info(), s->bucket_attrs);
if (op_ret < 0) {
return;
}
@@ -5743,8 +5627,8 @@ void RGWPutCORS::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
map<string, bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_CORS] = cors_bl;
- return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
});
}
@@ -5779,11 +5663,11 @@ void RGWDeleteCORS::execute()
map<string, bufferlist> attrs = s->bucket_attrs;
attrs.erase(RGW_ATTR_CORS);
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "RGWLC::RGWDeleteCORS() failed to set attrs on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "RGWLC::RGWDeleteCORS() failed to set attrs on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
}
return op_ret;
@@ -5856,7 +5740,7 @@ void RGWGetRequestPayment::pre_exec()
void RGWGetRequestPayment::execute()
{
- requester_pays = s->bucket_info.requester_pays;
+ requester_pays = s->bucket->get_info().requester_pays;
}
int RGWSetRequestPayment::verify_permission()
@@ -5885,11 +5769,11 @@ void RGWSetRequestPayment::execute()
if (op_ret < 0)
return;
- s->bucket_info.requester_pays = requester_pays;
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(),
+ s->bucket->get_info().requester_pays = requester_pays;
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false, real_time(),
&s->bucket_attrs);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -5901,7 +5785,7 @@ int RGWInitMultipart::verify_permission()
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
@@ -5910,7 +5794,7 @@ int RGWInitMultipart::verify_permission()
if (s->iam_policy) {
e = s->iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
}
if (e == Effect::Allow) {
return 0;
@@ -5942,7 +5826,7 @@ void RGWInitMultipart::execute()
if (get_params() < 0)
return;
- if (s->object.empty())
+ if (rgw::sal::RGWObject::empty(s->object.get()))
return;
policy.encode(aclbl);
@@ -5967,15 +5851,15 @@ void RGWInitMultipart::execute()
upload_id.append(buf);
string tmp_obj_name;
- RGWMPObj mp(s->object.name, upload_id);
+ RGWMPObj mp(s->object->get_name(), upload_id);
tmp_obj_name = mp.get_meta();
- obj.init_ns(s->bucket, tmp_obj_name, mp_ns);
+ obj.init_ns(s->bucket->get_bi(), tmp_obj_name, mp_ns);
// the meta object will be indexed with 0 size, we c
obj.set_in_extra_data(true);
- obj.index_hash_source = s->object.name;
+ obj.index_hash_source = s->object->get_name();
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
op_target.set_versioning_disabled(true); /* no versioning for multipart meta */
RGWRados::Object::Write obj_op(&op_target);
@@ -5995,7 +5879,7 @@ void RGWInitMultipart::execute()
op_ret = obj_op.write_meta(bl.length(), 0, attrs, s->yield);
} while (op_ret == -EEXIST);
- const auto ret = rgw::notify::publish(s, s->object, s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), rgw::notify::ObjectCreatedPost, store);
+ const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), rgw::notify::ObjectCreatedPost, store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
// TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
@@ -6010,7 +5894,7 @@ int RGWCompleteMultipart::verify_permission()
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
@@ -6019,7 +5903,7 @@ int RGWCompleteMultipart::verify_permission()
if (s->iam_policy) {
e = s->iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3PutObject,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
}
if (e == Effect::Allow) {
return 0;
@@ -6097,7 +5981,7 @@ void RGWCompleteMultipart::execute()
return;
}
- mp.init(s->object.name, upload_id);
+ mp.init(s->object->get_name(), upload_id);
meta_oid = mp.get_meta();
int total_parts = 0;
@@ -6113,13 +5997,13 @@ void RGWCompleteMultipart::execute()
list<rgw_obj_index_key> remove_objs; /* objects to be removed from index listing */
- bool versioned_object = s->bucket_info.versioning_enabled();
+ bool versioned_object = s->bucket->versioning_enabled();
iter = parts->parts.begin();
- meta_obj.init_ns(s->bucket, meta_oid, mp_ns);
+ meta_obj.init_ns(s->bucket->get_bi(), meta_oid, mp_ns);
meta_obj.set_in_extra_data(true);
- meta_obj.index_hash_source = s->object.name;
+ meta_obj.index_hash_source = s->object->get_name();
/*take a cls lock on meta_obj to prevent racing completions (or retries)
from deleting the parts*/
@@ -6129,8 +6013,8 @@ void RGWCompleteMultipart::execute()
s->cct->_conf.get_val<int64_t>("rgw_mp_lock_max_time");
utime_t dur(max_lock_secs_mp, 0);
- store->getRados()->obj_to_raw((s->bucket_info).placement_rule, meta_obj, &raw_obj);
- store->getRados()->get_obj_data_pool((s->bucket_info).placement_rule,
+ store->getRados()->obj_to_raw((s->bucket->get_info()).placement_rule, meta_obj, &raw_obj);
+ store->getRados()->get_obj_data_pool((s->bucket->get_info()).placement_rule,
meta_obj,&meta_pool);
store->getRados()->open_pool_ctx(meta_pool, serializer.ioctx, true);
@@ -6200,7 +6084,7 @@ void RGWCompleteMultipart::execute()
/* update manifest for part */
string oid = mp.get_part(obj_iter->second.num);
rgw_obj src_obj;
- src_obj.init_ns(s->bucket, oid, mp_ns);
+ src_obj.init_ns(s->bucket->get_bi(), oid, mp_ns);
if (obj_part.manifest.empty()) {
ldpp_dout(this, 0) << "ERROR: empty manifest for object part: obj="
@@ -6269,7 +6153,7 @@ void RGWCompleteMultipart::execute()
attrs[RGW_ATTR_COMPRESSION] = tmp;
}
- target_obj.init(s->bucket, s->object.name);
+ target_obj.init(s->bucket->get_bi(), s->object->get_name());
if (versioned_object) {
if (!version_id.empty()) {
target_obj.key.set_instance(version_id);
@@ -6283,7 +6167,7 @@ void RGWCompleteMultipart::execute()
obj_ctx.set_atomic(target_obj);
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), target_obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), target_obj);
RGWRados::Object::Write obj_op(&op_target);
obj_op.meta.manifest = &manifest;
@@ -6301,16 +6185,16 @@ void RGWCompleteMultipart::execute()
// remove the upload obj
int r = store->getRados()->delete_obj(*static_cast<RGWObjectCtx *>(s->obj_ctx),
- s->bucket_info, meta_obj, 0);
+ s->bucket->get_info(), meta_obj, 0);
if (r >= 0) {
/* serializer's exclusive lock is released */
serializer.clear_locked();
} else {
ldpp_dout(this, 0) << "WARNING: failed to remove object " << meta_obj << dendl;
}
-
- const auto ret = rgw::notify::publish(s, s->object, ofs, ceph::real_clock::now(), final_etag_str, rgw::notify::ObjectCreatedCompleteMultipartUpload, store);
+ s->object->set_obj_size(ofs);
+ const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), etag, rgw::notify::ObjectCreatedCompleteMultipartUpload, store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
// TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
@@ -6352,7 +6236,7 @@ int RGWAbortMultipart::verify_permission()
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
rgw::IAM::s3AbortMultipartUpload,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
@@ -6361,7 +6245,7 @@ int RGWAbortMultipart::verify_permission()
if (s->iam_policy) {
e = s->iam_policy->eval(s->env, *s->auth.identity,
rgw::IAM::s3AbortMultipartUpload,
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
}
if (e == Effect::Allow) {
return 0;
@@ -6392,10 +6276,10 @@ void RGWAbortMultipart::execute()
rgw_obj meta_obj;
RGWMPObj mp;
- if (upload_id.empty() || s->object.empty())
+ if (upload_id.empty() || rgw::sal::RGWObject::empty(s->object.get()))
return;
- mp.init(s->object.name, upload_id);
+ mp.init(s->object->get_name(), upload_id);
meta_oid = mp.get_meta();
op_ret = get_multipart_info(store, s, meta_oid, nullptr, nullptr, nullptr);
@@ -6403,7 +6287,7 @@ void RGWAbortMultipart::execute()
return;
RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
- op_ret = abort_multipart_upload(store, s->cct, obj_ctx, s->bucket_info, mp);
+ op_ret = abort_multipart_upload(store, s->cct, obj_ctx, s->bucket->get_info(), mp);
}
int RGWListMultipart::verify_permission()
@@ -6428,7 +6312,7 @@ void RGWListMultipart::execute()
if (op_ret < 0)
return;
- mp.init(s->object.name, upload_id);
+ mp.init(s->object->get_name(), upload_id);
meta_oid = mp.get_meta();
op_ret = get_multipart_info(store, s, meta_oid, &policy, nullptr, nullptr);
@@ -6477,7 +6361,7 @@ void RGWListBucketMultiparts::execute()
}
marker_meta = marker.get_meta();
- op_ret = list_bucket_multiparts(store, s->bucket_info, prefix, marker_meta, delimiter,
+ op_ret = list_bucket_multiparts(store, s->bucket->get_info(), prefix, marker_meta, delimiter,
max_uploads, &objs, &common_prefixes, &is_truncated);
if (op_ret < 0) {
return;
@@ -6513,10 +6397,10 @@ int RGWDeleteMultiObj::verify_permission()
if (s->iam_policy || ! s->iam_user_policies.empty()) {
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
- s->object.instance.empty() ?
+ s->object->get_instance().empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(s->bucket));
+ ARN(s->bucket->get_bi()));
if (usr_policy_res == Effect::Deny) {
return -EACCES;
}
@@ -6524,10 +6408,10 @@ int RGWDeleteMultiObj::verify_permission()
rgw::IAM::Effect r = Effect::Pass;
if (s->iam_policy) {
r = s->iam_policy->eval(s->env, *s->auth.identity,
- s->object.instance.empty() ?
+ s->object->get_instance().empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(s->bucket));
+ ARN(s->bucket->get_bi()));
}
if (r == Effect::Allow)
return 0;
@@ -6598,7 +6482,7 @@ void RGWDeleteMultiObj::execute()
if (multi_delete->is_quiet())
quiet = true;
- if (s->bucket_info.mfa_enabled()) {
+ if (s->bucket->get_info().mfa_enabled()) {
bool has_versioned = false;
for (auto i : multi_delete->objects) {
if (!i.instance.empty()) {
@@ -6621,14 +6505,14 @@ void RGWDeleteMultiObj::execute()
for (iter = multi_delete->objects.begin();
iter != multi_delete->objects.end();
++iter) {
- rgw_obj obj(bucket, *iter);
+ rgw::sal::RGWRadosObject obj(store, *iter, bucket);
if (s->iam_policy || ! s->iam_user_policies.empty()) {
auto usr_policy_res = eval_user_policies(s->iam_user_policies, s->env,
boost::none,
iter->instance.empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(obj));
+ ARN(obj.get_obj()));
if (usr_policy_res == Effect::Deny) {
send_partial_response(*iter, false, "", -EACCES);
continue;
@@ -6641,7 +6525,7 @@ void RGWDeleteMultiObj::execute()
iter->instance.empty() ?
rgw::IAM::s3DeleteObject :
rgw::IAM::s3DeleteObjectVersion,
- ARN(obj));
+ ARN(obj.get_obj()));
}
if ((e == Effect::Deny) ||
(usr_policy_res == Effect::Pass && e == Effect::Pass && !acl_allowed)) {
@@ -6650,13 +6534,13 @@ void RGWDeleteMultiObj::execute()
}
}
- obj_ctx->set_atomic(obj);
+ obj.set_atomic(obj_ctx);
- RGWRados::Object del_target(store->getRados(), s->bucket_info, *obj_ctx, obj);
+ RGWRados::Object del_target(store->getRados(), s->bucket->get_info(), *obj_ctx, obj.get_obj());
RGWRados::Object::Delete del_op(&del_target);
del_op.params.bucket_owner = s->bucket_owner.get_id();
- del_op.params.versioning_status = s->bucket_info.versioning_status();
+ del_op.params.versioning_status = s->bucket->get_info().versioning_status();
del_op.params.obj_owner = s->owner;
op_ret = del_op.delete_obj(s->yield);
@@ -6667,12 +6551,13 @@ void RGWDeleteMultiObj::execute()
send_partial_response(*iter, del_op.result.delete_marker,
del_op.result.version_id, op_ret);
- const auto obj_state = obj_ctx->get_state(obj);
+ const auto obj_state = obj_ctx->get_state(obj.get_obj());
bufferlist etag_bl;
const auto etag = obj_state->get_attr(RGW_ATTR_ETAG, etag_bl) ? etag_bl.to_str() : "";
+ obj.set_obj_size(obj_state->size);
- const auto ret = rgw::notify::publish(s, obj.key, obj_state->size, obj_state->mtime, etag,
- del_op.result.delete_marker && s->object.instance.empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
+ const auto ret = rgw::notify::publish(s, &obj, ceph::real_clock::now(), etag,
+ del_op.result.delete_marker && s->object->get_instance().empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
store);
if (ret < 0) {
ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
@@ -6933,10 +6818,10 @@ RGWBulkUploadOp::handle_upload_path(struct req_state *s)
std::string bucket_path, file_prefix;
if (! s->init_state.url_bucket.empty()) {
file_prefix = bucket_path = s->init_state.url_bucket + "/";
- if (! s->object.empty()) {
- std::string& object_name = s->object.name;
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ const std::string& object_name = s->object->get_name();
- /* As rgw_obj_key::empty() already verified emptiness of s->object.name,
+ /* As rgw_obj_key::empty() already verified emptiness of s->object->get_name(),
* we can safely examine its last element. */
if (object_name.back() == '/') {
file_prefix.append(object_name);
@@ -7008,10 +6893,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path)
/* we need to make sure we read bucket info, it's not read before for this
* specific request */
- RGWBucketInfo binfo;
- std::map<std::string, ceph::bufferlist> battrs;
- op_ret = store->getRados()->get_bucket_info(store->svc(), s->bucket_tenant, bucket_name,
- binfo, nullptr, s->yield, &battrs);
+ op_ret = store->get_bucket(s->user, s->bucket_tenant, bucket_name, &s->bucket);
if (op_ret < 0 && op_ret != -ENOENT) {
return op_ret;
}
@@ -7019,8 +6901,8 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path)
if (bucket_exists) {
RGWAccessControlPolicy old_policy(s->cct);
- int r = rgw_op_get_bucket_policy_from_attr(s->cct, store, binfo,
- battrs, &old_policy);
+ int r = rgw_op_get_bucket_policy_from_attr(s->cct, store, s->bucket->get_info(),
+ s->bucket->get_attrs().attrs, &old_policy);
if (r >= 0) {
if (old_policy.get_owner().get_id().compare(s->user->get_user()) != 0) {
op_ret = -EEXIST;
@@ -7061,7 +6943,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path)
pmaster_num_shards = nullptr;
}
- rgw_placement_rule placement_rule(binfo.placement_rule, s->info.storage_class);
+ rgw_placement_rule placement_rule(s->bucket->get_placement_rule(), s->info.storage_class);
if (bucket_exists) {
rgw_placement_rule selected_placement_rule;
@@ -7073,7 +6955,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path)
placement_rule,
&selected_placement_rule,
nullptr);
- if (selected_placement_rule != binfo.placement_rule) {
+ if (selected_placement_rule != s->bucket->get_placement_rule()) {
op_ret = -EEXIST;
ldpp_dout(this, 20) << "non-coherent placement rule" << dendl;
return op_ret;
@@ -7100,7 +6982,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path)
op_ret = store->getRados()->create_bucket(s->user->get_info(),
bucket,
store->svc()->zone->get_zonegroup().get_id(),
- placement_rule, binfo.swift_ver_location,
+ placement_rule, s->bucket->get_info().swift_ver_location,
pquota_info, attrs,
out_info, pobjv, &ep_objv, creation_time,
pmaster_bucket, pmaster_num_shards, true);
@@ -7201,45 +7083,45 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
std::tie(bucket_name, object) = *parse_path(path);
auto& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- RGWBucketInfo binfo;
- std::map<std::string, ceph::bufferlist> battrs;
+ std::unique_ptr<rgw::sal::RGWBucket> bucket;
ACLOwner bowner;
- op_ret = store->getRados()->get_bucket_info(store->svc(), s->user->get_tenant(),
- bucket_name, binfo, nullptr, s->yield, &battrs);
+
+ op_ret = store->get_bucket(s->user, rgw_bucket(rgw_bucket_key(s->user->get_tenant(), bucket_name)), &bucket);
if (op_ret == -ENOENT) {
ldpp_dout(this, 20) << "non existent directory=" << bucket_name << dendl;
} else if (op_ret < 0) {
return op_ret;
}
- if (! handle_file_verify_permission(binfo,
- rgw_obj(binfo.bucket, object),
- battrs, bowner)) {
+ std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(object);
+
+ if (! handle_file_verify_permission(bucket->get_info(),
+ obj->get_obj(),
+ bucket->get_attrs().attrs, bowner)) {
ldpp_dout(this, 20) << "object creation unauthorized" << dendl;
op_ret = -EACCES;
return op_ret;
}
- op_ret = store->getRados()->check_quota(bowner.get_id(), binfo.bucket,
+ op_ret = store->getRados()->check_quota(s->user->get_id(), bucket->get_bi(),
user_quota, bucket_quota, size);
if (op_ret < 0) {
return op_ret;
}
- rgw_obj obj(binfo.bucket, object);
- if (s->bucket_info.versioning_enabled()) {
- store->getRados()->gen_rand_obj_instance_name(&obj);
+ if (s->bucket->versioning_enabled()) {
+ obj->gen_rand_obj_instance_name();
}
rgw_placement_rule dest_placement = s->dest_placement;
- dest_placement.inherit_from(binfo.placement_rule);
+ dest_placement.inherit_from(bucket->get_placement_rule());
auto aio = rgw::make_throttle(s->cct->_conf->rgw_put_obj_min_window_size,
s->yield);
using namespace rgw::putobj;
- AtomicObjectProcessor processor(&*aio, store, binfo, &s->dest_placement, bowner.get_id(),
- obj_ctx, obj, 0, s->req_id, this, s->yield);
+ AtomicObjectProcessor processor(&*aio, store, bucket.get(), &s->dest_placement, bowner.get_id(),
+ obj_ctx, obj->get_obj(), 0, s->req_id, this, s->yield);
op_ret = processor.prepare(s->yield);
if (op_ret < 0) {
@@ -7302,7 +7184,7 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
return op_ret;
}
- op_ret = store->getRados()->check_quota(bowner.get_id(), binfo.bucket,
+ op_ret = store->getRados()->check_quota(bowner.get_id(), bucket->get_bi(),
user_quota, bucket_quota, size);
if (op_ret < 0) {
ldpp_dout(this, 20) << "quota exceeded for path=" << path << dendl;
@@ -7481,7 +7363,7 @@ int RGWSetAttrs::verify_permission()
// This looks to be part of the RGW-NFS machinery and has no S3 or
// Swift equivalent.
bool perm;
- if (!s->object.empty()) {
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
perm = verify_object_permission_no_policy(this, s, RGW_PERM_WRITE);
} else {
perm = verify_bucket_permission_no_policy(this, s, RGW_PERM_WRITE);
@@ -7503,17 +7385,15 @@ void RGWSetAttrs::execute()
if (op_ret < 0)
return;
- rgw_obj obj(s->bucket, s->object);
-
- if (!s->object.empty()) {
- store->getRados()->set_atomic(s->obj_ctx, obj);
- op_ret = store->getRados()->set_attrs(s->obj_ctx, s->bucket_info, obj, attrs, nullptr, s->yield);
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ rgw::sal::RGWAttrs a(attrs);
+ op_ret = s->object->set_attrs(a);
} else {
for (auto& iter : attrs) {
s->bucket_attrs[iter.first] = std::move(iter.second);
}
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
}
}
@@ -7525,11 +7405,10 @@ void RGWGetObjLayout::pre_exec()
void RGWGetObjLayout::execute()
{
- rgw_obj obj(s->bucket, s->object);
RGWRados::Object target(store->getRados(),
- s->bucket_info,
+ s->bucket->get_info(),
*static_cast<RGWObjectCtx *>(s->obj_ctx),
- rgw_obj(s->bucket, s->object));
+ s->object->get_obj());
RGWRados::Object::Read stat_op(&target);
op_ret = stat_op.prepare(s->yield);
@@ -7565,11 +7444,11 @@ void RGWConfigBucketMetaSearch::execute()
return;
}
- s->bucket_info.mdsearch_config = mdsearch_config;
+ s->bucket->get_info().mdsearch_config = mdsearch_config;
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(), &s->bucket_attrs);
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false, real_time(), &s->bucket_attrs);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -7605,11 +7484,11 @@ void RGWDelBucketMetaSearch::pre_exec()
void RGWDelBucketMetaSearch::execute()
{
- s->bucket_info.mdsearch_config.clear();
+ s->bucket->get_info().mdsearch_config.clear();
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false, real_time(), &s->bucket_attrs);
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false, real_time(), &s->bucket_attrs);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket.name
+ ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name()
<< " returned err=" << op_ret << dendl;
return;
}
@@ -7744,8 +7623,8 @@ void RGWPutBucketPolicy::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [&p, this, &attrs] {
attrs[RGW_ATTR_IAM_POLICY].clear();
attrs[RGW_ATTR_IAM_POLICY].append(p.text);
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
return op_ret;
});
@@ -7820,8 +7699,8 @@ void RGWDeleteBucketPolicy::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
auto attrs = s->bucket_attrs;
attrs.erase(RGW_ATTR_IAM_POLICY);
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
return op_ret;
});
@@ -7839,7 +7718,7 @@ int RGWPutBucketObjectLock::verify_permission()
void RGWPutBucketObjectLock::execute()
{
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
ldpp_dout(this, 0) << "ERROR: object Lock configuration cannot be enabled on existing buckets" << dendl;
op_ret = -ERR_INVALID_BUCKET_STATE;
return;
@@ -7882,8 +7761,8 @@ void RGWPutBucketObjectLock::execute()
}
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
- s->bucket_info.obj_lock = obj_lock;
- op_ret = store->getRados()->put_bucket_instance_info(s->bucket_info, false,
+ s->bucket->get_info().obj_lock = obj_lock;
+ op_ret = store->getRados()->put_bucket_instance_info(s->bucket->get_info(), false,
real_time(), &s->bucket_attrs);
return op_ret;
});
@@ -7902,7 +7781,7 @@ int RGWGetBucketObjectLock::verify_permission()
void RGWGetBucketObjectLock::execute()
{
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
op_ret = -ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION;
return;
}
@@ -7930,7 +7809,7 @@ void RGWPutObjRetention::pre_exec()
void RGWPutObjRetention::execute()
{
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
ldpp_dout(this, 0) << "ERROR: object retention can't be set if bucket object lock not configured" << dendl;
op_ret = -ERR_INVALID_REQUEST;
return;
@@ -7963,17 +7842,16 @@ void RGWPutObjRetention::execute()
}
bufferlist bl;
obj_retention.encode(bl);
- rgw_obj obj(s->bucket, s->object);
//check old retention
- map<string, bufferlist> attrs;
- op_ret = get_obj_attrs(store, s, obj, attrs);
+ op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: get obj attr error"<< dendl;
return;
}
- auto aiter = attrs.find(RGW_ATTR_OBJECT_RETENTION);
- if (aiter != attrs.end()) {
+ rgw::sal::RGWAttrs attrs = s->object->get_attrs();
+ auto aiter = attrs.attrs.find(RGW_ATTR_OBJECT_RETENTION);
+ if (aiter != attrs.attrs.end()) {
RGWObjectRetention old_obj_retention;
try {
decode(old_obj_retention, aiter->second);
@@ -7990,7 +7868,7 @@ void RGWPutObjRetention::execute()
}
}
- op_ret = modify_obj_attr(store, s, obj, RGW_ATTR_OBJECT_RETENTION, bl);
+ op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_RETENTION, bl, s->yield);
return;
}
@@ -8010,21 +7888,20 @@ void RGWGetObjRetention::pre_exec()
void RGWGetObjRetention::execute()
{
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
ldpp_dout(this, 0) << "ERROR: bucket object lock not configured" << dendl;
op_ret = -ERR_INVALID_REQUEST;
return;
}
- rgw_obj obj(s->bucket, s->object);
- map<string, bufferlist> attrs;
- op_ret = get_obj_attrs(store, s, obj, attrs);
+ op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield);
if (op_ret < 0) {
- ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << obj
+ ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object
<< " ret=" << op_ret << dendl;
return;
}
- auto aiter = attrs.find(RGW_ATTR_OBJECT_RETENTION);
- if (aiter == attrs.end()) {
+ rgw::sal::RGWAttrs attrs = s->object->get_attrs();
+ auto aiter = attrs.attrs.find(RGW_ATTR_OBJECT_RETENTION);
+ if (aiter == attrs.attrs.end()) {
op_ret = -ERR_NO_SUCH_OBJECT_LOCK_CONFIGURATION;
return;
}
@@ -8054,7 +7931,7 @@ void RGWPutObjLegalHold::pre_exec()
}
void RGWPutObjLegalHold::execute() {
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
ldpp_dout(this, 0) << "ERROR: object legal hold can't be set if bucket object lock not configured" << dendl;
op_ret = -ERR_INVALID_REQUEST;
return;
@@ -8085,9 +7962,8 @@ void RGWPutObjLegalHold::execute() {
}
bufferlist bl;
obj_legal_hold.encode(bl);
- rgw_obj obj(s->bucket, s->object);
//if instance is empty, we should modify the latest object
- op_ret = modify_obj_attr(store, s, obj, RGW_ATTR_OBJECT_LEGAL_HOLD, bl);
+ op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_LEGAL_HOLD, bl, s->yield);
return;
}
@@ -8106,12 +7982,12 @@ void RGWGetObjLegalHold::pre_exec()
void RGWGetObjLegalHold::execute()
{
- if (!s->bucket_info.obj_lock_enabled()) {
+ if (!s->bucket->get_info().obj_lock_enabled()) {
ldpp_dout(this, 0) << "ERROR: bucket object lock not configured" << dendl;
op_ret = -ERR_INVALID_REQUEST;
return;
}
- rgw_obj obj(s->bucket, s->object);
+ rgw_obj obj = s->object->get_obj();
map<string, bufferlist> attrs;
op_ret = get_obj_attrs(store, s, obj, attrs);
if (op_ret < 0) {
@@ -8212,7 +8088,7 @@ void RGWPutBucketPublicAccessBlock::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [this, &bl] {
map<string, bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_PUBLIC_ACCESS] = bl;
- return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs, &s->bucket_info.objv_tracker, s->yield);
+ return store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, s->yield);
});
}
@@ -8271,8 +8147,8 @@ void RGWDeleteBucketPublicAccessBlock::execute()
op_ret = retry_raced_bucket_write(store->getRados(), s, [this] {
auto attrs = s->bucket_attrs;
attrs.erase(RGW_ATTR_PUBLIC_ACCESS);
- op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket_info, attrs,
- &s->bucket_info.objv_tracker,
+ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs,
+ &s->bucket->get_info().objv_tracker,
s->yield);
return op_ret;
});
diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h
index c96bf3a4293..64611bdfd41 100644
--- a/src/rgw/rgw_op.h
+++ b/src/rgw/rgw_op.h
@@ -281,7 +281,6 @@ protected:
bool range_parsed;
bool skip_manifest;
bool skip_decrypt{false};
- rgw_obj obj;
utime_t gc_invalidate_time;
bool is_slo;
string lo_etag;
@@ -825,7 +824,6 @@ public:
class RGWListBucket : public RGWOp {
protected:
- rgw::sal::RGWBucket* bucket;
string prefix;
rgw_obj_key marker;
rgw_obj_key next_marker;
@@ -847,17 +845,15 @@ protected:
int parse_max_keys();
public:
- RGWListBucket() : bucket(nullptr), list_versions(false), max(0),
+ RGWListBucket() : list_versions(false), max(0),
default_max(0), is_truncated(false),
allow_unordered(false), shard_id(-1) {}
- ~RGWListBucket() { delete bucket; }
int verify_permission() override;
void pre_exec() override;
void execute() override;
void init(rgw::sal::RGWRadosStore *store, struct req_state *s, RGWHandler *h) override {
RGWOp::init(store, s, h);
- bucket = new rgw::sal::RGWRadosBucket(store, *s->user, s->bucket);
}
virtual int get_params() = 0;
void send_response() override = 0;
@@ -987,12 +983,9 @@ public:
class RGWStatBucket : public RGWOp {
protected:
- rgw::sal::RGWBucket* bucket;
+ std::unique_ptr<rgw::sal::RGWBucket> bucket;
public:
- RGWStatBucket() : bucket(nullptr) {}
- ~RGWStatBucket() override { delete bucket; }
-
int verify_permission() override;
void pre_exec() override;
void execute() override;
@@ -1433,17 +1426,15 @@ protected:
ceph::real_time *mod_ptr;
ceph::real_time *unmod_ptr;
map<string, buffer::list> attrs;
- string src_tenant_name, src_bucket_name;
- rgw_bucket src_bucket;
- rgw_obj_key src_object;
- string dest_tenant_name, dest_bucket_name;
- rgw_bucket dest_bucket;
- string dest_object;
+ string src_tenant_name, src_bucket_name, src_obj_name;
+ std::unique_ptr<rgw::sal::RGWBucket> src_bucket;
+ std::unique_ptr<rgw::sal::RGWObject> src_object;
+ string dest_tenant_name, dest_bucket_name, dest_obj_name;
+ std::unique_ptr<rgw::sal::RGWBucket> dest_bucket;
+ std::unique_ptr<rgw::sal::RGWObject> dest_object;
ceph::real_time src_mtime;
ceph::real_time mtime;
RGWRados::AttrsMod attrs_mod;
- RGWBucketInfo src_bucket_info;
- RGWBucketInfo dest_bucket_info;
string source_zone;
string etag;
@@ -1927,7 +1918,7 @@ public:
class RGWDeleteMultiObj : public RGWOp {
protected:
bufferlist data;
- rgw_bucket bucket;
+ rgw::sal::RGWBucket* bucket;
bool quiet;
bool status_dumped;
bool acl_allowed = false;
diff --git a/src/rgw/rgw_opa.cc b/src/rgw/rgw_opa.cc
index 96cc5841c1d..4e577030026 100644
--- a/src/rgw/rgw_opa.cc
+++ b/src/rgw/rgw_opa.cc
@@ -44,10 +44,10 @@ int rgw_opa_authorize(RGWOp *& op,
jf.dump_string("decoded_uri", s->decoded_uri.c_str());
jf.dump_string("params", s->info.request_params.c_str());
jf.dump_string("request_uri_aws4", s->info.request_uri_aws4.c_str());
- jf.dump_string("object_name", s->object.name.c_str());
+ jf.dump_string("object_name", s->object->get_name().c_str());
jf.dump_string("subuser", s->auth.identity->get_subuser().c_str());
jf.dump_object("user_info", s->user->get_info());
- jf.dump_object("bucket_info", s->bucket_info);
+ jf.dump_object("bucket_info", s->bucket->get_info());
jf.close_section();
jf.close_section();
diff --git a/src/rgw/rgw_os_lib.cc b/src/rgw/rgw_os_lib.cc
index b4f8bb260f5..d9b58f24319 100644
--- a/src/rgw/rgw_os_lib.cc
+++ b/src/rgw/rgw_os_lib.cc
@@ -11,7 +11,8 @@
namespace rgw {
/* static */
- int RGWHandler_Lib::init_from_header(struct req_state *s)
+ int RGWHandler_Lib::init_from_header(rgw::sal::RGWRadosStore *store,
+ struct req_state *s)
{
string req;
string first;
@@ -51,10 +52,10 @@ namespace rgw {
if (pos >= 0) {
// XXX ugh, another copy
string encoded_obj_str = req.substr(pos+1);
- s->object = rgw_obj_key(encoded_obj_str, s->info.args.get("versionId"));
+ s->object = store->get_object(rgw_obj_key(encoded_obj_str, s->info.args.get("versionId")));
}
} else {
- s->object = rgw_obj_key(req_name, s->info.args.get("versionId"));
+ s->object = store->get_object(rgw_obj_key(req_name, s->info.args.get("versionId")));
}
return 0;
} /* init_from_header */
diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc
index e314e8b2fb9..56560a660d7 100644
--- a/src/rgw/rgw_process.cc
+++ b/src/rgw/rgw_process.cc
@@ -185,7 +185,7 @@ int process_request(rgw::sal::RGWRadosStore* const store,
RGWEnv& rgw_env = client_io->get_env();
- rgw::sal::RGWRadosUser user;
+ rgw::sal::RGWRadosUser user(store);
struct req_state rstate(g_ceph_context, &rgw_env, &user, req->id);
struct req_state *s = &rstate;
diff --git a/src/rgw/rgw_putobj_processor.cc b/src/rgw/rgw_putobj_processor.cc
index 94aab677821..e3bc25ef09d 100644
--- a/src/rgw/rgw_putobj_processor.cc
+++ b/src/rgw/rgw_putobj_processor.cc
@@ -126,7 +126,7 @@ RadosWriter::~RadosWriter()
std::optional<rgw_raw_obj> raw_head;
if (!head_obj.empty()) {
raw_head.emplace();
- store->getRados()->obj_to_raw(bucket_info.placement_rule, head_obj, &*raw_head);
+ store->getRados()->obj_to_raw(bucket->get_placement_rule(), head_obj, &*raw_head);
}
/**
@@ -156,7 +156,7 @@ RadosWriter::~RadosWriter()
if (need_to_remove_head) {
ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl;
- int r = store->getRados()->delete_obj(obj_ctx, bucket_info, head_obj, 0, 0);
+ int r = store->getRados()->delete_obj(obj_ctx, bucket->get_info(), head_obj, 0, 0);
if (r < 0 && r != -ENOENT) {
ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl;
}
@@ -208,7 +208,7 @@ int AtomicObjectProcessor::prepare(optional_yield y)
uint64_t alignment;
rgw_pool head_pool;
- if (!store->getRados()->get_obj_data_pool(bucket_info.placement_rule, head_obj, &head_pool)) {
+ if (!store->getRados()->get_obj_data_pool(bucket->get_placement_rule(), head_obj, &head_pool)) {
return -EIO;
}
@@ -219,7 +219,7 @@ int AtomicObjectProcessor::prepare(optional_yield y)
bool same_pool = true;
- if (bucket_info.placement_rule != tail_placement_rule) {
+ if (bucket->get_placement_rule() != tail_placement_rule) {
rgw_pool tail_pool;
if (!store->getRados()->get_obj_data_pool(tail_placement_rule, head_obj, &tail_pool)) {
return -EIO;
@@ -250,7 +250,7 @@ int AtomicObjectProcessor::prepare(optional_yield y)
manifest.set_trivial_rule(head_max_size, stripe_size);
r = manifest_gen.create_begin(store->ctx(), &manifest,
- bucket_info.placement_rule,
+ bucket->get_placement_rule(),
&tail_placement_rule,
head_obj.bucket, head_obj);
if (r < 0) {
@@ -295,10 +295,10 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
obj_ctx.set_atomic(head_obj);
- RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, head_obj);
+ RGWRados::Object op_target(store->getRados(), bucket->get_info(), obj_ctx, head_obj);
/* some object types shouldn't be versioned, e.g., multipart parts */
- op_target.set_versioning_disabled(!bucket_info.versioning_enabled());
+ op_target.set_versioning_disabled(!bucket->versioning_enabled());
RGWRados::Object::Write obj_op(&op_target);
@@ -377,7 +377,7 @@ int MultipartObjectProcessor::prepare_head()
manifest.set_multipart_part_rule(stripe_size, part_num);
r = manifest_gen.create_begin(store->ctx(), &manifest,
- bucket_info.placement_rule,
+ bucket->get_placement_rule(),
&tail_placement_rule,
target_obj.bucket, target_obj);
if (r < 0) {
@@ -429,7 +429,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
return r;
}
- RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, head_obj);
+ RGWRados::Object op_target(store->getRados(), bucket->get_info(), obj_ctx, head_obj);
op_target.set_versioning_disabled(true);
RGWRados::Object::Write obj_op(&op_target);
@@ -473,12 +473,12 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
encode(info, bl);
rgw_obj meta_obj;
- meta_obj.init_ns(bucket_info.bucket, mp.get_meta(), RGW_OBJ_NS_MULTIPART);
+ meta_obj.init_ns(bucket->get_bi(), mp.get_meta(), RGW_OBJ_NS_MULTIPART);
meta_obj.set_in_extra_data(true);
rgw_raw_obj raw_meta_obj;
- store->getRados()->obj_to_raw(bucket_info.placement_rule, meta_obj, &raw_meta_obj);
+ store->getRados()->obj_to_raw(bucket->get_placement_rule(), meta_obj, &raw_meta_obj);
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(raw_meta_obj);
@@ -513,7 +513,7 @@ int AppendObjectProcessor::process_first_chunk(bufferlist &&data, rgw::putobj::D
int AppendObjectProcessor::prepare(optional_yield y)
{
RGWObjState *astate;
- int r = store->getRados()->get_obj_state(&obj_ctx, bucket_info, head_obj, &astate, y);
+ int r = store->getRados()->get_obj_state(&obj_ctx, bucket->get_info(), head_obj, &astate, y);
if (r < 0) {
return r;
}
@@ -571,7 +571,7 @@ int AppendObjectProcessor::prepare(optional_yield y)
}
manifest.set_multipart_part_rule(store->ctx()->_conf->rgw_obj_stripe_size, cur_part_num);
- r = manifest_gen.create_begin(store->ctx(), &manifest, bucket_info.placement_rule, &tail_placement_rule, head_obj.bucket, head_obj);
+ r = manifest_gen.create_begin(store->ctx(), &manifest, bucket->get_placement_rule(), &tail_placement_rule, head_obj.bucket, head_obj);
if (r < 0) {
return r;
}
@@ -614,7 +614,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
return r;
}
obj_ctx.set_atomic(head_obj);
- RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, head_obj);
+ RGWRados::Object op_target(store->getRados(), bucket->get_info(), obj_ctx, head_obj);
//For Append obj, disable versioning
op_target.set_versioning_disabled(true);
RGWRados::Object::Write obj_op(&op_target);
diff --git a/src/rgw/rgw_putobj_processor.h b/src/rgw/rgw_putobj_processor.h
index 322652ed9a4..b60d5ccf477 100644
--- a/src/rgw/rgw_putobj_processor.h
+++ b/src/rgw/rgw_putobj_processor.h
@@ -21,6 +21,7 @@
#include "rgw_rados.h"
#include "services/svc_rados.h"
#include "services/svc_tier_rados.h"
+#include "rgw_sal.h"
namespace rgw {
@@ -80,7 +81,7 @@ using RawObjSet = std::set<rgw_raw_obj>;
class RadosWriter : public DataProcessor {
Aio *const aio;
rgw::sal::RGWRadosStore *const store;
- const RGWBucketInfo& bucket_info;
+ rgw::sal::RGWBucket* bucket;
RGWObjectCtx& obj_ctx;
const rgw_obj head_obj;
RGWSI_RADOS::Obj stripe_obj; // current stripe object
@@ -90,10 +91,10 @@ class RadosWriter : public DataProcessor {
public:
RadosWriter(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
RGWObjectCtx& obj_ctx, const rgw_obj& head_obj,
const DoutPrefixProvider *dpp, optional_yield y)
- : aio(aio), store(store), bucket_info(bucket_info),
+ : aio(aio), store(store), bucket(bucket),
obj_ctx(obj_ctx), head_obj(head_obj), dpp(dpp), y(y)
{}
~RadosWriter();
@@ -120,7 +121,7 @@ class ManifestObjectProcessor : public HeadObjectProcessor,
public StripeGenerator {
protected:
rgw::sal::RGWRadosStore *const store;
- const RGWBucketInfo& bucket_info;
+ rgw::sal::RGWBucket* bucket;
rgw_placement_rule tail_placement_rule;
rgw_user owner;
RGWObjectCtx& obj_ctx;
@@ -138,16 +139,16 @@ class ManifestObjectProcessor : public HeadObjectProcessor,
public:
ManifestObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner, RGWObjectCtx& obj_ctx,
- const rgw_obj& head_obj,
+ rgw_obj& head_obj,
const DoutPrefixProvider* dpp, optional_yield y)
: HeadObjectProcessor(0),
- store(store), bucket_info(bucket_info),
+ store(store), bucket(bucket),
owner(owner),
obj_ctx(obj_ctx), head_obj(head_obj),
- writer(aio, store, bucket_info, obj_ctx, head_obj, dpp, y),
+ writer(aio, store, bucket, obj_ctx, head_obj, dpp, y),
chunk(&writer, 0), stripe(&chunk, this, 0), dpp(dpp) {
if (ptail_placement_rule) {
tail_placement_rule = *ptail_placement_rule;
@@ -178,14 +179,14 @@ class AtomicObjectProcessor : public ManifestObjectProcessor {
int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
public:
AtomicObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner,
- RGWObjectCtx& obj_ctx, const rgw_obj& head_obj,
+ RGWObjectCtx& obj_ctx, rgw_obj head_obj,
std::optional<uint64_t> olh_epoch,
const std::string& unique_tag,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
owner, obj_ctx, head_obj, dpp, y),
olh_epoch(olh_epoch), unique_tag(unique_tag)
{}
@@ -222,18 +223,18 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
int prepare_head();
public:
MultipartObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
- const RGWBucketInfo& bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
const rgw_user& owner, RGWObjectCtx& obj_ctx,
- const rgw_obj& head_obj,
+ rgw_obj head_obj,
const std::string& upload_id, uint64_t part_num,
const std::string& part_num_str,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
owner, obj_ctx, head_obj, dpp, y),
target_obj(head_obj), upload_id(upload_id),
part_num(part_num), part_num_str(part_num_str),
- mp(head_obj.key.name, upload_id)
+ mp(head_obj.key.name, upload_id)
{}
// prepare a multipart manifest
@@ -264,13 +265,15 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
int process_first_chunk(bufferlist&& data, DataProcessor **processor) override;
public:
- AppendObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info,
+ AppendObjectProcessor(Aio *aio, rgw::sal::RGWRadosStore *store,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule *ptail_placement_rule,
- const rgw_user& owner, RGWObjectCtx& obj_ctx,const rgw_obj& head_obj,
+ const rgw_user& owner, RGWObjectCtx& obj_ctx,
+ rgw_obj head_obj,
const std::string& unique_tag, uint64_t position,
uint64_t *cur_accounted_size,
const DoutPrefixProvider *dpp, optional_yield y)
- : ManifestObjectProcessor(aio, store, bucket_info, ptail_placement_rule,
+ : ManifestObjectProcessor(aio, store, bucket, ptail_placement_rule,
owner, obj_ctx, head_obj, dpp, y),
position(position), cur_size(0), cur_accounted_size(cur_accounted_size),
unique_tag(unique_tag), cur_manifest(nullptr)
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index abbb5946254..07bc831fccd 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -2725,22 +2725,27 @@ int RGWRados::on_last_entry_in_listing(RGWBucketInfo& bucket_info,
return 0;
}
+bool RGWRados::swift_versioning_enabled(rgw::sal::RGWBucket* bucket) const
+{
+ return bucket->get_info().has_swift_versioning() &&
+ bucket->get_info().swift_ver_location.size();
+}
int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
const rgw_user& user,
- RGWBucketInfo& bucket_info,
- rgw_obj& obj,
+ rgw::sal::RGWBucket* bucket,
+ rgw::sal::RGWObject* obj,
const DoutPrefixProvider *dpp,
optional_yield y)
{
- if (! swift_versioning_enabled(bucket_info)) {
+ if (! swift_versioning_enabled(bucket)) {
return 0;
}
- obj_ctx.set_atomic(obj);
+ obj->set_atomic(&obj_ctx);
RGWObjState * state = nullptr;
- int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false, y);
+ int r = get_obj_state(&obj_ctx, bucket->get_info(), obj->get_obj(), &state, false, y);
if (r < 0) {
return r;
}
@@ -2749,7 +2754,7 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
return 0;
}
- const string& src_name = obj.get_oid();
+ const string& src_name = obj->get_oid();
char buf[src_name.size() + 32];
struct timespec ts = ceph::real_clock::to_timespec(state->mtime);
snprintf(buf, sizeof(buf), "%03x%s/%lld.%06ld", (int)src_name.size(),
@@ -2757,7 +2762,7 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
RGWBucketInfo dest_bucket_info;
- r = get_bucket_info(&svc, bucket_info.bucket.tenant, bucket_info.swift_ver_location, dest_bucket_info, NULL, null_yield, NULL);
+ r = get_bucket_info(&svc, bucket->get_tenant(), bucket->get_info().swift_ver_location, dest_bucket_info, NULL, null_yield, NULL);
if (r < 0) {
ldout(cct, 10) << "failed to read dest bucket info: r=" << r << dendl;
if (r == -ENOENT) {
@@ -2766,17 +2771,18 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
return r;
}
- if (dest_bucket_info.owner != bucket_info.owner) {
+ if (dest_bucket_info.owner != bucket->get_info().owner) {
return -ERR_PRECONDITION_FAILED;
}
- rgw_obj dest_obj(dest_bucket_info.bucket, buf);
+ rgw::sal::RGWRadosBucket dest_bucket(store, dest_bucket_info);
+ rgw::sal::RGWRadosObject dest_obj(store, rgw_obj_key(buf), &dest_bucket);
if (dest_bucket_info.versioning_enabled()){
- gen_rand_obj_instance_name(&dest_obj);
+ dest_obj.gen_rand_obj_instance_name();
}
- obj_ctx.set_atomic(dest_obj);
+ dest_obj.set_atomic(&obj_ctx);
rgw_zone_id no_zone;
@@ -2784,11 +2790,11 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
user,
NULL, /* req_info *info */
no_zone,
- dest_obj,
+ &dest_obj,
obj,
- dest_bucket_info,
- bucket_info,
- bucket_info.placement_rule,
+ &dest_bucket,
+ bucket,
+ bucket->get_placement_rule(),
NULL, /* time_t *src_mtime */
NULL, /* time_t *mtime */
NULL, /* const time_t *mod_ptr */
@@ -2820,21 +2826,21 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx,
int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
const rgw_user& user,
- RGWBucketInfo& bucket_info,
- rgw_obj& obj,
+ rgw::sal::RGWBucket* bucket,
+ rgw::sal::RGWObject* obj,
bool& restored, /* out */
const DoutPrefixProvider *dpp)
{
- if (! swift_versioning_enabled(bucket_info)) {
+ if (! swift_versioning_enabled(bucket)) {
return 0;
}
/* Bucket info of the bucket that stores previous versions of our object. */
RGWBucketInfo archive_binfo;
- int ret = get_bucket_info(&svc, bucket_info.bucket.tenant,
- bucket_info.swift_ver_location, archive_binfo,
- nullptr, null_yield, nullptr);
+ int ret = get_bucket_info(&svc, bucket->get_tenant(),
+ bucket->get_info().swift_ver_location,
+ archive_binfo, nullptr, null_yield, nullptr);
if (ret < 0) {
return ret;
}
@@ -2844,7 +2850,7 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
* into consideration. For we can live with that.
*
* TODO: delegate this check to un upper layer and compare with ACLs. */
- if (bucket_info.owner != archive_binfo.owner) {
+ if (bucket->get_info().owner != archive_binfo.owner) {
return -EPERM;
}
@@ -2865,24 +2871,25 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
* irrelevant and may be safely skipped. */
std::map<std::string, ceph::bufferlist> no_attrs;
- rgw_obj archive_obj(archive_binfo.bucket, entry.key);
+ rgw::sal::RGWRadosBucket archive_bucket(store, archive_binfo);
+ rgw::sal::RGWRadosObject archive_obj(store, entry.key, &archive_bucket);
- if (bucket_info.versioning_enabled()){
- gen_rand_obj_instance_name(&obj);
+ if (bucket->versioning_enabled()){
+ obj->gen_rand_obj_instance_name();
}
- obj_ctx.set_atomic(archive_obj);
- obj_ctx.set_atomic(obj);
+ archive_obj.set_atomic(&obj_ctx);
+ obj->set_atomic(&obj_ctx);
int ret = copy_obj(obj_ctx,
user,
nullptr, /* req_info *info */
no_zone,
obj, /* dest obj */
- archive_obj, /* src obj */
- bucket_info, /* dest bucket info */
- archive_binfo, /* src bucket info */
- bucket_info.placement_rule, /* placement_rule */
+ &archive_obj, /* src obj */
+ bucket, /* dest bucket info */
+ &archive_bucket, /* src bucket info */
+ bucket->get_placement_rule(), /* placement_rule */
nullptr, /* time_t *src_mtime */
nullptr, /* time_t *mtime */
nullptr, /* const time_t *mod_ptr */
@@ -2914,13 +2921,13 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
}
/* Need to remove the archived copy. */
- ret = delete_obj(obj_ctx, archive_binfo, archive_obj,
+ ret = delete_obj(obj_ctx, archive_binfo, archive_obj.get_obj(),
archive_binfo.versioning_status());
return ret;
};
- const std::string& obj_name = obj.get_oid();
+ const std::string& obj_name = obj->get_oid();
const auto prefix = boost::str(boost::format("%03x%s") % obj_name.size()
% obj_name);
@@ -3487,31 +3494,12 @@ static void set_copy_attrs(map<string, bufferlist>& src_attrs,
}
}
-int RGWRados::rewrite_obj(RGWBucketInfo& dest_bucket_info, const rgw_obj& obj, const DoutPrefixProvider *dpp, optional_yield y)
+int RGWRados::rewrite_obj(RGWBucketInfo& dest_bucket_info, rgw::sal::RGWObject* obj, const DoutPrefixProvider *dpp, optional_yield y)
{
- map<string, bufferlist> attrset;
-
- real_time mtime;
- uint64_t obj_size;
RGWObjectCtx rctx(this->store);
+ rgw::sal::RGWRadosBucket bucket(store, dest_bucket_info);
- RGWRados::Object op_target(this, dest_bucket_info, rctx, obj);
- RGWRados::Object::Read read_op(&op_target);
-
- read_op.params.attrs = &attrset;
- read_op.params.lastmod = &mtime;
- read_op.params.obj_size = &obj_size;
-
- int ret = read_op.prepare(y);
- if (ret < 0)
- return ret;
-
- attrset.erase(RGW_ATTR_ID_TAG);
- attrset.erase(RGW_ATTR_TAIL_TAG);
-
- return copy_obj_data(rctx, dest_bucket_info, dest_bucket_info.placement_rule,
- read_op, obj_size - 1, obj, NULL, mtime, attrset,
- 0, real_time(), NULL, dpp, y);
+ return obj->copy_obj_data(rctx, &bucket, obj, 0, NULL, dpp, y);
}
struct obj_time_weight {
@@ -3612,7 +3600,7 @@ int RGWRados::stat_remote_obj(RGWObjectCtx& obj_ctx,
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- rgw_obj& src_obj,
+ rgw::sal::RGWObject* src_obj,
const RGWBucketInfo *src_bucket_info,
real_time *src_mtime,
uint64_t *psize,
@@ -3749,10 +3737,10 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- const rgw_obj& dest_obj,
- const rgw_obj& src_obj,
- const RGWBucketInfo& dest_bucket_info,
- const RGWBucketInfo *src_bucket_info,
+ rgw::sal::RGWObject* dest_obj,
+ rgw::sal::RGWObject* src_obj,
+ rgw::sal::RGWBucket* dest_bucket,
+ rgw::sal::RGWBucket* src_bucket,
std::optional<rgw_placement_rule> dest_placement_rule,
real_time *src_mtime,
real_time *mtime,
@@ -3788,17 +3776,17 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
rgw::BlockingAioThrottle aio(cct->_conf->rgw_put_obj_min_window_size);
using namespace rgw::putobj;
- AtomicObjectProcessor processor(&aio, this->store, dest_bucket_info, nullptr, user_id,
- obj_ctx, dest_obj, olh_epoch, tag, dpp, null_yield);
+ AtomicObjectProcessor processor(&aio, this->store, dest_bucket, nullptr, user_id,
+ obj_ctx, dest_obj->get_obj(), olh_epoch, tag, dpp, null_yield);
RGWRESTConn *conn;
auto& zone_conn_map = svc.zone->get_zone_conn_map();
auto& zonegroup_conn_map = svc.zone->get_zonegroup_conn_map();
if (source_zone.empty()) {
- if (!src_bucket_info || src_bucket_info->zonegroup.empty()) {
+ if (!src_bucket || src_bucket->get_info().zonegroup.empty()) {
/* source is in the master zonegroup */
conn = svc.zone->get_master_conn();
} else {
- map<string, RGWRESTConn *>::iterator iter = zonegroup_conn_map.find(src_bucket_info->zonegroup);
+ map<string, RGWRESTConn *>::iterator iter = zonegroup_conn_map.find(src_bucket->get_info().zonegroup);
if (iter == zonegroup_conn_map.end()) {
ldout(cct, 0) << "could not find zonegroup connection to zonegroup: " << source_zone << dendl;
return -ENOENT;
@@ -3829,8 +3817,8 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
const rgw_placement_rule *ptail_rule;
int ret = filter->filter(cct,
- src_obj.key,
- dest_bucket_info,
+ src_obj->get_key(),
+ dest_bucket->get_info(),
dest_placement_rule,
obj_attrs,
&override_owner,
@@ -3870,7 +3858,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
if (copy_if_newer) {
/* need to get mtime for destination */
- ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false, null_yield);
+ ret = get_obj_state(&obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield);
if (ret < 0)
goto set_err_state;
@@ -4035,8 +4023,8 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
if (copy_if_newer && canceled) {
ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl;
- obj_ctx.invalidate(dest_obj); /* object was overwritten */
- ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false, null_yield);
+ obj_ctx.invalidate(dest_obj->get_obj()); /* object was overwritten */
+ ret = get_obj_state(&obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield);
if (ret < 0) {
ldout(cct, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
goto set_err_state;
@@ -4070,7 +4058,7 @@ set_err_state:
// for OP_LINK_OLH to call set_olh() with a real olh_epoch
if (olh_epoch && *olh_epoch > 0) {
constexpr bool log_data_change = true;
- ret = set_olh(obj_ctx, dest_bucket_info, dest_obj, false, nullptr,
+ ret = set_olh(obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), false, nullptr,
*olh_epoch, real_time(), false, null_yield, zones_trace, log_data_change);
} else {
// we already have the latest copy
@@ -4085,7 +4073,7 @@ int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate,
map<string, bufferlist>& src_attrs,
RGWRados::Object::Read& read_op,
const rgw_user& user_id,
- rgw_obj& dest_obj,
+ rgw::sal::RGWObject* dest_obj,
real_time *mtime)
{
string etag;
@@ -4131,10 +4119,10 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- rgw_obj& dest_obj,
- rgw_obj& src_obj,
- RGWBucketInfo& dest_bucket_info,
- RGWBucketInfo& src_bucket_info,
+ rgw::sal::RGWObject* dest_obj,
+ rgw::sal::RGWObject* src_obj,
+ rgw::sal::RGWBucket* dest_bucket,
+ rgw::sal::RGWBucket* src_bucket,
const rgw_placement_rule& dest_placement,
real_time *src_mtime,
real_time *mtime,
@@ -4159,30 +4147,30 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
{
int ret;
uint64_t obj_size;
- rgw_obj shadow_obj = dest_obj;
+ rgw_obj shadow_obj = dest_obj->get_obj();
string shadow_oid;
bool remote_src;
bool remote_dest;
- append_rand_alpha(cct, dest_obj.get_oid(), shadow_oid, 32);
- shadow_obj.init_ns(dest_obj.bucket, shadow_oid, shadow_ns);
+ append_rand_alpha(cct, dest_obj->get_oid(), shadow_oid, 32);
+ shadow_obj.init_ns(dest_obj->get_bucket()->get_bi(), shadow_oid, shadow_ns);
auto& zonegroup = svc.zone->get_zonegroup();
- remote_dest = !zonegroup.equals(dest_bucket_info.zonegroup);
- remote_src = !zonegroup.equals(src_bucket_info.zonegroup);
+ remote_dest = !zonegroup.equals(dest_bucket->get_info().zonegroup);
+ remote_src = !zonegroup.equals(src_bucket->get_info().zonegroup);
if (remote_src && remote_dest) {
ldpp_dout(dpp, 0) << "ERROR: can't copy object when both src and dest buckets are remote" << dendl;
return -EINVAL;
}
- ldpp_dout(dpp, 5) << "Copy object " << src_obj.bucket << ":" << src_obj.get_oid() << " => " << dest_obj.bucket << ":" << dest_obj.get_oid() << dendl;
+ ldpp_dout(dpp, 5) << "Copy object " << src_obj->get_bucket() << ":" << src_obj->get_oid() << " => " << dest_obj->get_bucket() << ":" << dest_obj->get_oid() << dendl;
if (remote_src || !source_zone.empty()) {
return fetch_remote_obj(obj_ctx, user_id, info, source_zone,
- dest_obj, src_obj, dest_bucket_info, &src_bucket_info,
+ dest_obj, src_obj, dest_bucket, src_bucket,
dest_placement, src_mtime, mtime, mod_ptr,
unmod_ptr, high_precision_time,
if_match, if_nomatch, attrs_mod, copy_if_newer, attrs, category,
@@ -4191,7 +4179,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
}
map<string, bufferlist> src_attrs;
- RGWRados::Object src_op_target(this, src_bucket_info, obj_ctx, src_obj);
+ RGWRados::Object src_op_target(this, src_bucket->get_info(), obj_ctx, src_obj->get_obj());
RGWRados::Object::Read read_op(&src_op_target);
read_op.conds.mod_ptr = mod_ptr;
@@ -4231,7 +4219,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
RGWObjManifest manifest;
RGWObjState *astate = NULL;
- ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate, y);
+ ret = get_obj_state(&obj_ctx, src_bucket->get_info(), src_obj->get_obj(), &astate, y);
if (ret < 0) {
return ret;
}
@@ -4244,9 +4232,9 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
}
uint64_t max_chunk_size;
- ret = get_max_chunk_size(dest_bucket_info.placement_rule, dest_obj, &max_chunk_size);
+ ret = get_max_chunk_size(dest_bucket->get_placement_rule(), dest_obj->get_obj(), &max_chunk_size);
if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed to get max_chunk_size() for bucket " << dest_obj.bucket << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: failed to get max_chunk_size() for bucket " << dest_obj->get_bucket() << dendl;
return ret;
}
@@ -4261,15 +4249,15 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
}
if (!src_rule || src_rule->empty()) {
- src_rule = &src_bucket_info.placement_rule;
+ src_rule = &src_bucket->get_placement_rule();
}
- if (!get_obj_data_pool(*src_rule, src_obj, &src_pool)) {
+ if (!get_obj_data_pool(*src_rule, src_obj->get_obj(), &src_pool)) {
ldpp_dout(dpp, 0) << "ERROR: failed to locate data pool for " << src_obj << dendl;
return -EIO;
}
- if (!get_obj_data_pool(dest_placement, dest_obj, &dest_pool)) {
+ if (!get_obj_data_pool(dest_placement, dest_obj->get_obj(), &dest_pool)) {
ldpp_dout(dpp, 0) << "ERROR: failed to locate data pool for " << dest_obj << dendl;
return -EIO;
}
@@ -4307,7 +4295,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
if (copy_data) { /* refcounting tail wouldn't work here, just copy the data */
attrs.erase(RGW_ATTR_TAIL_TAG);
- return copy_obj_data(obj_ctx, dest_bucket_info, dest_placement, read_op, obj_size - 1, dest_obj,
+ return copy_obj_data(obj_ctx, dest_bucket, dest_placement, read_op, obj_size - 1, dest_obj,
mtime, real_time(), attrs, olh_epoch, delete_at, petag, dpp, y);
}
@@ -4329,7 +4317,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
RGWObjManifest *pmanifest;
ldpp_dout(dpp, 20) << "dest_obj=" << dest_obj << " src_obj=" << src_obj << " copy_itself=" << (int)copy_itself << dendl;
- RGWRados::Object dest_op_target(this, dest_bucket_info, obj_ctx, dest_obj);
+ RGWRados::Object dest_op_target(this, dest_bucket->get_info(), obj_ctx, dest_obj->get_obj());
RGWRados::Object::Write write_op(&dest_op_target);
string tag;
@@ -4347,7 +4335,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
manifest = *astate->manifest;
const rgw_bucket_placement& tail_placement = manifest.get_tail_placement();
if (tail_placement.bucket.name.empty()) {
- manifest.set_tail_placement(tail_placement.placement_rule, src_obj.bucket);
+ manifest.set_tail_placement(tail_placement.placement_rule, src_obj->get_bucket()->get_bi());
}
string ref_tag;
for (; miter != astate->manifest->obj_end(); ++miter) {
@@ -4380,15 +4368,15 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
goto done_ret;
}
- pmanifest->set_head(dest_bucket_info.placement_rule, dest_obj, first_chunk.length());
+ pmanifest->set_head(dest_bucket->get_placement_rule(), dest_obj->get_obj(), first_chunk.length());
} else {
- pmanifest->set_head(dest_bucket_info.placement_rule, dest_obj, 0);
+ pmanifest->set_head(dest_bucket->get_placement_rule(), dest_obj->get_obj(), 0);
}
write_op.meta.data = &first_chunk;
write_op.meta.manifest = pmanifest;
write_op.meta.ptag = &tag;
- write_op.meta.owner = dest_bucket_info.owner;
+ write_op.meta.owner = dest_bucket->get_info().owner;
write_op.meta.mtime = mtime;
write_op.meta.flags = PUT_OBJ_CREATE;
write_op.meta.category = category;
@@ -4426,10 +4414,10 @@ done_ret:
int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& dest_bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule& dest_placement,
RGWRados::Object::Read& read_op, off_t end,
- const rgw_obj& dest_obj,
+ rgw::sal::RGWObject* dest_obj,
real_time *mtime,
real_time set_mtime,
map<string, bufferlist>& attrs,
@@ -4446,9 +4434,9 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
using namespace rgw::putobj;
// do not change the null_yield in the initialization of this AtomicObjectProcessor
// it causes crashes in the ragweed tests
- AtomicObjectProcessor processor(&aio, this->store, dest_bucket_info, &dest_placement,
- dest_bucket_info.owner, obj_ctx,
- dest_obj, olh_epoch, tag, dpp, null_yield);
+ AtomicObjectProcessor processor(&aio, this->store, bucket, &dest_placement,
+ bucket->get_info().owner, obj_ctx,
+ dest_obj->get_obj(), olh_epoch, tag, dpp, null_yield);
int ret = processor.prepare(y);
if (ret < 0)
return ret;
@@ -4506,8 +4494,8 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
}
int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& bucket_info,
- rgw_obj& obj,
+ rgw::sal::RGWBucket* bucket,
+ rgw::sal::RGWObject& obj,
const rgw_placement_rule& placement_rule,
const real_time& mtime,
uint64_t olh_epoch,
@@ -4518,9 +4506,8 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
real_time read_mtime;
uint64_t obj_size;
- obj_ctx.set_atomic(obj);
-
- RGWRados::Object op_target(this, bucket_info, obj_ctx, obj);
+ obj.set_atomic(&obj_ctx);
+ RGWRados::Object op_target(this, bucket->get_info(), obj_ctx, obj.get_obj());
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = &attrs;
@@ -4541,11 +4528,11 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
attrs.erase(RGW_ATTR_TAIL_TAG);
ret = copy_obj_data(obj_ctx,
- bucket_info,
+ bucket,
placement_rule,
read_op,
obj_size - 1,
- obj,
+ &obj,
nullptr /* pmtime */,
mtime,
attrs,
@@ -8393,7 +8380,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info,
}; // ShardTracker
// add the next unique candidate, or return false if we reach the end
- auto next_candidate = [] (ShardTracker& t,
+ auto next_candidate = [] (CephContext *cct, ShardTracker& t,
std::map<std::string, size_t>& candidates,
size_t tracker_idx) {
while (!t.at_end()) {
@@ -8429,7 +8416,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info,
// it's important that the values in the map refer to the index
// into the results_trackers vector, which may not be the same
// as the shard number (i.e., when not all shards are requested)
- next_candidate(t, candidates, tracker_idx);
+ next_candidate(cct, t, candidates, tracker_idx);
++tracker_idx;
}
@@ -8489,7 +8476,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info,
candidates.erase(candidates.begin());
tracker.advance();
- next_candidate(tracker, candidates, tracker_idx);
+ next_candidate(cct, tracker, candidates, tracker_idx);
if (tracker.at_end() && tracker.is_truncated()) {
// once we exhaust one shard that is truncated, we need to stop,
diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h
index afd06cc53b2..c12404c1090 100644
--- a/src/rgw/rgw_rados.h
+++ b/src/rgw/rgw_rados.h
@@ -1051,28 +1051,25 @@ public:
const std::string& obj_delim,
std::function<int(const rgw_bucket_dir_entry&)> handler);
- bool swift_versioning_enabled(const RGWBucketInfo& bucket_info) const {
- return bucket_info.has_swift_versioning() &&
- bucket_info.swift_ver_location.size();
- }
+ bool swift_versioning_enabled(rgw::sal::RGWBucket* bucket) const;
int swift_versioning_copy(RGWObjectCtx& obj_ctx, /* in/out */
const rgw_user& user, /* in */
- RGWBucketInfo& bucket_info, /* in */
- rgw_obj& obj, /* in */
+ rgw::sal::RGWBucket* bucket, /* in */
+ rgw::sal::RGWObject* obj, /* in */
const DoutPrefixProvider *dpp, /* in/out */
optional_yield y); /* in */
int swift_versioning_restore(RGWObjectCtx& obj_ctx, /* in/out */
const rgw_user& user, /* in */
- RGWBucketInfo& bucket_info, /* in */
- rgw_obj& obj, /* in */
+ rgw::sal::RGWBucket* bucket, /* in */
+ rgw::sal::RGWObject* obj, /* in */
bool& restored, /* out */
const DoutPrefixProvider *dpp); /* in/out */
int copy_obj_to_remote_dest(RGWObjState *astate,
map<string, bufferlist>& src_attrs,
RGWRados::Object::Read& read_op,
const rgw_user& user_id,
- rgw_obj& dest_obj,
+ rgw::sal::RGWObject* dest_obj,
ceph::real_time *mtime);
enum AttrsMod {
@@ -1081,13 +1078,13 @@ public:
ATTRSMOD_MERGE = 2
};
- int rewrite_obj(RGWBucketInfo& dest_bucket_info, const rgw_obj& obj, const DoutPrefixProvider *dpp, optional_yield y);
+ int rewrite_obj(RGWBucketInfo& dest_bucket_info, rgw::sal::RGWObject* obj, const DoutPrefixProvider *dpp, optional_yield y);
int stat_remote_obj(RGWObjectCtx& obj_ctx,
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- rgw_obj& src_obj,
+ rgw::sal::RGWObject* src_obj,
const RGWBucketInfo *src_bucket_info,
real_time *src_mtime,
uint64_t *psize,
@@ -1106,10 +1103,10 @@ public:
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- const rgw_obj& dest_obj,
- const rgw_obj& src_obj,
- const RGWBucketInfo& dest_bucket_info,
- const RGWBucketInfo *src_bucket_info,
+ rgw::sal::RGWObject* dest_obj,
+ rgw::sal::RGWObject* src_obj,
+ rgw::sal::RGWBucket* dest_bucket,
+ rgw::sal::RGWBucket* src_bucket,
std::optional<rgw_placement_rule> dest_placement,
ceph::real_time *src_mtime,
ceph::real_time *mtime,
@@ -1150,10 +1147,10 @@ public:
const rgw_user& user_id,
req_info *info,
const rgw_zone_id& source_zone,
- rgw_obj& dest_obj,
- rgw_obj& src_obj,
- RGWBucketInfo& dest_bucket_info,
- RGWBucketInfo& src_bucket_info,
+ rgw::sal::RGWObject* dest_obj,
+ rgw::sal::RGWObject* src_obj,
+ rgw::sal::RGWBucket* dest_bucket,
+ rgw::sal::RGWBucket* src_bucket,
const rgw_placement_rule& dest_placement,
ceph::real_time *src_mtime,
ceph::real_time *mtime,
@@ -1177,10 +1174,10 @@ public:
optional_yield y);
int copy_obj_data(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& dest_bucket_info,
+ rgw::sal::RGWBucket* bucket,
const rgw_placement_rule& dest_placement,
RGWRados::Object::Read& read_op, off_t end,
- const rgw_obj& dest_obj,
+ rgw::sal::RGWObject* dest_obj,
ceph::real_time *mtime,
ceph::real_time set_mtime,
map<string, bufferlist>& attrs,
@@ -1191,8 +1188,8 @@ public:
optional_yield y);
int transition_obj(RGWObjectCtx& obj_ctx,
- RGWBucketInfo& bucket_info,
- rgw_obj& obj,
+ rgw::sal::RGWBucket* bucket,
+ rgw::sal::RGWObject& obj,
const rgw_placement_rule& placement_rule,
const real_time& mtime,
uint64_t olh_epoch,
@@ -1220,12 +1217,12 @@ public:
/** Delete an object.*/
int delete_obj(RGWObjectCtx& obj_ctx,
- const RGWBucketInfo& bucket_owner,
- const rgw_obj& src_obj,
- int versioning_status,
- uint16_t bilog_flags = 0,
- const ceph::real_time& expiration_time = ceph::real_time(),
- rgw_zone_set *zones_trace = nullptr);
+ const RGWBucketInfo& bucket_owner,
+ const rgw_obj& src_obj,
+ int versioning_status,
+ uint16_t bilog_flags = 0,
+ const ceph::real_time& expiration_time = ceph::real_time(),
+ rgw_zone_set *zones_trace = nullptr);
int delete_raw_obj(const rgw_raw_obj& obj);
diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc
index 19ed78eeb67..55bc28ba05d 100644
--- a/src/rgw/rgw_rest.cc
+++ b/src/rgw/rgw_rest.cc
@@ -566,9 +566,9 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type,
dump_trans_id(s);
- if ((!s->is_err()) &&
- (s->bucket_info.owner != s->user->get_id()) &&
- (s->bucket_info.requester_pays)) {
+ if ((!s->is_err()) && s->bucket &&
+ (s->bucket->get_info().owner != s->user->get_id()) &&
+ (s->bucket->get_info().requester_pays)) {
dump_header(s, "x-amz-request-charged", "requester");
}
@@ -1022,7 +1022,7 @@ int RGWPutObj_ObjStore::get_params()
{
return ret;
}
- torrent.set_info_name((s->object).name);
+ torrent.set_info_name(s->object->get_name());
}
/* end gettorrent */
supplied_md5_b64 = s->info.env->get("HTTP_CONTENT_MD5");
@@ -1626,7 +1626,7 @@ int RGWDeleteMultiObj_ObjStore::get_params()
}
// everything is probably fine, set the bucket
- bucket = s->bucket;
+ bucket = s->bucket.get();
const auto max_size = s->cct->_conf->rgw_max_put_param_size;
std::tie(op_ret, data) = rgw_rest_read_all_input(s, max_size, false);
@@ -2294,7 +2294,7 @@ RGWHandler_REST* RGWREST::get_handler(
*pmgr = m;
}
- RGWHandler_REST* handler = m->get_handler(s, auth_registry, frontend_prefix);
+ RGWHandler_REST* handler = m->get_handler(store, s, auth_registry, frontend_prefix);
if (! handler) {
*init_error = -ERR_METHOD_NOT_ALLOWED;
return NULL;
diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h
index 928f8bd8226..754d3ca7dc4 100644
--- a/src/rgw/rgw_rest.h
+++ b/src/rgw/rgw_rest.h
@@ -639,6 +639,7 @@ public:
}
virtual RGWHandler_REST* get_handler(
+ rgw::sal::RGWRadosStore *store,
struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix
diff --git a/src/rgw/rgw_rest_bucket.h b/src/rgw/rgw_rest_bucket.h
index d516ea5c54a..0a7de160c1e 100644
--- a/src/rgw/rgw_rest_bucket.h
+++ b/src/rgw/rgw_rest_bucket.h
@@ -27,7 +27,8 @@ public:
RGWRESTMgr_Bucket() = default;
~RGWRESTMgr_Bucket() override = default;
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override {
return new RGWHandler_Bucket(auth_registry);
diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc
index c9e9729a9f3..4ad08d8acfb 100644
--- a/src/rgw/rgw_rest_client.cc
+++ b/src/rgw/rgw_rest_client.cc
@@ -557,17 +557,17 @@ int RGWRESTGenerateHTTPHeaders::sign(RGWAccessKey& key)
return 0;
}
-void RGWRESTStreamS3PutObj::send_init(rgw_obj& obj)
+void RGWRESTStreamS3PutObj::send_init(rgw::sal::RGWObject* obj)
{
string resource_str;
string resource;
string new_url = url;
if (host_style == VirtualStyle) {
- resource_str = obj.get_oid();
- new_url = obj.bucket.name + "." + new_url;
+ resource_str = obj->get_oid();
+ new_url = obj->get_bucket()->get_name() + "." + new_url;
} else {
- resource_str = obj.bucket.name + "/" + obj.get_oid();
+ resource_str = obj->get_bucket()->get_name() + "/" + obj->get_oid();
}
//do not encode slash in object key name
@@ -617,7 +617,7 @@ int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, bool send)
return 0;
}
-int RGWRESTStreamS3PutObj::put_obj_init(RGWAccessKey& key, rgw_obj& obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send)
+int RGWRESTStreamS3PutObj::put_obj_init(RGWAccessKey& key, rgw::sal::RGWObject* obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send)
{
send_init(obj);
return send_ready(key, attrs, send);
diff --git a/src/rgw/rgw_rest_client.h b/src/rgw/rgw_rest_client.h
index 1e11e3ae2ae..2628806ce13 100644
--- a/src/rgw/rgw_rest_client.h
+++ b/src/rgw/rgw_rest_client.h
@@ -211,13 +211,13 @@ public:
out_cb(NULL), new_info(cct, &new_env), headers_gen(_cct, &new_env, &new_info) {}
~RGWRESTStreamS3PutObj() override;
- void send_init(rgw_obj& obj);
+ void send_init(rgw::sal::RGWObject* obj);
int send_ready(RGWAccessKey& key, map<string, bufferlist>& rgw_attrs, bool send);
int send_ready(RGWAccessKey& key, const map<string, string>& http_attrs,
RGWAccessControlPolicy& policy, bool send);
int send_ready(RGWAccessKey& key, bool send);
- int put_obj_init(RGWAccessKey& key, rgw_obj& obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send);
+ int put_obj_init(RGWAccessKey& key, rgw::sal::RGWObject* obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send);
RGWGetDataCB *get_out_cb() { return out_cb; }
};
diff --git a/src/rgw/rgw_rest_config.h b/src/rgw/rgw_rest_config.h
index 99c77364696..3fb3e871f4d 100644
--- a/src/rgw/rgw_rest_config.h
+++ b/src/rgw/rgw_rest_config.h
@@ -77,7 +77,8 @@ public:
RGWRESTMgr_Config() = default;
~RGWRESTMgr_Config() override = default;
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override {
return new RGWHandler_Config(auth_registry);
diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc
index a0fafe90f95..7d70cdb3993 100644
--- a/src/rgw/rgw_rest_conn.cc
+++ b/src/rgw/rgw_rest_conn.cc
@@ -4,6 +4,7 @@
#include "rgw_rados.h"
#include "rgw_zone.h"
#include "rgw_rest_conn.h"
+#include "rgw_sal.h"
#include "services/svc_zone.h"
@@ -116,7 +117,7 @@ public:
explicit StreamObjData(rgw_obj& _obj) : obj(_obj) {}
};
-int RGWRESTConn::put_obj_send_init(rgw_obj& obj, const rgw_http_param_pair *extra_params, RGWRESTStreamS3PutObj **req)
+int RGWRESTConn::put_obj_send_init(rgw::sal::RGWObject* obj, const rgw_http_param_pair *extra_params, RGWRESTStreamS3PutObj **req)
{
string url;
int ret = get_url(url);
@@ -137,7 +138,7 @@ int RGWRESTConn::put_obj_send_init(rgw_obj& obj, const rgw_http_param_pair *extr
return 0;
}
-int RGWRESTConn::put_obj_async(const rgw_user& uid, rgw_obj& obj, uint64_t obj_size,
+int RGWRESTConn::put_obj_async(const rgw_user& uid, rgw::sal::RGWObject* obj, uint64_t obj_size,
map<string, bufferlist>& attrs, bool send,
RGWRESTStreamS3PutObj **req)
{
@@ -190,7 +191,7 @@ static void set_header(T val, map<string, string>& headers, const string& header
}
-int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, const rgw_obj& obj,
+int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, const rgw::sal::RGWObject* obj,
const real_time *mod_ptr, const real_time *unmod_ptr,
uint32_t mod_zone_id, uint64_t mod_pg_ver,
bool prepend_metadata, bool get_op, bool rgwx_stat,
@@ -211,7 +212,7 @@ int RGWRESTConn::get_obj(const rgw_user& uid, req_info *info /* optional */, con
return get_obj(obj, params, send, req);
}
-int RGWRESTConn::get_obj(const rgw_obj& obj, const get_obj_params& in_params, bool send, RGWRESTStreamRWRequest **req)
+int RGWRESTConn::get_obj(const rgw::sal::RGWObject* obj, const get_obj_params& in_params, bool send, RGWRESTStreamRWRequest **req)
{
string url;
int ret = get_url(url);
@@ -232,8 +233,8 @@ int RGWRESTConn::get_obj(const rgw_obj& obj, const get_obj_params& in_params, bo
if (in_params.skip_decrypt) {
params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "skip-decrypt", ""));
}
- if (!obj.key.instance.empty()) {
- const string& instance = obj.key.instance;
+ if (!obj->get_instance().empty()) {
+ const string& instance = obj->get_instance();
params.push_back(param_pair_t("versionId", instance));
}
if (in_params.get_op) {
@@ -274,7 +275,7 @@ int RGWRESTConn::get_obj(const rgw_obj& obj, const get_obj_params& in_params, bo
set_header(buf, extra_headers, "RANGE");
}
- int r = (*req)->send_prepare(key, extra_headers, obj);
+ int r = (*req)->send_prepare(key, extra_headers, obj->get_obj());
if (r < 0) {
goto done_err;
}
diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h
index 5cbd3579a08..186f63eca9c 100644
--- a/src/rgw/rgw_rest_conn.h
+++ b/src/rgw/rgw_rest_conn.h
@@ -113,8 +113,8 @@ public:
/* async requests */
- int put_obj_send_init(rgw_obj& obj, const rgw_http_param_pair *extra_params, RGWRESTStreamS3PutObj **req);
- int put_obj_async(const rgw_user& uid, rgw_obj& obj, uint64_t obj_size,
+ int put_obj_send_init(rgw::sal::RGWObject* obj, const rgw_http_param_pair *extra_params, RGWRESTStreamS3PutObj **req);
+ int put_obj_async(const rgw_user& uid, rgw::sal::RGWObject* obj, uint64_t obj_size,
map<string, bufferlist>& attrs, bool send, RGWRESTStreamS3PutObj **req);
int complete_request(RGWRESTStreamS3PutObj *req, string& etag, ceph::real_time *mtime);
@@ -143,9 +143,9 @@ public:
uint64_t range_end{0};
};
- int get_obj(const rgw_obj& obj, const get_obj_params& params, bool send, RGWRESTStreamRWRequest **req);
+ int get_obj(const rgw::sal::RGWObject* obj, const get_obj_params& params, bool send, RGWRESTStreamRWRequest **req);
- int get_obj(const rgw_user& uid, req_info *info /* optional */, const rgw_obj& obj,
+ int get_obj(const rgw_user& uid, req_info *info /* optional */, const rgw::sal::RGWObject* obj,
const ceph::real_time *mod_ptr, const ceph::real_time *unmod_ptr,
uint32_t mod_zone_id, uint64_t mod_pg_ver,
bool prepend_metadata, bool get_op, bool rgwx_stat, bool sync_manifest,
diff --git a/src/rgw/rgw_rest_iam.cc b/src/rgw/rgw_rest_iam.cc
index 4f56d6334a0..a6cce4f7191 100644
--- a/src/rgw/rgw_rest_iam.cc
+++ b/src/rgw/rgw_rest_iam.cc
@@ -144,9 +144,10 @@ int RGWHandler_REST_IAM::init_from_header(struct req_state* s,
}
RGWHandler_REST*
-RGWRESTMgr_IAM::get_handler(struct req_state* const s,
- const rgw::auth::StrategyRegistry& auth_registry,
- const std::string& frontend_prefix)
+RGWRESTMgr_IAM::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
+ const rgw::auth::StrategyRegistry& auth_registry,
+ const std::string& frontend_prefix)
{
return new RGWHandler_REST_IAM(auth_registry);
}
diff --git a/src/rgw/rgw_rest_iam.h b/src/rgw/rgw_rest_iam.h
index 30e0304c37a..1c6a0e89d32 100644
--- a/src/rgw/rgw_rest_iam.h
+++ b/src/rgw/rgw_rest_iam.h
@@ -39,7 +39,8 @@ public:
return this;
}
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry&,
const std::string&) override;
};
diff --git a/src/rgw/rgw_rest_log.h b/src/rgw/rgw_rest_log.h
index fa2897802bc..62d0ba8334d 100644
--- a/src/rgw/rgw_rest_log.h
+++ b/src/rgw/rgw_rest_log.h
@@ -298,7 +298,8 @@ public:
RGWRESTMgr_Log() = default;
~RGWRESTMgr_Log() override = default;
- RGWHandler_REST* get_handler(struct req_state* const,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefixs) override {
return new RGWHandler_Log(auth_registry);
diff --git a/src/rgw/rgw_rest_metadata.h b/src/rgw/rgw_rest_metadata.h
index faabe288e59..78aabb63fa8 100644
--- a/src/rgw/rgw_rest_metadata.h
+++ b/src/rgw/rgw_rest_metadata.h
@@ -95,7 +95,8 @@ public:
RGWRESTMgr_Metadata() = default;
~RGWRESTMgr_Metadata() override = default;
- RGWHandler_REST* get_handler(struct req_state* const s,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override {
return new RGWHandler_Metadata(auth_registry);
diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc
index 423f9cbf488..9a14d8d5ff0 100644
--- a/src/rgw/rgw_rest_realm.cc
+++ b/src/rgw/rgw_rest_realm.cc
@@ -246,7 +246,8 @@ class RGWHandler_Period : public RGWHandler_Auth_S3 {
class RGWRESTMgr_Period : public RGWRESTMgr {
public:
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override {
return new RGWHandler_Period(auth_registry);
@@ -362,7 +363,8 @@ RGWRESTMgr_Realm::RGWRESTMgr_Realm()
}
RGWHandler_REST*
-RGWRESTMgr_Realm::get_handler(struct req_state*,
+RGWRESTMgr_Realm::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&)
{
diff --git a/src/rgw/rgw_rest_realm.h b/src/rgw/rgw_rest_realm.h
index fd4401d9649..84ee86b48ad 100644
--- a/src/rgw/rgw_rest_realm.h
+++ b/src/rgw/rgw_rest_realm.h
@@ -9,7 +9,8 @@ class RGWRESTMgr_Realm : public RGWRESTMgr {
public:
RGWRESTMgr_Realm();
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override;
};
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 96d86329661..d59515593ed 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -107,7 +107,7 @@ static inline std::string get_s3_expiration_header(
const ceph::real_time& mtime)
{
return rgw::lc::s3_expiration_header(
- s, s->object, s->tagset, mtime, s->bucket_attrs);
+ s, s->object->get_key(), s->tagset, mtime, s->bucket_attrs);
}
static inline bool get_s3_multipart_abort_header(
@@ -115,7 +115,7 @@ static inline bool get_s3_multipart_abort_header(
ceph::real_time& date, std::string& rule_id)
{
return rgw::lc::s3_multipart_abort_header(
- s, s->object, mtime, s->bucket_attrs, date, rule_id);
+ s, s->object->get_key(), mtime, s->bucket_attrs, date, rule_id);
}
struct response_attr_param {
@@ -1163,8 +1163,8 @@ void RGWGetBucketReplication_ObjStore_S3::send_response_data()
ReplicationConfiguration conf;
- if (s->bucket_info.sync_policy) {
- auto policy = s->bucket_info.sync_policy;
+ if (s->bucket->get_info().sync_policy) {
+ auto policy = s->bucket->get_info().sync_policy;
auto iter = policy->groups.find(enabled_group_id);
if (iter != policy->groups.end()) {
@@ -1275,12 +1275,11 @@ void RGWListBuckets_ObjStore_S3::send_response_data(rgw::sal::RGWBucketList& buc
if (!sent_data)
return;
- map<string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
- map<string, rgw::sal::RGWBucket*>::iterator iter;
+ auto& m = buckets.get_buckets();
- for (iter = m.begin(); iter != m.end(); ++iter) {
- rgw::sal::RGWBucket* obj = iter->second;
- dump_bucket(s, *obj);
+ for (auto iter = m.begin(); iter != m.end(); ++iter) {
+ auto& bucket = iter->second;
+ dump_bucket(s, *bucket);
}
rgw_flush_formatter(s, s->formatter);
}
@@ -1886,12 +1885,12 @@ void RGWGetBucketLocation_ObjStore_S3::send_response()
RGWZoneGroup zonegroup;
string api_name;
- int ret = store->svc()->zone->get_zonegroup(s->bucket_info.zonegroup, zonegroup);
+ int ret = store->svc()->zone->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
if (ret >= 0) {
api_name = zonegroup.api_name;
} else {
- if (s->bucket_info.zonegroup != "default") {
- api_name = s->bucket_info.zonegroup;
+ if (s->bucket->get_info().zonegroup != "default") {
+ api_name = s->bucket->get_info().zonegroup;
}
}
@@ -2128,7 +2127,7 @@ void RGWGetBucketWebsite_ObjStore_S3::send_response()
return;
}
- RGWBucketWebsiteConf& conf = s->bucket_info.website_conf;
+ RGWBucketWebsiteConf& conf = s->bucket->get_info().website_conf;
s->formatter->open_object_section_in_ns("WebsiteConfiguration", XMLNS_AWS_S3);
conf.dump_xml(s->formatter);
@@ -2145,7 +2144,7 @@ static void dump_bucket_metadata(struct req_state *s, rgw::sal::RGWBucket* bucke
void RGWStatBucket_ObjStore_S3::send_response()
{
if (op_ret >= 0) {
- dump_bucket_metadata(s, bucket);
+ dump_bucket_metadata(s, bucket.get());
}
set_req_state_err(s, op_ret);
@@ -2493,7 +2492,7 @@ int RGWPutObj_ObjStore_S3::get_params()
}
obj_legal_hold = new RGWObjectLegalHold(obj_legal_hold_str);
}
- if (!s->bucket_info.obj_lock_enabled() && (obj_retention || obj_legal_hold)) {
+ if (!s->bucket->get_info().obj_lock_enabled() && (obj_retention || obj_legal_hold)) {
ldpp_dout(this, 0) << "ERROR: object retention or legal hold can't be set if bucket object lock not configured" << dendl;
ret = -ERR_INVALID_REQUEST;
return ret;
@@ -2606,7 +2605,7 @@ void RGWPutObj_ObjStore_S3::send_response()
static inline int get_obj_attrs(rgw::sal::RGWRadosStore *store, struct req_state *s, rgw_obj& obj, map<string, bufferlist>& attrs)
{
- RGWRados::Object op_target(store->getRados(), s->bucket_info, *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), *static_cast<RGWObjectCtx *>(s->obj_ctx), obj);
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = &attrs;
@@ -2662,9 +2661,9 @@ int RGWPutObj_ObjStore_S3::get_encrypt_filter(
{
int res = 0;
if (!multipart_upload_id.empty()) {
- RGWMPObj mp(s->object.name, multipart_upload_id);
+ RGWMPObj mp(s->object->get_name(), multipart_upload_id);
rgw_obj obj;
- obj.init_ns(s->bucket, mp.get_meta(), RGW_OBJ_NS_MULTIPART);
+ obj.init_ns(s->bucket->get_bi(), mp.get_meta(), RGW_OBJ_NS_MULTIPART);
obj.set_in_extra_data(true);
map<string, bufferlist> xattrs;
res = get_obj_attrs(store, s, obj, xattrs);
@@ -2689,8 +2688,9 @@ int RGWPutObj_ObjStore_S3::get_encrypt_filter(
return res;
}
-void RGWPostObj_ObjStore_S3::rebuild_key(string& key)
+void RGWPostObj_ObjStore_S3::rebuild_key(rgw::sal::RGWObject* obj)
{
+ string key = obj->get_name();
static string var = "${filename}";
int pos = key.find(var);
if (pos < 0)
@@ -2700,12 +2700,12 @@ void RGWPostObj_ObjStore_S3::rebuild_key(string& key)
new_key.append(filename);
new_key.append(key.substr(pos + var.size()));
- key = new_key;
+ obj->set_key(new_key);
}
std::string RGWPostObj_ObjStore_S3::get_current_filename() const
{
- return s->object.name;
+ return s->object->get_name();
}
std::string RGWPostObj_ObjStore_S3::get_current_content_type() const
@@ -2722,9 +2722,9 @@ int RGWPostObj_ObjStore_S3::get_params()
map_qs_metadata(s);
- ldpp_dout(this, 20) << "adding bucket to policy env: " << s->bucket.name
+ ldpp_dout(this, 20) << "adding bucket to policy env: " << s->bucket->get_name()
<< dendl;
- env.add_var("bucket", s->bucket.name);
+ env.add_var("bucket", s->bucket->get_name());
bool done;
do {
@@ -2782,16 +2782,16 @@ int RGWPostObj_ObjStore_S3::get_params()
return -EINVAL;
}
- s->object = rgw_obj_key(object_str);
+ s->object = store->get_object(rgw_obj_key(object_str));
- rebuild_key(s->object.name);
+ rebuild_key(s->object.get());
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
err_msg = "Empty object name";
return -EINVAL;
}
- env.add_var("key", s->object.name);
+ env.add_var("key", s->object->get_name());
part_str(parts, "Content-Type", &content_type);
@@ -3113,7 +3113,7 @@ void RGWPostObj_ObjStore_S3::send_response()
url_encode(s->bucket_tenant, tenant); /* surely overkill, but cheap */
url_encode(s->bucket_name, bucket);
- url_encode(s->object.name, key);
+ url_encode(s->object->get_name(), key);
url_encode(etag_str, etag_url);
if (!s->bucket_tenant.empty()) {
@@ -3182,16 +3182,16 @@ done:
base_uri.c_str(),
url_encode(s->bucket_tenant).c_str(),
url_encode(s->bucket_name).c_str(),
- url_encode(s->object.name).c_str());
+ url_encode(s->object->get_name()).c_str());
s->formatter->dump_string("Tenant", s->bucket_tenant);
} else {
s->formatter->dump_format("Location", "%s/%s/%s",
base_uri.c_str(),
url_encode(s->bucket_name).c_str(),
- url_encode(s->object.name).c_str());
+ url_encode(s->object->get_name()).c_str());
}
s->formatter->dump_string("Bucket", s->bucket_name);
- s->formatter->dump_string("Key", s->object.name);
+ s->formatter->dump_string("Key", s->object->get_name());
s->formatter->dump_string("ETag", etag);
s->formatter->close_section();
}
@@ -3289,10 +3289,10 @@ int RGWCopyObj_ObjStore_S3::get_params()
src_tenant_name = s->src_tenant_name;
src_bucket_name = s->src_bucket_name;
- src_object = s->src_object;
- dest_tenant_name = s->bucket.tenant;
- dest_bucket_name = s->bucket.name;
- dest_object = s->object.name;
+ src_object = s->src_object->clone();
+ dest_tenant_name = s->bucket->get_tenant();
+ dest_bucket_name = s->bucket->get_name();
+ dest_obj_name = s->object->get_name();
if (s->system_request) {
source_zone = s->info.args.get(RGW_SYS_PARAM_PREFIX "source-zone");
@@ -3319,8 +3319,8 @@ int RGWCopyObj_ObjStore_S3::get_params()
if (source_zone.empty() &&
(dest_tenant_name.compare(src_tenant_name) == 0) &&
(dest_bucket_name.compare(src_bucket_name) == 0) &&
- (dest_object.compare(src_object.name) == 0) &&
- src_object.instance.empty() &&
+ (dest_obj_name.compare(src_object->get_name()) == 0) &&
+ src_object->get_instance().empty() &&
(attrs_mod != RGWRados::ATTRSMOD_REPLACE)) {
need_to_check_storage_class = true;
}
@@ -3419,7 +3419,7 @@ int RGWPutACLs_ObjStore_S3::get_policy_from_state(rgw::sal::RGWRadosStore *store
RGWAccessControlPolicy_S3 s3policy(s->cct);
// bucket-* canned acls do not apply to bucket
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
if (s->canned_acl.find("bucket") != string::npos)
s->canned_acl.clear();
}
@@ -3752,7 +3752,7 @@ void RGWInitMultipart_ObjStore_S3::send_response()
if (!s->bucket_tenant.empty())
s->formatter->dump_string("Tenant", s->bucket_tenant);
s->formatter->dump_string("Bucket", s->bucket_name);
- s->formatter->dump_string("Key", s->object.name);
+ s->formatter->dump_string("Key", s->object->get_name());
s->formatter->dump_string("UploadId", upload_id);
s->formatter->close_section();
rgw_flush_formatter_and_reset(s, s->formatter);
@@ -3794,18 +3794,18 @@ void RGWCompleteMultipart_ObjStore_S3::send_response()
base_uri.c_str(),
s->bucket_tenant.c_str(),
s->bucket_name.c_str(),
- s->object.name.c_str()
+ s->object->get_name().c_str()
);
s->formatter->dump_string("Tenant", s->bucket_tenant);
} else {
s->formatter->dump_format("Location", "%s/%s/%s",
base_uri.c_str(),
s->bucket_name.c_str(),
- s->object.name.c_str()
+ s->object->get_name().c_str()
);
}
s->formatter->dump_string("Bucket", s->bucket_name);
- s->formatter->dump_string("Key", s->object.name);
+ s->formatter->dump_string("Key", s->object->get_name());
s->formatter->dump_string("ETag", etag);
s->formatter->close_section();
rgw_flush_formatter_and_reset(s, s->formatter);
@@ -3847,7 +3847,7 @@ void RGWListMultipart_ObjStore_S3::send_response()
if (!s->bucket_tenant.empty())
s->formatter->dump_string("Tenant", s->bucket_tenant);
s->formatter->dump_string("Bucket", s->bucket_name);
- s->formatter->dump_string("Key", s->object.name);
+ s->formatter->dump_string("Key", s->object->get_name());
s->formatter->dump_string("UploadId", upload_id);
s->formatter->dump_string("StorageClass", "STANDARD");
s->formatter->dump_int("PartNumberMarker", marker);
@@ -4140,7 +4140,7 @@ void RGWGetBucketMetaSearch_ObjStore_S3::send_response()
Formatter *f = s->formatter;
f->open_array_section("GetBucketMetaSearchResult");
- for (auto& e : s->bucket_info.mdsearch_config) {
+ for (auto& e : s->bucket->get_info().mdsearch_config) {
f->open_object_section("Entry");
string k = string("x-amz-meta-") + e.first;
f->dump_string("Key", k.c_str());
@@ -4191,7 +4191,7 @@ void RGWGetBucketObjectLock_ObjStore_S3::send_response()
if (op_ret) {
return;
}
- encode_xml("ObjectLockConfiguration", s->bucket_info.obj_lock, s->formatter);
+ encode_xml("ObjectLockConfiguration", s->bucket->get_info().obj_lock, s->formatter);
rgw_flush_formatter_and_reset(s, s->formatter);
}
@@ -4615,9 +4615,10 @@ RGWOp *RGWHandler_REST_Obj_S3::op_options()
return new RGWOptionsCORS_ObjStore_S3;
}
-int RGWHandler_REST_S3::init_from_header(struct req_state* s,
- int default_formatter,
- bool configurable_format)
+int RGWHandler_REST_S3::init_from_header(rgw::sal::RGWRadosStore *store,
+ struct req_state* s,
+ int default_formatter,
+ bool configurable_format)
{
string req;
string first;
@@ -4670,10 +4671,18 @@ int RGWHandler_REST_S3::init_from_header(struct req_state* s,
s->init_state.url_bucket = first;
if (pos >= 0) {
string encoded_obj_str = req.substr(pos+1);
- s->object = rgw_obj_key(encoded_obj_str, s->info.args.get("versionId"));
+ if (s->bucket) {
+ s->object = s->bucket->get_object(rgw_obj_key(encoded_obj_str, s->info.args.get("versionId")));
+ } else {
+ s->object = store->get_object(rgw_obj_key(encoded_obj_str, s->info.args.get("versionId")));
+ }
}
} else {
- s->object = rgw_obj_key(req_name, s->info.args.get("versionId"));
+ if (s->bucket) {
+ s->object = s->bucket->get_object(rgw_obj_key(req_name, s->info.args.get("versionId")));
+ } else {
+ s->object = store->get_object(rgw_obj_key(req_name, s->info.args.get("versionId")));
+ }
}
return 0;
}
@@ -4715,15 +4724,15 @@ int RGWHandler_REST_S3::postauth_init()
rgw_parse_url_bucket(t->url_bucket, s->user->get_tenant(),
s->bucket_tenant, s->bucket_name);
- dout(10) << "s->object=" << (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
+ dout(10) << "s->object=" << s->object
<< " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) << dendl;
int ret;
ret = rgw_validate_tenant_name(s->bucket_tenant);
if (ret)
return ret;
- if (!s->bucket_name.empty()) {
- ret = validate_object_name(s->object.name);
+ if (!s->bucket_name.empty() && !rgw::sal::RGWObject::empty(s->object.get())) {
+ ret = validate_object_name(s->object->get_name());
if (ret)
return ret;
}
@@ -4755,7 +4764,7 @@ int RGWHandler_REST_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *s
if (ret)
return ret;
if (!s->bucket_name.empty()) {
- ret = validate_object_name(s->object.name);
+ ret = validate_object_name(s->object->get_name());
if (ret)
return ret;
}
@@ -4770,14 +4779,16 @@ int RGWHandler_REST_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *s
if (copy_source &&
(! s->info.env->get("HTTP_X_AMZ_COPY_SOURCE_RANGE")) &&
(! s->info.args.exists("uploadId"))) {
+ rgw_obj_key key;
ret = RGWCopyObj::parse_copy_location(copy_source,
s->init_state.src_bucket,
- s->src_object);
+ key);
if (!ret) {
ldpp_dout(s, 0) << "failed to parse copy location" << dendl;
return -EINVAL; // XXX why not -ERR_INVALID_BUCKET_NAME or -ERR_BAD_URL?
}
+ s->src_object = store->get_object(key);
}
const char *sc = s->info.env->get("HTTP_X_AMZ_STORAGE_CLASS");
@@ -4876,21 +4887,21 @@ int RGW_Auth_S3::authorize(const DoutPrefixProvider *dpp,
int RGWHandler_Auth_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *state,
rgw::io::BasicClient *cio)
{
- int ret = RGWHandler_REST_S3::init_from_header(state, RGW_FORMAT_JSON,
- true);
+ int ret = RGWHandler_REST_S3::init_from_header(store, state, RGW_FORMAT_JSON, true);
if (ret < 0)
return ret;
return RGWHandler_REST::init(store, state, cio);
}
-RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state* const s,
+RGWHandler_REST* RGWRESTMgr_S3::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix)
{
bool is_s3website = enable_s3website && (s->prot_flags & RGW_REST_WEBSITE);
int ret =
- RGWHandler_REST_S3::init_from_header(s,
+ RGWHandler_REST_S3::init_from_header(store, s,
is_s3website ? RGW_FORMAT_HTML :
RGW_FORMAT_XML, true);
if (ret < 0)
@@ -4901,7 +4912,7 @@ RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state* const s,
if (is_s3website) {
if (s->init_state.url_bucket.empty()) {
handler = new RGWHandler_REST_Service_S3Website(auth_registry);
- } else if (s->object.empty()) {
+ } else if (rgw::sal::RGWObject::empty(s->object.get())) {
handler = new RGWHandler_REST_Bucket_S3Website(auth_registry);
} else {
handler = new RGWHandler_REST_Obj_S3Website(auth_registry);
@@ -4909,7 +4920,7 @@ RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state* const s,
} else {
if (s->init_state.url_bucket.empty()) {
handler = new RGWHandler_REST_Service_S3(auth_registry, enable_sts, enable_iam, enable_pubsub);
- } else if (s->object.empty()) {
+ } else if (rgw::sal::RGWObject::empty(s->object.get())) {
handler = new RGWHandler_REST_Bucket_S3(auth_registry, enable_pubsub);
} else {
handler = new RGWHandler_REST_Obj_S3(auth_registry);
@@ -4922,7 +4933,7 @@ RGWHandler_REST* RGWRESTMgr_S3::get_handler(struct req_state* const s,
}
bool RGWHandler_REST_S3Website::web_dir() const {
- std::string subdir_name = url_decode(s->object.name);
+ std::string subdir_name = url_decode(s->object->get_name());
if (subdir_name.empty()) {
return false;
@@ -4930,14 +4941,14 @@ bool RGWHandler_REST_S3Website::web_dir() const {
subdir_name.pop_back();
}
- rgw_obj obj(s->bucket, subdir_name);
+ rgw_obj obj(s->bucket->get_bi(), subdir_name);
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
obj_ctx.set_atomic(obj);
obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
- if (store->getRados()->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
+ if (store->getRados()->get_obj_state(&obj_ctx, s->bucket->get_info(), obj, &state, false, s->yield) < 0) {
return false;
}
if (! state->exists) {
@@ -4952,7 +4963,11 @@ int RGWHandler_REST_S3Website::init(rgw::sal::RGWRadosStore *store, req_state *s
// save the original object name before retarget() replaces it with the
// result of get_effective_key(). the error_handler() needs the original
// object name for redirect handling
- original_object_name = s->object.name;
+ if (!rgw::sal::RGWObject::empty(s->object.get())) {
+ original_object_name = s->object->get_name();
+ } else {
+ original_object_name = "";
+ }
return RGWHandler_REST_S3::init(store, s, cio);
}
@@ -4964,39 +4979,40 @@ int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op) {
if (!(s->prot_flags & RGW_REST_WEBSITE))
return 0;
- int ret = store->getRados()->get_bucket_info(store->svc(), s->bucket_tenant,
- s->bucket_name, s->bucket_info, NULL,
- s->yield, &s->bucket_attrs);
+ int ret = store->get_bucket(nullptr, s->bucket_tenant, s->bucket_name, &s->bucket);
if (ret < 0) {
// TODO-FUTURE: if the bucket does not exist, maybe expose it here?
return -ERR_NO_SUCH_BUCKET;
}
- if (!s->bucket_info.has_website) {
+
+ s->bucket_attrs = s->bucket->get_attrs().attrs;
+
+ if (!s->bucket->get_info().has_website) {
// TODO-FUTURE: if the bucket has no WebsiteConfig, expose it here
return -ERR_NO_SUCH_WEBSITE_CONFIGURATION;
}
rgw_obj_key new_obj;
- bool get_res = s->bucket_info.website_conf.get_effective_key(s->object.name, &new_obj.name, web_dir());
+ bool get_res = s->bucket->get_info().website_conf.get_effective_key(s->object->get_name(), &new_obj.name, web_dir());
if (!get_res) {
s->err.message = "The IndexDocument Suffix is not configurated or not well formed!";
ldpp_dout(s, 5) << s->err.message << dendl;
return -EINVAL;
}
- ldpp_dout(s, 10) << "retarget get_effective_key " << s->object << " -> "
+ ldpp_dout(s, 10) << "retarget get_effective_key " << s->object->get_key() << " -> "
<< new_obj << dendl;
RGWBWRoutingRule rrule;
bool should_redirect =
- s->bucket_info.website_conf.should_redirect(new_obj.name, 0, &rrule);
+ s->bucket->get_info().website_conf.should_redirect(new_obj.name, 0, &rrule);
if (should_redirect) {
const string& hostname = s->info.env->get("HTTP_HOST", "");
const string& protocol =
(s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
int redirect_code = 0;
- rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect,
+ rrule.apply_rule(protocol, hostname, s->object->get_name(), &s->redirect,
&redirect_code);
// APply a custom HTTP response code
if (redirect_code > 0)
@@ -5012,7 +5028,7 @@ int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op) {
* operation. Or remove this comment if it's not applicable anymore
*/
- s->object = new_obj;
+ s->object = store->get_object(new_obj);
return 0;
}
@@ -5041,7 +5057,7 @@ int RGWHandler_REST_S3Website::serve_errordoc(int http_ret, const string& errord
getop->if_unmod = NULL;
getop->if_match = NULL;
getop->if_nomatch = NULL;
- s->object = errordoc_key;
+ s->object = store->get_object(errordoc_key);
ret = init_permissions(getop.get());
if (ret < 0) {
@@ -5111,7 +5127,7 @@ int RGWHandler_REST_S3Website::error_handler(int err_no,
RGWBWRoutingRule rrule;
bool should_redirect =
- s->bucket_info.website_conf.should_redirect(original_object_name,
+ s->bucket->get_info().website_conf.should_redirect(original_object_name,
http_error_code, &rrule);
if (should_redirect) {
@@ -5131,12 +5147,12 @@ int RGWHandler_REST_S3Website::error_handler(int err_no,
} else if (err_no == -ERR_WEBSITE_REDIRECT) {
// Do nothing here, this redirect will be handled in abort_early's ERR_WEBSITE_REDIRECT block
// Do NOT fire the ErrorDoc handler
- } else if (!s->bucket_info.website_conf.error_doc.empty()) {
+ } else if (!s->bucket->get_info().website_conf.error_doc.empty()) {
/* This serves an entire page!
On success, it will return zero, and no further content should be sent to the socket
On failure, we need the double-error handler
*/
- new_err_no = RGWHandler_REST_S3Website::serve_errordoc(http_error_code, s->bucket_info.website_conf.error_doc);
+ new_err_no = RGWHandler_REST_S3Website::serve_errordoc(http_error_code, s->bucket->get_info().website_conf.error_doc);
if (new_err_no && new_err_no != -1) {
err_no = new_err_no;
}
diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h
index 1993f647e80..1e03134f6c5 100644
--- a/src/rgw/rgw_rest_s3.h
+++ b/src/rgw/rgw_rest_s3.h
@@ -297,7 +297,7 @@ class RGWPostObj_ObjStore_S3 : public RGWPostObj_ObjStore {
int get_policy();
int get_tags();
- void rebuild_key(string& key);
+ void rebuild_key(rgw::sal::RGWObject* obj);
std::string get_current_filename() const override;
std::string get_current_content_type() const override;
@@ -625,7 +625,7 @@ class RGWHandler_REST_S3 : public RGWHandler_REST {
protected:
const rgw::auth::StrategyRegistry& auth_registry;
public:
- static int init_from_header(struct req_state *s, int default_formatter, bool configurable_format);
+ static int init_from_header(rgw::sal::RGWRadosStore *store, struct req_state *s, int default_formatter, bool configurable_format);
explicit RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
: RGWHandler_REST(),
@@ -765,7 +765,8 @@ public:
~RGWRESTMgr_S3() override = default;
- RGWHandler_REST *get_handler(struct req_state* s,
+ RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override;
};
diff --git a/src/rgw/rgw_rest_sts.cc b/src/rgw/rgw_rest_sts.cc
index 7ef6455cd32..0e5c7b76d92 100644
--- a/src/rgw/rgw_rest_sts.cc
+++ b/src/rgw/rgw_rest_sts.cc
@@ -670,9 +670,10 @@ int RGWHandler_REST_STS::init_from_header(struct req_state* s,
}
RGWHandler_REST*
-RGWRESTMgr_STS::get_handler(struct req_state* const s,
- const rgw::auth::StrategyRegistry& auth_registry,
- const std::string& frontend_prefix)
+RGWRESTMgr_STS::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
+ const rgw::auth::StrategyRegistry& auth_registry,
+ const std::string& frontend_prefix)
{
return new RGWHandler_REST_STS(auth_registry);
}
diff --git a/src/rgw/rgw_rest_sts.h b/src/rgw/rgw_rest_sts.h
index d7227fe5af6..4845010d650 100644
--- a/src/rgw/rgw_rest_sts.h
+++ b/src/rgw/rgw_rest_sts.h
@@ -205,7 +205,8 @@ public:
return this;
}
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry&,
const std::string&) override;
};
diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc
index a06e2cd328a..e2c7a2e0d2e 100644
--- a/src/rgw/rgw_rest_swift.cc
+++ b/src/rgw/rgw_rest_swift.cc
@@ -212,7 +212,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_data(rgw::sal::RGWBucketList&
* in applying the filter earlier as we really need to go through all
* entries regardless of it (the headers like X-Account-Container-Count
* aren't affected by specifying prefix). */
- const std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ const auto& m = buckets.get_buckets();
for (auto iter = m.lower_bound(prefix);
iter != m.end() && boost::algorithm::starts_with(iter->first, prefix);
++iter) {
@@ -247,7 +247,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_data_reversed(rgw::sal::RGWBuc
* in applying the filter earlier as we really need to go through all
* entries regardless of it (the headers like X-Account-Container-Count
* aren't affected by specifying prefix). */
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ auto& m = buckets.get_buckets();
auto iter = m.rbegin();
for (/* initialized above */;
@@ -349,12 +349,12 @@ void RGWListBucket_ObjStore_SWIFT::send_response()
map<string, bool>::iterator pref_iter = common_prefixes.begin();
dump_start(s);
- dump_container_metadata(s, bucket, bucket_quota,
- s->bucket_info.website_conf);
+ dump_container_metadata(s, s->bucket.get(), bucket_quota,
+ s->bucket->get_info().website_conf);
s->formatter->open_array_section_with_attrs("container",
FormatterAttrs("name",
- s->bucket.name.c_str(),
+ s->bucket->get_name().c_str(),
NULL));
while (iter != objs.end() || pref_iter != common_prefixes.end()) {
@@ -454,13 +454,13 @@ static void dump_container_metadata(struct req_state *s,
const RGWBucketWebsiteConf& ws_conf)
{
/* Adding X-Timestamp to keep align with Swift API */
- dump_header(s, "X-Timestamp", utime_t(s->bucket_info.creation_time));
+ dump_header(s, "X-Timestamp", utime_t(s->bucket->get_info().creation_time));
dump_header(s, "X-Container-Object-Count", bucket->get_count());
dump_header(s, "X-Container-Bytes-Used", bucket->get_size());
dump_header(s, "X-Container-Bytes-Used-Actual", bucket->get_size_rounded());
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
auto swift_policy = \
static_cast<RGWAccessControlPolicy_SWIFT*>(s->bucket_acl.get());
std::string read_acl, write_acl;
@@ -472,10 +472,10 @@ static void dump_container_metadata(struct req_state *s,
if (write_acl.size()) {
dump_header(s, "X-Container-Write", write_acl);
}
- if (!s->bucket_info.placement_rule.name.empty()) {
- dump_header(s, "X-Storage-Policy", s->bucket_info.placement_rule.name);
+ if (!s->bucket->get_placement_rule().name.empty()) {
+ dump_header(s, "X-Storage-Policy", s->bucket->get_placement_rule().name);
}
- dump_header(s, "X-Storage-Class", s->bucket_info.placement_rule.get_storage_class());
+ dump_header(s, "X-Storage-Class", s->bucket->get_placement_rule().get_storage_class());
/* Dump user-defined metadata items and generic attrs. */
const size_t PREFIX_LEN = sizeof(RGW_ATTR_META_PREFIX) - 1;
@@ -497,9 +497,9 @@ static void dump_container_metadata(struct req_state *s,
}
/* Dump container versioning info. */
- if (! s->bucket_info.swift_ver_location.empty()) {
+ if (! s->bucket->get_info().swift_ver_location.empty()) {
dump_header(s, "X-Versions-Location",
- url_encode(s->bucket_info.swift_ver_location));
+ url_encode(s->bucket->get_info().swift_ver_location));
}
/* Dump quota headers. */
@@ -571,8 +571,8 @@ void RGWStatBucket_ObjStore_SWIFT::send_response()
{
if (op_ret >= 0) {
op_ret = STATUS_NO_CONTENT;
- dump_container_metadata(s, bucket, bucket_quota,
- s->bucket_info.website_conf);
+ dump_container_metadata(s, bucket.get(), bucket_quota,
+ s->bucket->get_info().website_conf);
}
set_req_state_err(s, op_ret);
@@ -845,7 +845,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
rgw_bucket bucket;
- if (bucket_name.compare(s->bucket.name) != 0) {
+ if (bucket_name.compare(s->bucket->get_name()) != 0) {
RGWBucketInfo bucket_info;
map<string, bufferlist> bucket_attrs;
r = store->getRados()->get_bucket_info(store->svc(), s->user->get_id().tenant,
@@ -858,7 +858,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
}
bucket = bucket_info.bucket;
} else {
- bucket = s->bucket;
+ bucket = s->bucket->get_bi();
}
/* fetch the stored size of the seg (or error if not valid) */
@@ -869,7 +869,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
RGWObjectCtx obj_ctx(store);
obj_ctx.set_atomic(slo_seg);
- RGWRados::Object op_target(store->getRados(), s->bucket_info, obj_ctx, slo_seg);
+ RGWRados::Object op_target(store->getRados(), s->bucket->get_info(), obj_ctx, slo_seg);
RGWRados::Object::Read read_op(&op_target);
bool compressed;
@@ -929,7 +929,7 @@ int RGWPutObj_ObjStore_SWIFT::get_params()
if (!s->generic_attrs.count(RGW_ATTR_CONTENT_TYPE)) {
ldpp_dout(this, 5) << "content type wasn't provided, trying to guess" << dendl;
- const char *suffix = strrchr(s->object.name.c_str(), '.');
+ const char *suffix = strrchr(s->object->get_name().c_str(), '.');
if (suffix) {
suffix++;
if (*suffix) {
@@ -1292,7 +1292,7 @@ void RGWDeleteObj_ObjStore_SWIFT::send_response()
} else {
RGWBulkDelete::acct_path_t path;
path.bucket_name = s->bucket_name;
- path.obj_key = s->object;
+ path.obj_key = s->object->get_key();
RGWBulkDelete::fail_desc_t fail_desc;
fail_desc.err = op_ret;
@@ -1389,10 +1389,10 @@ int RGWCopyObj_ObjStore_SWIFT::get_params()
src_tenant_name = s->src_tenant_name;
src_bucket_name = s->src_bucket_name;
- src_object = s->src_object;
+ src_object = s->src_object->clone();
dest_tenant_name = s->bucket_tenant;
dest_bucket_name = s->bucket_name;
- dest_object = s->object.name;
+ dest_obj_name = s->object->get_name();
const char * const fresh_meta = s->info.env->get("HTTP_X_FRESH_METADATA");
if (fresh_meta && strcasecmp(fresh_meta, "TRUE") == 0) {
@@ -1435,8 +1435,8 @@ void RGWCopyObj_ObjStore_SWIFT::send_partial_response(off_t ofs)
void RGWCopyObj_ObjStore_SWIFT::dump_copy_info()
{
/* Dump X-Copied-From. */
- dump_header(s, "X-Copied-From", url_encode(src_bucket.name) +
- "/" + url_encode(src_object.name));
+ dump_header(s, "X-Copied-From", url_encode(src_bucket->get_name()) +
+ "/" + url_encode(src_object->get_name()));
/* Dump X-Copied-From-Account. */
/* XXX tenant */
@@ -1979,8 +1979,8 @@ void RGWFormPost::init(rgw::sal::RGWRadosStore* const store,
req_state* const s,
RGWHandler* const dialect_handler)
{
- prefix = std::move(s->object.name);
- s->object = rgw_obj_key();
+ prefix = std::move(s->object->get_name());
+ s->object->set_key(rgw_obj_key());
return RGWPostObj_ObjStore::init(store, s, dialect_handler);
}
@@ -2371,7 +2371,11 @@ int RGWSwiftWebsiteHandler::serve_errordoc(const int http_ret,
}
} get_errpage_op(store, handler, s, http_ret);
- s->object = std::to_string(http_ret) + error_doc;
+ if (!rgw::sal::RGWBucket::empty(s->bucket.get())) {
+ s->object = s->bucket->get_object(rgw_obj_key(std::to_string(http_ret) + error_doc));
+ } else {
+ s->object = store->get_object(rgw_obj_key(std::to_string(http_ret) + error_doc));
+ }
RGWOp* newop = &get_errpage_op;
RGWRequest req(0);
@@ -2381,7 +2385,7 @@ int RGWSwiftWebsiteHandler::serve_errordoc(const int http_ret,
int RGWSwiftWebsiteHandler::error_handler(const int err_no,
std::string* const error_content)
{
- const auto& ws_conf = s->bucket_info.website_conf;
+ const auto& ws_conf = s->bucket->get_info().website_conf;
if (can_be_website_req() && ! ws_conf.error_doc.empty()) {
set_req_state_err(s, err_no);
@@ -2459,11 +2463,11 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_redirect_op()
RGWOp* RGWSwiftWebsiteHandler::get_ws_index_op()
{
/* Retarget to get obj on requested index file. */
- if (! s->object.empty()) {
- s->object = s->object.name +
- s->bucket_info.website_conf.get_index_doc();
+ if (! s->object->empty()) {
+ s->object->set_name(s->object->get_name() +
+ s->bucket->get_info().website_conf.get_index_doc());
} else {
- s->object = s->bucket_info.website_conf.get_index_doc();
+ s->object->set_name(s->bucket->get_info().website_conf.get_index_doc());
}
auto getop = new RGWGetObj_ObjStore_SWIFT;
@@ -2488,8 +2492,8 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_listing_op()
/* Generate the header now. */
set_req_state_err(s, op_ret);
dump_errno(s);
- dump_container_metadata(s, bucket, bucket_quota,
- s->bucket_info.website_conf);
+ dump_container_metadata(s, s->bucket.get(), bucket_quota,
+ s->bucket->get_info().website_conf);
end_header(s, this, "text/html");
if (op_ret < 0) {
return;
@@ -2501,7 +2505,7 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_listing_op()
std::stringstream ss;
RGWSwiftWebsiteListingFormatter htmler(ss, prefix);
- const auto& ws_conf = s->bucket_info.website_conf;
+ const auto& ws_conf = s->bucket->get_info().website_conf;
htmler.generate_header(s->decoded_uri,
ws_conf.listing_css_doc);
@@ -2533,15 +2537,15 @@ RGWOp* RGWSwiftWebsiteHandler::get_ws_listing_op()
}
};
- std::string prefix = std::move(s->object.name);
- s->object = rgw_obj_key();
+ std::string prefix = std::move(s->object->get_name());
+ s->object->set_key(rgw_obj_key());
return new RGWWebsiteListing(std::move(prefix));
}
bool RGWSwiftWebsiteHandler::is_web_dir() const
{
- std::string subdir_name = url_decode(s->object.name);
+ std::string subdir_name = url_decode(s->object->get_name());
/* Remove character from the subdir name if it is "/". */
if (subdir_name.empty()) {
@@ -2550,15 +2554,15 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
subdir_name.pop_back();
}
- rgw_obj obj(s->bucket, std::move(subdir_name));
+ rgw::sal::RGWRadosObject obj(store, rgw_obj_key(std::move(subdir_name)), s->bucket.get());
/* First, get attrset of the object we'll try to retrieve. */
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.set_atomic(obj);
- obj_ctx.set_prefetch_data(obj);
+ obj.set_atomic(&obj_ctx);
+ obj.set_prefetch_data(&obj_ctx);
RGWObjState* state = nullptr;
- if (store->getRados()->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
+ if (obj.get_obj_state(&obj_ctx, *s->bucket, &state, s->yield, false)) {
return false;
}
@@ -2572,7 +2576,7 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
std::string content_type;
get_contype_from_attrs(state->attrset, content_type);
- const auto& ws_conf = s->bucket_info.website_conf;
+ const auto& ws_conf = s->bucket->get_info().website_conf;
const std::string subdir_marker = ws_conf.subdir_marker.empty()
? "application/directory"
: ws_conf.subdir_marker;
@@ -2581,14 +2585,14 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const
bool RGWSwiftWebsiteHandler::is_index_present(const std::string& index) const
{
- rgw_obj obj(s->bucket, index);
+ rgw::sal::RGWRadosObject obj(store, rgw_obj_key(index), s->bucket.get());
RGWObjectCtx& obj_ctx = *static_cast<RGWObjectCtx *>(s->obj_ctx);
- obj_ctx.set_atomic(obj);
- obj_ctx.set_prefetch_data(obj);
+ obj.set_atomic(&obj_ctx);
+ obj.set_prefetch_data(&obj_ctx);
RGWObjState* state = nullptr;
- if (store->getRados()->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
+ if (obj.get_obj_state(&obj_ctx, *s->bucket, &state, s->yield, false)) {
return false;
}
@@ -2605,8 +2609,8 @@ int RGWSwiftWebsiteHandler::retarget_bucket(RGWOp* op, RGWOp** new_op)
/* In Swift static web content is served if the request is anonymous or
* has X-Web-Mode HTTP header specified to true. */
if (can_be_website_req()) {
- const auto& ws_conf = s->bucket_info.website_conf;
- const auto& index = s->bucket_info.website_conf.get_index_doc();
+ const auto& ws_conf = s->bucket->get_info().website_conf;
+ const auto& index = s->bucket->get_info().website_conf.get_index_doc();
if (s->decoded_uri.back() != '/') {
op_override = get_ws_redirect_op();
@@ -2639,8 +2643,8 @@ int RGWSwiftWebsiteHandler::retarget_object(RGWOp* op, RGWOp** new_op)
/* In Swift static web content is served if the request is anonymous or
* has X-Web-Mode HTTP header specified to true. */
if (can_be_website_req() && is_web_dir()) {
- const auto& ws_conf = s->bucket_info.website_conf;
- const auto& index = s->bucket_info.website_conf.get_index_doc();
+ const auto& ws_conf = s->bucket->get_info().website_conf;
+ const auto& index = s->bucket->get_info().website_conf.get_index_doc();
if (s->decoded_uri.back() != '/') {
op_override = get_ws_redirect_op();
@@ -2796,8 +2800,13 @@ int RGWHandler_REST_SWIFT::postauth_init()
s->bucket_tenant = s->user->get_tenant();
s->bucket_name = t->url_bucket;
+ if (!s->object) {
+ /* Need an object, even an empty one */
+ s->object = store->get_object(rgw_obj_key());
+ }
+
dout(10) << "s->object=" <<
- (!s->object.empty() ? s->object : rgw_obj_key("<NULL>"))
+ (!s->object->empty() ? s->object->get_key() : rgw_obj_key("<NULL>"))
<< " s->bucket="
<< rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name)
<< dendl;
@@ -2809,7 +2818,7 @@ int RGWHandler_REST_SWIFT::postauth_init()
ret = validate_bucket_name(s->bucket_name);
if (ret)
return ret;
- ret = validate_object_name(s->object.name);
+ ret = validate_object_name(s->object->get_name());
if (ret)
return ret;
@@ -2825,7 +2834,7 @@ int RGWHandler_REST_SWIFT::postauth_init()
if (ret < 0) {
return ret;
}
- ret = validate_object_name(s->src_object.name);
+ ret = validate_object_name(s->src_object->get_name());
if (ret < 0) {
return ret;
}
@@ -2890,7 +2899,8 @@ static void next_tok(string& str, string& tok, char delim)
}
}
-int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s,
+int RGWHandler_REST_SWIFT::init_from_header(rgw::sal::RGWRadosStore* store,
+ struct req_state* const s,
const std::string& frontend_prefix)
{
string req;
@@ -3007,9 +3017,9 @@ int RGWHandler_REST_SWIFT::init_from_header(struct req_state* const s,
s->init_state.url_bucket = first;
if (req.size()) {
- s->object =
- rgw_obj_key(req, s->info.env->get("HTTP_X_OBJECT_VERSION_ID", "")); /* rgw swift extension */
- s->info.effective_uri.append("/" + s->object.name);
+ s->object = store->get_object(
+ rgw_obj_key(req, s->info.env->get("HTTP_X_OBJECT_VERSION_ID", ""))); /* rgw swift extension */
+ s->info.effective_uri.append("/" + s->object->get_name());
}
return 0;
@@ -3024,10 +3034,13 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state
std::string copy_source = s->info.env->get("HTTP_X_COPY_FROM", "");
if (! copy_source.empty()) {
- bool result = RGWCopyObj::parse_copy_location(copy_source, t->src_bucket,
- s->src_object);
+ rgw_obj_key key;
+ bool result = RGWCopyObj::parse_copy_location(copy_source, t->src_bucket, key);
if (!result)
return -ERR_BAD_URL;
+ s->src_object = store->get_object(key);
+ if (!s->src_object)
+ return -ERR_BAD_URL;
}
if (s->op == OP_COPY) {
@@ -3043,13 +3056,13 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state
if (!result)
return -ERR_BAD_URL;
- std::string dest_object = dest_obj_key.name;
+ std::string dest_object_name = dest_obj_key.name;
/* convert COPY operation into PUT */
t->src_bucket = t->url_bucket;
- s->src_object = s->object;
+ s->src_object = s->object->clone();
t->url_bucket = dest_bucket_name;
- s->object = rgw_obj_key(dest_object);
+ s->object->set_name(dest_object_name);
s->op = OP_PUT;
}
@@ -3059,11 +3072,12 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state
}
RGWHandler_REST*
-RGWRESTMgr_SWIFT::get_handler(struct req_state* const s,
+RGWRESTMgr_SWIFT::get_handler(rgw::sal::RGWRadosStore* store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix)
{
- int ret = RGWHandler_REST_SWIFT::init_from_header(s, frontend_prefix);
+ int ret = RGWHandler_REST_SWIFT::init_from_header(store, s, frontend_prefix);
if (ret < 0) {
ldpp_dout(s, 10) << "init_from_header returned err=" << ret << dendl;
return nullptr;
@@ -3075,7 +3089,7 @@ RGWRESTMgr_SWIFT::get_handler(struct req_state* const s,
return new RGWHandler_REST_Service_SWIFT(auth_strategy);
}
- if (s->object.empty()) {
+ if (rgw::sal::RGWObject::empty(s->object.get())) {
return new RGWHandler_REST_Bucket_SWIFT(auth_strategy);
}
@@ -3083,6 +3097,7 @@ RGWRESTMgr_SWIFT::get_handler(struct req_state* const s,
}
RGWHandler_REST* RGWRESTMgr_SWIFT_Info::get_handler(
+ rgw::sal::RGWRadosStore* store,
struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix)
diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h
index cf8b224313f..1ed664d02a3 100644
--- a/src/rgw/rgw_rest_swift.h
+++ b/src/rgw/rgw_rest_swift.h
@@ -384,7 +384,7 @@ protected:
return false;
}
- static int init_from_header(struct req_state* s,
+ static int init_from_header(rgw::sal::RGWRadosStore* store, struct req_state* s,
const std::string& frontend_prefix);
public:
explicit RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
@@ -500,7 +500,8 @@ public:
RGWRESTMgr_SWIFT() = default;
~RGWRESTMgr_SWIFT() override = default;
- RGWHandler_REST *get_handler(struct req_state *s,
+ RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state *s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override;
};
@@ -571,7 +572,8 @@ public:
RGWRESTMgr_SWIFT_CrossDomain() = default;
~RGWRESTMgr_SWIFT_CrossDomain() override = default;
- RGWHandler_REST* get_handler(struct req_state* const s,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry&,
const std::string&) override {
s->prot_flags |= RGW_REST_SWIFT;
@@ -627,7 +629,8 @@ public:
RGWRESTMgr_SWIFT_HealthCheck() = default;
~RGWRESTMgr_SWIFT_HealthCheck() override = default;
- RGWHandler_REST* get_handler(struct req_state* const s,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry&,
const std::string&) override {
s->prot_flags |= RGW_REST_SWIFT;
@@ -673,7 +676,8 @@ public:
RGWRESTMgr_SWIFT_Info() = default;
~RGWRESTMgr_SWIFT_Info() override = default;
- RGWHandler_REST *get_handler(struct req_state* s,
+ RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override;
};
diff --git a/src/rgw/rgw_rest_usage.h b/src/rgw/rgw_rest_usage.h
index 6bffad69dd4..741ca87ca4a 100644
--- a/src/rgw/rgw_rest_usage.h
+++ b/src/rgw/rgw_rest_usage.h
@@ -25,7 +25,8 @@ public:
RGWRESTMgr_Usage() = default;
~RGWRESTMgr_Usage() override = default;
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore* store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override {
return new RGWHandler_Usage(auth_registry);
diff --git a/src/rgw/rgw_rest_user.h b/src/rgw/rgw_rest_user.h
index 06279759496..a8b86101e47 100644
--- a/src/rgw/rgw_rest_user.h
+++ b/src/rgw/rgw_rest_user.h
@@ -27,7 +27,8 @@ public:
RGWRESTMgr_User() = default;
~RGWRESTMgr_User() override = default;
- RGWHandler_REST *get_handler(struct req_state*,
+ RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string&) override {
return new RGWHandler_User(auth_registry);
diff --git a/src/rgw/rgw_sal.cc b/src/rgw/rgw_sal.cc
index 22cb33fa216..8b9d95edc28 100644
--- a/src/rgw/rgw_sal.cc
+++ b/src/rgw/rgw_sal.cc
@@ -19,11 +19,19 @@
#include <unistd.h>
#include <sstream>
+#include "common/Clock.h"
#include "common/errno.h"
#include "rgw_sal.h"
#include "rgw_bucket.h"
#include "rgw_multi.h"
+#include "rgw_acl_s3.h"
+
+/* Stuff for RGWRadosStore. Move to separate file when store split out */
+#include "rgw_zone.h"
+#include "rgw_rest_conn.h"
+#include "services/svc_sys_obj.h"
+#include "services/svc_zone.h"
#define dout_subsys ceph_subsys_rgw
@@ -36,6 +44,7 @@ int RGWRadosUser::list_buckets(const string& marker, const string& end_marker,
bool is_truncated = false;
int ret;
+ buckets.clear();
ret = store->ctl()->user->list_buckets(info.user_id, marker, end_marker, max,
need_stats, &ulist, &is_truncated);
if (ret < 0)
@@ -43,43 +52,36 @@ int RGWRadosUser::list_buckets(const string& marker, const string& end_marker,
buckets.set_truncated(is_truncated);
for (const auto& ent : ulist.get_buckets()) {
- RGWRadosBucket *rb = new RGWRadosBucket(this->store, *this, ent.second);
- buckets.add(rb);
+ buckets.add(std::unique_ptr<RGWBucket>(new RGWRadosBucket(this->store, ent.second, this)));
}
return 0;
}
-RGWBucketList::~RGWBucketList()
-{
- for (auto itr = buckets.begin(); itr != buckets.end(); itr++) {
- delete itr->second;
- }
- buckets.clear();
-}
-
-RGWBucket* RGWRadosUser::add_bucket(rgw_bucket& bucket,
+RGWBucket* RGWRadosUser::create_bucket(rgw_bucket& bucket,
ceph::real_time creation_time)
{
return NULL;
}
-int RGWRadosUser::get_by_id(rgw_user id, optional_yield y)
+int RGWRadosUser::load_by_id(optional_yield y)
{
- return store->ctl()->user->get_info_by_uid(id, &info, y);
+ return store->ctl()->user->get_info_by_uid(info.user_id, &info, y);
}
-RGWObject *RGWRadosBucket::create_object(const rgw_obj_key &key)
+std::unique_ptr<RGWObject> RGWRadosStore::get_object(const rgw_obj_key& k)
{
- if (!object) {
- object = new RGWRadosObject(store, key);
- }
+ return std::unique_ptr<RGWObject>(new RGWRadosObject(this, k));
+}
- return object;
+/* Placeholder */
+RGWObject *RGWRadosBucket::create_object(const rgw_obj_key &key)
+{
+ return nullptr;
}
-int RGWRadosBucket::remove_bucket(bool delete_children, optional_yield y)
+int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std::string delimiter, optional_yield y)
{
int ret;
map<RGWObjCategory, RGWStorageStats> stats;
@@ -111,22 +113,21 @@ int RGWRadosBucket::remove_bucket(bool delete_children, optional_yield y)
return ret;
if (!objs.empty() && !delete_children) {
- lderr(store->ctx()) << "ERROR: could not remove non-empty bucket " << ent.bucket.name << dendl;
+ lderr(store->ctx()) << "ERROR: could not remove non-empty bucket " << info.bucket.name <<
+ dendl;
return -ENOTEMPTY;
}
for (const auto& obj : objs) {
rgw_obj_key key(obj.key);
/* xxx dang */
- ret = rgw_remove_object(store, info, ent.bucket, key);
+ ret = rgw_remove_object(store, info, info.bucket, key);
if (ret < 0 && ret != -ENOENT) {
- return ret;
+ return ret;
}
}
} while(is_truncated);
- string prefix, delimiter;
-
ret = abort_bucket_multiparts(store, store->ctx(), info, prefix, delimiter);
if (ret < 0) {
return ret;
@@ -144,11 +145,11 @@ int RGWRadosBucket::remove_bucket(bool delete_children, optional_yield y)
ret = store->getRados()->delete_bucket(info, objv_tracker, null_yield, !delete_children);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: could not remove bucket " <<
- ent.bucket.name << dendl;
+ info.bucket.name << dendl;
return ret;
}
- ret = store->ctl()->bucket->unlink_bucket(info.owner, ent.bucket, null_yield, false);
+ ret = store->ctl()->bucket->unlink_bucket(info.owner, info.bucket, null_yield, false);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: unable to remove user bucket information" << dendl;
}
@@ -158,8 +159,34 @@ int RGWRadosBucket::remove_bucket(bool delete_children, optional_yield y)
int RGWRadosBucket::get_bucket_info(optional_yield y)
{
- return store->getRados()->get_bucket_info(store->svc(), ent.bucket.tenant, ent.bucket.name, info,
- NULL, y, &attrs);
+ auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
+ RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx);
+ RGWObjVersionTracker ep_ot;
+ int ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y,
+ RGWBucketCtl::BucketInstance::GetParams()
+ .set_mtime(&mtime)
+ .set_attrs(&attrs.attrs)
+ .set_bectx_params(bectx_params),
+ &ep_ot);
+ if (ret == 0) {
+ bucket_version = ep_ot.read_version;
+ ent.placement_rule = info.placement_rule;
+ }
+ return ret;
+}
+
+int RGWRadosBucket::load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y)
+{
+ info.bucket.tenant = tenant;
+ info.bucket.name = bucket_name;
+ info.bucket.bucket_id = bucket_instance_id;
+ ent.bucket = info.bucket;
+
+ if (bucket_instance_id.empty()) {
+ return get_bucket_info(y);
+ }
+
+ return store->getRados()->get_bucket_instance_info(*rctx, info.bucket, info, NULL, &attrs.attrs, y);
}
int RGWRadosBucket::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id,
@@ -172,12 +199,14 @@ int RGWRadosBucket::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id,
int RGWRadosBucket::read_bucket_stats(optional_yield y)
{
- return store->ctl()->bucket->read_bucket_stats(ent.bucket, &ent, y);
+ int ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y);
+ info.placement_rule = ent.placement_rule;
+ return ret;
}
int RGWRadosBucket::sync_user_stats()
{
- return store->ctl()->bucket->sync_user_stats(user.info.user_id, info, &ent);
+ return store->ctl()->bucket->sync_user_stats(owner->get_id(), info, &ent);
}
int RGWRadosBucket::update_container_stats(void)
@@ -185,34 +214,36 @@ int RGWRadosBucket::update_container_stats(void)
int ret;
map<std::string, RGWBucketEnt> m;
- m[ent.bucket.name] = ent;
+ m[info.bucket.name] = ent;
ret = store->getRados()->update_containers_stats(m);
if (!ret)
return -EEXIST;
if (ret < 0)
return ret;
- map<string, RGWBucketEnt>::iterator iter = m.find(ent.bucket.name);
+ map<string, RGWBucketEnt>::iterator iter = m.find(info.bucket.name);
if (iter == m.end())
return -EINVAL;
ent.count = iter->second.count;
ent.size = iter->second.size;
ent.size_rounded = iter->second.size_rounded;
+ ent.creation_time = iter->second.creation_time;
ent.placement_rule = std::move(iter->second.placement_rule);
+ info.placement_rule = ent.placement_rule;
return 0;
}
int RGWRadosBucket::check_bucket_shards(void)
{
- return store->getRados()->check_bucket_shards(info, ent.bucket, get_count());
+ return store->getRados()->check_bucket_shards(info, info.bucket, get_count());
}
int RGWRadosBucket::link(RGWUser* new_user, optional_yield y)
{
RGWBucketEntryPoint ep;
- ep.bucket = ent.bucket;
+ ep.bucket = info.bucket;
ep.owner = new_user->get_user();
ep.creation_time = get_creation_time();
ep.linked = true;
@@ -236,13 +267,29 @@ int RGWRadosBucket::chown(RGWUser* new_user, RGWUser* old_user, optional_yield y
old_user->get_display_name(), obj_marker, y);
}
-bool RGWRadosBucket::is_owner(RGWUser* user)
+int RGWRadosBucket::put_instance_info(bool exclusive, ceph::real_time _mtime)
{
- get_bucket_info(null_yield);
+ mtime = _mtime;
+ return store->getRados()->put_bucket_instance_info(info, exclusive, mtime, &attrs.attrs);
+}
+/* Make sure to call get_bucket_info() if you need it first */
+bool RGWRadosBucket::is_owner(RGWUser* user)
+{
return (info.owner.compare(user->get_user()) == 0);
}
+int RGWRadosBucket::check_empty(optional_yield y)
+{
+ return store->getRados()->check_bucket_empty(info, y);
+}
+
+int RGWRadosBucket::check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size)
+{
+ return store->getRados()->check_quota(owner->get_user(), get_bi(),
+ user_quota, bucket_quota, obj_size);
+}
+
int RGWRadosBucket::set_acl(RGWAccessControlPolicy &acl, optional_yield y)
{
bufferlist aclbl;
@@ -250,12 +297,17 @@ int RGWRadosBucket::set_acl(RGWAccessControlPolicy &acl, optional_yield y)
acls = acl;
acl.encode(aclbl);
- return store->ctl()->bucket->set_acl(acl.get_owner(), ent.bucket, info, aclbl, null_yield);
+ return store->ctl()->bucket->set_acl(acl.get_owner(), info.bucket, info, aclbl, null_yield);
}
-RGWUser *RGWRadosStore::get_user(const rgw_user &u)
+std::unique_ptr<RGWObject> RGWRadosBucket::get_object(const rgw_obj_key& k)
{
- return new RGWRadosUser(this, u);
+ return std::unique_ptr<RGWObject>(new RGWRadosObject(this->store, k, this));
+}
+
+std::unique_ptr<RGWUser> RGWRadosStore::get_user(const rgw_user &u)
+{
+ return std::unique_ptr<RGWUser>(new RGWRadosUser(this, u));
}
//RGWBucket *RGWRadosStore::create_bucket(RGWUser &u, const rgw_bucket &b)
@@ -267,32 +319,322 @@ RGWUser *RGWRadosStore::get_user(const rgw_user &u)
//return bucket;
//}
//
-void RGWRadosStore::finalize(void) {
+void RGWRadosStore::finalize(void)
+{
if (rados)
rados->finalize();
}
-int RGWRadosStore::get_bucket(RGWUser& u, const rgw_bucket& b, RGWBucket** bucket)
+int RGWRadosObject::get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh)
{
- int ret;
- RGWBucket* bp;
+ rgw_obj obj(bucket.get_bi(), key.name);
+
+ return store->getRados()->get_obj_state(rctx, bucket.get_info(), obj, state, follow_olh, y);
+}
+
+int RGWRadosObject::read_attrs(RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj)
+{
+ read_op.params.attrs = &attrs.attrs;
+ read_op.params.target_obj = target_obj;
+ read_op.params.obj_size = &obj_size;
+ read_op.params.lastmod = &mtime;
+
+ return read_op.prepare(y);
+}
+
+int RGWRadosObject::get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj *target_obj)
+{
+ RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rctx, get_obj());
+ RGWRados::Object::Read read_op(&op_target);
- *bucket = nullptr;
+ return read_attrs(read_op, y, target_obj);
+}
- bp = new RGWRadosBucket(this, u, b);
- if (!bp) {
- return -ENOMEM;
+int RGWRadosObject::modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y)
+{
+ rgw_obj target_obj;
+ int r = get_obj_attrs(rctx, y, &target_obj);
+ if (r < 0) {
+ return r;
}
+ set_atomic(rctx);
+ attrs.attrs[attr_name] = attr_val;
+ return store->getRados()->set_attrs(rctx, bucket->get_info(), target_obj, attrs.attrs, NULL, y);
+}
+
+int RGWRadosObject::copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket,
+ RGWObject* dest_obj,
+ uint16_t olh_epoch,
+ std::string* petag,
+ const DoutPrefixProvider *dpp,
+ optional_yield y)
+{
+ map<string, bufferlist> attrset;
+ RGWRados::Object op_target(store->getRados(), dest_bucket->get_info(), rctx, get_obj());
+ RGWRados::Object::Read read_op(&op_target);
+
+ int ret = read_attrs(read_op, y);
+ if (ret < 0)
+ return ret;
+
+ attrset = attrs.attrs;
+
+ attrset.erase(RGW_ATTR_ID_TAG);
+ attrset.erase(RGW_ATTR_TAIL_TAG);
+
+ return store->getRados()->copy_obj_data(rctx, dest_bucket,
+ dest_bucket->get_info().placement_rule, read_op,
+ obj_size - 1, dest_obj, NULL, mtime, attrset, 0, real_time(), NULL,
+ dpp, y);
+}
+
+int RGWRadosObject::delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y)
+{
+ map <string, bufferlist> attrs;
+ map <string, bufferlist> rmattr;
+ bufferlist bl;
+
+ set_atomic(rctx);
+ rmattr[attr_name] = bl;
+ rgw_obj obj = get_obj();
+ return store->getRados()->set_attrs(rctx, bucket->get_info(), obj, attrs, &rmattr, y);
+}
+
+void RGWRadosObject::set_atomic(RGWObjectCtx *rctx) const
+{
+ rgw_obj obj = get_obj();
+ store->getRados()->set_atomic(rctx, obj);
+}
+
+void RGWRadosObject::set_prefetch_data(RGWObjectCtx *rctx)
+{
+ rgw_obj obj = get_obj();
+ store->getRados()->set_prefetch_data(rctx, obj);
+}
+
+void RGWRadosObject::gen_rand_obj_instance_name()
+{
+ store->getRados()->gen_rand_obj_instance_name(&key);
+}
+
+int RGWRadosStore::get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket)
+{
+ int ret;
+ RGWBucket* bp;
+
+ bp = new RGWRadosBucket(this, b, u);
ret = bp->get_bucket_info(null_yield);
if (ret < 0) {
delete bp;
return ret;
}
- *bucket = bp;
+ bucket->reset(bp);
+ return 0;
+}
+
+int RGWRadosStore::get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket)
+{
+ RGWBucket* bp;
+
+ bp = new RGWRadosBucket(this, i, u);
+ /* Don't need to fetch the bucket info, use the provided one */
+
+ bucket->reset(bp);
+ return 0;
+}
+
+int RGWRadosStore::get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* bucket)
+{
+ rgw_bucket b;
+
+ b.tenant = tenant;
+ b.name = name;
+
+ return get_bucket(u, b, bucket);
+}
+
+static int decode_policy(CephContext *cct,
+ bufferlist& bl,
+ RGWAccessControlPolicy *policy)
+{
+ auto iter = bl.cbegin();
+ try {
+ policy->decode(iter);
+ } catch (buffer::error& err) {
+ ldout(cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
+ return -EIO;
+ }
+ if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 15>()) {
+ ldout(cct, 15) << __func__ << " Read AccessControlPolicy";
+ RGWAccessControlPolicy_S3 *s3policy = static_cast<RGWAccessControlPolicy_S3 *>(policy);
+ s3policy->to_xml(*_dout);
+ *_dout << dendl;
+ }
+ return 0;
+}
+
+static int rgw_op_get_bucket_policy_from_attr(RGWRadosStore *store,
+ RGWUser& user,
+ map<string, bufferlist>& bucket_attrs,
+ RGWAccessControlPolicy *policy)
+{
+ map<string, bufferlist>::iterator aiter = bucket_attrs.find(RGW_ATTR_ACL);
+
+ if (aiter != bucket_attrs.end()) {
+ int ret = decode_policy(store->ctx(), aiter->second, policy);
+ if (ret < 0)
+ return ret;
+ } else {
+ ldout(store->ctx(), 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl;
+ /* object exists, but policy is broken */
+ int r = user.load_by_id(null_yield);
+ if (r < 0)
+ return r;
+
+ policy->create_default(user.get_user(), user.get_display_name());
+ }
+ return 0;
+}
+
+int RGWRadosStore::forward_request_to_master(RGWUser* user, obj_version *objv,
+ bufferlist& in_data,
+ JSONParser *jp, req_info& info)
+{
+ if (!svc()->zone->get_master_conn()) {
+ ldout(ctx(), 0) << "rest connection is invalid" << dendl;
+ return -EINVAL;
+ }
+ ldout(ctx(), 0) << "sending request to master zonegroup" << dendl;
+ bufferlist response;
+ string uid_str = user->get_id().to_str();
+#define MAX_REST_RESPONSE (128 * 1024) // we expect a very small response
+ int ret = svc()->zone->get_master_conn()->forward(rgw_user(uid_str), info,
+ objv, MAX_REST_RESPONSE,
+ &in_data, &response);
+ if (ret < 0)
+ return ret;
+
+ ldout(ctx(), 20) << "response: " << response.c_str() << dendl;
+ if (jp && !jp->parse(response.c_str(), response.length())) {
+ ldout(ctx(), 0) << "failed parsing response from master zonegroup" << dendl;
+ return -EINVAL;
+ }
+
return 0;
}
+
+int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b,
+ const string& zonegroup_id,
+ const rgw_placement_rule& placement_rule,
+ const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
+ map<std::string, bufferlist>& attrs,
+ RGWBucketInfo& info,
+ obj_version& ep_objv,
+ bool exclusive,
+ bool obj_lock_enabled,
+ bool *existed,
+ req_info& req_info,
+ std::unique_ptr<RGWBucket>* bucket_out)
+{
+ int ret;
+ bufferlist in_data;
+ RGWBucketInfo master_info;
+ rgw_bucket *pmaster_bucket;
+ uint32_t *pmaster_num_shards;
+ real_time creation_time;
+ RGWAccessControlPolicy old_policy(ctx());
+ std::unique_ptr<RGWBucket> bucket;
+ obj_version objv, *pobjv = NULL;
+
+ /* If it exists, look it up; otherwise create it */
+ ret = get_bucket(&u, b, &bucket);
+ if (ret < 0 && ret != -ENOENT)
+ return ret;
+
+ if (ret != -ENOENT) {
+ *existed = true;
+ int r = rgw_op_get_bucket_policy_from_attr(this, u, bucket->get_attrs().attrs,
+ &old_policy);
+ if (r >= 0) {
+ if (old_policy.get_owner().get_id().compare(u.get_id()) != 0) {
+ bucket_out->swap(bucket);
+ ret = -EEXIST;
+ return ret;
+ }
+ }
+ } else {
+ bucket = std::unique_ptr<RGWBucket>(new RGWRadosBucket(this, b, &u));
+ *existed = false;
+ bucket->set_attrs(attrs);
+ }
+
+ if (!svc()->zone->is_meta_master()) {
+ JSONParser jp;
+ ret = forward_request_to_master(&u, NULL, in_data, &jp, req_info);
+ if (ret < 0) {
+ return ret;
+ }
+
+ JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp);
+ JSONDecoder::decode_json("object_ver", objv, &jp);
+ JSONDecoder::decode_json("bucket_info", master_info, &jp);
+ ldpp_dout(this, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl;
+ std::time_t ctime = ceph::real_clock::to_time_t(master_info.creation_time);
+ ldpp_dout(this, 20) << "got creation time: << " << std::put_time(std::localtime(&ctime), "%F %T") << dendl;
+ pmaster_bucket= &master_info.bucket;
+ creation_time = master_info.creation_time;
+ pmaster_num_shards = &master_info.layout.current_index.layout.normal.num_shards;
+ pobjv = &objv;
+ if (master_info.obj_lock_enabled()) {
+ info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
+ }
+ } else {
+ pmaster_bucket = NULL;
+ pmaster_num_shards = NULL;
+ if (obj_lock_enabled)
+ info.flags = BUCKET_VERSIONED | BUCKET_OBJ_LOCK_ENABLED;
+ }
+
+ std::string zid = zonegroup_id;
+ if (zid.empty()) {
+ zid = svc()->zone->get_zonegroup().get_id();
+ }
+
+ if (*existed) {
+ rgw_placement_rule selected_placement_rule;
+ ret = svc()->zone->select_bucket_placement(u.get_info(),
+ zid, placement_rule,
+ &selected_placement_rule, nullptr);
+ if (selected_placement_rule != info.placement_rule) {
+ ret = -EEXIST;
+ bucket_out->swap(bucket);
+ return ret;
+ }
+ } else {
+
+ ret = getRados()->create_bucket(u.get_info(), bucket->get_bi(),
+ zid, placement_rule, swift_ver_location,
+ pquota_info, attrs,
+ info, pobjv, &ep_objv, creation_time,
+ pmaster_bucket, pmaster_num_shards, exclusive);
+ if (ret == -EEXIST) {
+ *existed = true;
+ } else if (ret != 0) {
+ return ret;
+ }
+ }
+
+ bucket->set_version(ep_objv);
+ bucket->get_info() = info;
+
+ bucket_out->swap(bucket);
+
+ return ret;
+}
+
} // namespace rgw::sal
rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache)
diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h
index 542844d0392..7b27b3c3d46 100644
--- a/src/rgw/rgw_sal.h
+++ b/src/rgw/rgw_sal.h
@@ -27,16 +27,44 @@ class RGWBucket;
class RGWObject;
class RGWBucketList;
-typedef std::map<std::string, ceph::bufferlist> RGWAttrs;
+struct RGWAttrs {
+ std::map<std::string, ceph::buffer::list> attrs;
-class RGWStore {
+ RGWAttrs() {}
+ RGWAttrs(const std::map<std::string, ceph::buffer::list>&& _a) : attrs(std::move(_a)) {}
+ RGWAttrs(const std::map<std::string, ceph::buffer::list>& _a) : attrs(_a) {}
+
+ void emplace(std::string&& key, buffer::list&& bl) {
+ attrs.emplace(std::move(key), std::move(bl)); /* key and bl are r-value refs */
+ }
+ std::map<std::string, bufferlist>::iterator find(const std::string& key) {
+ return attrs.find(key);
+ }
+};
+
+class RGWStore : public DoutPrefixProvider {
public:
RGWStore() {}
virtual ~RGWStore() = default;
- virtual RGWUser* get_user(const rgw_user& u) = 0;
- virtual int get_bucket(RGWUser& u, const rgw_bucket& b, RGWBucket** bucket) = 0;
- //virtual RGWBucket* create_bucket(RGWUser& u, const rgw_bucket& b) = 0;
+ virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u) = 0;
+ virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) = 0;
+ virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket) = 0;
+ virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) = 0;
+ virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* bucket) = 0;
+ virtual int create_bucket(RGWUser& u, const rgw_bucket& b,
+ const string& zonegroup_id,
+ const rgw_placement_rule& placement_rule,
+ const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
+ map<std::string, bufferlist>& attrs,
+ RGWBucketInfo& info,
+ obj_version& ep_objv,
+ bool exclusive,
+ bool obj_lock_enabled,
+ bool *existed,
+ req_info& req_info,
+ std::unique_ptr<RGWBucket>* bucket) = 0;
virtual RGWBucketList* list_buckets(void) = 0;
virtual void finalize(void)=0;
@@ -56,7 +84,7 @@ class RGWUser {
virtual int list_buckets(const string& marker, const string& end_marker,
uint64_t max, bool need_stats, RGWBucketList& buckets) = 0;
- virtual RGWBucket* add_bucket(rgw_bucket& bucket, ceph::real_time creation_time) = 0;
+ virtual RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time) = 0;
friend class RGWBucket;
virtual std::string& get_display_name() { return info.display_name; }
@@ -66,8 +94,10 @@ class RGWUser {
int32_t get_max_buckets() const { return info.max_buckets; }
const RGWUserCaps& get_caps() const { return info.caps; }
+ /* Placeholders */
+ virtual int load_by_id(optional_yield y) = 0;
- /* xxx dang temporary; will be removed when User is complete */
+ /* dang temporary; will be removed when User is complete */
rgw_user& get_user() { return info.user_id; }
RGWUserInfo& get_info() { return info; }
};
@@ -76,21 +106,34 @@ class RGWBucket {
protected:
RGWBucketEnt ent;
RGWBucketInfo info;
- RGWUser *owner;
+ RGWUser* owner;
RGWAttrs attrs;
+ obj_version bucket_version;
+ ceph::real_time mtime;
public:
- RGWBucket() : ent(), owner(nullptr), attrs() {}
- RGWBucket(const rgw_bucket& _b) : ent(), attrs() { ent.bucket = _b; }
- RGWBucket(const RGWBucketEnt& _e) : ent(_e), attrs() {}
+ RGWBucket() : ent(), info(), owner(nullptr), attrs(), bucket_version() {}
+ RGWBucket(const rgw_bucket& _b) :
+ ent(), info(), owner(nullptr), attrs(), bucket_version() { ent.bucket = _b; info.bucket = _b; }
+ RGWBucket(const RGWBucketEnt& _e) :
+ ent(_e), info(), owner(nullptr), attrs(), bucket_version() { info.bucket = ent.bucket; info.placement_rule = ent.placement_rule; }
+ RGWBucket(const RGWBucketInfo& _i) :
+ ent(), info(_i), owner(nullptr), attrs(), bucket_version() {ent.bucket = info.bucket; ent.placement_rule = info.placement_rule; }
+ RGWBucket(const rgw_bucket& _b, RGWUser* _u) :
+ ent(), info(), owner(_u), attrs(), bucket_version() { ent.bucket = _b; info.bucket = _b; }
+ RGWBucket(const RGWBucketEnt& _e, RGWUser* _u) :
+ ent(_e), info(), owner(_u), attrs(), bucket_version() { info.bucket = ent.bucket; info.placement_rule = ent.placement_rule; }
+ RGWBucket(const RGWBucketInfo& _i, RGWUser* _u) :
+ ent(), info(_i), owner(_u), attrs(), bucket_version() { ent.bucket = info.bucket; ent.placement_rule = info.placement_rule;}
virtual ~RGWBucket() = default;
- virtual RGWObject* get_object(const rgw_obj_key& key) = 0;
+ virtual int load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) = 0;
+ virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& key) = 0;
virtual RGWBucketList* list(void) = 0;
virtual RGWObject* create_object(const rgw_obj_key& key /* Attributes */) = 0;
virtual RGWAttrs& get_attrs(void) { return attrs; }
- virtual int set_attrs(RGWAttrs& a) { attrs = a; return 0; }
- virtual int remove_bucket(bool delete_children, optional_yield y) = 0;
+ virtual int set_attrs(RGWAttrs a) { attrs = a; return 0; }
+ virtual int remove_bucket(bool delete_children, std::string prefix, std::string delimiter, optional_yield y) = 0;
virtual RGWAccessControlPolicy& get_acl(void) = 0;
virtual int set_acl(RGWAccessControlPolicy& acl, optional_yield y) = 0;
virtual int get_bucket_info(optional_yield y) = 0;
@@ -106,64 +149,110 @@ class RGWBucket {
virtual int link(RGWUser* new_user, optional_yield y) = 0;
virtual int unlink(RGWUser* new_user, optional_yield y) = 0;
virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y) = 0;
- virtual bool is_owner(RGWUser *user) = 0;
-
- const std::string& get_name() const { return ent.bucket.name; }
- const std::string& get_tenant() const { return ent.bucket.tenant; }
- const std::string& get_marker() const { return ent.bucket.marker; }
- const std::string& get_bucket_id() const { return ent.bucket.bucket_id; }
+ virtual int put_instance_info(bool exclusive, ceph::real_time mtime) = 0;
+ virtual bool is_owner(RGWUser* user) = 0;
+ virtual int check_empty(optional_yield y) = 0;
+ virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size) = 0;
+
+ bool empty() const { return info.bucket.name.empty(); }
+ const std::string& get_name() const { return info.bucket.name; }
+ const std::string& get_tenant() const { return info.bucket.tenant; }
+ const std::string& get_marker() const { return info.bucket.marker; }
+ const std::string& get_bucket_id() const { return info.bucket.bucket_id; }
size_t get_size() const { return ent.size; }
size_t get_size_rounded() const { return ent.size_rounded; }
uint64_t get_count() const { return ent.count; }
- rgw_placement_rule get_placement_rule() const { return ent.placement_rule; }
- ceph::real_time& get_creation_time() { return ent.creation_time; };
+ rgw_placement_rule& get_placement_rule() { return info.placement_rule; }
+ ceph::real_time& get_creation_time() { return ent.creation_time; }
+ ceph::real_time& get_modification_time() { return mtime; }
+ obj_version& get_version() { return bucket_version; }
+ void set_version(obj_version &ver) { bucket_version = ver; }
+ std::string get_key() { return info.bucket.get_key(); }
+ bool versioned() { return info.versioned(); }
+ bool versioning_enabled() { return info.versioning_enabled(); }
void convert(cls_user_bucket_entry *b) const {
ent.convert(b);
}
+ static bool empty(RGWBucket* b) { return (!b || b->empty()); }
+ virtual std::unique_ptr<RGWBucket> clone() = 0;
+
/* dang - This is temporary, until the API is completed */
- rgw_bucket& get_bi() { return ent.bucket; }
+ rgw_bucket& get_bi() { return info.bucket; }
RGWBucketInfo& get_info() { return info; }
friend inline ostream& operator<<(ostream& out, const RGWBucket& b) {
- out << b.ent.bucket;
+ out << b.info.bucket;
+ return out;
+ }
+
+ friend inline ostream& operator<<(ostream& out, const RGWBucket* b) {
+ if (!b)
+ out << "<NULL>";
+ else
+ out << b->info.bucket;
+ return out;
+ }
+
+ friend inline ostream& operator<<(ostream& out, const std::unique_ptr<RGWBucket>& p) {
+ out << p.get();
return out;
}
friend class RGWBucketList;
protected:
- virtual void set_ent(RGWBucketEnt& _ent) { ent = _ent; }
+ virtual void set_ent(RGWBucketEnt& _ent) { ent = _ent; info.bucket = ent.bucket; info.placement_rule = ent.placement_rule; }
};
+
class RGWBucketList {
- std::map<std::string, RGWBucket*> buckets;
+ std::map<std::string, std::unique_ptr<RGWBucket>> buckets;
bool truncated;
public:
RGWBucketList() : buckets(), truncated(false) {}
- RGWBucketList(RGWBucketList&&) = default;
- RGWBucketList& operator=(const RGWBucketList&) = default;
- ~RGWBucketList();
+ RGWBucketList(RGWBucketList&& _bl) :
+ buckets(std::move(_bl.buckets)),
+ truncated(_bl.truncated)
+ { }
+ RGWBucketList& operator=(const RGWBucketList&) = delete;
+ RGWBucketList& operator=(RGWBucketList&& _bl) {
+ for (auto& ent : _bl.buckets) {
+ buckets.emplace(ent.first, std::move(ent.second));
+ }
+ truncated = _bl.truncated;
+ return *this;
+ };
- map<string, RGWBucket*>& get_buckets() { return buckets; }
+ map<string, std::unique_ptr<RGWBucket>>& get_buckets() { return buckets; }
bool is_truncated(void) const { return truncated; }
void set_truncated(bool trunc) { truncated = trunc; }
- void add(RGWBucket* bucket) {
- buckets[bucket->ent.bucket.name] = bucket;
+ void add(std::unique_ptr<RGWBucket> bucket) {
+ buckets.emplace(bucket->info.bucket.name, std::move(bucket));
}
size_t count() const { return buckets.size(); }
- void clear() { buckets.clear(); truncated = false; }
-}; // class RGWBucketList
+ void clear(void) {
+ buckets.clear();
+ truncated = false;
+ }
+};
class RGWObject {
protected:
rgw_obj_key key;
+ RGWBucket* bucket;
+ std::string index_hash_source;
+ uint64_t obj_size;
+ ceph::real_time mtime;
public:
- RGWObject() : key() {}
- RGWObject(const rgw_obj_key& _k) : key(_k) {}
+ RGWObject() : key(), bucket(nullptr), index_hash_source(), obj_size(), mtime() {}
+ RGWObject(const rgw_obj_key& _k) : key(_k), bucket(), index_hash_source(), obj_size(), mtime() {}
+ RGWObject(const rgw_obj_key& _k, RGWBucket* _b) : key(_k), bucket(_b), index_hash_source(), obj_size(), mtime() {}
+ RGWObject(const RGWObject& _o) = default;
+
virtual ~RGWObject() = default;
virtual int read(off_t offset, off_t length, std::iostream& stream) = 0;
@@ -173,6 +262,57 @@ class RGWObject {
virtual int delete_object(void) = 0;
virtual RGWAccessControlPolicy& get_acl(void) = 0;
virtual int set_acl(const RGWAccessControlPolicy& acl) = 0;
+ virtual void set_atomic(RGWObjectCtx *rctx) const = 0;
+ virtual void set_prefetch_data(RGWObjectCtx *rctx) = 0;
+
+ bool empty() const { return key.empty(); }
+ const std::string &get_name() const { return key.name; }
+
+ virtual int get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = false) = 0;
+ virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj *target_obj = nullptr) = 0;
+ virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y) = 0;
+ virtual int delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y) = 0;
+ virtual int copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, RGWObject* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider *dpp, optional_yield y) = 0;
+
+ ceph::real_time get_mtime(void) const { return mtime; }
+ uint64_t get_obj_size(void) const { return obj_size; }
+ RGWBucket* get_bucket(void) const { return bucket; }
+ void set_bucket(RGWBucket* b) { bucket = b; }
+ std::string get_hash_source(void) { return index_hash_source; }
+ void set_hash_source(std::string s) { index_hash_source = s; }
+ std::string get_oid(void) const { return key.get_oid(); }
+
+ static bool empty(RGWObject* o) { return (!o || o->empty()); }
+ virtual std::unique_ptr<RGWObject> clone() = 0;
+
+ /* dang - Not sure if we want this, but it simplifies things a lot */
+ void set_obj_size(uint64_t s) { obj_size = s; }
+ virtual void set_name(const string& n) { key = n; }
+ virtual void set_key(const rgw_obj_key& k) { key = k; }
+ virtual rgw_obj get_obj(void) const { return rgw_obj(bucket->get_bi(), key); }
+ virtual void gen_rand_obj_instance_name() = 0;
+
+ /* dang - This is temporary, until the API is completed */
+ rgw_obj_key& get_key() { return key; }
+ void set_instance(const std::string &i) { key.set_instance(i); }
+ const std::string &get_instance() const { return key.instance; }
+ bool have_instance(void) { return key.have_instance(); }
+
+ friend inline ostream& operator<<(ostream& out, const RGWObject& o) {
+ out << o.key;
+ return out;
+ }
+ friend inline ostream& operator<<(ostream& out, const RGWObject* o) {
+ if (!o)
+ out << "<NULL>";
+ else
+ out << o->key;
+ return out;
+ }
+ friend inline ostream& operator<<(ostream& out, const std::unique_ptr<RGWObject>& p) {
+ out << p.get();
+ return out;
+ }
};
@@ -190,10 +330,10 @@ class RGWRadosUser : public RGWUser {
int list_buckets(const string& marker, const string& end_marker,
uint64_t max, bool need_stats, RGWBucketList& buckets);
- RGWBucket* add_bucket(rgw_bucket& bucket, ceph::real_time creation_time);
+ RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time);
/* Placeholders */
- int get_by_id(rgw_user id, optional_yield y);
+ virtual int load_by_id(optional_yield y);
friend class RGWRadosBucket;
};
@@ -206,7 +346,8 @@ class RGWRadosObject : public RGWObject {
public:
RGWRadosObject()
- : attrs(),
+ : store(),
+ attrs(),
acls() {
}
@@ -216,6 +357,13 @@ class RGWRadosObject : public RGWObject {
attrs(),
acls() {
}
+ RGWRadosObject(RGWRadosStore *_st, const rgw_obj_key& _k, RGWBucket* _b)
+ : RGWObject(_k, _b),
+ store(_st),
+ attrs(),
+ acls() {
+ }
+ RGWRadosObject(const RGWRadosObject& _o) = default;
int read(off_t offset, off_t length, std::iostream& stream) { return length; }
int write(off_t offset, off_t length, std::iostream& stream) { return length; }
@@ -224,45 +372,77 @@ class RGWRadosObject : public RGWObject {
int delete_object(void) { return 0; }
RGWAccessControlPolicy& get_acl(void) { return acls; }
int set_acl(const RGWAccessControlPolicy& acl) { acls = acl; return 0; }
+ virtual void set_atomic(RGWObjectCtx *rctx) const;
+ virtual void set_prefetch_data(RGWObjectCtx *rctx);
+
+ virtual int get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = true);
+ virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj *target_obj = nullptr);
+ virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y);
+ virtual int delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y);
+ virtual int copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, RGWObject* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider *dpp, optional_yield y);
+ virtual void gen_rand_obj_instance_name() override;
+ virtual std::unique_ptr<RGWObject> clone() {
+ return std::unique_ptr<RGWObject>(new RGWRadosObject(*this));
+ }
+
+ private:
+ int read_attrs(RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj = nullptr);
};
class RGWRadosBucket : public RGWBucket {
private:
RGWRadosStore *store;
- RGWRadosObject *object;
RGWAccessControlPolicy acls;
- RGWRadosUser user;
public:
- RGWRadosBucket()
- : store(nullptr),
- object(nullptr),
- acls(),
- user() {
+ RGWRadosBucket(RGWRadosStore *_st)
+ : store(_st),
+ acls() {
}
- RGWRadosBucket(RGWRadosStore *_st, RGWUser& _u, const rgw_bucket& _b)
+ RGWRadosBucket(RGWRadosStore *_st, const rgw_bucket& _b)
: RGWBucket(_b),
store(_st),
- object(nullptr),
- acls(),
- user(dynamic_cast<RGWRadosUser&>(_u)) {
+ acls() {
}
- RGWRadosBucket(RGWRadosStore *_st, RGWUser& _u, const RGWBucketEnt& _e)
+ RGWRadosBucket(RGWRadosStore *_st, const RGWBucketEnt& _e)
: RGWBucket(_e),
store(_st),
- object(nullptr),
- acls(),
- user(dynamic_cast<RGWRadosUser&>(_u)) {
+ acls() {
+ }
+
+ RGWRadosBucket(RGWRadosStore *_st, const RGWBucketInfo& _i)
+ : RGWBucket(_i),
+ store(_st),
+ acls() {
+ }
+
+ RGWRadosBucket(RGWRadosStore *_st, const rgw_bucket& _b, RGWUser* _u)
+ : RGWBucket(_b, _u),
+ store(_st),
+ acls() {
+ }
+
+ RGWRadosBucket(RGWRadosStore *_st, const RGWBucketEnt& _e, RGWUser* _u)
+ : RGWBucket(_e, _u),
+ store(_st),
+ acls() {
+ }
+
+ RGWRadosBucket(RGWRadosStore *_st, const RGWBucketInfo& _i, RGWUser* _u)
+ : RGWBucket(_i, _u),
+ store(_st),
+ acls() {
}
~RGWRadosBucket() { }
- RGWObject* get_object(const rgw_obj_key& key) { return object; }
+ virtual int load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) override;
+ virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) override;
RGWBucketList* list(void) { return new RGWBucketList(); }
RGWObject* create_object(const rgw_obj_key& key /* Attributes */) override;
- virtual int remove_bucket(bool delete_children, optional_yield y) override;
+ virtual int remove_bucket(bool delete_children, std::string prefix, std::string delimiter, optional_yield y) override;
RGWAccessControlPolicy& get_acl(void) { return acls; }
virtual int set_acl(RGWAccessControlPolicy& acl, optional_yield y) override;
virtual int get_bucket_info(optional_yield y) override;
@@ -278,7 +458,15 @@ class RGWRadosBucket : public RGWBucket {
virtual int link(RGWUser* new_user, optional_yield y) override;
virtual int unlink(RGWUser* new_user, optional_yield y) override;
virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y) override;
- virtual bool is_owner(RGWUser *user) override;
+ virtual int put_instance_info(bool exclusive, ceph::real_time mtime) override;
+ virtual bool is_owner(RGWUser* user) override;
+ virtual int check_empty(optional_yield y) override;
+ virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size) override;
+ virtual std::unique_ptr<RGWBucket> clone() {
+ return std::unique_ptr<RGWBucket>(new RGWRadosBucket(*this));
+ }
+
+ friend class RGWRadosStore;
};
class RGWRadosStore : public RGWStore {
@@ -294,9 +482,24 @@ class RGWRadosStore : public RGWStore {
delete rados;
}
- virtual RGWUser* get_user(const rgw_user& u);
- virtual int get_bucket(RGWUser& u, const rgw_bucket& b, RGWBucket** bucket) override;
- //virtual RGWBucket* create_bucket(RGWUser& u, const rgw_bucket& b);
+ virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u);
+ virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) override;
+ virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket) override;
+ virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) override;
+ virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* bucket) override;
+ virtual int create_bucket(RGWUser& u, const rgw_bucket& b,
+ const string& zonegroup_id,
+ const rgw_placement_rule& placement_rule,
+ const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
+ map<std::string, bufferlist>& attrs,
+ RGWBucketInfo& info,
+ obj_version& ep_objv,
+ bool exclusive,
+ bool obj_lock_enabled,
+ bool *existed,
+ req_info& req_info,
+ std::unique_ptr<RGWBucket>* bucket);
virtual RGWBucketList* list_buckets(void) { return new RGWBucketList(); }
void setRados(RGWRados * st) { rados = st; }
@@ -310,6 +513,16 @@ class RGWRadosStore : public RGWStore {
void finalize(void) override;
virtual CephContext *ctx(void) { return rados->ctx(); }
+
+ // implements DoutPrefixProvider
+ std::ostream& gen_prefix(std::ostream& out) const { return out << "RGWRadosStore "; }
+ CephContext* get_cct() const override { return rados->ctx(); }
+ unsigned get_subsys() const override { return ceph_subsys_rgw; }
+
+ private:
+ int forward_request_to_master(RGWUser* user, obj_version *objv,
+ bufferlist& in_data, JSONParser *jp, req_info& info);
+
};
} } // namespace rgw::sal
diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc
index 44bb3efd9e3..242d24294ef 100644
--- a/src/rgw/rgw_swift_auth.cc
+++ b/src/rgw/rgw_swift_auth.cc
@@ -48,7 +48,7 @@ void TempURLApplier::modify_request_state(const DoutPrefixProvider* dpp, req_sta
s->content_disp.override = "attachment; filename=\"" + fenc + "\"";
} else {
std::string fenc;
- url_encode(s->object.name, fenc);
+ url_encode(s->object->get_name(), fenc);
s->content_disp.fallback = "attachment; filename=\"" + fenc + "\"";
}
@@ -74,7 +74,7 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat
const string& bucket_name = s->init_state.url_bucket;
/* TempURL requires that bucket and object names are specified. */
- if (bucket_name.empty() || s->object.empty()) {
+ if (bucket_name.empty() || s->object->empty()) {
throw -EPERM;
}
@@ -351,7 +351,7 @@ TempURLEngine::authenticate(const DoutPrefixProvider* dpp, const req_state* cons
/* Need to try each combination of keys, allowed path and methods. */
PrefixableSignatureHelper sig_helper {
s->decoded_uri,
- s->object.name,
+ s->object->get_name(),
temp_url_prefix
};
diff --git a/src/rgw/rgw_swift_auth.h b/src/rgw/rgw_swift_auth.h
index 8cefbf1a488..fda9d6c9833 100644
--- a/src/rgw/rgw_swift_auth.h
+++ b/src/rgw/rgw_swift_auth.h
@@ -337,7 +337,8 @@ public:
return this;
}
- RGWHandler_REST* get_handler(struct req_state*,
+ RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state*,
const rgw::auth::StrategyRegistry&,
const std::string&) override {
return new RGWHandler_SWIFT_Auth;
diff --git a/src/rgw/rgw_sync_module_aws.cc b/src/rgw/rgw_sync_module_aws.cc
index 845fb74a48f..c837070c7e8 100644
--- a/src/rgw/rgw_sync_module_aws.cc
+++ b/src/rgw/rgw_sync_module_aws.cc
@@ -35,9 +35,9 @@ static string get_key_oid(const rgw_obj_key& key)
return oid;
}
-static string obj_to_aws_path(const rgw_obj& obj)
+static string obj_to_aws_path(rgw::sal::RGWObject* obj)
{
- string path = obj.bucket.name + "/" + get_key_oid(obj.key);
+ string path = obj->get_bucket()->get_name() + "/" + get_key_oid(obj->get_key());
return path;
@@ -717,7 +717,7 @@ class RGWRESTStreamGetCRF : public RGWStreamReadHTTPResourceCRF
{
RGWDataSyncCtx *sc;
RGWRESTConn *conn;
- rgw_obj src_obj;
+ rgw::sal::RGWObject* src_obj;
RGWRESTConn::get_obj_params req_params;
rgw_sync_aws_src_obj_properties src_properties;
@@ -727,9 +727,9 @@ public:
RGWCoroutine *_caller,
RGWDataSyncCtx *_sc,
RGWRESTConn *_conn,
- rgw_obj& _src_obj,
+ rgw::sal::RGWObject* _src_obj,
const rgw_sync_aws_src_obj_properties& _src_properties) : RGWStreamReadHTTPResourceCRF(_cct, _env, _caller,
- _sc->env->http_manager, _src_obj.key),
+ _sc->env->http_manager, _src_obj->get_key()),
sc(_sc), conn(_conn), src_obj(_src_obj),
src_properties(_src_properties) {
}
@@ -796,7 +796,7 @@ class RGWAWSStreamPutCRF : public RGWStreamWriteHTTPResourceCRF
RGWDataSyncCtx *sc;
rgw_sync_aws_src_obj_properties src_properties;
std::shared_ptr<AWSSyncConfig_Profile> target;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* dest_obj;
string etag;
public:
RGWAWSStreamPutCRF(CephContext *_cct,
@@ -805,7 +805,7 @@ public:
RGWDataSyncCtx *_sc,
const rgw_sync_aws_src_obj_properties& _src_properties,
std::shared_ptr<AWSSyncConfig_Profile>& _target,
- rgw_obj& _dest_obj) : RGWStreamWriteHTTPResourceCRF(_cct, _env, _caller, _sc->env->http_manager),
+ rgw::sal::RGWObject* _dest_obj) : RGWStreamWriteHTTPResourceCRF(_cct, _env, _caller, _sc->env->http_manager),
sc(_sc), src_properties(_src_properties), target(_target), dest_obj(_dest_obj) {
}
@@ -993,8 +993,8 @@ class RGWAWSStreamObjToCloudPlainCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *source_conn;
std::shared_ptr<AWSSyncConfig_Profile> target;
- rgw_obj src_obj;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* src_obj;
+ rgw::sal::RGWObject* dest_obj;
rgw_sync_aws_src_obj_properties src_properties;
@@ -1004,10 +1004,10 @@ class RGWAWSStreamObjToCloudPlainCR : public RGWCoroutine {
public:
RGWAWSStreamObjToCloudPlainCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_source_conn,
- const rgw_obj& _src_obj,
+ rgw::sal::RGWObject* _src_obj,
const rgw_sync_aws_src_obj_properties& _src_properties,
std::shared_ptr<AWSSyncConfig_Profile> _target,
- const rgw_obj& _dest_obj) : RGWCoroutine(_sc->cct),
+ rgw::sal::RGWObject* _dest_obj) : RGWCoroutine(_sc->cct),
sc(_sc),
source_conn(_source_conn),
target(_target),
@@ -1042,8 +1042,8 @@ class RGWAWSStreamObjToCloudMultipartPartCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *source_conn;
std::shared_ptr<AWSSyncConfig_Profile> target;
- rgw_obj src_obj;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* src_obj;
+ rgw::sal::RGWObject* dest_obj;
rgw_sync_aws_src_obj_properties src_properties;
@@ -1059,9 +1059,9 @@ class RGWAWSStreamObjToCloudMultipartPartCR : public RGWCoroutine {
public:
RGWAWSStreamObjToCloudMultipartPartCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_source_conn,
- const rgw_obj& _src_obj,
+ rgw::sal::RGWObject* _src_obj,
std::shared_ptr<AWSSyncConfig_Profile>& _target,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
const rgw_sync_aws_src_obj_properties& _src_properties,
const string& _upload_id,
const rgw_sync_aws_multipart_part_info& _part_info,
@@ -1111,14 +1111,14 @@ public:
class RGWAWSAbortMultipartCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *dest_conn;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* dest_obj;
string upload_id;
public:
RGWAWSAbortMultipartCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_dest_conn,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
const string& _upload_id) : RGWCoroutine(_sc->cct),
sc(_sc),
dest_conn(_dest_conn),
@@ -1150,7 +1150,7 @@ public:
class RGWAWSInitMultipartCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *dest_conn;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* dest_obj;
uint64_t obj_size;
map<string, string> attrs;
@@ -1174,7 +1174,7 @@ class RGWAWSInitMultipartCR : public RGWCoroutine {
public:
RGWAWSInitMultipartCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_dest_conn,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
uint64_t _obj_size,
const map<string, string>& _attrs,
string *_upload_id) : RGWCoroutine(_sc->cct),
@@ -1240,7 +1240,7 @@ public:
class RGWAWSCompleteMultipartCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *dest_conn;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* dest_obj;
bufferlist out_bl;
@@ -1278,7 +1278,7 @@ class RGWAWSCompleteMultipartCR : public RGWCoroutine {
public:
RGWAWSCompleteMultipartCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_dest_conn,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
string _upload_id,
const map<int, rgw_sync_aws_multipart_part_info>& _parts) : RGWCoroutine(_sc->cct),
sc(_sc),
@@ -1350,7 +1350,7 @@ public:
class RGWAWSStreamAbortMultipartUploadCR : public RGWCoroutine {
RGWDataSyncCtx *sc;
RGWRESTConn *dest_conn;
- const rgw_obj dest_obj;
+ rgw::sal::RGWObject* dest_obj;
const rgw_raw_obj status_obj;
string upload_id;
@@ -1359,7 +1359,7 @@ public:
RGWAWSStreamAbortMultipartUploadCR(RGWDataSyncCtx *_sc,
RGWRESTConn *_dest_conn,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
const rgw_raw_obj& _status_obj,
const string& _upload_id) : RGWCoroutine(_sc->cct), sc(_sc),
dest_conn(_dest_conn),
@@ -1392,8 +1392,8 @@ class RGWAWSStreamObjToCloudMultipartCR : public RGWCoroutine {
AWSSyncConfig& conf;
RGWRESTConn *source_conn;
std::shared_ptr<AWSSyncConfig_Profile> target;
- rgw_obj src_obj;
- rgw_obj dest_obj;
+ rgw::sal::RGWObject* src_obj;
+ rgw::sal::RGWObject* dest_obj;
uint64_t obj_size;
string src_etag;
@@ -1415,9 +1415,9 @@ public:
rgw_bucket_sync_pipe& _sync_pipe,
AWSSyncConfig& _conf,
RGWRESTConn *_source_conn,
- const rgw_obj& _src_obj,
+ rgw::sal::RGWObject* _src_obj,
std::shared_ptr<AWSSyncConfig_Profile>& _target,
- const rgw_obj& _dest_obj,
+ rgw::sal::RGWObject* _dest_obj,
uint64_t _obj_size,
const rgw_sync_aws_src_obj_properties& _src_properties,
const rgw_rest_obj& _rest_obj) : RGWCoroutine(_sc->cct),
@@ -1658,13 +1658,15 @@ public:
}
yield {
- rgw_obj src_obj(src_bucket, key);
+ rgw::sal::RGWRadosBucket bucket(sync_env->store, src_bucket);
+ rgw::sal::RGWRadosObject src_obj(sync_env->store, key, &bucket);
/* init output */
rgw_bucket target_bucket;
target_bucket.name = target_bucket_name; /* this is only possible because we only use bucket name for
uri resolution */
- rgw_obj dest_obj(target_bucket, target_obj_name);
+ rgw::sal::RGWRadosBucket dest_bucket(sync_env->store, target_bucket);
+ rgw::sal::RGWRadosObject dest_obj(sync_env->store, rgw_obj_key(target_obj_name), &dest_bucket);
rgw_sync_aws_src_obj_properties src_properties;
@@ -1675,10 +1677,10 @@ public:
src_properties.versioned_epoch = versioned_epoch;
if (size < instance.conf.s3.multipart_sync_threshold) {
- call(new RGWAWSStreamObjToCloudPlainCR(sc, source_conn, src_obj,
+ call(new RGWAWSStreamObjToCloudPlainCR(sc, source_conn, &src_obj,
src_properties,
target,
- dest_obj));
+ &dest_obj));
} else {
rgw_rest_obj rest_obj;
rest_obj.init(key);
@@ -1686,8 +1688,8 @@ public:
ldout(sc->cct, 0) << "ERROR: failed to decode rest obj out of headers=" << headers << ", attrs=" << attrs << dendl;
return set_cr_error(-EINVAL);
}
- call(new RGWAWSStreamObjToCloudMultipartCR(sc, sync_pipe, instance.conf, source_conn, src_obj,
- target, dest_obj, size, src_properties, rest_obj));
+ call(new RGWAWSStreamObjToCloudMultipartCR(sc, sync_pipe, instance.conf, source_conn, &src_obj,
+ target, &dest_obj, size, src_properties, rest_obj));
}
}
if (retcode < 0) {
diff --git a/src/rgw/rgw_sync_module_es_rest.cc b/src/rgw/rgw_sync_module_es_rest.cc
index 1abeaeb83d5..675e89196ab 100644
--- a/src/rgw/rgw_sync_module_es_rest.cc
+++ b/src/rgw/rgw_sync_module_es_rest.cc
@@ -208,7 +208,7 @@ void RGWMetadataSearchOp::execute()
es_query.set_restricted_fields(&restricted_fields);
map<string, ESEntityTypeMap::EntityType> custom_map;
- for (auto& i : s->bucket_info.mdsearch_config) {
+ for (auto& i : s->bucket->get_info().mdsearch_config) {
custom_map[i.first] = (ESEntityTypeMap::EntityType)i.second;
}
@@ -399,18 +399,19 @@ public:
};
-RGWHandler_REST* RGWRESTMgr_MDSearch_S3::get_handler(struct req_state* const s,
+RGWHandler_REST* RGWRESTMgr_MDSearch_S3::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix)
{
int ret =
- RGWHandler_REST_S3::init_from_header(s,
+ RGWHandler_REST_S3::init_from_header(store, s,
RGW_FORMAT_XML, true);
if (ret < 0) {
return nullptr;
}
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return nullptr;
}
diff --git a/src/rgw/rgw_sync_module_es_rest.h b/src/rgw/rgw_sync_module_es_rest.h
index 676cbba64e5..6e4a459499d 100644
--- a/src/rgw/rgw_sync_module_es_rest.h
+++ b/src/rgw/rgw_sync_module_es_rest.h
@@ -11,7 +11,8 @@ class RGWRESTMgr_MDSearch_S3 : public RGWRESTMgr {
public:
explicit RGWRESTMgr_MDSearch_S3() {}
- RGWHandler_REST *get_handler(struct req_state* s,
+ RGWHandler_REST *get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override;
};
diff --git a/src/rgw/rgw_sync_module_pubsub_rest.cc b/src/rgw/rgw_sync_module_pubsub_rest.cc
index 9a77ea78627..f2fff54cf76 100644
--- a/src/rgw/rgw_sync_module_pubsub_rest.cc
+++ b/src/rgw/rgw_sync_module_pubsub_rest.cc
@@ -23,7 +23,7 @@ class RGWPSCreateTopic_ObjStore : public RGWPSCreateTopicOp {
public:
int get_params() override {
- topic_name = s->object.name;
+ topic_name = s->object->get_name();
opaque_data = s->info.args.get("OpaqueData");
dest.push_endpoint = s->info.args.get("push-endpoint");
@@ -87,7 +87,7 @@ public:
class RGWPSGetTopic_ObjStore : public RGWPSGetTopicOp {
public:
int get_params() override {
- topic_name = s->object.name;
+ topic_name = s->object->get_name();
return 0;
}
@@ -111,7 +111,7 @@ public:
class RGWPSDeleteTopic_ObjStore : public RGWPSDeleteTopicOp {
public:
int get_params() override {
- topic_name = s->object.name;
+ topic_name = s->object->get_name();
return 0;
}
};
@@ -135,19 +135,19 @@ protected:
if (s->init_state.url_bucket.empty()) {
return nullptr;
}
- if (s->object.empty()) {
+ if (s->object->empty()) {
return new RGWPSListTopics_ObjStore();
}
return new RGWPSGetTopic_ObjStore();
}
RGWOp *op_put() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSCreateTopic_ObjStore();
}
return nullptr;
}
RGWOp *op_delete() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSDeleteTopic_ObjStore();
}
return nullptr;
@@ -161,7 +161,7 @@ public:
class RGWPSCreateSub_ObjStore : public RGWPSCreateSubOp {
public:
int get_params() override {
- sub_name = s->object.name;
+ sub_name = s->object->get_name();
bool exists;
topic_name = s->info.args.get("topic", &exists);
@@ -190,7 +190,7 @@ public:
class RGWPSGetSub_ObjStore : public RGWPSGetSubOp {
public:
int get_params() override {
- sub_name = s->object.name;
+ sub_name = s->object->get_name();
return 0;
}
void send_response() override {
@@ -213,7 +213,7 @@ public:
class RGWPSDeleteSub_ObjStore : public RGWPSDeleteSubOp {
public:
int get_params() override {
- sub_name = s->object.name;
+ sub_name = s->object->get_name();
topic_name = s->info.args.get("topic");
return 0;
}
@@ -225,7 +225,7 @@ public:
explicit RGWPSAckSubEvent_ObjStore() {}
int get_params() override {
- sub_name = s->object.name;
+ sub_name = s->object->get_name();
bool exists;
@@ -242,7 +242,7 @@ public:
class RGWPSPullSubEvents_ObjStore : public RGWPSPullSubEventsOp {
public:
int get_params() override {
- sub_name = s->object.name;
+ sub_name = s->object->get_name();
marker = s->info.args.get("marker");
const int ret = s->info.args.get_int("max-entries", &max_entries,
RGWUserPubSub::Sub::DEFAULT_MAX_EVENTS);
@@ -283,7 +283,7 @@ protected:
return false;
}
RGWOp *op_get() override {
- if (s->object.empty()) {
+ if (s->object->empty()) {
return nullptr;
}
if (s->info.args.exists("events")) {
@@ -292,13 +292,13 @@ protected:
return new RGWPSGetSub_ObjStore();
}
RGWOp *op_put() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSCreateSub_ObjStore();
}
return nullptr;
}
RGWOp *op_delete() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSDeleteSub_ObjStore();
}
return nullptr;
@@ -363,7 +363,7 @@ private:
ldout(s->cct, 1) << "invalid event type in list: " << events_str << dendl;
return -EINVAL;
}
- return notif_bucket_path(s->object.name, bucket_name);
+ return notif_bucket_path(s->object->get_name(), bucket_name);
}
public:
@@ -396,7 +396,7 @@ private:
ldout(s->cct, 1) << "missing required param 'topic'" << dendl;
return -EINVAL;
}
- return notif_bucket_path(s->object.name, bucket_name);
+ return notif_bucket_path(s->object->get_name(), bucket_name);
}
public:
@@ -426,7 +426,7 @@ private:
rgw_pubsub_bucket_topics result;
int get_params() override {
- return notif_bucket_path(s->object.name, bucket_name);
+ return notif_bucket_path(s->object->get_name(), bucket_name);
}
public:
@@ -472,19 +472,19 @@ protected:
return false;
}
RGWOp *op_get() override {
- if (s->object.empty()) {
+ if (s->object->empty()) {
return nullptr;
}
return new RGWPSListNotifs_ObjStore();
}
RGWOp *op_put() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSCreateNotif_ObjStore();
}
return nullptr;
}
RGWOp *op_delete() override {
- if (!s->object.empty()) {
+ if (!s->object->empty()) {
return new RGWPSDeleteNotif_ObjStore();
}
return nullptr;
@@ -495,11 +495,12 @@ public:
};
// factory for ceph specific PubSub REST handlers
-RGWHandler_REST* RGWRESTMgr_PubSub::get_handler(struct req_state* const s,
- const rgw::auth::StrategyRegistry& auth_registry,
- const std::string& frontend_prefix)
+RGWHandler_REST* RGWRESTMgr_PubSub::get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* const s,
+ const rgw::auth::StrategyRegistry& auth_registry,
+ const std::string& frontend_prefix)
{
- if (RGWHandler_REST_S3::init_from_header(s, RGW_FORMAT_JSON, true) < 0) {
+ if (RGWHandler_REST_S3::init_from_header(store, s, RGW_FORMAT_JSON, true) < 0) {
return nullptr;
}
diff --git a/src/rgw/rgw_sync_module_pubsub_rest.h b/src/rgw/rgw_sync_module_pubsub_rest.h
index 4990dbbedd0..c558ecd0c81 100644
--- a/src/rgw/rgw_sync_module_pubsub_rest.h
+++ b/src/rgw/rgw_sync_module_pubsub_rest.h
@@ -7,7 +7,8 @@
class RGWRESTMgr_PubSub : public RGWRESTMgr {
public:
- virtual RGWHandler_REST* get_handler(struct req_state* s,
+ virtual RGWHandler_REST* get_handler(rgw::sal::RGWRadosStore *store,
+ struct req_state* s,
const rgw::auth::StrategyRegistry& auth_registry,
const std::string& frontend_prefix) override;
};
diff --git a/src/rgw/rgw_tools.cc b/src/rgw/rgw_tools.cc
index af5e05cca64..716a1086c81 100644
--- a/src/rgw/rgw_tools.cc
+++ b/src/rgw/rgw_tools.cc
@@ -500,15 +500,17 @@ int RGWDataAccess::Object::put(bufferlist& data,
rgw::BlockingAioThrottle aio(store->ctx()->_conf->rgw_put_obj_min_window_size);
RGWObjectCtx obj_ctx(store);
- rgw_obj obj(bucket_info.bucket, key);
+ std::unique_ptr<rgw::sal::RGWBucket> b;
+ store->get_bucket(NULL, bucket_info, &b);
+ std::unique_ptr<rgw::sal::RGWObject> obj = b->get_object(key);
auto& owner = bucket->policy.get_owner();
string req_id = store->svc()->zone_utils->unique_id(store->getRados()->get_new_req_id());
using namespace rgw::putobj;
- AtomicObjectProcessor processor(&aio, store, bucket_info, nullptr,
- owner.get_id(), obj_ctx, obj, olh_epoch,
+ AtomicObjectProcessor processor(&aio, store, b.get(), nullptr,
+ owner.get_id(), obj_ctx, obj->get_obj(), olh_epoch,
req_id, dpp, y);
int ret = processor.prepare(y);
diff --git a/src/rgw/rgw_torrent.cc b/src/rgw/rgw_torrent.cc
index b4501aad1fe..a9f65226779 100644
--- a/src/rgw/rgw_torrent.cc
+++ b/src/rgw/rgw_torrent.cc
@@ -248,10 +248,10 @@ int seed::save_torrent_file()
{
int op_ret = 0;
string key = RGW_OBJ_TORRENT;
- rgw_obj obj(s->bucket, s->object.name);
+ rgw_obj obj(s->bucket->get_bi(), s->object->get_name());
rgw_raw_obj raw_obj;
- store->getRados()->obj_to_raw(s->bucket_info.placement_rule, obj, &raw_obj);
+ store->getRados()->obj_to_raw(s->bucket->get_info().placement_rule, obj, &raw_obj);
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(raw_obj);
diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc
index 887bdac6b37..d6a7aa74b98 100644
--- a/src/rgw/rgw_user.cc
+++ b/src/rgw/rgw_user.cc
@@ -64,13 +64,11 @@ int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user
ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl;
return ret;
}
- map<string, rgw::sal::RGWBucket*>& buckets = user_buckets.get_buckets();
- for (map<string, rgw::sal::RGWBucket*>::iterator i = buckets.begin();
- i != buckets.end();
- ++i) {
+ auto& buckets = user_buckets.get_buckets();
+ for (auto i = buckets.begin(); i != buckets.end(); ++i) {
marker = i->first;
- rgw::sal::RGWBucket* bucket = i->second;
+ auto& bucket = i->second;
ret = bucket->get_bucket_info(null_yield);
if (ret < 0) {
@@ -114,11 +112,11 @@ int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, const rgw_use
ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl;
return ret;
}
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ auto& m = buckets.get_buckets();
for (const auto& i : m) {
marker = i.first;
- rgw::sal::RGWBucket* bucket_ent = i.second;
+ auto& bucket_ent = i.second;
ret = bucket_ent->read_bucket_stats(null_yield);
if (ret < 0) {
ldout(cct, 0) << "ERROR: could not get bucket stats: ret=" << ret << dendl;
@@ -1644,11 +1642,10 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg)
return ret;
}
- map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
- std::map<std::string, rgw::sal::RGWBucket*>::iterator it;
+ auto& m = buckets.get_buckets();
- for (it = m.begin(); it != m.end(); ++it) {
- rgw::sal::RGWBucket* bucket = it->second;
+ for (auto it = m.begin(); it != m.end(); ++it) {
+ auto& bucket = it->second;
marker = it->first;
ret = bucket->get_bucket_info(null_yield);
@@ -1884,15 +1881,15 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg,
return ret;
}
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
+ auto& m = buckets.get_buckets();
if (!m.empty() && !purge_data) {
set_err_msg(err_msg, "must specify purge data to remove user with buckets");
return -EEXIST; // change to code that maps to 409: conflict
}
- std::map<std::string, rgw::sal::RGWBucket*>::iterator it;
- for (it = m.begin(); it != m.end(); ++it) {
- ret = it->second->remove_bucket(true, y);
+ std::string prefix, delimiter;
+ for (auto it = m.begin(); it != m.end(); ++it) {
+ ret = it->second->remove_bucket(true, prefix, delimiter, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to delete user data");
return ret;
@@ -2039,13 +2036,12 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg)
return ret;
}
- std::map<std::string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
- std::map<std::string, rgw::sal::RGWBucket*>::iterator iter;
+ auto& m = buckets.get_buckets();
vector<rgw_bucket> bucket_names;
- for (iter = m.begin(); iter != m.end(); ++iter) {
- rgw::sal::RGWBucket* obj = iter->second;
- bucket_names.push_back(obj->get_bi());
+ for (auto iter = m.begin(); iter != m.end(); ++iter) {
+ auto& bucket = iter->second;
+ bucket_names.push_back(bucket->get_bi());
marker = iter->first;
}
diff --git a/src/script/ptl-tool.py b/src/script/ptl-tool.py
index a171cf57543..16799667151 100755
--- a/src/script/ptl-tool.py
+++ b/src/script/ptl-tool.py
@@ -162,6 +162,58 @@ with codecs.open(git_dir + "/.githubmap", encoding='utf-8') as f:
BZ_MATCH = re.compile("(.*https?://bugzilla.redhat.com/.*)")
TRACKER_MATCH = re.compile("(.*https?://tracker.ceph.com/.*)")
+def get_credits(pr, pr_req):
+ comments = requests.get("https://api.github.com/repos/{project}/{repo}/issues/{pr}/comments".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
+ if comments.status_code != 200:
+ log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
+ sys.exit(1)
+
+ reviews = requests.get("https://api.github.com/repos/{project}/{repo}/pulls/{pr}/reviews".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
+ if reviews.status_code != 200:
+ log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
+ sys.exit(1)
+
+ review_comments = requests.get("https://api.github.com/repos/{project}/{repo}/pulls/{pr}/comments".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
+ if review_comments.status_code != 200:
+ log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
+ sys.exit(1)
+
+ credits = set()
+ for comment in [pr_req.json()]+comments.json()+reviews.json()+review_comments.json():
+ body = comment["body"]
+ if body:
+ url = comment["html_url"]
+ for m in BZ_MATCH.finditer(body):
+ log.info("[ {url} ] BZ cited: {cite}".format(url=url, cite=m.group(1)))
+ for m in TRACKER_MATCH.finditer(body):
+ log.info("[ {url} ] Ceph tracker cited: {cite}".format(url=url, cite=m.group(1)))
+ for indication in INDICATIONS:
+ for cap in indication.findall(comment["body"]):
+ credits.add(cap)
+
+ new_new_contributors = {}
+ for review in reviews.json():
+ if review["state"] == "APPROVED":
+ user = review["user"]["login"]
+ try:
+ credits.add("Reviewed-by: "+CONTRIBUTORS[user])
+ except KeyError as e:
+ try:
+ credits.add("Reviewed-by: "+NEW_CONTRIBUTORS[user])
+ except KeyError as e:
+ try:
+ name = input("Need name for contributor \"%s\" (use ^D to skip); Reviewed-by: " % user)
+ name = name.strip()
+ if len(name) == 0:
+ continue
+ NEW_CONTRIBUTORS[user] = name
+ new_new_contributors[user] = name
+ credits.add("Reviewed-by: "+name)
+ except EOFError as e:
+ continue
+
+ return "\n".join(credits), new_new_contributors
+
def build_branch(args):
base = args.base
branch = datetime.datetime.utcnow().strftime(args.branch).format(user=USER)
@@ -251,67 +303,20 @@ def build_branch(args):
log.info("[ {sha1} ] Ceph tracker cited: {cite}".format(sha1=short, cite=m.group(1)))
message = message + "\n"
-
- comments = requests.get("https://api.github.com/repos/{project}/{repo}/issues/{pr}/comments".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
- if comments.status_code != 200:
- log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
- sys.exit(1)
-
- reviews = requests.get("https://api.github.com/repos/{project}/{repo}/pulls/{pr}/reviews".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
- if reviews.status_code != 200:
- log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
- sys.exit(1)
-
- review_comments = requests.get("https://api.github.com/repos/{project}/{repo}/pulls/{pr}/comments".format(pr=pr, project=BASE_PROJECT, repo=BASE_REPO), auth=(USER, PASSWORD))
- if review_comments.status_code != 200:
- log.error("PR '{pr}' not found: {c}".format(pr=pr,c=comments))
- sys.exit(1)
-
- indications = set()
- for comment in [pr_req.json()]+comments.json()+reviews.json()+review_comments.json():
- body = comment["body"]
- if body:
- url = comment["html_url"]
- for m in BZ_MATCH.finditer(body):
- log.info("[ {url} ] BZ cited: {cite}".format(url=url, cite=m.group(1)))
- for m in TRACKER_MATCH.finditer(body):
- log.info("[ {url} ] Ceph tracker cited: {cite}".format(url=url, cite=m.group(1)))
- for indication in INDICATIONS:
- for cap in indication.findall(comment["body"]):
- indications.add(cap)
-
- new_new_contributors = {}
- for review in reviews.json():
- if review["state"] == "APPROVED":
- user = review["user"]["login"]
- try:
- indications.add("Reviewed-by: "+CONTRIBUTORS[user])
- except KeyError as e:
- try:
- indications.add("Reviewed-by: "+NEW_CONTRIBUTORS[user])
- except KeyError as e:
- try:
- name = input("Need name for contributor \"%s\" (use ^D to skip); Reviewed-by: " % user)
- name = name.strip()
- if len(name) == 0:
- continue
- NEW_CONTRIBUTORS[user] = name
- new_new_contributors[user] = name
- indications.add("Reviewed-by: "+name)
- except EOFError as e:
- continue
-
- for indication in indications:
- message = message + indication + "\n"
+ if args.credits:
+ (addendum, new_contributors) = get_credits(pr, pr_req)
+ message += addendum
+ else:
+ new_contributors = []
G.git.merge(tip.hexsha, '--no-ff', m=message)
- if new_new_contributors:
+ if new_contributors:
# Check out the PR, add a commit adding to .githubmap
log.info("adding new contributors to githubmap in merge commit")
with open(git_dir + "/.githubmap", "a") as f:
- for c in new_new_contributors:
- f.write("%s %s\n" % (c, new_new_contributors[c]))
+ for c in new_contributors:
+ f.write("%s %s\n" % (c, new_contributors[c]))
G.index.add([".githubmap"])
G.git.commit("--amend", "--no-edit")
@@ -360,6 +365,7 @@ def main():
parser.add_argument('--git-dir', dest='git', action='store', default=git_dir, help='git directory')
parser.add_argument('--label', dest='label', action='store', default=default_label, help='label PRs for testing')
parser.add_argument('--pr-label', dest='pr_label', action='store', help='label PRs for testing')
+ parser.add_argument('--no-credits', dest='credits', action='store_false', help='skip indication search (Reviewed-by, etc.)')
parser.add_argument('prs', metavar="PR", type=int, nargs='*', help='Pull Requests to merge')
args = parser.parse_args(argv)
return build_branch(args)
diff --git a/src/test/cls_rbd/CMakeLists.txt b/src/test/cls_rbd/CMakeLists.txt
index 59a75b030f4..74c5804e736 100644
--- a/src/test/cls_rbd/CMakeLists.txt
+++ b/src/test/cls_rbd/CMakeLists.txt
@@ -5,6 +5,7 @@ add_executable(ceph_test_cls_rbd
target_link_libraries(ceph_test_cls_rbd
cls_rbd_client
cls_lock_client
+ libneorados
librados
global
${UNITTEST_LIBS}
diff --git a/src/test/librados_test_stub/CMakeLists.txt b/src/test/librados_test_stub/CMakeLists.txt
index ba30a4356c9..f501d2da2e5 100644
--- a/src/test/librados_test_stub/CMakeLists.txt
+++ b/src/test/librados_test_stub/CMakeLists.txt
@@ -1,5 +1,6 @@
set(librados_test_stub_srcs
LibradosTestStub.cc
+ NeoradosTestStub.cc
TestClassHandler.cc
TestIoCtxImpl.cc
TestMemCluster.cc
diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc
index 93d0e3bb92f..c1f1f72db3d 100644
--- a/src/test/librados_test_stub/LibradosTestStub.cc
+++ b/src/test/librados_test_stub/LibradosTestStub.cc
@@ -60,10 +60,6 @@ TestClusterRef get_cluster() {
return cluster_ref;
}
-} // namespace librados_test_stub
-
-namespace {
-
librados::TestClassHandler *get_class_handler() {
static boost::shared_ptr<librados::TestClassHandler> s_class_handler;
if (!s_class_handler) {
@@ -73,6 +69,10 @@ librados::TestClassHandler *get_class_handler() {
return s_class_handler.get();
}
+} // namespace librados_test_stub
+
+namespace {
+
void do_out_buffer(bufferlist& outbl, char **outbuf, size_t *outbuflen) {
if (outbuf) {
if (outbl.length() > 0) {
@@ -428,7 +428,8 @@ int IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
bufferlist *pbl) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
TestObjectOperationImpl *ops = reinterpret_cast<TestObjectOperationImpl*>(op->impl);
- return ctx->aio_operate_read(oid, *ops, c->pc, flags, pbl);
+ return ctx->aio_operate_read(oid, *ops, c->pc, flags, pbl,
+ ctx->get_snap_read());
}
int IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
@@ -524,8 +525,10 @@ int IoCtx::exec(const std::string& oid, const char *cls, const char *method,
bufferlist& inbl, bufferlist& outbl) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::exec, _1, _2, get_class_handler(), cls,
- method, inbl, &outbl, ctx->get_snap_context()));
+ oid, boost::bind(&TestIoCtxImpl::exec, _1, _2,
+ librados_test_stub::get_class_handler(), cls,
+ method, inbl, &outbl, ctx->get_snap_read(),
+ ctx->get_snap_context()));
}
void IoCtx::from_rados_ioctx_t(rados_ioctx_t p, IoCtx &io) {
@@ -613,7 +616,8 @@ int IoCtx::read(const std::string& oid, bufferlist& bl, size_t len,
uint64_t off) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl));
+ oid, boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, &bl,
+ ctx->get_snap_read()));
}
int IoCtx::remove(const std::string& oid) {
@@ -663,7 +667,8 @@ int IoCtx::sparse_read(const std::string& oid, std::map<uint64_t,uint64_t>& m,
bufferlist& bl, size_t len, uint64_t off) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl));
+ oid, boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, &m, &bl,
+ ctx->get_snap_read()));
}
int IoCtx::stat(const std::string& oid, uint64_t *psize, time_t *pmtime) {
@@ -733,7 +738,8 @@ int IoCtx::writesame(const std::string& oid, bufferlist& bl, size_t len,
int IoCtx::cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) {
TestIoCtxImpl *ctx = reinterpret_cast<TestIoCtxImpl*>(io_ctx_impl);
return ctx->execute_operation(
- oid, boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl));
+ oid, boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl,
+ ctx->get_snap_read()));
}
int IoCtx::application_enable(const std::string& app_name, bool force) {
@@ -804,14 +810,15 @@ ObjectOperation::~ObjectOperation() {
void ObjectOperation::assert_exists() {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::assert_exists, _1, _2));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::assert_exists, _1, _2, _4));
}
void ObjectOperation::exec(const char *cls, const char *method,
bufferlist& inbl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::exec, _1, _2,
- get_class_handler(), cls, method, inbl, _3, _4));
+ librados_test_stub::get_class_handler(), cls,
+ method, inbl, _3, _4, _5));
}
void ObjectOperation::set_op_flags2(int flags) {
@@ -825,10 +832,11 @@ size_t ObjectOperation::size() {
void ObjectOperation::cmpext(uint64_t off, const bufferlist& cmp_bl,
int *prval) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl);
+ ObjectOperationTestImpl op = boost::bind(&TestIoCtxImpl::cmpext, _1, _2, off,
+ cmp_bl, _4);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
@@ -840,7 +848,7 @@ void ObjectReadOperation::list_snaps(snap_set_t *out_snaps, int *prval) {
out_snaps);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
@@ -853,7 +861,7 @@ void ObjectReadOperation::list_watchers(std::list<obj_watch_t> *out_watchers,
_2, out_watchers);
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
@@ -864,14 +872,14 @@ void ObjectReadOperation::read(size_t off, uint64_t len, bufferlist *pbl,
ObjectOperationTestImpl op;
if (pbl != NULL) {
- op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl);
+ op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, pbl, _4);
} else {
- op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3);
+ op = boost::bind(&TestIoCtxImpl::read, _1, _2, len, off, _3, _4);
}
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
@@ -883,14 +891,14 @@ void ObjectReadOperation::sparse_read(uint64_t off, uint64_t len,
ObjectOperationTestImpl op;
if (pbl != NULL) {
- op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl);
+ op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, pbl, _4);
} else {
- op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3);
+ op = boost::bind(&TestIoCtxImpl::sparse_read, _1, _2, off, len, m, _3, _4);
}
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
@@ -903,19 +911,19 @@ void ObjectReadOperation::stat(uint64_t *psize, time_t *pmtime, int *prval) {
if (prval != NULL) {
op = boost::bind(save_operation_result,
- boost::bind(op, _1, _2, _3, _4), prval);
+ boost::bind(op, _1, _2, _3, _4, _5), prval);
}
o->ops.push_back(op);
}
void ObjectWriteOperation::append(const bufferlist &bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _5));
}
void ObjectWriteOperation::create(bool exclusive) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive, _5));
}
void ObjectWriteOperation::omap_set(const std::map<std::string, bufferlist> &map) {
@@ -925,7 +933,7 @@ void ObjectWriteOperation::omap_set(const std::map<std::string, bufferlist> &map
void ObjectWriteOperation::remove() {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::remove, _1, _2, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::remove, _1, _2, _5));
}
void ObjectWriteOperation::selfmanaged_snap_rollback(uint64_t snapid) {
@@ -939,7 +947,7 @@ void ObjectWriteOperation::set_alloc_hint(uint64_t expected_object_size,
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2,
expected_object_size, expected_write_size, 0,
- _4));
+ _5));
}
void ObjectWriteOperation::set_alloc_hint2(uint64_t expected_object_size,
@@ -948,7 +956,7 @@ void ObjectWriteOperation::set_alloc_hint2(uint64_t expected_object_size,
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::set_alloc_hint, _1, _2,
expected_object_size, expected_write_size, flags,
- _4));
+ _5));
}
void ObjectWriteOperation::tmap_update(const bufferlist& cmdbl) {
@@ -959,29 +967,30 @@ void ObjectWriteOperation::tmap_update(const bufferlist& cmdbl) {
void ObjectWriteOperation::truncate(uint64_t off) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::truncate, _1, _2, off, _5));
}
void ObjectWriteOperation::write(uint64_t off, const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::write, _1, _2, bl, bl.length(),
- off, _4));
+ off, _5));
}
void ObjectWriteOperation::write_full(const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::write_full, _1, _2, bl, _5));
}
-void ObjectWriteOperation::writesame(uint64_t off, uint64_t len, const bufferlist& bl) {
+void ObjectWriteOperation::writesame(uint64_t off, uint64_t len,
+ const bufferlist& bl) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::writesame, _1, _2, bl, len,
- off, _4));
+ off, _5));
}
void ObjectWriteOperation::zero(uint64_t off, uint64_t len) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
- o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _4));
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::zero, _1, _2, off, len, _5));
}
Rados::Rados() : client(NULL) {
@@ -1365,7 +1374,7 @@ int cls_cxx_read2(cls_method_context_t hctx, int ofs, int len,
bufferlist *outbl, uint32_t op_flags) {
librados::TestClassHandler::MethodContext *ctx =
reinterpret_cast<librados::TestClassHandler::MethodContext*>(hctx);
- return ctx->io_ctx_impl->read(ctx->oid, len, ofs, outbl);
+ return ctx->io_ctx_impl->read(ctx->oid, len, ofs, outbl, ctx->snap_id);
}
int cls_cxx_setxattr(cls_method_context_t hctx, const char *name,
@@ -1484,7 +1493,7 @@ int cls_log(int level, const char *format, ...) {
}
int cls_register(const char *name, cls_handle_t *handle) {
- librados::TestClassHandler *cls = get_class_handler();
+ librados::TestClassHandler *cls = librados_test_stub::get_class_handler();
return cls->create(name, handle);
}
@@ -1492,7 +1501,7 @@ int cls_register_cxx_method(cls_handle_t hclass, const char *method,
int flags,
cls_method_cxx_call_t class_call,
cls_method_handle_t *handle) {
- librados::TestClassHandler *cls = get_class_handler();
+ librados::TestClassHandler *cls = librados_test_stub::get_class_handler();
return cls->create_method(hclass, method, class_call, handle);
}
@@ -1501,7 +1510,7 @@ int cls_register_cxx_filter(cls_handle_t hclass,
cls_cxx_filter_factory_t fn,
cls_filter_handle_t *)
{
- librados::TestClassHandler *cls = get_class_handler();
+ librados::TestClassHandler *cls = librados_test_stub::get_class_handler();
return cls->create_filter(hclass, filter_name, fn);
}
diff --git a/src/test/librados_test_stub/LibradosTestStub.h b/src/test/librados_test_stub/LibradosTestStub.h
index 8e6c4569522..5d335f48826 100644
--- a/src/test/librados_test_stub/LibradosTestStub.h
+++ b/src/test/librados_test_stub/LibradosTestStub.h
@@ -7,12 +7,23 @@
#include "include/rados/librados_fwd.hpp"
#include <boost/shared_ptr.hpp>
+namespace neorados {
+struct IOContext;
+struct RADOS;
+} // namespace neorados
+
namespace librados {
class MockTestMemIoCtxImpl;
+class MockTestMemRadosClient;
class TestCluster;
+class TestClassHandler;
MockTestMemIoCtxImpl &get_mock_io_ctx(IoCtx &ioctx);
+MockTestMemIoCtxImpl &get_mock_io_ctx(neorados::RADOS& rados,
+ neorados::IOContext& io_context);
+
+MockTestMemRadosClient &get_mock_rados_client(neorados::RADOS& rados);
} // namespace librados
@@ -23,6 +34,8 @@ typedef boost::shared_ptr<librados::TestCluster> TestClusterRef;
void set_cluster(TestClusterRef cluster);
TestClusterRef get_cluster();
+librados::TestClassHandler* get_class_handler();
+
} // namespace librados_test_stub
diff --git a/src/test/librados_test_stub/MockTestMemIoCtxImpl.h b/src/test/librados_test_stub/MockTestMemIoCtxImpl.h
index fc86c287fe9..765af67367f 100644
--- a/src/test/librados_test_stub/MockTestMemIoCtxImpl.h
+++ b/src/test/librados_test_stub/MockTestMemIoCtxImpl.h
@@ -63,9 +63,9 @@ public:
return TestMemIoCtxImpl::aio_unwatch(handle, c);
}
- MOCK_METHOD1(assert_exists, int(const std::string &));
- int do_assert_exists(const std::string &oid) {
- return TestMemIoCtxImpl::assert_exists(oid);
+ MOCK_METHOD2(assert_exists, int(const std::string &, uint64_t));
+ int do_assert_exists(const std::string &oid, uint64_t snap_id) {
+ return TestMemIoCtxImpl::assert_exists(oid, snap_id);
}
MOCK_METHOD3(create, int(const std::string&, bool, const SnapContext &));
@@ -74,23 +74,26 @@ public:
return TestMemIoCtxImpl::create(oid, exclusive, snapc);
}
- MOCK_METHOD3(cmpext, int(const std::string&, uint64_t, bufferlist&));
- int do_cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) {
- return TestMemIoCtxImpl::cmpext(oid, off, cmp_bl);
+ MOCK_METHOD4(cmpext, int(const std::string&, uint64_t, bufferlist&,
+ uint64_t snap_id));
+ int do_cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) {
+ return TestMemIoCtxImpl::cmpext(oid, off, cmp_bl, snap_id);
}
- MOCK_METHOD7(exec, int(const std::string& oid,
+ MOCK_METHOD8(exec, int(const std::string& oid,
TestClassHandler *handler,
const char *cls,
const char *method,
bufferlist& inbl,
bufferlist* outbl,
+ uint64_t snap_id,
const SnapContext &snapc));
int do_exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method, bufferlist& inbl,
- bufferlist* outbl, const SnapContext &snapc) {
+ bufferlist* outbl, uint64_t snap_id, const SnapContext &snapc) {
return TestMemIoCtxImpl::exec(oid, handler, cls, method, inbl, outbl,
- snapc);
+ snap_id, snapc);
}
MOCK_CONST_METHOD0(get_instance_id, uint64_t());
@@ -121,23 +124,24 @@ public:
void do_set_snap_read(snap_t snap_id) {
return TestMemIoCtxImpl::set_snap_read(snap_id);
}
- MOCK_METHOD5(sparse_read, int(const std::string& oid,
+ MOCK_METHOD6(sparse_read, int(const std::string& oid,
uint64_t off,
uint64_t len,
std::map<uint64_t, uint64_t> *m,
- bufferlist *bl));
+ bufferlist *bl, uint64_t));
int do_sparse_read(const std::string& oid, uint64_t off, size_t len,
- std::map<uint64_t, uint64_t> *m, bufferlist *bl){
- return TestMemIoCtxImpl::sparse_read(oid, off, len, m, bl);
+ std::map<uint64_t, uint64_t> *m, bufferlist *bl,
+ uint64_t snap_id) {
+ return TestMemIoCtxImpl::sparse_read(oid, off, len, m, bl, snap_id);
}
- MOCK_METHOD4(read, int(const std::string& oid,
+ MOCK_METHOD5(read, int(const std::string& oid,
size_t len,
uint64_t off,
- bufferlist *bl));
+ bufferlist *bl, uint64_t snap_id));
int do_read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) {
- return TestMemIoCtxImpl::read(oid, len, off, bl);
+ bufferlist *bl, uint64_t snap_id) {
+ return TestMemIoCtxImpl::read(oid, len, off, bl, snap_id);
}
MOCK_METHOD2(remove, int(const std::string& oid, const SnapContext &snapc));
@@ -208,17 +212,17 @@ public:
ON_CALL(*this, aio_operate(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_operate));
ON_CALL(*this, aio_watch(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_watch));
ON_CALL(*this, aio_unwatch(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_aio_unwatch));
- ON_CALL(*this, assert_exists(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_assert_exists));
+ ON_CALL(*this, assert_exists(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_assert_exists));
ON_CALL(*this, create(_, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_create));
- ON_CALL(*this, cmpext(_,_,_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_cmpext));
- ON_CALL(*this, exec(_, _, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_exec));
+ ON_CALL(*this, cmpext(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_cmpext));
+ ON_CALL(*this, exec(_, _, _, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_exec));
ON_CALL(*this, get_instance_id()).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_get_instance_id));
ON_CALL(*this, list_snaps(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_list_snaps));
ON_CALL(*this, list_watchers(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_list_watchers));
ON_CALL(*this, notify(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_notify));
- ON_CALL(*this, read(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_read));
+ ON_CALL(*this, read(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_read));
ON_CALL(*this, set_snap_read(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_set_snap_read));
- ON_CALL(*this, sparse_read(_, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_sparse_read));
+ ON_CALL(*this, sparse_read(_, _, _, _, _, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_sparse_read));
ON_CALL(*this, remove(_, _)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_remove));
ON_CALL(*this, selfmanaged_snap_create(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_selfmanaged_snap_create));
ON_CALL(*this, selfmanaged_snap_remove(_)).WillByDefault(Invoke(this, &MockTestMemIoCtxImpl::do_selfmanaged_snap_remove));
diff --git a/src/test/librados_test_stub/MockTestMemRadosClient.h b/src/test/librados_test_stub/MockTestMemRadosClient.h
index 63050cb1ed2..1ee6ec4e0a7 100644
--- a/src/test/librados_test_stub/MockTestMemRadosClient.h
+++ b/src/test/librados_test_stub/MockTestMemRadosClient.h
@@ -70,6 +70,19 @@ public:
return TestMemRadosClient::service_daemon_update_status(std::move(s));
}
+ MOCK_METHOD4(mon_command, int(const std::vector<std::string>&,
+ const bufferlist&, bufferlist*, std::string*));
+ int do_mon_command(const std::vector<std::string>& cmd,
+ const bufferlist &inbl, bufferlist *outbl,
+ std::string *outs) {
+ return mon_command(cmd, inbl, outbl, outs);
+ }
+
+ MOCK_METHOD0(wait_for_latest_osd_map, int());
+ int do_wait_for_latest_osd_map() {
+ return wait_for_latest_osd_map();
+ }
+
void default_to_dispatch() {
using namespace ::testing;
@@ -80,6 +93,8 @@ public:
ON_CALL(*this, get_min_compatible_client(_, _)).WillByDefault(Invoke(this, &MockTestMemRadosClient::do_get_min_compatible_client));
ON_CALL(*this, service_daemon_register(_, _, _)).WillByDefault(Invoke(this, &MockTestMemRadosClient::do_service_daemon_register));
ON_CALL(*this, service_daemon_update_status_r(_)).WillByDefault(Invoke(this, &MockTestMemRadosClient::do_service_daemon_update_status_r));
+ ON_CALL(*this, mon_command(_, _, _, _)).WillByDefault(Invoke(this, &MockTestMemRadosClient::do_mon_command));
+ ON_CALL(*this, wait_for_latest_osd_map()).WillByDefault(Invoke(this, &MockTestMemRadosClient::do_wait_for_latest_osd_map));
}
};
diff --git a/src/test/librados_test_stub/NeoradosTestStub.cc b/src/test/librados_test_stub/NeoradosTestStub.cc
new file mode 100644
index 00000000000..2121a6fb8eb
--- /dev/null
+++ b/src/test/librados_test_stub/NeoradosTestStub.cc
@@ -0,0 +1,533 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "include/neorados/RADOS.hpp"
+#include "include/rados/librados.hpp"
+#include "common/ceph_mutex.h"
+#include "common/hobject.h"
+#include "librados/AioCompletionImpl.h"
+#include "osd/error_code.h"
+#include "osd/osd_types.h"
+#include "osdc/error_code.h"
+#include "test/librados_test_stub/LibradosTestStub.h"
+#include "test/librados_test_stub/TestClassHandler.h"
+#include "test/librados_test_stub/TestIoCtxImpl.h"
+#include "test/librados_test_stub/TestRadosClient.h"
+#include <map>
+#include <memory>
+#include <optional>
+#include <string>
+#include <boost/bind.hpp>
+#include <boost/system/system_error.hpp>
+
+namespace bs = boost::system;
+
+namespace neorados {
+namespace detail {
+
+struct Client {
+ ceph::mutex mutex = ceph::make_mutex("NeoradosTestStub::Client");
+
+ librados::TestRadosClient* test_rados_client;
+ boost::asio::io_context& io_context;
+
+ std::map<std::pair<int64_t, std::string>, librados::TestIoCtxImpl*> io_ctxs;
+
+ Client(librados::TestRadosClient* test_rados_client)
+ : test_rados_client(test_rados_client),
+ io_context(test_rados_client->get_io_context()) {
+ }
+
+ ~Client() {
+ for (auto& io_ctx : io_ctxs) {
+ io_ctx.second->put();
+ }
+ }
+
+ librados::TestIoCtxImpl* get_io_ctx(const IOContext& ioc) {
+ int64_t pool_id = ioc.pool();
+ std::string ns = std::string{ioc.ns()};
+
+ auto lock = std::scoped_lock{mutex};
+ auto key = make_pair(pool_id, ns);
+ auto it = io_ctxs.find(key);
+ if (it != io_ctxs.end()) {
+ return it->second;
+ }
+
+ std::list<std::pair<int64_t, std::string>> pools;
+ int r = test_rados_client->pool_list(pools);
+ if (r < 0) {
+ return nullptr;
+ }
+
+ for (auto& pool : pools) {
+ if (pool.first == pool_id) {
+ auto io_ctx = test_rados_client->create_ioctx(pool_id, pool.second);
+ io_ctx->set_namespace(ns);
+ io_ctxs[key] = io_ctx;
+ return io_ctx;
+ }
+ }
+ return nullptr;
+ }
+};
+
+} // namespace detail
+
+namespace {
+
+struct CompletionPayload {
+ std::unique_ptr<Op::Completion> c;
+};
+
+void completion_callback_adapter(rados_completion_t c, void *arg) {
+ auto impl = reinterpret_cast<librados::AioCompletionImpl *>(c);
+ auto r = impl->get_return_value();
+ impl->release();
+
+ auto payload = reinterpret_cast<CompletionPayload*>(arg);
+ payload->c->defer(std::move(payload->c),
+ (r < 0) ? bs::error_code(-r, osd_category()) :
+ bs::error_code());
+ delete payload;
+}
+
+librados::AioCompletionImpl* create_aio_completion(
+ std::unique_ptr<Op::Completion>&& c) {
+ auto payload = new CompletionPayload{std::move(c)};
+
+ auto impl = new librados::AioCompletionImpl();
+ impl->set_complete_callback(payload, completion_callback_adapter);
+
+ return impl;
+}
+
+int save_operation_size(int result, size_t* pval) {
+ if (pval != NULL) {
+ *pval = result;
+ }
+ return result;
+}
+
+int save_operation_ec(int result, boost::system::error_code* ec) {
+ if (ec != NULL) {
+ *ec = {std::abs(result), bs::system_category()};
+ }
+ return result;
+}
+
+} // anonymous namespace
+
+Object::Object() {
+ static_assert(impl_size >= sizeof(object_t));
+ new (&impl) object_t();
+}
+
+Object::Object(std::string&& s) {
+ static_assert(impl_size >= sizeof(object_t));
+ new (&impl) object_t(std::move(s));
+}
+
+Object::~Object() {
+ reinterpret_cast<object_t*>(&impl)->~object_t();
+}
+
+Object::operator std::string_view() const {
+ return std::string_view(reinterpret_cast<const object_t*>(&impl)->name);
+}
+
+struct IOContextImpl {
+ object_locator_t oloc;
+ snapid_t snap_seq = CEPH_NOSNAP;
+ SnapContext snapc;
+};
+
+IOContext::IOContext() {
+ static_assert(impl_size >= sizeof(IOContextImpl));
+ new (&impl) IOContextImpl();
+}
+
+IOContext::IOContext(const IOContext& rhs) {
+ static_assert(impl_size >= sizeof(IOContextImpl));
+ new (&impl) IOContextImpl(*reinterpret_cast<const IOContextImpl*>(&rhs.impl));
+}
+
+IOContext::IOContext(int64_t _pool, std::string&& _ns)
+ : IOContext() {
+ pool(_pool);
+ ns(std::move(_ns));
+}
+
+IOContext::~IOContext() {
+ reinterpret_cast<IOContextImpl*>(&impl)->~IOContextImpl();
+}
+
+std::int64_t IOContext::pool() const {
+ return reinterpret_cast<const IOContextImpl*>(&impl)->oloc.pool;
+}
+
+void IOContext::pool(std::int64_t _pool) {
+ reinterpret_cast<IOContextImpl*>(&impl)->oloc.pool = _pool;
+}
+
+std::string_view IOContext::ns() const {
+ return reinterpret_cast<const IOContextImpl*>(&impl)->oloc.nspace;
+}
+
+void IOContext::ns(std::string&& _ns) {
+ reinterpret_cast<IOContextImpl*>(&impl)->oloc.nspace = std::move(_ns);
+}
+
+std::optional<std::uint64_t> IOContext::read_snap() const {
+ auto& snap_seq = reinterpret_cast<const IOContextImpl*>(&impl)->snap_seq;
+ if (snap_seq == CEPH_NOSNAP)
+ return std::nullopt;
+ else
+ return snap_seq;
+}
+void IOContext::read_snap(std::optional<std::uint64_t> _snapid) {
+ auto& snap_seq = reinterpret_cast<IOContextImpl*>(&impl)->snap_seq;
+ snap_seq = _snapid.value_or(CEPH_NOSNAP);
+}
+
+std::optional<
+ std::pair<std::uint64_t,
+ std::vector<std::uint64_t>>> IOContext::write_snap_context() const {
+ auto& snapc = reinterpret_cast<const IOContextImpl*>(&impl)->snapc;
+ if (snapc.empty()) {
+ return std::nullopt;
+ } else {
+ std::vector<uint64_t> v(snapc.snaps.begin(), snapc.snaps.end());
+ return std::make_optional(std::make_pair(uint64_t(snapc.seq), v));
+ }
+}
+
+void IOContext::write_snap_context(
+ std::optional<std::pair<std::uint64_t, std::vector<std::uint64_t>>> _snapc) {
+ auto& snapc = reinterpret_cast<IOContextImpl*>(&impl)->snapc;
+ if (!_snapc) {
+ snapc.clear();
+ } else {
+ SnapContext n(_snapc->first, { _snapc->second.begin(), _snapc->second.end()});
+ if (!n.is_valid()) {
+ throw bs::system_error(EINVAL,
+ bs::system_category(),
+ "Invalid snap context.");
+ }
+
+ snapc = n;
+ }
+}
+
+Op::Op() {
+ static_assert(Op::impl_size >= sizeof(librados::TestObjectOperationImpl*));
+ auto& o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o = new librados::TestObjectOperationImpl();
+ o->get();
+}
+
+Op::~Op() {
+ auto& o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ if (o != nullptr) {
+ o->put();
+ o = nullptr;
+ }
+}
+
+void Op::assert_exists() {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::assert_exists, _1, _2, _4));
+}
+
+void Op::cmpext(uint64_t off, ceph::buffer::list&& cmp_bl, std::size_t* s) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ librados::ObjectOperationTestImpl op = boost::bind(
+ &librados::TestIoCtxImpl::cmpext, _1, _2, off, cmp_bl, _4);
+ if (s != nullptr) {
+ op = boost::bind(
+ save_operation_size, boost::bind(op, _1, _2, _3, _4, _5), s);
+ }
+ o->ops.push_back(op);
+}
+
+std::size_t Op::size() const {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl* const *>(&impl);
+ return o->ops.size();
+}
+
+void Op::set_fadvise_random() {
+ // no-op
+}
+
+void Op::set_fadvise_sequential() {
+ // no-op
+}
+
+void Op::set_fadvise_willneed() {
+ // no-op
+}
+
+void Op::set_fadvise_dontneed() {
+ // no-op
+}
+
+void Op::set_fadvise_nocache() {
+ // no-op
+}
+
+void Op::balance_reads() {
+ // no-op
+}
+
+void Op::localize_reads() {
+ // no-op
+}
+
+void Op::exec(std::string_view cls, std::string_view method,
+ const ceph::buffer::list& inbl,
+ ceph::buffer::list* out,
+ boost::system::error_code* ec) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+
+ auto cls_handler = librados_test_stub::get_class_handler();
+ librados::ObjectOperationTestImpl op =
+ [cls_handler, cls, method, inbl = const_cast<bufferlist&>(inbl), out]
+ (librados::TestIoCtxImpl* io_ctx, const std::string& oid, bufferlist* outbl,
+ uint64_t snap_id, const SnapContext& snapc) mutable -> int {
+ return io_ctx->exec(
+ oid, cls_handler, std::string(cls).c_str(),
+ std::string(method).c_str(), inbl,
+ (out != nullptr ? out : outbl), snap_id, snapc);
+ };
+ if (ec != nullptr) {
+ op = boost::bind(
+ save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec);
+ }
+ o->ops.push_back(op);
+}
+
+void Op::exec(std::string_view cls, std::string_view method,
+ const ceph::buffer::list& inbl,
+ boost::system::error_code* ec) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+
+ auto cls_handler = librados_test_stub::get_class_handler();
+ librados::ObjectOperationTestImpl op =
+ [cls_handler, cls, method, inbl = const_cast<bufferlist&>(inbl)]
+ (librados::TestIoCtxImpl* io_ctx, const std::string& oid, bufferlist* outbl,
+ uint64_t snap_id, const SnapContext& snapc) mutable -> int {
+ return io_ctx->exec(
+ oid, cls_handler, std::string(cls).c_str(),
+ std::string(method).c_str(), inbl, outbl, snap_id, snapc);
+ };
+ if (ec != NULL) {
+ op = boost::bind(
+ save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec);
+ }
+ o->ops.push_back(op);
+}
+
+void ReadOp::read(size_t off, uint64_t len, ceph::buffer::list* out,
+ boost::system::error_code* ec) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ librados::ObjectOperationTestImpl op;
+ if (out != nullptr) {
+ op = boost::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, out, _4);
+ } else {
+ op = boost::bind(&librados::TestIoCtxImpl::read, _1, _2, len, off, _3, _4);
+ }
+
+ if (ec != NULL) {
+ op = boost::bind(
+ save_operation_ec, boost::bind(op, _1, _2, _3, _4, _5), ec);
+ }
+ o->ops.push_back(op);
+}
+
+void ReadOp::sparse_read(uint64_t off, uint64_t len,
+ ceph::buffer::list* out,
+ std::vector<std::pair<std::uint64_t,
+ std::uint64_t>>* extents,
+ boost::system::error_code* ec) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ librados::ObjectOperationTestImpl op =
+ [off, len, out, extents]
+ (librados::TestIoCtxImpl* io_ctx, const std::string& oid, bufferlist* outbl,
+ uint64_t snap_id, const SnapContext& snapc) mutable -> int {
+ std::map<uint64_t,uint64_t> m;
+ int r = io_ctx->sparse_read(
+ oid, off, len, &m, (out != nullptr ? out : outbl), snap_id);
+ if (r >= 0 && extents != nullptr) {
+ extents->clear();
+ extents->insert(extents->end(), m.begin(), m.end());
+ }
+ return r;
+ };
+ if (ec != NULL) {
+ op = boost::bind(save_operation_ec,
+ boost::bind(op, _1, _2, _3, _4, _5), ec);
+ }
+ o->ops.push_back(op);
+}
+
+void WriteOp::create(bool exclusive) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::create, _1, _2, exclusive, _5));
+}
+
+void WriteOp::write(uint64_t off, ceph::buffer::list&& bl) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::write, _1, _2, bl, bl.length(), off, _5));
+}
+
+void WriteOp::write_full(ceph::buffer::list&& bl) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::write_full, _1, _2, bl, _5));
+}
+
+void WriteOp::remove() {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::remove, _1, _2, _5));
+}
+
+void WriteOp::truncate(uint64_t off) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::truncate, _1, _2, off, _5));
+}
+
+void WriteOp::zero(uint64_t off, uint64_t len) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::zero, _1, _2, off, len, _5));
+}
+
+void WriteOp::writesame(std::uint64_t off, std::uint64_t write_len,
+ ceph::buffer::list&& bl) {
+ auto o = *reinterpret_cast<librados::TestObjectOperationImpl**>(&impl);
+ o->ops.push_back(boost::bind(
+ &librados::TestIoCtxImpl::writesame, _1, _2, bl, write_len, off, _5));
+}
+
+void WriteOp::set_alloc_hint(uint64_t expected_object_size,
+ uint64_t expected_write_size,
+ alloc_hint::alloc_hint_t flags) {
+ // no-op
+}
+
+RADOS::RADOS() = default;
+
+RADOS::RADOS(RADOS&&) = default;
+
+RADOS::RADOS(std::unique_ptr<detail::Client> impl)
+ : impl(std::move(impl)) {
+}
+
+RADOS::~RADOS() = default;
+
+RADOS RADOS::make_with_librados(librados::Rados& rados) {
+ auto test_rados_client = reinterpret_cast<librados::TestRadosClient*>(
+ rados.client);
+ return RADOS{std::make_unique<detail::Client>(test_rados_client)};
+}
+
+CephContext* neorados::RADOS::cct() {
+ return impl->test_rados_client->cct();
+}
+
+boost::asio::io_context& neorados::RADOS::get_io_context() {
+ return impl->io_context;
+}
+
+boost::asio::io_context::executor_type neorados::RADOS::get_executor() const {
+ return impl->io_context.get_executor();
+}
+
+void RADOS::execute(const Object& o, const IOContext& ioc, ReadOp&& op,
+ ceph::buffer::list* bl, std::unique_ptr<Op::Completion> c,
+ uint64_t* objver, const blkin_trace_info* trace_info) {
+ auto io_ctx = impl->get_io_ctx(ioc);
+ if (io_ctx == nullptr) {
+ c->dispatch(std::move(c), osdc_errc::pool_dne);
+ return;
+ }
+
+ auto ops = *reinterpret_cast<librados::TestObjectOperationImpl**>(&op.impl);
+
+ auto snap_id = CEPH_NOSNAP;
+ auto opt_snap_id = ioc.read_snap();
+ if (opt_snap_id) {
+ snap_id = *opt_snap_id;
+ }
+
+ auto completion = create_aio_completion(std::move(c));
+ auto r = io_ctx->aio_operate_read(std::string{o}, *ops, completion, 0U, bl,
+ snap_id);
+ ceph_assert(r == 0);
+}
+
+void RADOS::execute(const Object& o, const IOContext& ioc, WriteOp&& op,
+ std::unique_ptr<Op::Completion> c, uint64_t* objver,
+ const blkin_trace_info* trace_info) {
+ auto io_ctx = impl->get_io_ctx(ioc);
+ if (io_ctx == nullptr) {
+ c->dispatch(std::move(c), osdc_errc::pool_dne);
+ return;
+ }
+
+ auto ops = *reinterpret_cast<librados::TestObjectOperationImpl**>(&op.impl);
+
+ SnapContext snapc;
+ auto opt_snapc = ioc.write_snap_context();
+ if (opt_snapc) {
+ snapc.seq = opt_snapc->first;
+ snapc.snaps.assign(opt_snapc->second.begin(), opt_snapc->second.end());
+ }
+
+ auto completion = create_aio_completion(std::move(c));
+ auto r = io_ctx->aio_operate(std::string{o}, *ops, completion, &snapc, 0U);
+ ceph_assert(r == 0);
+}
+
+void RADOS::mon_command(std::vector<std::string> command,
+ const bufferlist& bl,
+ std::string* outs, bufferlist* outbl,
+ std::unique_ptr<Op::Completion> c) {
+ auto r = impl->test_rados_client->mon_command(command, bl, outbl, outs);
+ c->post(std::move(c),
+ (r < 0 ? bs::error_code(-r, osd_category()) : bs::error_code()));
+}
+
+void RADOS::wait_for_latest_osd_map(std::unique_ptr<Op::Completion> c) {
+ auto r = impl->test_rados_client->wait_for_latest_osd_map();
+ c->dispatch(std::move(c),
+ (r < 0 ? bs::error_code(-r, osd_category()) :
+ bs::error_code()));
+}
+
+} // namespace neorados
+
+namespace librados {
+
+MockTestMemIoCtxImpl& get_mock_io_ctx(neorados::RADOS& rados,
+ neorados::IOContext& io_context) {
+ auto& impl = *reinterpret_cast<std::unique_ptr<neorados::detail::Client>*>(
+ &rados);
+ auto io_ctx = impl->get_io_ctx(io_context);
+ ceph_assert(io_ctx != nullptr);
+ return *reinterpret_cast<MockTestMemIoCtxImpl*>(io_ctx);
+}
+
+MockTestMemRadosClient& get_mock_rados_client(neorados::RADOS& rados) {
+ auto& impl = *reinterpret_cast<std::unique_ptr<neorados::detail::Client>*>(
+ &rados);
+ return *reinterpret_cast<MockTestMemRadosClient*>(impl->test_rados_client);
+}
+
+} // namespace librados
diff --git a/src/test/librados_test_stub/TestClassHandler.cc b/src/test/librados_test_stub/TestClassHandler.cc
index ef96f6198db..ff0441f30e0 100644
--- a/src/test/librados_test_stub/TestClassHandler.cc
+++ b/src/test/librados_test_stub/TestClassHandler.cc
@@ -132,13 +132,14 @@ cls_method_cxx_call_t TestClassHandler::get_method(const std::string &cls,
}
TestClassHandler::SharedMethodContext TestClassHandler::get_method_context(
- TestIoCtxImpl *io_ctx_impl, const std::string &oid,
+ TestIoCtxImpl *io_ctx_impl, const std::string &oid, uint64_t snap_id,
const SnapContext &snapc) {
SharedMethodContext ctx(new MethodContext());
// clone to ioctx to provide a firewall for gmock expectations
ctx->io_ctx_impl = io_ctx_impl->clone();
ctx->oid = oid;
+ ctx->snap_id = snap_id;
ctx->snapc = snapc;
return ctx;
}
diff --git a/src/test/librados_test_stub/TestClassHandler.h b/src/test/librados_test_stub/TestClassHandler.h
index df273364d30..09e009bf861 100644
--- a/src/test/librados_test_stub/TestClassHandler.h
+++ b/src/test/librados_test_stub/TestClassHandler.h
@@ -27,6 +27,7 @@ public:
TestIoCtxImpl *io_ctx_impl;
std::string oid;
+ uint64_t snap_id;
SnapContext snapc;
};
typedef boost::shared_ptr<MethodContext> SharedMethodContext;
@@ -54,6 +55,7 @@ public:
const std::string &method);
SharedMethodContext get_method_context(TestIoCtxImpl *io_ctx_impl,
const std::string &oid,
+ uint64_t snap_id,
const SnapContext &snapc);
int create_filter(cls_handle_t hclass, const std::string& filter_name,
diff --git a/src/test/librados_test_stub/TestIoCtxImpl.cc b/src/test/librados_test_stub/TestIoCtxImpl.cc
index 31a60ae2621..2aaf29d578b 100644
--- a/src/test/librados_test_stub/TestIoCtxImpl.cc
+++ b/src/test/librados_test_stub/TestIoCtxImpl.cc
@@ -111,7 +111,7 @@ int TestIoCtxImpl::aio_operate(const std::string& oid, TestObjectOperationImpl &
m_pending_ops++;
m_client->add_aio_operation(oid, true, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
- reinterpret_cast<bufferlist*>(0),
+ reinterpret_cast<bufferlist*>(0), m_snap_seq,
snap_context != NULL ? *snap_context : m_snapc), c);
return 0;
}
@@ -119,12 +119,13 @@ int TestIoCtxImpl::aio_operate(const std::string& oid, TestObjectOperationImpl &
int TestIoCtxImpl::aio_operate_read(const std::string& oid,
TestObjectOperationImpl &ops,
AioCompletionImpl *c, int flags,
- bufferlist *pbl) {
+ bufferlist *pbl, uint64_t snap_id) {
// TODO ignoring flags for now
ops.get();
m_pending_ops++;
m_client->add_aio_operation(oid, true, boost::bind(
- &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, m_snapc), c);
+ &TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl, snap_id,
+ m_snapc), c);
return 0;
}
@@ -159,7 +160,7 @@ int TestIoCtxImpl::aio_unwatch(uint64_t handle, AioCompletionImpl *c) {
int TestIoCtxImpl::exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method,
bufferlist& inbl, bufferlist* outbl,
- const SnapContext &snapc) {
+ uint64_t snap_id, const SnapContext &snapc) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
@@ -170,7 +171,8 @@ int TestIoCtxImpl::exec(const std::string& oid, TestClassHandler *handler,
}
return (*call)(reinterpret_cast<cls_method_context_t>(
- handler->get_method_context(this, oid, snapc).get()), &inbl, outbl);
+ handler->get_method_context(this, oid, snap_id, snapc).get()), &inbl,
+ outbl);
}
int TestIoCtxImpl::list_watchers(const std::string& o,
@@ -201,14 +203,15 @@ void TestIoCtxImpl::notify_ack(const std::string& o, uint64_t notify_id,
m_client->get_instance_id(), bl);
}
-int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops) {
+int TestIoCtxImpl::operate(const std::string& oid,
+ TestObjectOperationImpl &ops) {
AioCompletionImpl *comp = new AioCompletionImpl();
ops.get();
m_pending_ops++;
m_client->add_aio_operation(oid, false, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops,
- reinterpret_cast<bufferlist*>(0), m_snapc), comp);
+ reinterpret_cast<bufferlist*>(0), m_snap_seq, m_snapc), comp);
comp->wait_for_complete();
int ret = comp->get_return_value();
@@ -216,7 +219,8 @@ int TestIoCtxImpl::operate(const std::string& oid, TestObjectOperationImpl &ops)
return ret;
}
-int TestIoCtxImpl::operate_read(const std::string& oid, TestObjectOperationImpl &ops,
+int TestIoCtxImpl::operate_read(const std::string& oid,
+ TestObjectOperationImpl &ops,
bufferlist *pbl) {
AioCompletionImpl *comp = new AioCompletionImpl();
@@ -224,7 +228,7 @@ int TestIoCtxImpl::operate_read(const std::string& oid, TestObjectOperationImpl
m_pending_ops++;
m_client->add_aio_operation(oid, false, boost::bind(
&TestIoCtxImpl::execute_aio_operations, this, oid, &ops, pbl,
- m_snapc), comp);
+ m_snap_seq, m_snapc), comp);
comp->wait_for_complete();
int ret = comp->get_return_value();
@@ -287,7 +291,7 @@ int TestIoCtxImpl::tmap_update(const std::string& oid, bufferlist& cmdbl) {
if (size > 0) {
bufferlist inbl;
- r = read(oid, size, 0, &inbl);
+ r = read(oid, size, 0, &inbl, CEPH_NOSNAP);
if (r < 0) {
return r;
}
@@ -357,7 +361,7 @@ int TestIoCtxImpl::execute_operation(const std::string& oid,
int TestIoCtxImpl::execute_aio_operations(const std::string& oid,
TestObjectOperationImpl *ops,
- bufferlist *pbl,
+ bufferlist *pbl, uint64_t snap_id,
const SnapContext &snapc) {
int ret = 0;
if (m_client->is_blacklisted()) {
@@ -366,7 +370,7 @@ int TestIoCtxImpl::execute_aio_operations(const std::string& oid,
TestRadosClient::Transaction transaction(m_client, get_namespace(), oid);
for (ObjectOperations::iterator it = ops->ops.begin();
it != ops->ops.end(); ++it) {
- ret = (*it)(this, oid, pbl, snapc);
+ ret = (*it)(this, oid, pbl, snap_id, snapc);
if (ret < 0) {
break;
}
diff --git a/src/test/librados_test_stub/TestIoCtxImpl.h b/src/test/librados_test_stub/TestIoCtxImpl.h
index 0bd3e6fb0c2..8d8a07dfded 100644
--- a/src/test/librados_test_stub/TestIoCtxImpl.h
+++ b/src/test/librados_test_stub/TestIoCtxImpl.h
@@ -22,6 +22,7 @@ class TestRadosClient;
typedef boost::function<int(TestIoCtxImpl*,
const std::string&,
bufferlist *,
+ uint64_t,
const SnapContext &)> ObjectOperationTestImpl;
typedef std::list<ObjectOperationTestImpl> ObjectOperations;
@@ -89,7 +90,7 @@ public:
int flags);
virtual int aio_operate_read(const std::string& oid, TestObjectOperationImpl &ops,
AioCompletionImpl *c, int flags,
- bufferlist *pbl);
+ bufferlist *pbl, uint64_t snap_id);
virtual int aio_remove(const std::string& oid, AioCompletionImpl *c,
int flags = 0) = 0;
virtual int aio_watch(const std::string& o, AioCompletionImpl *c,
@@ -97,14 +98,14 @@ public:
virtual int aio_unwatch(uint64_t handle, AioCompletionImpl *c);
virtual int append(const std::string& oid, const bufferlist &bl,
const SnapContext &snapc) = 0;
- virtual int assert_exists(const std::string &oid) = 0;
+ virtual int assert_exists(const std::string &oid, uint64_t snap_id) = 0;
virtual int create(const std::string& oid, bool exclusive,
const SnapContext &snapc) = 0;
virtual int exec(const std::string& oid, TestClassHandler *handler,
const char *cls, const char *method,
bufferlist& inbl, bufferlist* outbl,
- const SnapContext &snapc);
+ uint64_t snap_id, const SnapContext &snapc);
virtual int list_snaps(const std::string& o, snap_set_t *out_snaps) = 0;
virtual int list_watchers(const std::string& o,
std::list<obj_watch_t> *out_watchers);
@@ -131,7 +132,7 @@ public:
virtual int operate_read(const std::string& oid, TestObjectOperationImpl &ops,
bufferlist *pbl);
virtual int read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) = 0;
+ bufferlist *bl, uint64_t snap_id) = 0;
virtual int remove(const std::string& oid, const SnapContext &snapc) = 0;
virtual int selfmanaged_snap_create(uint64_t *snapid) = 0;
virtual void aio_selfmanaged_snap_create(uint64_t *snapid,
@@ -151,7 +152,7 @@ public:
virtual void set_snap_read(snap_t seq);
virtual int sparse_read(const std::string& oid, uint64_t off, uint64_t len,
std::map<uint64_t,uint64_t> *m,
- bufferlist *data_bl) = 0;
+ bufferlist *data_bl, uint64_t snap_id) = 0;
virtual int stat(const std::string& oid, uint64_t *psize, time_t *pmtime) = 0;
virtual int truncate(const std::string& oid, uint64_t size,
const SnapContext &snapc) = 0;
@@ -165,7 +166,8 @@ public:
const SnapContext &snapc) = 0;
virtual int writesame(const std::string& oid, bufferlist& bl, size_t len,
uint64_t off, const SnapContext &snapc) = 0;
- virtual int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) = 0;
+ virtual int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) = 0;
virtual int xattr_get(const std::string& oid,
std::map<std::string, bufferlist>* attrset) = 0;
virtual int xattr_set(const std::string& oid, const std::string &name,
@@ -182,7 +184,8 @@ protected:
int execute_aio_operations(const std::string& oid,
TestObjectOperationImpl *ops,
- bufferlist *pbl, const SnapContext &snapc);
+ bufferlist *pbl, uint64_t,
+ const SnapContext &snapc);
private:
struct C_AioNotify : public Context {
diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
index dae137b4543..d1f2f8cda51 100644
--- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc
+++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
@@ -76,7 +76,7 @@ int TestMemIoCtxImpl::append(const std::string& oid, const bufferlist &bl,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
@@ -86,13 +86,13 @@ int TestMemIoCtxImpl::append(const std::string& oid, const bufferlist &bl,
return 0;
}
-int TestMemIoCtxImpl::assert_exists(const std::string &oid) {
+int TestMemIoCtxImpl::assert_exists(const std::string &oid, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
std::shared_lock l{m_pool->file_lock};
- TestMemCluster::SharedFile file = get_file(oid, false, get_snap_context());
+ TestMemCluster::SharedFile file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
@@ -108,7 +108,7 @@ int TestMemIoCtxImpl::create(const std::string& oid, bool exclusive,
}
std::unique_lock l{m_pool->file_lock};
- get_file(oid, true, snapc);
+ get_file(oid, true, CEPH_NOSNAP, snapc);
return 0;
}
@@ -198,7 +198,7 @@ int TestMemIoCtxImpl::omap_get_vals2(const std::string& oid,
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, CEPH_NOSNAP, {});
if (file == NULL) {
return -ENOENT;
}
@@ -255,7 +255,7 @@ int TestMemIoCtxImpl::omap_rm_keys(const std::string& oid,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, get_snap_context());
+ file = get_file(oid, true, CEPH_NOSNAP, get_snap_context());
if (file == NULL) {
return -ENOENT;
}
@@ -280,7 +280,7 @@ int TestMemIoCtxImpl::omap_set(const std::string& oid,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, get_snap_context());
+ file = get_file(oid, true, CEPH_NOSNAP, get_snap_context());
if (file == NULL) {
return -ENOENT;
}
@@ -298,7 +298,7 @@ int TestMemIoCtxImpl::omap_set(const std::string& oid,
}
int TestMemIoCtxImpl::read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) {
+ bufferlist *bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
@@ -306,7 +306,7 @@ int TestMemIoCtxImpl::read(const std::string& oid, size_t len, uint64_t off,
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
@@ -333,11 +333,11 @@ int TestMemIoCtxImpl::remove(const std::string& oid, const SnapContext &snapc) {
}
std::unique_lock l{m_pool->file_lock};
- TestMemCluster::SharedFile file = get_file(oid, false, snapc);
+ TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, snapc);
if (file == NULL) {
return -ENOENT;
}
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
{
std::unique_lock l2{file->lock};
@@ -455,7 +455,7 @@ int TestMemIoCtxImpl::set_alloc_hint(const std::string& oid,
{
std::unique_lock l{m_pool->file_lock};
- get_file(oid, true, snapc);
+ get_file(oid, true, CEPH_NOSNAP, snapc);
}
return 0;
@@ -464,7 +464,7 @@ int TestMemIoCtxImpl::set_alloc_hint(const std::string& oid,
int TestMemIoCtxImpl::sparse_read(const std::string& oid, uint64_t off,
uint64_t len,
std::map<uint64_t,uint64_t> *m,
- bufferlist *data_bl) {
+ bufferlist *data_bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
@@ -473,7 +473,7 @@ int TestMemIoCtxImpl::sparse_read(const std::string& oid, uint64_t off,
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return -ENOENT;
}
@@ -505,7 +505,7 @@ int TestMemIoCtxImpl::stat(const std::string& oid, uint64_t *psize,
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, CEPH_NOSNAP, {});
if (file == NULL) {
return -ENOENT;
}
@@ -532,7 +532,7 @@ int TestMemIoCtxImpl::truncate(const std::string& oid, uint64_t size,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
@@ -570,7 +570,7 @@ int TestMemIoCtxImpl::write(const std::string& oid, bufferlist& bl, size_t len,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
@@ -597,7 +597,7 @@ int TestMemIoCtxImpl::write_full(const std::string& oid, bufferlist& bl,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
if (file == NULL) {
return -ENOENT;
}
@@ -617,8 +617,9 @@ int TestMemIoCtxImpl::write_full(const std::string& oid, bufferlist& bl,
return 0;
}
-int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl, size_t len,
- uint64_t off, const SnapContext &snapc) {
+int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl,
+ size_t len, uint64_t off,
+ const SnapContext &snapc) {
if (get_snap_read() != CEPH_NOSNAP) {
return -EROFS;
} else if (m_client->is_blacklisted()) {
@@ -632,7 +633,7 @@ int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl, size_t l
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
}
std::unique_lock l{file->lock};
@@ -653,7 +654,7 @@ int TestMemIoCtxImpl::writesame(const std::string& oid, bufferlist& bl, size_t l
}
int TestMemIoCtxImpl::cmpext(const std::string& oid, uint64_t off,
- bufferlist& cmp_bl) {
+ bufferlist& cmp_bl, uint64_t snap_id) {
if (m_client->is_blacklisted()) {
return -EBLACKLISTED;
}
@@ -664,7 +665,7 @@ int TestMemIoCtxImpl::cmpext(const std::string& oid, uint64_t off,
TestMemCluster::SharedFile file;
{
std::shared_lock l{m_pool->file_lock};
- file = get_file(oid, false, get_snap_context());
+ file = get_file(oid, false, snap_id, {});
if (file == NULL) {
return cmpext_compare(cmp_bl, read_bl);
}
@@ -718,11 +719,11 @@ int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len,
TestMemCluster::SharedFile file;
{
std::unique_lock l{m_pool->file_lock};
- file = get_file(oid, false, snapc);
+ file = get_file(oid, false, CEPH_NOSNAP, snapc);
if (!file) {
return 0;
}
- file = get_file(oid, true, snapc);
+ file = get_file(oid, true, CEPH_NOSNAP, snapc);
std::shared_lock l2{file->lock};
if (len > 0 && off + len >= file->data.length()) {
@@ -768,7 +769,8 @@ void TestMemIoCtxImpl::ensure_minimum_length(size_t len, bufferlist *bl) {
}
TestMemCluster::SharedFile TestMemIoCtxImpl::get_file(
- const std::string &oid, bool write, const SnapContext &snapc) {
+ const std::string &oid, bool write, uint64_t snap_id,
+ const SnapContext &snapc) {
ceph_assert(ceph_mutex_is_locked(m_pool->file_lock) ||
ceph_mutex_is_wlocked(m_pool->file_lock));
ceph_assert(!write || ceph_mutex_is_wlocked(m_pool->file_lock));
@@ -817,7 +819,7 @@ TestMemCluster::SharedFile TestMemIoCtxImpl::get_file(
return file;
}
- if (get_snap_read() == CEPH_NOSNAP) {
+ if (snap_id == CEPH_NOSNAP) {
if (!file->exists) {
ceph_assert(it->second.size() > 1);
return TestMemCluster::SharedFile();
@@ -829,7 +831,7 @@ TestMemCluster::SharedFile TestMemIoCtxImpl::get_file(
for (TestMemCluster::FileSnapshots::reverse_iterator it = snaps.rbegin();
it != snaps.rend(); ++it) {
TestMemCluster::SharedFile file = *it;
- if (file->snap_id < get_snap_read()) {
+ if (file->snap_id < snap_id) {
if (!file->exists) {
return TestMemCluster::SharedFile();
}
diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.h b/src/test/librados_test_stub/TestMemIoCtxImpl.h
index 712c57f8cc8..d4be453868f 100644
--- a/src/test/librados_test_stub/TestMemIoCtxImpl.h
+++ b/src/test/librados_test_stub/TestMemIoCtxImpl.h
@@ -26,7 +26,7 @@ public:
int append(const std::string& oid, const bufferlist &bl,
const SnapContext &snapc) override;
- int assert_exists(const std::string &oid) override;
+ int assert_exists(const std::string &oid, uint64_t snap_id) override;
int create(const std::string& oid, bool exclusive,
const SnapContext &snapc) override;
@@ -47,7 +47,7 @@ public:
int omap_set(const std::string& oid, const std::map<std::string,
bufferlist> &map) override;
int read(const std::string& oid, size_t len, uint64_t off,
- bufferlist *bl) override;
+ bufferlist *bl, uint64_t snap_id) override;
int remove(const std::string& oid, const SnapContext &snapc) override;
int selfmanaged_snap_create(uint64_t *snapid) override;
int selfmanaged_snap_remove(uint64_t snapid) override;
@@ -57,7 +57,8 @@ public:
uint64_t expected_write_size, uint32_t flags,
const SnapContext &snapc) override;
int sparse_read(const std::string& oid, uint64_t off, uint64_t len,
- std::map<uint64_t,uint64_t> *m, bufferlist *data_bl) override;
+ std::map<uint64_t,uint64_t> *m, bufferlist *data_bl,
+ uint64_t snap_id) override;
int stat(const std::string& oid, uint64_t *psize, time_t *pmtime) override;
int truncate(const std::string& oid, uint64_t size,
const SnapContext &snapc) override;
@@ -67,7 +68,8 @@ public:
const SnapContext &snapc) override;
int writesame(const std::string& oid, bufferlist& bl, size_t len,
uint64_t off, const SnapContext &snapc) override;
- int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl) override;
+ int cmpext(const std::string& oid, uint64_t off, bufferlist& cmp_bl,
+ uint64_t snap_id) override;
int xattr_get(const std::string& oid,
std::map<std::string, bufferlist>* attrset) override;
int xattr_set(const std::string& oid, const std::string &name,
@@ -91,6 +93,7 @@ private:
void ensure_minimum_length(size_t len, bufferlist *bl);
TestMemCluster::SharedFile get_file(const std::string &oid, bool write,
+ uint64_t snap_id,
const SnapContext &snapc);
};
diff --git a/src/test/librados_test_stub/TestRadosClient.cc b/src/test/librados_test_stub/TestRadosClient.cc
index 2d75a4b2aa9..aa002af4766 100644
--- a/src/test/librados_test_stub/TestRadosClient.cc
+++ b/src/test/librados_test_stub/TestRadosClient.cc
@@ -7,7 +7,9 @@
#include "include/ceph_assert.h"
#include "common/ceph_json.h"
#include "common/Finisher.h"
+#include "common/async/context_pool.h"
#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <errno.h>
@@ -31,6 +33,15 @@ static int get_concurrency() {
namespace librados {
+namespace {
+
+const char *config_keys[] = {
+ "librados_thread_count",
+ NULL
+};
+
+} // anonymous namespace
+
static void finish_aio_completion(AioCompletionImpl *c, int r) {
c->lock.lock();
c->complete = true;
@@ -87,7 +98,8 @@ private:
TestRadosClient::TestRadosClient(CephContext *cct,
TestWatchNotify *watch_notify)
: m_cct(cct->get()), m_watch_notify(watch_notify),
- m_aio_finisher(new Finisher(m_cct))
+ m_aio_finisher(new Finisher(m_cct)),
+ m_io_context_pool(std::make_unique<ceph::async::io_context_pool>())
{
get();
@@ -100,6 +112,11 @@ TestRadosClient::TestRadosClient(CephContext *cct,
// replicate AIO callback processing
m_aio_finisher->start();
+
+ // replicate neorados callback processing
+ m_cct->_conf.add_observer(this);
+ m_io_context_pool->start(m_cct->_conf.get_val<uint64_t>(
+ "librados_thread_count"));
}
TestRadosClient::~TestRadosClient() {
@@ -112,10 +129,30 @@ TestRadosClient::~TestRadosClient() {
m_aio_finisher->stop();
delete m_aio_finisher;
+ m_cct->_conf.remove_observer(this);
+ m_io_context_pool->stop();
+
m_cct->put();
m_cct = NULL;
}
+boost::asio::io_context& TestRadosClient::get_io_context() {
+ return m_io_context_pool->get_io_context();
+}
+
+const char** TestRadosClient::get_tracked_conf_keys() const {
+ return config_keys;
+}
+
+void TestRadosClient::handle_conf_change(
+ const ConfigProxy& conf, const std::set<std::string> &changed) {
+ if (changed.count("librados_thread_count")) {
+ m_io_context_pool->stop();
+ m_io_context_pool->start(conf.get_val<std::uint64_t>(
+ "librados_thread_count"));
+ }
+}
+
void TestRadosClient::get() {
m_refcount++;
}
@@ -186,6 +223,18 @@ int TestRadosClient::mon_command(const std::vector<std::string>& cmd,
str << "]}";
outbl->append(str.str());
return 0;
+ } else if ((*j_it)->get_data() == "osd blacklist") {
+ auto op_it = parser.find("blacklistop");
+ if (!op_it.end() && (*op_it)->get_data() == "add") {
+ uint32_t expire = 0;
+ auto expire_it = parser.find("expire");
+ if (!expire_it.end()) {
+ expire = boost::lexical_cast<uint32_t>((*expire_it)->get_data());
+ }
+
+ auto addr_it = parser.find("addr");
+ return blacklist_add((*addr_it)->get_data(), expire);
+ }
}
}
return -ENOSYS;
diff --git a/src/test/librados_test_stub/TestRadosClient.h b/src/test/librados_test_stub/TestRadosClient.h
index 993382f7b98..4a247670b3c 100644
--- a/src/test/librados_test_stub/TestRadosClient.h
+++ b/src/test/librados_test_stub/TestRadosClient.h
@@ -5,6 +5,7 @@
#define CEPH_TEST_RADOS_CLIENT_H
#include <map>
+#include <memory>
#include <list>
#include <string>
#include <vector>
@@ -15,16 +16,20 @@
#include "include/rados/librados.hpp"
#include "common/config.h"
+#include "common/config_obs.h"
#include "include/buffer_fwd.h"
#include "test/librados_test_stub/TestWatchNotify.h"
class Finisher;
+namespace boost { namespace asio { struct io_context; }}
+namespace ceph { namespace async { struct io_context_pool; }}
+
namespace librados {
class TestIoCtxImpl;
-class TestRadosClient {
+class TestRadosClient : public md_config_obs_t {
public:
static void Deallocate(librados::TestRadosClient* client)
@@ -103,6 +108,10 @@ public:
virtual int blacklist_add(const std::string& client_address,
uint32_t expire_seconds) = 0;
+ virtual int wait_for_latest_osd_map() {
+ return 0;
+ }
+
Finisher *get_aio_finisher() {
return m_aio_finisher;
}
@@ -117,6 +126,8 @@ public:
void finish_aio_completion(AioCompletionImpl *c, int r);
+ boost::asio::io_context& get_io_context();
+
protected:
virtual ~TestRadosClient();
@@ -125,7 +136,12 @@ protected:
virtual void transaction_finish(const std::string& nspace,
const std::string &oid) = 0;
+ const char** get_tracked_conf_keys() const override;
+ void handle_conf_change(const ConfigProxy& conf,
+ const std::set<std::string> &changed) override;
+
private:
+ struct IOContextPool;
CephContext *m_cct;
std::atomic<uint64_t> m_refcount = { 0 };
@@ -138,6 +154,7 @@ private:
std::vector<Finisher *> m_finishers;
boost::hash<std::string> m_hash;
+ std::unique_ptr<ceph::async::io_context_pool> m_io_context_pool;
};
} // namespace librados
diff --git a/src/test/librbd/CMakeLists.txt b/src/test/librbd/CMakeLists.txt
index e57842ef982..8189b46d755 100644
--- a/src/test/librbd/CMakeLists.txt
+++ b/src/test/librbd/CMakeLists.txt
@@ -126,22 +126,23 @@ add_executable(unittest_librbd
${unittest_librbd_srcs}
$<TARGET_OBJECTS:common_texttable_obj>)
target_compile_definitions(unittest_librbd PRIVATE "TEST_LIBRBD_INTERNALS")
-target_link_libraries(unittest_librbd
- cls_rbd
- cls_rbd_client
+add_dependencies(unittest_librbd
+ cls_journal
cls_lock
- cls_lock_client
+ cls_rbd)
+target_link_libraries(unittest_librbd
+ rbd_test
+ rbd_api
+ rbd_internal
+ rbd_test_mock
journal
journal_test_mock
- cls_journal
+ cls_rbd_client
+ cls_lock_client
cls_journal_client
+ rbd_types
rados_test_stub
librados
- rbd_test
- rbd_test_mock
- rbd_api
- rbd_internal
- rbd_types
ceph_immutable_object_cache_lib
osdc
ceph-common
@@ -159,6 +160,7 @@ target_link_libraries(ceph_test_librbd
journal
cls_journal_client
cls_rbd_client
+ libneorados
librados
${UNITTEST_LIBS}
radostest)
diff --git a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
index 1b2172a51cc..f20867cd4ba 100644
--- a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
@@ -3,6 +3,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "include/rbd/librbd.hpp"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/internal.h"
@@ -174,7 +175,10 @@ public:
librbd::ImageCtx *m_src_image_ctx;
librbd::ImageCtx *m_dst_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
+
librbd::SnapSeqs m_snap_seqs;
SnapMap m_snap_map;
@@ -188,7 +192,9 @@ public:
ASSERT_EQ(0, create_image_pp(rbd, m_ioctx, dst_image_name, m_image_size));
ASSERT_EQ(0, open_image(dst_image_name, &m_dst_image_ctx));
- librbd::ImageCtx::get_work_queue(m_src_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_src_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void expect_get_image_size(librbd::MockTestImageCtx &mock_image_ctx,
diff --git a/src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc
index a44cd4cda3e..ba59e3cdb7c 100644
--- a/src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_MetadataCopyRequest.cc
@@ -4,6 +4,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "include/rbd/librbd.hpp"
#include "include/stringify.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/deep_copy/MetadataCopyRequest.h"
#include "librbd/image/GetMetadataRequest.h"
@@ -79,6 +80,8 @@ public:
librbd::ImageCtx *m_src_image_ctx;
librbd::ImageCtx *m_dst_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
void SetUp() override {
@@ -91,7 +94,9 @@ public:
ASSERT_EQ(0, create_image_pp(rbd, m_ioctx, dst_image_name, m_image_size));
ASSERT_EQ(0, open_image(dst_image_name, &m_dst_image_ctx));
- librbd::ImageCtx::get_work_queue(m_src_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_src_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void expect_get_metadata(MockGetMetadataRequest& mock_request,
@@ -110,7 +115,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
index 03de245f151..3c6db9057d2 100644
--- a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
@@ -5,6 +5,7 @@
#include "include/interval_set.h"
#include "include/rbd/librbd.hpp"
#include "include/rbd/object_map_types.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/internal.h"
@@ -112,6 +113,8 @@ public:
librbd::ImageCtx *m_src_image_ctx;
librbd::ImageCtx *m_dst_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
SnapMap m_snap_map;
@@ -132,7 +135,9 @@ public:
ASSERT_EQ(0, create_image_pp(rbd, m_ioctx, dst_image_name, m_image_size));
ASSERT_EQ(0, open_image(dst_image_name, &m_dst_image_ctx));
- librbd::ImageCtx::get_work_queue(m_src_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_src_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
bool is_fast_diff(librbd::MockImageCtx &mock_image_ctx) {
@@ -220,7 +225,8 @@ public:
void expect_sparse_read(librados::MockTestMemIoCtxImpl &mock_io_ctx, uint64_t offset,
uint64_t length, int r) {
- auto &expect = EXPECT_CALL(mock_io_ctx, sparse_read(_, offset, length, _, _));
+ auto &expect = EXPECT_CALL(mock_io_ctx, sparse_read(_, offset, length, _, _,
+ _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc b/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
index f044f55e0c7..209339973ed 100644
--- a/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SetHeadRequest.cc
@@ -4,6 +4,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "test/librados_test_stub/LibradosTestStub.h"
#include "include/rbd/librbd.hpp"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "osdc/Striper.h"
@@ -97,6 +98,8 @@ public:
typedef image::DetachParentRequest<MockTestImageCtx> MockDetachParentRequest;
librbd::ImageCtx *m_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
void SetUp() override {
@@ -104,7 +107,9 @@ public:
ASSERT_EQ(0, open_image(m_image_name, &m_image_ctx));
- librbd::ImageCtx::get_work_queue(m_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void expect_start_op(librbd::MockExclusiveLock &mock_exclusive_lock) {
@@ -119,7 +124,8 @@ public:
void expect_set_size(librbd::MockTestImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("set_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("set_size"), _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
index f2e10cfde40..6a52898220a 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
@@ -3,6 +3,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "include/rbd/librbd.hpp"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/Operations.h"
@@ -106,6 +107,8 @@ public:
librbd::ImageCtx *m_src_image_ctx;
librbd::ImageCtx *m_dst_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
librbd::SnapSeqs m_snap_seqs;
@@ -120,7 +123,9 @@ public:
ASSERT_EQ(0, create_image_pp(rbd, m_ioctx, dst_image_name, m_image_size));
ASSERT_EQ(0, open_image(dst_image_name, &m_dst_image_ctx));
- librbd::ImageCtx::get_work_queue(m_src_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_src_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void prepare_exclusive_lock(librbd::MockImageCtx &mock_image_ctx,
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
index b192e3f1a6f..af24f5a0cf2 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
@@ -4,6 +4,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "test/librados_test_stub/LibradosTestStub.h"
#include "include/rbd/librbd.hpp"
+#include "librbd/AsioEngine.h"
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/Operations.h"
@@ -76,6 +77,8 @@ public:
typedef SnapshotCreateRequest<librbd::MockTestImageCtx> MockSnapshotCreateRequest;
librbd::ImageCtx *m_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
asio::ContextWQ *m_work_queue;
void SetUp() override {
@@ -83,7 +86,9 @@ public:
ASSERT_EQ(0, open_image(m_image_name, &m_image_ctx));
- librbd::ImageCtx::get_work_queue(m_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void expect_start_op(librbd::MockExclusiveLock &mock_exclusive_lock) {
@@ -122,7 +127,8 @@ public:
std::string oid(librbd::ObjectMap<>::object_map_name(mock_image_ctx.id,
snap_id));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _,
+ _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/image/test_mock_AttachChildRequest.cc b/src/test/librbd/image/test_mock_AttachChildRequest.cc
index 100d2da2457..66d594eb025 100644
--- a/src/test/librbd/image/test_mock_AttachChildRequest.cc
+++ b/src/test/librbd/image/test_mock_AttachChildRequest.cc
@@ -92,7 +92,8 @@ public:
void expect_add_child(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("add_child"), _, _, _))
+ exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("add_child"), _, _, _,
+ _))
.WillOnce(Return(r));
}
@@ -119,7 +120,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(util::header_name(mock_image_ctx.id), _, StrEq("rbd"),
- StrEq("op_features_set"), ContentsEqual(bl), _, _))
+ StrEq("op_features_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
@@ -131,7 +132,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("child_attach"), ContentsEqual(bl), _, _))
+ StrEq("child_attach"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/image/test_mock_AttachParentRequest.cc b/src/test/librbd/image/test_mock_AttachParentRequest.cc
index c8c6ca71bcc..de5f644310b 100644
--- a/src/test/librbd/image/test_mock_AttachParentRequest.cc
+++ b/src/test/librbd/image/test_mock_AttachParentRequest.cc
@@ -45,14 +45,14 @@ public:
void expect_parent_attach(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_attach"), _, _, _))
+ StrEq("parent_attach"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_set_parent(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_parent"), _, _, _))
+ StrEq("set_parent"), _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/image/test_mock_CloneRequest.cc b/src/test/librbd/image/test_mock_CloneRequest.cc
index 1745a96335c..1a0524e5689 100644
--- a/src/test/librbd/image/test_mock_CloneRequest.cc
+++ b/src/test/librbd/image/test_mock_CloneRequest.cc
@@ -332,7 +332,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(WithArg<5>(Invoke([out_bl, r](bufferlist* out) {
*out = out_bl;
return r;
diff --git a/src/test/librbd/image/test_mock_DetachChildRequest.cc b/src/test/librbd/image/test_mock_DetachChildRequest.cc
index cd62099c00f..f160305a007 100644
--- a/src/test/librbd/image/test_mock_DetachChildRequest.cc
+++ b/src/test/librbd/image/test_mock_DetachChildRequest.cc
@@ -130,14 +130,14 @@ public:
EXPECT_CALL(mock_io_ctx_impl,
exec(util::header_name(parent_spec.image_id),
_, StrEq("rbd"), StrEq("child_detach"), ContentsEqual(bl),
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
void expect_remove_child(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("remove_child"), _,
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
@@ -149,7 +149,7 @@ public:
using ceph::encode;
EXPECT_CALL(mock_io_ctx_impl,
exec(parent_header_name, _, StrEq("rbd"),
- StrEq("snapshot_get"), _, _, _))
+ StrEq("snapshot_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([snap_info, r](bufferlist* bl) {
encode(snap_info, *bl);
return r;
@@ -194,7 +194,7 @@ public:
using ceph::encode;
EXPECT_CALL(mock_io_ctx_impl,
exec(RBD_TRASH, _, StrEq("rbd"),
- StrEq("trash_get"), _, _, _))
+ StrEq("trash_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([trash_spec, r](bufferlist* bl) {
encode(trash_spec, *bl);
return r;
diff --git a/src/test/librbd/image/test_mock_DetachParentRequest.cc b/src/test/librbd/image/test_mock_DetachParentRequest.cc
index 3d7a0e32503..4d9f012f823 100644
--- a/src/test/librbd/image/test_mock_DetachParentRequest.cc
+++ b/src/test/librbd/image/test_mock_DetachParentRequest.cc
@@ -45,14 +45,14 @@ public:
void expect_parent_detach(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_detach"), _, _, _))
+ StrEq("parent_detach"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_remove_parent(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("remove_parent"), _, _, _))
+ StrEq("remove_parent"), _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/image/test_mock_PreRemoveRequest.cc b/src/test/librbd/image/test_mock_PreRemoveRequest.cc
index 08c6eb1627c..a451104f882 100644
--- a/src/test/librbd/image/test_mock_PreRemoveRequest.cc
+++ b/src/test/librbd/image/test_mock_PreRemoveRequest.cc
@@ -183,7 +183,7 @@ public:
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("image_group_get"), _, _, _));
+ StrEq("image_group_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/image/test_mock_RefreshRequest.cc b/src/test/librbd/image/test_mock_RefreshRequest.cc
index 93f30186406..c032cb7f791 100644
--- a/src/test/librbd/image/test_mock_RefreshRequest.cc
+++ b/src/test/librbd/image/test_mock_RefreshRequest.cc
@@ -196,7 +196,7 @@ public:
void expect_v1_read_header(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- read(mock_image_ctx.header_oid, _, _, _));
+ read(mock_image_ctx.header_oid, _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -206,7 +206,8 @@ public:
void expect_v1_get_snapshots(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("snap_list"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("snap_list"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -216,7 +217,8 @@ public:
void expect_v1_get_locks(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("get_info"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -227,7 +229,8 @@ public:
void expect_get_mutable_metadata(MockRefreshImageCtx &mock_image_ctx,
uint64_t features, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_size"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -237,7 +240,8 @@ public:
expect.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_features"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_features"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([features, incompatible](bufferlist* out_bl) {
encode(features, *out_bl);
encode(incompatible, *out_bl);
@@ -245,10 +249,12 @@ public:
})));
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapcontext"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapcontext"), _, _, _, _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("get_info"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("get_info"), _, _, _, _))
.WillOnce(DoDefault());
}
}
@@ -256,7 +262,7 @@ public:
void expect_parent_overlap_get(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_overlap_get"), _, _, _));
+ StrEq("parent_overlap_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -267,7 +273,7 @@ public:
void expect_get_parent(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("parent_get"), _, _, _));
+ StrEq("parent_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -279,7 +285,7 @@ public:
void expect_get_parent_legacy(MockRefreshImageCtx &mock_image_ctx, int r) {
auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("get_parent"), _, _, _));
+ StrEq("get_parent"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -290,7 +296,7 @@ public:
void expect_get_migration_header(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("migration_get"), _, _, _));
+ StrEq("migration_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -313,7 +319,8 @@ public:
void expect_get_flags(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_flags"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_flags"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -325,7 +332,7 @@ public:
uint64_t op_features, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("op_features_get"), _, _, _))
+ StrEq("op_features_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([op_features, r](bufferlist* out_bl) {
encode(op_features, *out_bl);
return r;
@@ -335,7 +342,7 @@ public:
void expect_get_group(MockRefreshImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("image_group_get"), _, _, _));
+ StrEq("image_group_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -346,21 +353,24 @@ public:
void expect_get_snapshots(MockRefreshImageCtx &mock_image_ctx,
bool legacy_parent, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("snapshot_get"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("snapshot_get"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
expect.WillOnce(DoDefault());
if (legacy_parent) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_parent"), _, _, _, _))
.WillOnce(DoDefault());
} else {
expect_parent_overlap_get(mock_image_ctx, 0);
}
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_protection_status"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_protection_status"), _, _, _, _))
.WillOnce(DoDefault());
}
}
@@ -368,25 +378,30 @@ public:
void expect_get_snapshots_legacy(MockRefreshImageCtx &mock_image_ctx,
bool include_timestamp, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapshot_name"), _, _, _));
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapshot_name"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
expect.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_size"), _, _, _, _))
.WillOnce(DoDefault());
if (include_timestamp) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_snapshot_timestamp"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_snapshot_timestamp"), _, _, _, _))
.WillOnce(DoDefault());
}
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_parent"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_parent"), _, _, _, _))
.WillOnce(DoDefault());
expect_get_flags(mock_image_ctx, 0);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("get_protection_status"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("get_protection_status"), _, _, _, _))
.WillOnce(DoDefault());
}
}
@@ -543,6 +558,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessV1) {
expect_v1_get_snapshots(mock_image_ctx, 0);
expect_v1_get_locks(mock_image_ctx, 0);
expect_init_layout(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -568,6 +584,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessSnapshotV1) {
expect_v1_get_locks(mock_image_ctx, 0);
expect_init_layout(mock_image_ctx);
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -602,6 +619,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessV2) {
if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -639,6 +657,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessSnapshotV2) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -678,6 +697,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessLegacySnapshotV2) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -718,6 +738,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessLegacySnapshotNoTimestampV2) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -760,6 +781,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessSetSnapshotV2) {
}
expect_add_snap(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
expect_get_snap_id(mock_image_ctx, "snap", ictx->snap_ids.begin()->second);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -817,6 +839,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessChild) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
expect_refresh_parent_apply(*mock_refresh_parent_request);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
expect_refresh_parent_finalize(mock_image_ctx, *mock_refresh_parent_request, 0);
C_SaferCond ctx;
@@ -871,6 +894,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessChildDontOpenParent) {
if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, true, &ctx);
@@ -908,6 +932,7 @@ TEST_F(TestMockImageRefreshRequest, SuccessOpFeatures) {
if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -973,6 +998,7 @@ TEST_F(TestMockImageRefreshRequest, DisableExclusiveLock) {
expect_apply_metadata(mock_image_ctx, 0);
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
expect_shut_down_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
C_SaferCond ctx;
@@ -1027,6 +1053,7 @@ TEST_F(TestMockImageRefreshRequest, DisableExclusiveLockWhileAcquiringLock) {
expect_apply_metadata(mock_image_ctx, 0);
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, true, false, &ctx);
@@ -1075,6 +1102,7 @@ TEST_F(TestMockImageRefreshRequest, JournalDisabledByPolicy) {
MockJournalPolicy mock_journal_policy;
expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
expect_journal_disabled(mock_journal_policy, true);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1125,6 +1153,7 @@ TEST_F(TestMockImageRefreshRequest, EnableJournalWithExclusiveLock) {
expect_get_journal_policy(mock_image_ctx, mock_journal_policy);
expect_journal_disabled(mock_journal_policy, false);
expect_open_journal(mock_image_ctx, mock_journal, 0);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1169,6 +1198,7 @@ TEST_F(TestMockImageRefreshRequest, EnableJournalWithoutExclusiveLock) {
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
expect_set_require_lock(mock_exclusive_lock, librbd::io::DIRECTION_BOTH);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1220,6 +1250,7 @@ TEST_F(TestMockImageRefreshRequest, DisableJournal) {
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
expect_block_writes(mock_image_ctx, 0);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
if (!mock_image_ctx.clone_copy_on_read) {
expect_unset_require_lock(mock_exclusive_lock, librbd::io::DIRECTION_READ);
}
@@ -1272,6 +1303,7 @@ TEST_F(TestMockImageRefreshRequest, EnableObjectMapWithExclusiveLock) {
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
expect_open_object_map(mock_image_ctx, &mock_object_map, 0);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1315,6 +1347,7 @@ TEST_F(TestMockImageRefreshRequest, EnableObjectMapWithoutExclusiveLock) {
expect_apply_metadata(mock_image_ctx, 0);
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1365,6 +1398,7 @@ TEST_F(TestMockImageRefreshRequest, DisableObjectMap) {
expect_apply_metadata(mock_image_ctx, 0);
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
expect_close_object_map(mock_image_ctx, mock_object_map, 0);
C_SaferCond ctx;
@@ -1412,6 +1446,7 @@ TEST_F(TestMockImageRefreshRequest, OpenObjectMapError) {
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
expect_open_object_map(mock_image_ctx, &mock_object_map, -EBLACKLISTED);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false,
@@ -1460,6 +1495,7 @@ TEST_F(TestMockImageRefreshRequest, OpenObjectMapTooLarge) {
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
expect_open_object_map(mock_image_ctx, &mock_object_map, -EFBIG);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false,
@@ -1496,6 +1532,7 @@ TEST_F(TestMockImageRefreshRequest, ApplyMetadataError) {
if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx;
MockRefreshRequest *req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx);
@@ -1530,6 +1567,7 @@ TEST_F(TestMockImageRefreshRequest, NonPrimaryFeature) {
expect_apply_metadata(mock_image_ctx, 0);
expect_get_group(mock_image_ctx, 0);
expect_refresh_parent_is_required(mock_refresh_parent_request, false);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx1;
auto req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx1);
@@ -1555,6 +1593,7 @@ TEST_F(TestMockImageRefreshRequest, NonPrimaryFeature) {
if (ictx->test_features(RBD_FEATURE_EXCLUSIVE_LOCK)) {
expect_init_exclusive_lock(mock_image_ctx, mock_exclusive_lock, 0);
}
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
C_SaferCond ctx2;
req = new MockRefreshRequest(mock_image_ctx, false, false, &ctx2);
diff --git a/src/test/librbd/image/test_mock_RemoveRequest.cc b/src/test/librbd/image/test_mock_RemoveRequest.cc
index d6359ff3274..9a6e8abdb00 100644
--- a/src/test/librbd/image/test_mock_RemoveRequest.cc
+++ b/src/test/librbd/image/test_mock_RemoveRequest.cc
@@ -291,15 +291,15 @@ public:
void expect_remove_mirror_image(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
- exec(StrEq("rbd_mirroring"), _, StrEq("rbd"), StrEq("mirror_image_remove"),
- _, _, _))
+ exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
+ StrEq("mirror_image_remove"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_dir_remove_image(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_remove_image"),
- _, _, _))
+ _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/image/test_mock_ValidatePoolRequest.cc b/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
index e40e50af0ad..7bb3ead9db9 100644
--- a/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
+++ b/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
@@ -52,7 +52,7 @@ public:
void expect_read_rbd_info(librados::MockTestMemIoCtxImpl &mock_io_ctx,
const std::string& data, int r) {
- auto& expect = EXPECT_CALL(mock_io_ctx, read(StrEq(RBD_INFO), 0, 0, _));
+ auto& expect = EXPECT_CALL(mock_io_ctx, read(StrEq(RBD_INFO), 0, 0, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/io/test_mock_CopyupRequest.cc b/src/test/librbd/io/test_mock_CopyupRequest.cc
index 6bb9294bec8..b0f3eae101a 100644
--- a/src/test/librbd/io/test_mock_CopyupRequest.cc
+++ b/src/test/librbd/io/test_mock_CopyupRequest.cc
@@ -83,7 +83,7 @@ namespace io {
template <>
struct ObjectRequest<librbd::MockTestImageCtx> {
static void add_write_hint(librbd::MockTestImageCtx&,
- librados::ObjectWriteOperation*) {
+ neorados::WriteOp*) {
}
};
@@ -97,7 +97,7 @@ struct AbstractObjectWriteRequest<librbd::MockTestImageCtx> {
MOCK_CONST_METHOD0(get_pre_write_object_map_state, uint8_t());
MOCK_CONST_METHOD0(is_empty_write_op, bool());
- MOCK_METHOD1(add_copyup_ops, void(librados::ObjectWriteOperation*));
+ MOCK_METHOD1(add_copyup_ops, void(neorados::WriteOp*));
};
template <>
@@ -175,23 +175,19 @@ struct TestMockIoCopyupRequest : public TestMockFixture {
void expect_get_parent_overlap(MockTestImageCtx& mock_image_ctx,
librados::snap_t snap_id, uint64_t overlap,
int r) {
- if (mock_image_ctx.object_map != nullptr) {
- EXPECT_CALL(mock_image_ctx, get_parent_overlap(snap_id, _))
- .WillOnce(WithArg<1>(Invoke([overlap, r](uint64_t *o) {
- *o = overlap;
- return r;
- })));
- }
+ EXPECT_CALL(mock_image_ctx, get_parent_overlap(snap_id, _))
+ .WillOnce(WithArg<1>(Invoke([overlap, r](uint64_t *o) {
+ *o = overlap;
+ return r;
+ })));
}
void expect_prune_parent_extents(MockTestImageCtx& mock_image_ctx,
uint64_t overlap, uint64_t object_overlap) {
- if (mock_image_ctx.object_map != nullptr) {
- EXPECT_CALL(mock_image_ctx, prune_parent_extents(_, overlap))
- .WillOnce(WithoutArgs(Invoke([object_overlap]() {
- return object_overlap;
- })));
- }
+ EXPECT_CALL(mock_image_ctx, prune_parent_extents(_, overlap))
+ .WillOnce(WithoutArgs(Invoke([object_overlap]() {
+ return object_overlap;
+ })));
}
void expect_read_parent(MockTestImageCtx& mock_image_ctx,
@@ -221,9 +217,11 @@ struct TestMockIoCopyupRequest : public TestMockFixture {
snapc = mock_image_ctx.snapc;
}
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx,
exec(oid, _, StrEq("rbd"), StrEq("copyup"),
- ContentsEqual(in_bl), _, snapc))
+ ContentsEqual(in_bl), _, _, snapc))
.WillOnce(Return(r));
}
@@ -243,9 +241,11 @@ struct TestMockIoCopyupRequest : public TestMockFixture {
snapc = mock_image_ctx.snapc;
}
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx,
exec(oid, _, StrEq("rbd"), StrEq("sparse_copyup"),
- ContentsEqual(in_bl), _, snapc))
+ ContentsEqual(in_bl), _, _, snapc))
.WillOnce(Return(r));
}
@@ -256,8 +256,9 @@ struct TestMockIoCopyupRequest : public TestMockFixture {
snapc = mock_image_ctx.snapc;
}
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- write(oid, _, 0, 0, snapc))
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx, write(oid, _, 0, 0, snapc))
.WillOnce(Return(r));
}
@@ -283,7 +284,7 @@ struct TestMockIoCopyupRequest : public TestMockFixture {
void expect_add_copyup_ops(MockAbstractObjectWriteRequest& mock_write_request) {
EXPECT_CALL(mock_write_request, add_copyup_ops(_))
- .WillOnce(Invoke([](librados::ObjectWriteOperation* op) {
+ .WillOnce(Invoke([](neorados::WriteOp* op) {
op->write(0, bufferlist{});
}));
}
@@ -918,8 +919,9 @@ TEST_F(TestMockIoCopyupRequest, RestartWrite) {
{{0, 4096}}, data, 0);
MockAbstractObjectWriteRequest mock_write_request2;
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- write(ictx->get_object_name(0), _, 0, 0, _))
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx, write(ictx->get_object_name(0), _, 0, 0, _))
.WillOnce(WithoutArgs(Invoke([req, &mock_write_request2]() {
req->append_request(&mock_write_request2);
return 0;
diff --git a/src/test/librbd/io/test_mock_ObjectRequest.cc b/src/test/librbd/io/test_mock_ObjectRequest.cc
index b963d737704..841b3c40d33 100644
--- a/src/test/librbd/io/test_mock_ObjectRequest.cc
+++ b/src/test/librbd/io/test_mock_ObjectRequest.cc
@@ -149,8 +149,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
bufferlist bl;
bl.append(data);
- auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- read(oid, len, off, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto& expect = EXPECT_CALL(mock_io_ctx, read(oid, len, off, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -167,8 +168,10 @@ struct TestMockIoObjectRequest : public TestMockFixture {
bufferlist bl;
bl.append(data);
- auto& expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- sparse_read(oid, off, len, _, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto& expect = EXPECT_CALL(mock_io_ctx,
+ sparse_read(oid, off, len, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -225,13 +228,17 @@ struct TestMockIoObjectRequest : public TestMockFixture {
}
void expect_assert_exists(MockTestImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx), assert_exists(_))
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx, assert_exists(_, _))
.WillOnce(Return(r));
}
void expect_write(MockTestImageCtx &mock_image_ctx,
uint64_t offset, uint64_t length, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx,
write(_, _, length, offset, _));
if (r < 0) {
expect.WillOnce(Return(r));
@@ -241,8 +248,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
}
void expect_write_full(MockTestImageCtx &mock_image_ctx, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- write_full(_, _, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, write_full(_, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -252,8 +260,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
void expect_writesame(MockTestImageCtx &mock_image_ctx,
uint64_t offset, uint64_t length, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- writesame(_, _, length, offset, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, writesame(_, _, length, offset, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -262,8 +271,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
}
void expect_remove(MockTestImageCtx &mock_image_ctx, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- remove(_, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, remove(_, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -272,13 +282,16 @@ struct TestMockIoObjectRequest : public TestMockFixture {
}
void expect_create(MockTestImageCtx &mock_image_ctx, bool exclusive) {
- EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx), create(_, exclusive, _))
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ EXPECT_CALL(mock_io_ctx, create(_, exclusive, _))
.Times(1);
}
void expect_truncate(MockTestImageCtx &mock_image_ctx, int offset, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- truncate(_, offset, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, truncate(_, offset, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -288,8 +301,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
void expect_zero(MockTestImageCtx &mock_image_ctx, int offset, int length,
int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- zero(_, offset, length, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, zero(_, offset, length, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -298,8 +312,9 @@ struct TestMockIoObjectRequest : public TestMockFixture {
}
void expect_cmpext(MockTestImageCtx &mock_image_ctx, int offset, int r) {
- auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.data_ctx),
- cmpext(_, offset, _));
+ auto& mock_io_ctx = librados::get_mock_io_ctx(
+ mock_image_ctx.rados_api, *mock_image_ctx.get_data_io_context());
+ auto &expect = EXPECT_CALL(mock_io_ctx, cmpext(_, offset, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -327,7 +342,7 @@ TEST_F(TestMockIoObjectRequest, Read) {
std::string(4096, '1'), 0);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, 4096, CEPH_NOSNAP, 0, {}, &bl, &extent_map, &ctx);
@@ -355,7 +370,7 @@ TEST_F(TestMockIoObjectRequest, SparseReadThreshold) {
std::string(ictx->sparse_read_threshold_bytes, '1'), 0);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, ictx->sparse_read_threshold_bytes, CEPH_NOSNAP, 0,
@@ -382,7 +397,7 @@ TEST_F(TestMockIoObjectRequest, ReadError) {
expect_read(mock_image_ctx, ictx->get_object_name(0), 0, 4096, "", -EPERM);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, 4096, CEPH_NOSNAP, 0, {}, &bl, &extent_map, &ctx);
@@ -429,7 +444,7 @@ TEST_F(TestMockIoObjectRequest, ParentRead) {
expect_aio_read(mock_image_ctx, mock_image_request, {{0, 4096}}, 0);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, 4096, CEPH_NOSNAP, 0, {}, &bl, &extent_map, &ctx);
@@ -476,7 +491,7 @@ TEST_F(TestMockIoObjectRequest, ParentReadError) {
expect_aio_read(mock_image_ctx, mock_image_request, {{0, 4096}}, -EPERM);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, 4096, CEPH_NOSNAP, 0, {}, &bl, &extent_map, &ctx);
@@ -528,7 +543,7 @@ TEST_F(TestMockIoObjectRequest, CopyOnRead) {
expect_copyup(mock_copyup_request, 0);
bufferlist bl;
- ExtentMap extent_map;
+ Extents extent_map;
C_SaferCond ctx;
auto req = MockObjectReadRequest::create(
&mock_image_ctx, 0, 0, 4096, CEPH_NOSNAP, 0, {}, &bl, &extent_map, &ctx);
diff --git a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
index 6e42d95bb7e..4edd448112d 100644
--- a/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_AcquireRequest.cc
@@ -29,7 +29,7 @@ struct BreakRequest<librbd::MockImageCtx> {
Context *on_finish = nullptr;
static BreakRequest *s_instance;
static BreakRequest* create(librados::IoCtx& ioctx,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid, const Locker &locker,
bool exclusive, bool blacklist_locker,
uint32_t blacklist_expire_seconds,
@@ -120,7 +120,7 @@ public:
bool exclusive = true) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("lock"), IsLockType(exclusive), _, _))
+ StrEq("lock"), IsLockType(exclusive), _, _, _))
.WillOnce(Return(r));
}
@@ -156,8 +156,8 @@ TEST_F(TestMockManagedLockAcquireRequest, SuccessExclusive) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, true, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, true, true, 0, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
}
@@ -176,8 +176,8 @@ TEST_F(TestMockManagedLockAcquireRequest, SuccessShared) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, false, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, false, true, 0, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
}
@@ -201,8 +201,8 @@ TEST_F(TestMockManagedLockAcquireRequest, LockBusy) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, true, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, true, true, 0, &ctx);
req->send();
ASSERT_EQ(-ENOENT, ctx.wait());
}
@@ -219,8 +219,8 @@ TEST_F(TestMockManagedLockAcquireRequest, GetLockInfoError) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, true, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, true, true, 0, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
@@ -238,8 +238,8 @@ TEST_F(TestMockManagedLockAcquireRequest, GetLockInfoEmpty) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, true, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, true, true, 0, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
@@ -261,8 +261,8 @@ TEST_F(TestMockManagedLockAcquireRequest, BreakLockError) {
C_SaferCond ctx;
MockAcquireRequest *req = MockAcquireRequest::create(mock_image_ctx.md_ctx,
- mock_image_ctx.image_watcher, ictx->op_work_queue, mock_image_ctx.header_oid,
- TEST_COOKIE, true, true, 0, &ctx);
+ mock_image_ctx.image_watcher, *ictx->asio_engine, mock_image_ctx.header_oid,
+ TEST_COOKIE, true, true, 0, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
diff --git a/src/test/librbd/managed_lock/test_mock_BreakRequest.cc b/src/test/librbd/managed_lock/test_mock_BreakRequest.cc
index d47799c6d76..4c810fab05e 100644
--- a/src/test/librbd/managed_lock/test_mock_BreakRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_BreakRequest.cc
@@ -56,6 +56,11 @@ GetLockerRequest<librbd::MockTestImageCtx> *GetLockerRequest<librbd::MockTestIma
// template definitions
#include "librbd/managed_lock/BreakRequest.cc"
+MATCHER(IsBlacklistCommand, "") {
+ return (arg.size() == 1 &&
+ arg[0].find("\"blacklistop\": \"add\"") != std::string::npos);
+}
+
namespace librbd {
namespace managed_lock {
@@ -106,14 +111,23 @@ public:
void expect_blacklist_add(MockTestImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(*get_mock_io_ctx(mock_image_ctx.md_ctx).get_mock_rados_client(),
- blacklist_add(_, _))
- .WillOnce(Return(r));
+ auto& mock_rados_client = librados::get_mock_rados_client(
+ mock_image_ctx.rados_api);
+ EXPECT_CALL(mock_rados_client, mon_command(IsBlacklistCommand(), _, _, _))
+ .WillOnce(Return(r));
+ }
+
+ void expect_wait_for_latest_osd_map(MockTestImageCtx &mock_image_ctx, int r) {
+ auto& mock_rados_client = librados::get_mock_rados_client(
+ mock_image_ctx.rados_api);
+ EXPECT_CALL(mock_rados_client, wait_for_latest_osd_map())
+ .WillOnce(Return(r));
}
void expect_break_lock(MockTestImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("lock"),
+ StrEq("break_lock"), _, _, _, _))
.WillOnce(Return(r));
}
@@ -141,12 +155,13 @@ TEST_F(TestMockManagedLockBreakRequest, DeadLockOwner) {
0);
expect_blacklist_add(mock_image_ctx, 0);
+ expect_wait_for_latest_osd_map(mock_image_ctx, 0);
expect_break_lock(mock_image_ctx, 0);
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
@@ -170,12 +185,13 @@ TEST_F(TestMockManagedLockBreakRequest, ForceBreak) {
0);
expect_blacklist_add(mock_image_ctx, 0);
+ expect_wait_for_latest_osd_map(mock_image_ctx, 0);
expect_break_lock(mock_image_ctx, 0);
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, true, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
@@ -196,7 +212,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetWatchersError) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
@@ -217,7 +233,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetWatchersAlive) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(-EAGAIN, ctx.wait());
@@ -243,7 +259,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetLockerUpdated) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, false, 0, false, &ctx);
req->send();
ASSERT_EQ(-EAGAIN, ctx.wait());
@@ -269,7 +285,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetLockerBusy) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, false, 0, false, &ctx);
req->send();
ASSERT_EQ(-EAGAIN, ctx.wait());
@@ -295,7 +311,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetLockerMissing) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, false, 0, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
@@ -319,7 +335,7 @@ TEST_F(TestMockManagedLockBreakRequest, GetLockerError) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, false, 0, false, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
@@ -347,7 +363,7 @@ TEST_F(TestMockManagedLockBreakRequest, BlacklistDisabled) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, false, 0, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
@@ -375,7 +391,7 @@ TEST_F(TestMockManagedLockBreakRequest, BlacklistSelf) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(456), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
@@ -403,7 +419,7 @@ TEST_F(TestMockManagedLockBreakRequest, BlacklistError) {
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
@@ -427,12 +443,13 @@ TEST_F(TestMockManagedLockBreakRequest, BreakLockMissing) {
0);
expect_blacklist_add(mock_image_ctx, 0);
+ expect_wait_for_latest_osd_map(mock_image_ctx, 0);
expect_break_lock(mock_image_ctx, -ENOENT);
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
@@ -456,12 +473,13 @@ TEST_F(TestMockManagedLockBreakRequest, BreakLockError) {
0);
expect_blacklist_add(mock_image_ctx, 0);
+ expect_wait_for_latest_osd_map(mock_image_ctx, 0);
expect_break_lock(mock_image_ctx, -EINVAL);
C_SaferCond ctx;
Locker locker{entity_name_t::CLIENT(1), "auto 123", "1.2.3.4:0/0", 123};
MockBreakRequest *req = MockBreakRequest::create(
- mock_image_ctx.md_ctx, ictx->op_work_queue, mock_image_ctx.header_oid,
+ mock_image_ctx.md_ctx, *ictx->asio_engine, mock_image_ctx.header_oid,
locker, true, true, 0, false, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
diff --git a/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc b/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc
index 1850526a7fc..8cad1f09258 100644
--- a/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_GetLockerRequest.cc
@@ -52,7 +52,7 @@ public:
ClsLockType lock_type) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("get_info"), _, _, _));
+ StrEq("get_info"), _, _, _, _));
if (r < 0 && r != -ENOENT) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc b/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc
index e295f8fc3d9..ec63925acc1 100644
--- a/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_ReacquireRequest.cc
@@ -46,7 +46,7 @@ public:
bool exclusive = true) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("set_cookie"), IsLockType(exclusive), _, _))
+ StrEq("set_cookie"), IsLockType(exclusive), _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc b/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc
index af75f8f2963..63752475e13 100644
--- a/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc
+++ b/src/test/librbd/managed_lock/test_mock_ReleaseRequest.cc
@@ -41,7 +41,7 @@ public:
void expect_unlock(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("lock"),
- StrEq("unlock"), _, _, _))
+ StrEq("unlock"), _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
index 6649d24479a..d7e70cab764 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
@@ -129,7 +129,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
@@ -149,7 +149,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_peer_list"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
index 3babd19d232..f38e58d8e87 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
@@ -140,7 +140,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_peer_list"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_ImageMeta.cc b/src/test/librbd/mirror/snapshot/test_mock_ImageMeta.cc
index 9bc6139d83e..70a5eaeb0a8 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_ImageMeta.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_ImageMeta.cc
@@ -49,7 +49,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_get"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_get"), ContentsEqual(in_bl), _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(out_bl)),
Return(r)));
}
@@ -68,7 +68,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(in_bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc
index eba9b5cbf3f..2492e06f9bd 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc
@@ -85,7 +85,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("mirror_image_snapshot_unlink_peer"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Invoke([&mock_image_ctx, snap_id, peer_uuid, r](auto&&... args) -> int {
if (r == 0) {
auto it = mock_image_ctx.snap_info.find(snap_id);
diff --git a/src/test/librbd/mirror/test_mock_DisableRequest.cc b/src/test/librbd/mirror/test_mock_DisableRequest.cc
index 95c8927772a..823884fe588 100644
--- a/src/test/librbd/mirror/test_mock_DisableRequest.cc
+++ b/src/test/librbd/mirror/test_mock_DisableRequest.cc
@@ -228,7 +228,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(::journal::Journaler::header_oid(mock_image_ctx.id),
- _, StrEq("journal"), StrEq("client_list"), _, _, _))
+ _, StrEq("journal"), StrEq("client_list"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(CopyInBufferlist(bl)),
Return(r)));
}
@@ -243,7 +243,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(::journal::Journaler::header_oid(mock_image_ctx.id),
_, StrEq("journal"), StrEq("client_unregister"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/librbd/mock/MockImageCtx.cc b/src/test/librbd/mock/MockImageCtx.cc
index 9a1c5430daa..a2670f896dc 100644
--- a/src/test/librbd/mock/MockImageCtx.cc
+++ b/src/test/librbd/mock/MockImageCtx.cc
@@ -1,6 +1,7 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
+#include "include/neorados/RADOS.hpp"
#include "test/librbd/mock/MockImageCtx.h"
#include "test/librbd/mock/MockSafeTimer.h"
#include "librbd/io/AsyncOperation.h"
@@ -35,4 +36,13 @@ void MockImageCtx::wait_for_async_ops() {
async_op.finish_op();
}
+IOContext MockImageCtx::get_data_io_context() {
+ auto ctx = std::make_shared<neorados::IOContext>(
+ data_ctx.get_id(), data_ctx.get_namespace());
+ ctx->read_snap(snap_id);
+ ctx->write_snap_context(
+ {{snapc.seq, {snapc.snaps.begin(), snapc.snaps.end()}}});
+ return ctx;
+}
+
} // namespace librbd
diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h
index 738143153e6..a06ce09e6a5 100644
--- a/src/test/librbd/mock/MockImageCtx.h
+++ b/src/test/librbd/mock/MockImageCtx.h
@@ -62,6 +62,8 @@ struct MockImageCtx {
lockers(image_ctx.lockers),
exclusive_locked(image_ctx.exclusive_locked),
lock_tag(image_ctx.lock_tag),
+ asio_engine(image_ctx.asio_engine),
+ rados_api(image_ctx.rados_api),
owner_lock(image_ctx.owner_lock),
image_lock(image_ctx.image_lock),
timestamp_lock(image_ctx.timestamp_lock),
@@ -219,6 +221,9 @@ struct MockImageCtx {
MOCK_CONST_METHOD0(get_stripe_count, uint64_t());
MOCK_CONST_METHOD0(get_stripe_period, uint64_t());
+ MOCK_METHOD0(rebuild_data_io_context, void());
+ IOContext get_data_io_context();
+
static void set_timer_instance(MockSafeTimer *timer, ceph::mutex *timer_lock);
static void get_timer_instance(CephContext *cct, MockSafeTimer **timer,
ceph::mutex **timer_lock);
@@ -249,6 +254,9 @@ struct MockImageCtx {
bool exclusive_locked;
std::string lock_tag;
+ std::shared_ptr<AsioEngine> asio_engine;
+ neorados::RADOS& rados_api;
+
librados::IoCtx md_ctx;
librados::IoCtx data_ctx;
diff --git a/src/test/librbd/mock/io/MockObjectDispatch.h b/src/test/librbd/mock/io/MockObjectDispatch.h
index 16cf4b0d2b1..5cfe98f4806 100644
--- a/src/test/librbd/mock/io/MockObjectDispatch.h
+++ b/src/test/librbd/mock/io/MockObjectDispatch.h
@@ -26,12 +26,12 @@ public:
MOCK_METHOD8(execute_read,
bool(uint64_t, uint64_t, uint64_t, librados::snap_t,
- ceph::bufferlist*, ExtentMap*, DispatchResult*, Context*));
+ ceph::bufferlist*, Extents*, DispatchResult*, Context*));
bool read(
uint64_t object_no, uint64_t object_off, uint64_t object_len,
librados::snap_t snap_id, int op_flags,
const ZTracer::Trace& parent_trace, ceph::bufferlist* read_data,
- ExtentMap* extent_map, int* dispatch_flags,
+ Extents* extent_map, int* dispatch_flags,
DispatchResult* dispatch_result, Context** on_finish,
Context* on_dispatched) {
return execute_read(object_no, object_off, object_len, snap_id, read_data,
diff --git a/src/test/librbd/object_map/test_mock_InvalidateRequest.cc b/src/test/librbd/object_map/test_mock_InvalidateRequest.cc
index 5cefe6fae0f..5ea40c03d69 100644
--- a/src/test/librbd/object_map/test_mock_InvalidateRequest.cc
+++ b/src/test/librbd/object_map/test_mock_InvalidateRequest.cc
@@ -33,11 +33,12 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesInMemoryFlag) {
ASSERT_FALSE(flags_set);
C_SaferCond cond_ctx;
- AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
+ AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, true, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
- .Times(0);
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
+ .WillOnce(DoDefault());
{
std::shared_lock owner_locker{ictx->owner_lock};
@@ -62,7 +63,8 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesHeadOnDiskFlag) {
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(DoDefault());
{
@@ -91,7 +93,8 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesSnapOnDiskFlag) {
&cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(DoDefault());
{
@@ -102,7 +105,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, UpdatesSnapOnDiskFlag) {
ASSERT_EQ(0, cond_ctx.wait());
}
-TEST_F(TestMockObjectMapInvalidateRequest, SkipOnDiskUpdateWithoutLock) {
+TEST_F(TestMockObjectMapInvalidateRequest, ErrorOnDiskUpdateWithoutLock) {
REQUIRE_FEATURE(RBD_FEATURE_OBJECT_MAP);
librbd::ImageCtx *ictx;
@@ -112,7 +115,8 @@ TEST_F(TestMockObjectMapInvalidateRequest, SkipOnDiskUpdateWithoutLock) {
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.Times(0);
{
@@ -120,12 +124,12 @@ TEST_F(TestMockObjectMapInvalidateRequest, SkipOnDiskUpdateWithoutLock) {
std::unique_lock image_locker{ictx->image_lock};
request->send();
}
- ASSERT_EQ(0, cond_ctx.wait());
+ ASSERT_EQ(-EROFS, cond_ctx.wait());
expect_unlock_exclusive_lock(*ictx);
}
-TEST_F(TestMockObjectMapInvalidateRequest, IgnoresOnDiskUpdateFailure) {
+TEST_F(TestMockObjectMapInvalidateRequest, ErrorOnDiskUpdateFailure) {
REQUIRE_FEATURE(RBD_FEATURE_OBJECT_MAP);
librbd::ImageCtx *ictx;
@@ -136,7 +140,8 @@ TEST_F(TestMockObjectMapInvalidateRequest, IgnoresOnDiskUpdateFailure) {
AsyncRequest<> *request = new InvalidateRequest<>(*ictx, CEPH_NOSNAP, false, &cond_ctx);
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _,
+ _, _))
.WillOnce(Return(-EINVAL));
{
@@ -144,7 +149,7 @@ TEST_F(TestMockObjectMapInvalidateRequest, IgnoresOnDiskUpdateFailure) {
std::unique_lock image_locker{ictx->image_lock};
request->send();
}
- ASSERT_EQ(0, cond_ctx.wait());
+ ASSERT_EQ(-EINVAL, cond_ctx.wait());
expect_unlock_exclusive_lock(*ictx);
}
diff --git a/src/test/librbd/object_map/test_mock_LockRequest.cc b/src/test/librbd/object_map/test_mock_LockRequest.cc
index 5f95429acd2..a99cab61efe 100644
--- a/src/test/librbd/object_map/test_mock_LockRequest.cc
+++ b/src/test/librbd/object_map/test_mock_LockRequest.cc
@@ -30,7 +30,7 @@ public:
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("lock"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("lock"), _, _, _, _))
.WillOnce(Return(r));
}
@@ -38,7 +38,8 @@ public:
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("get_info"), _, _, _));
+ exec(oid, _, StrEq("lock"), StrEq("get_info"), _,
+ _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -64,7 +65,8 @@ public:
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("break_lock"), _, _, _));
+ exec(oid, _, StrEq("lock"), StrEq("break_lock"),
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/object_map/test_mock_RefreshRequest.cc b/src/test/librbd/object_map/test_mock_RefreshRequest.cc
index f7dffb61eeb..43d9c3b43ca 100644
--- a/src/test/librbd/object_map/test_mock_RefreshRequest.cc
+++ b/src/test/librbd/object_map/test_mock_RefreshRequest.cc
@@ -88,7 +88,8 @@ public:
int r) {
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id, snap_id));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _));
+ exec(oid, _, StrEq("rbd"),
+ StrEq("object_map_load"), _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -129,7 +130,8 @@ public:
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
TEST_SNAP_ID));
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _));
+ exec(oid, _, StrEq("rbd"),
+ StrEq("object_map_resize"), _, _, _, _));
expect.WillOnce(Return(r));
}
diff --git a/src/test/librbd/object_map/test_mock_ResizeRequest.cc b/src/test/librbd/object_map/test_mock_ResizeRequest.cc
index 1ca85258848..d6a3dd91ce6 100644
--- a/src/test/librbd/object_map/test_mock_ResizeRequest.cc
+++ b/src/test/librbd/object_map/test_mock_ResizeRequest.cc
@@ -26,24 +26,28 @@ public:
std::string oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (snap_id == CEPH_NOSNAP) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
}
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _,
+ _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_resize"), _, _,
+ _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
diff --git a/src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc
index 74ac7732b90..b49f7419d5d 100644
--- a/src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/object_map/test_mock_SnapshotCreateRequest.cc
@@ -33,11 +33,11 @@ public:
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP),
- 0, 0, _)).WillOnce(Return(r));
+ 0, 0, _, _)).WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP),
- 0, 0, _)).WillOnce(DoDefault());
+ 0, 0, _, _)).WillOnce(DoDefault());
}
}
@@ -59,21 +59,25 @@ public:
std::string oid(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_add"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_add"), _, _,
+ _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
@@ -130,7 +134,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, ReadMapError) {
std::shared_lock image_locker{ictx->image_lock};
request->send();
}
- ASSERT_EQ(0, cond_ctx.wait());
+ ASSERT_EQ(-ENOENT, cond_ctx.wait());
expect_unlock_exclusive_lock(*ictx);
}
@@ -158,7 +162,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, WriteMapError) {
std::shared_lock image_locker{ictx->image_lock};
request->send();
}
- ASSERT_EQ(0, cond_ctx.wait());
+ ASSERT_EQ(-ENOENT, cond_ctx.wait());
expect_unlock_exclusive_lock(*ictx);
}
@@ -187,7 +191,7 @@ TEST_F(TestMockObjectMapSnapshotCreateRequest, AddSnapshotError) {
std::shared_lock image_locker{ictx->image_lock};
request->send();
}
- ASSERT_EQ(0, cond_ctx.wait());
+ ASSERT_EQ(-ENOENT, cond_ctx.wait());
expect_unlock_exclusive_lock(*ictx);
}
diff --git a/src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc b/src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc
index f02d3d3e70d..20318743d30 100644
--- a/src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc
+++ b/src/test/librbd/object_map/test_mock_SnapshotRemoveRequest.cc
@@ -26,11 +26,13 @@ public:
std::string snap_oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
+ exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _,
+ _, _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _, _, _))
+ exec(snap_oid, _, StrEq("rbd"), StrEq("object_map_load"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
}
@@ -39,14 +41,17 @@ public:
std::string oid(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP));
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_remove"), _, _, _))
+ exec(oid, _, StrEq("rbd"), StrEq("object_map_snap_remove"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
}
@@ -64,7 +69,8 @@ public:
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
diff --git a/src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc b/src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc
index 92f3847ca07..96636ab14d0 100644
--- a/src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc
+++ b/src/test/librbd/object_map/test_mock_SnapshotRollbackRequest.cc
@@ -25,18 +25,18 @@ public:
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, snap_id),
- 0, 0, _)).WillOnce(Return(r));
+ 0, 0, _, _)).WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
read(ObjectMap<>::object_map_name(ictx->id, snap_id),
- 0, 0, _)).WillOnce(DoDefault());
+ 0, 0, _, _)).WillOnce(DoDefault());
}
}
void expect_write_map(librbd::ImageCtx *ictx, int r) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(ObjectMap<>::object_map_name(ictx->id, CEPH_NOSNAP), _,
- StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ StrEq("lock"), StrEq("assert_locked"), _, _, _, _))
.WillOnce(DoDefault());
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
@@ -53,7 +53,8 @@ public:
void expect_invalidate(librbd::ImageCtx *ictx, uint32_t times) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.Times(times)
.WillRepeatedly(DoDefault());
}
diff --git a/src/test/librbd/object_map/test_mock_UnlockRequest.cc b/src/test/librbd/object_map/test_mock_UnlockRequest.cc
index 95879c88748..f91ee001d0f 100644
--- a/src/test/librbd/object_map/test_mock_UnlockRequest.cc
+++ b/src/test/librbd/object_map/test_mock_UnlockRequest.cc
@@ -28,7 +28,7 @@ public:
std::string oid(ObjectMap<>::object_map_name(mock_image_ctx.id,
CEPH_NOSNAP));
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("unlock"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("unlock"), _, _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/librbd/object_map/test_mock_UpdateRequest.cc b/src/test/librbd/object_map/test_mock_UpdateRequest.cc
index 42b3a5360bf..20683ac6957 100644
--- a/src/test/librbd/object_map/test_mock_UpdateRequest.cc
+++ b/src/test/librbd/object_map/test_mock_UpdateRequest.cc
@@ -38,26 +38,28 @@ public:
std::string oid(ObjectMap<>::object_map_name(ictx->id, snap_id));
if (snap_id == CEPH_NOSNAP) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _))
+ exec(oid, _, StrEq("lock"), StrEq("assert_locked"), _, _, _,
+ _))
.WillOnce(DoDefault());
}
if (r < 0) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(oid, _, StrEq("rbd"), StrEq("object_map_update"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
} else {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
exec(oid, _, StrEq("rbd"), StrEq("object_map_update"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(DoDefault());
}
}
void expect_invalidate(librbd::ImageCtx *ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx->md_ctx),
- exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _, _, _))
+ exec(ictx->header_oid, _, StrEq("rbd"), StrEq("set_flags"), _,
+ _, _, _))
.WillOnce(DoDefault());
}
};
diff --git a/src/test/librbd/operation/test_mock_ResizeRequest.cc b/src/test/librbd/operation/test_mock_ResizeRequest.cc
index 707bdf45813..7c5fb546209 100644
--- a/src/test/librbd/operation/test_mock_ResizeRequest.cc
+++ b/src/test/librbd/operation/test_mock_ResizeRequest.cc
@@ -141,7 +141,8 @@ public:
} else {
expect_is_lock_owner(mock_image_ctx);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("set_size"), _, _, _))
+ exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
+ StrEq("set_size"), _, _, _, _))
.WillOnce(Return(r));
}
}
diff --git a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
index cf56f9e2980..2aed5403c34 100644
--- a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
@@ -105,7 +105,7 @@ public:
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq(mock_image_ctx.old_format ? "snap_add" :
"snapshot_add"),
- _, _, _));
+ _, _, _, _));
if (r == -ESTALE) {
expect.WillOnce(Return(r)).WillOnce(DoDefault());
} else if (r < 0) {
@@ -179,6 +179,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, Success) {
if (!mock_image_ctx.old_format) {
expect_object_map_snap_create(mock_image_ctx);
expect_update_snap_context(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
}
expect_unblock_writes(mock_image_ctx);
expect_notify_unquiesce(mock_image_ctx, -EINVAL);
@@ -278,6 +279,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, CreateSnapStale) {
if (!mock_image_ctx.old_format) {
expect_object_map_snap_create(mock_image_ctx);
expect_update_snap_context(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
}
expect_unblock_writes(mock_image_ctx);
expect_notify_unquiesce(mock_image_ctx, 0);
@@ -387,6 +389,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, SkipObjectMap) {
expect_allocate_snap_id(mock_image_ctx, 0);
expect_snap_create(mock_image_ctx, 0);
expect_update_snap_context(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
expect_unblock_writes(mock_image_ctx);
expect_notify_unquiesce(mock_image_ctx, 0);
@@ -430,6 +433,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, SkipNotifyQuiesce) {
if (!mock_image_ctx.old_format) {
expect_object_map_snap_create(mock_image_ctx);
expect_update_snap_context(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
}
expect_unblock_writes(mock_image_ctx);
@@ -475,6 +479,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, SetImageState) {
MockSetImageStateRequest mock_set_image_state_request;
expect_set_image_state(mock_image_ctx, mock_set_image_state_request, 0);
expect_update_snap_context(mock_image_ctx);
+ EXPECT_CALL(mock_image_ctx, rebuild_data_io_context());
expect_unblock_writes(mock_image_ctx);
expect_notify_unquiesce(mock_image_ctx, 0);
diff --git a/src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc b/src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc
index b2d56912ee3..aa8c1e78dc7 100644
--- a/src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotProtectRequest.cc
@@ -48,7 +48,8 @@ public:
void expect_set_protection_status(MockImageCtx &mock_image_ctx, int r) {
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_protection_status"), _, _, _));
+ StrEq("set_protection_status"), _, _, _,
+ _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
index 74c0108300d..886ac768e74 100644
--- a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
@@ -121,7 +121,7 @@ public:
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("snapshot_trash_add"),
- _, _, _));
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -138,7 +138,7 @@ public:
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("snapshot_get"), _, _, _))
+ StrEq("snapshot_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([snap_info, r](bufferlist* bl) {
encode(snap_info, *bl);
return r;
@@ -154,7 +154,7 @@ public:
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("children_list"), _, _, _))
+ StrEq("children_list"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([child_images, r](bufferlist* bl) {
encode(child_images, *bl);
return r;
@@ -171,7 +171,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(util::header_name(parent_spec.image_id),
_, StrEq("rbd"), StrEq("child_detach"), ContentsEqual(bl),
- _, _))
+ _, _, _))
.WillOnce(Return(r));
}
@@ -217,7 +217,7 @@ public:
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
StrEq(mock_image_ctx.old_format ? "snap_remove" :
"snapshot_remove"),
- _, _, _));
+ _, _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
diff --git a/src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc b/src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc
index cad664486d6..26b1be2066a 100644
--- a/src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotUnprotectRequest.cc
@@ -56,8 +56,8 @@ public:
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"),
- StrEq("set_protection_status"), ContentsEqual(bl),
- _, _));
+ StrEq("set_protection_status"),
+ ContentsEqual(bl), _, _, _));
if (r < 0) {
expect.WillOnce(Return(r));
} else {
@@ -90,8 +90,8 @@ public:
encode(children, bl);
auto &expect = EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
- exec(RBD_CHILDREN, _, StrEq("rbd"), StrEq("get_children"), _,
- _, _));
+ exec(RBD_CHILDREN, _, StrEq("rbd"),
+ StrEq("get_children"), _, _, _, _));
if (r < 0) {
expect.WillRepeatedly(Return(r));
} else {
diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc
index 283fd7c5592..3164e3e7b7e 100644
--- a/src/test/librbd/test_internal.cc
+++ b/src/test/librbd/test_internal.cc
@@ -1026,32 +1026,6 @@ TEST_F(TestInternal, DiscardCopyup)
}
}
-TEST_F(TestInternal, ShrinkFlushesCache) {
- librbd::ImageCtx *ictx;
- ASSERT_EQ(0, open_image(m_image_name, &ictx));
-
- std::string buffer(4096, '1');
-
- // ensure write-path is initialized
- bufferlist write_bl;
- write_bl.append(buffer);
- api::Io<>::write(*ictx, 0, buffer.size(), bufferlist{write_bl}, 0);
-
- C_SaferCond cond_ctx;
- auto c = librbd::io::AioCompletion::create(&cond_ctx);
- c->get();
- api::Io<>::aio_write(*ictx, c, 0, buffer.size(), bufferlist{write_bl}, 0,
- true);
-
- librbd::NoOpProgressContext no_op;
- ASSERT_EQ(0, ictx->operations->resize(m_image_size >> 1, true, no_op));
-
- ASSERT_TRUE(c->is_complete());
- ASSERT_EQ(0, c->wait_for_complete());
- ASSERT_EQ(0, cond_ctx.wait());
- c->put();
-}
-
TEST_F(TestInternal, ImageOptions) {
rbd_image_options_t opts1 = NULL, opts2 = NULL;
uint64_t uint64_val1 = 10, uint64_val2 = 0;
diff --git a/src/test/librbd/test_mock_DeepCopyRequest.cc b/src/test/librbd/test_mock_DeepCopyRequest.cc
index 93f37909fee..de6ceb64d5f 100644
--- a/src/test/librbd/test_mock_DeepCopyRequest.cc
+++ b/src/test/librbd/test_mock_DeepCopyRequest.cc
@@ -3,6 +3,7 @@
#include "test/librbd/test_mock_fixture.h"
#include "include/rbd/librbd.hpp"
+#include "librbd/AsioEngine.h"
#include "librbd/DeepCopyRequest.h"
#include "librbd/ImageState.h"
#include "librbd/Operations.h"
@@ -150,6 +151,8 @@ public:
librbd::ImageCtx *m_src_image_ctx;
librbd::ImageCtx *m_dst_image_ctx;
+
+ std::shared_ptr<librbd::AsioEngine> m_asio_engine;
librbd::asio::ContextWQ *m_work_queue;
void SetUp() override {
@@ -160,7 +163,9 @@ public:
ASSERT_EQ(0, open_image(m_image_name, &m_dst_image_ctx));
- librbd::ImageCtx::get_work_queue(m_src_image_ctx->cct, &m_work_queue);
+ m_asio_engine = std::make_shared<librbd::AsioEngine>(
+ m_src_image_ctx->md_ctx);
+ m_work_queue = m_asio_engine->get_work_queue();
}
void TearDown() override {
diff --git a/src/test/librbd/test_mock_ExclusiveLock.cc b/src/test/librbd/test_mock_ExclusiveLock.cc
index 34ae8c5a6ef..c0693f78a1d 100644
--- a/src/test/librbd/test_mock_ExclusiveLock.cc
+++ b/src/test/librbd/test_mock_ExclusiveLock.cc
@@ -40,7 +40,7 @@ struct Traits<MockExclusiveLockImageCtx> {
template <>
struct ManagedLock<MockExclusiveLockImageCtx> {
- ManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
+ ManagedLock(librados::IoCtx& ioctx, AsioEngine& asio_engine,
const std::string& oid, librbd::MockImageWatcher *watcher,
managed_lock::Mode mode, bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds)
diff --git a/src/test/librbd/test_mock_ManagedLock.cc b/src/test/librbd/test_mock_ManagedLock.cc
index bfad7422405..89fd9d20616 100644
--- a/src/test/librbd/test_mock_ManagedLock.cc
+++ b/src/test/librbd/test_mock_ManagedLock.cc
@@ -27,11 +27,11 @@ struct Traits<MockManagedLockImageCtx> {
}
struct MockMockManagedLock : public ManagedLock<MockManagedLockImageCtx> {
- MockMockManagedLock(librados::IoCtx& ioctx, asio::ContextWQ *work_queue,
+ MockMockManagedLock(librados::IoCtx& ioctx, AsioEngine& asio_engine,
const std::string& oid, librbd::MockImageWatcher *watcher,
- managed_lock::Mode mode, bool blacklist_on_break_lock,
+ managed_lock::Mode mode, bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds)
- : ManagedLock<MockManagedLockImageCtx>(ioctx, work_queue, oid, watcher,
+ : ManagedLock<MockManagedLockImageCtx>(ioctx, asio_engine, oid, watcher,
librbd::managed_lock::EXCLUSIVE, true, 0) {
};
virtual ~MockMockManagedLock() = default;
@@ -50,8 +50,8 @@ struct BaseRequest {
Context *on_finish = nullptr;
static T* create(librados::IoCtx& ioctx, MockImageWatcher *watcher,
- asio::ContextWQ *work_queue, const std::string& oid,
- const std::string& cookie, Context *on_finish) {
+ const std::string& oid, const std::string& cookie,
+ Context *on_finish) {
ceph_assert(!s_requests.empty());
T* req = s_requests.front();
req->on_finish = on_finish;
@@ -68,16 +68,17 @@ template<typename T>
std::list<T *> BaseRequest<T>::s_requests;
template <>
-struct AcquireRequest<MockManagedLockImageCtx> : public BaseRequest<AcquireRequest<MockManagedLockImageCtx> > {
+struct AcquireRequest<MockManagedLockImageCtx>
+ : public BaseRequest<AcquireRequest<MockManagedLockImageCtx> > {
static AcquireRequest* create(librados::IoCtx& ioctx,
MockImageWatcher *watcher,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid,
const std::string& cookie,
bool exclusive, bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds,
Context *on_finish) {
- return BaseRequest::create(ioctx, watcher, work_queue, oid, cookie, on_finish);
+ return BaseRequest::create(ioctx, watcher, oid, cookie, on_finish);
}
MOCK_METHOD0(send, void());
@@ -88,7 +89,7 @@ struct ReacquireRequest<MockManagedLockImageCtx> : public BaseRequest<ReacquireR
static ReacquireRequest* create(librados::IoCtx &ioctx, const std::string& oid,
const string& old_cookie, const std::string& new_cookie,
bool exclusive, Context *on_finish) {
- return BaseRequest::create(ioctx, nullptr, nullptr, oid, new_cookie,
+ return BaseRequest::create(ioctx, nullptr, oid, new_cookie,
on_finish);
}
@@ -101,8 +102,7 @@ struct ReleaseRequest<MockManagedLockImageCtx> : public BaseRequest<ReleaseReque
asio::ContextWQ *work_queue,
const std::string& oid,
const std::string& cookie, Context *on_finish) {
- return BaseRequest::create(ioctx, watcher, work_queue, oid, cookie,
- on_finish);
+ return BaseRequest::create(ioctx, watcher, oid, cookie, on_finish);
}
MOCK_METHOD0(send, void());
};
@@ -123,7 +123,7 @@ struct GetLockerRequest<MockManagedLockImageCtx> {
template <>
struct BreakRequest<MockManagedLockImageCtx> {
static BreakRequest* create(librados::IoCtx& ioctx,
- asio::ContextWQ *work_queue,
+ AsioEngine& asio_engine,
const std::string& oid, const Locker &locker,
bool exclusive, bool blacklist_locker,
uint32_t blacklist_expire_seconds,
@@ -211,7 +211,7 @@ public:
.WillOnce(CompleteContext(0, (asio::ContextWQ *)nullptr));
}
- void expect_post_reacquired_lock_handler(MockImageWatcher& watcher,
+ void expect_post_reacquired_lock_handler(MockImageWatcher& watcher,
MockMockManagedLock &managed_lock, uint64_t &client_id) {
expect_get_watch_handle(watcher);
EXPECT_CALL(managed_lock, post_reacquire_lock_handler(_, _))
@@ -271,7 +271,7 @@ TEST_F(TestMockManagedLock, StateTransitions) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -302,7 +302,7 @@ TEST_F(TestMockManagedLock, AcquireLockLockedState) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -322,7 +322,7 @@ TEST_F(TestMockManagedLock, AcquireLockAlreadyLocked) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -340,7 +340,7 @@ TEST_F(TestMockManagedLock, AcquireLockBusy) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -358,7 +358,7 @@ TEST_F(TestMockManagedLock, AcquireLockError) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -377,7 +377,7 @@ TEST_F(TestMockManagedLock, AcquireLockBlacklist) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -396,7 +396,7 @@ TEST_F(TestMockManagedLock, ReleaseLockUnlockedState) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -411,7 +411,7 @@ TEST_F(TestMockManagedLock, ReleaseLockBlacklist) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockMockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockMockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -433,7 +433,7 @@ TEST_F(TestMockManagedLock, ReleaseLockError) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -459,7 +459,7 @@ TEST_F(TestMockManagedLock, ConcurrentRequests) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -516,7 +516,7 @@ TEST_F(TestMockManagedLock, ReacquireLock) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -544,7 +544,7 @@ TEST_F(TestMockManagedLock, AttemptReacquireBlacklistedLock) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -573,7 +573,7 @@ TEST_F(TestMockManagedLock, ReacquireBlacklistedLock) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -610,7 +610,7 @@ TEST_F(TestMockManagedLock, ReacquireLockError) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -645,7 +645,7 @@ TEST_F(TestMockManagedLock, ReacquireWithSameCookie) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockMockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockMockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
InSequence seq;
@@ -675,7 +675,7 @@ TEST_F(TestMockManagedLock, ShutDownWhileWaiting) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
MockManagedLockImageCtx mock_image_ctx(*ictx);
- MockMockManagedLock managed_lock(ictx->md_ctx, ictx->op_work_queue,
+ MockMockManagedLock managed_lock(ictx->md_ctx, *ictx->asio_engine,
ictx->header_oid, mock_image_ctx.image_watcher,
librbd::managed_lock::EXCLUSIVE, true, 0);
diff --git a/src/test/librbd/test_mock_fixture.cc b/src/test/librbd/test_mock_fixture.cc
index 0a467c16137..166175c9bd4 100644
--- a/src/test/librbd/test_mock_fixture.cc
+++ b/src/test/librbd/test_mock_fixture.cc
@@ -53,7 +53,7 @@ void TestMockFixture::TearDown() {
void TestMockFixture::expect_unlock_exclusive_lock(librbd::ImageCtx &ictx) {
EXPECT_CALL(get_mock_io_ctx(ictx.md_ctx),
- exec(_, _, StrEq("lock"), StrEq("unlock"), _, _, _))
+ exec(_, _, StrEq("lock"), StrEq("unlock"), _, _, _, _))
.WillRepeatedly(DoDefault());
}
diff --git a/src/test/librbd/trash/test_mock_MoveRequest.cc b/src/test/librbd/trash/test_mock_MoveRequest.cc
index 7bd7dbfcb67..1a35c62ae60 100644
--- a/src/test/librbd/trash/test_mock_MoveRequest.cc
+++ b/src/test/librbd/trash/test_mock_MoveRequest.cc
@@ -62,7 +62,7 @@ struct TestMockTrashMoveRequest : public TestMockFixture {
int r) {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_add"),
- _, _, _))
+ _, _, _, _))
.WillOnce(WithArg<4>(Invoke([=](bufferlist& in_bl) {
std::string id;
cls::rbd::TrashImageSpec trash_image_spec;
@@ -96,7 +96,7 @@ struct TestMockTrashMoveRequest : public TestMockFixture {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_directory"), _, StrEq("rbd"), StrEq("dir_remove_image"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/librbd/trash/test_mock_RemoveRequest.cc b/src/test/librbd/trash/test_mock_RemoveRequest.cc
index 407855ae77c..2e75b3ac5b8 100644
--- a/src/test/librbd/trash/test_mock_RemoveRequest.cc
+++ b/src/test/librbd/trash/test_mock_RemoveRequest.cc
@@ -103,7 +103,7 @@ struct TestMockTrashRemoveRequest : public TestMockFixture {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_state_set"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
@@ -140,7 +140,7 @@ struct TestMockTrashRemoveRequest : public TestMockFixture {
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_trash"), _, StrEq("rbd"), StrEq("trash_remove"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
};
diff --git a/src/test/rbd_mirror/CMakeLists.txt b/src/test/rbd_mirror/CMakeLists.txt
index 36a1603d9c5..1226735d546 100644
--- a/src/test/rbd_mirror/CMakeLists.txt
+++ b/src/test/rbd_mirror/CMakeLists.txt
@@ -57,7 +57,6 @@ add_dependencies(unittest_rbd_mirror
cls_rbd)
target_link_libraries(unittest_rbd_mirror
rbd_mirror_test
- rados_test_stub
rbd_mirror_internal
rbd_mirror_types
rbd_api
@@ -69,6 +68,7 @@ target_link_libraries(unittest_rbd_mirror
cls_lock_client
cls_journal_client
rbd_types
+ rados_test_stub
librados
osdc
global
@@ -89,6 +89,7 @@ target_link_libraries(ceph_test_rbd_mirror
cls_rbd_client
cls_journal_client
rbd_types
+ libneorados
librados
radostest-cxx
${UNITTEST_LIBS}
diff --git a/src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc b/src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc
index ae481dce4e2..c85fb150014 100644
--- a/src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc
+++ b/src/test/rbd_mirror/image_deleter/test_mock_TrashMoveRequest.cc
@@ -201,7 +201,8 @@ public:
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
@@ -272,14 +273,14 @@ public:
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_set"), ContentsEqual(bl), _, _))
+ StrEq("mirror_image_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
void expect_mirror_image_remove(librados::IoCtx &ioctx, int r) {
EXPECT_CALL(get_mock_io_ctx(ioctx),
- exec(StrEq("rbd_mirroring"), _, StrEq("rbd"), StrEq("mirror_image_remove"),
- _, _, _))
+ exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
+ StrEq("mirror_image_remove"), _, _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc b/src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc
index 43057cce048..f69a74f64da 100644
--- a/src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc
+++ b/src/test/rbd_mirror/image_deleter/test_mock_TrashRemoveRequest.cc
@@ -134,7 +134,7 @@ public:
using ceph::encode;
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq(RBD_TRASH), _, StrEq("rbd"),
- StrEq("trash_get"), _, _, _))
+ StrEq("trash_get"), _, _, _, _))
.WillOnce(WithArg<5>(Invoke([trash_spec, r](bufferlist* bl) {
encode(trash_spec, *bl);
return r;
@@ -150,7 +150,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq(RBD_TRASH), _, StrEq("rbd"),
StrEq("trash_state_set"),
- ContentsEqual(in_bl), _, _))
+ ContentsEqual(in_bl), _, _, _))
.WillOnce(Return(r));
}
@@ -161,7 +161,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(librbd::util::header_name(image_id), _, StrEq("rbd"),
- StrEq("get_snapcontext"), _, _, _))
+ StrEq("get_snapcontext"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
diff --git a/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc b/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc
index a3961d9f6a6..bd434b85f51 100644
--- a/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc
+++ b/src/test/rbd_mirror/image_deleter/test_mock_TrashWatcher.cc
@@ -169,7 +169,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(io_ctx),
exec(RBD_TRASH, _, StrEq("rbd"), StrEq("trash_list"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
diff --git a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_ApplyImageStateRequest.cc b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_ApplyImageStateRequest.cc
index f937024eaf5..904d3685485 100644
--- a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_ApplyImageStateRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_ApplyImageStateRequest.cc
@@ -128,7 +128,7 @@ public:
ceph::encode(key, bl);
EXPECT_CALL(get_mock_io_ctx(m_mock_local_image_ctx->md_ctx),
exec(m_mock_local_image_ctx->header_oid, _, StrEq("rbd"),
- StrEq("metadata_remove"), ContentsEqual(bl), _, _))
+ StrEq("metadata_remove"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
if (r < 0) {
return;
@@ -140,7 +140,7 @@ public:
ceph::encode(pairs, bl);
EXPECT_CALL(get_mock_io_ctx(m_mock_local_image_ctx->md_ctx),
exec(m_mock_local_image_ctx->header_oid, _, StrEq("rbd"),
- StrEq("metadata_set"), ContentsEqual(bl), _, _))
+ StrEq("metadata_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
}
diff --git a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
index 74e385a8084..58214f3e8f8 100644
--- a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
@@ -170,7 +170,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_set"), ContentsEqual(bl), _, _))
+ StrEq("mirror_image_set"), ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
@@ -181,7 +181,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(m_local_io_ctx),
exec(StrEq("rbd_mirroring"), _, StrEq("rbd"),
StrEq("mirror_image_remove"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc
index d1117bb79eb..f9550dcb5b4 100644
--- a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc
+++ b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc
@@ -580,7 +580,7 @@ public:
EXPECT_CALL(get_mock_io_ctx(mock_test_image_ctx.md_ctx),
exec(mock_test_image_ctx.header_oid, _, StrEq("rbd"),
StrEq("mirror_image_snapshot_set_copy_progress"),
- ContentsEqual(bl), _, _))
+ ContentsEqual(bl), _, _, _))
.WillOnce(Return(r));
}
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
index c87173d271b..ed2cf8f96e4 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
@@ -274,7 +274,8 @@ public:
encode(mirror_image, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get"),
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
@@ -287,7 +288,8 @@ public:
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc
index 40007dfda98..4a238d282a9 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_GetMirrorImageIdRequest.cc
@@ -49,7 +49,8 @@ public:
encode(image_id, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_get_image_id"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"),
+ StrEq("mirror_image_get_image_id"), _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc
index a53f01fd2c9..0b0a87e8de5 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_PrepareLocalImageRequest.cc
@@ -198,7 +198,8 @@ public:
encode(image_name, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_get_name"), _, _, _))
+ exec(RBD_DIRECTORY, _, StrEq("rbd"), StrEq("dir_get_name"), _,
+ _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
diff --git a/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc b/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
index afabcdfc27a..3347a6cd4be 100644
--- a/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
+++ b/src/test/rbd_mirror/pool_watcher/test_mock_RefreshImagesRequest.cc
@@ -47,7 +47,8 @@ public:
encode(ids, bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
- exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_list"), _, _, _))
+ exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_image_list"),
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([bl](bufferlist *out_bl) {
*out_bl = bl;
})),
diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc
index ce94e5a6d14..cb21fc72396 100644
--- a/src/test/rbd_mirror/test_ImageReplayer.cc
+++ b/src/test/rbd_mirror/test_ImageReplayer.cc
@@ -170,13 +170,13 @@ public:
m_global_image_id = get_global_image_id(m_remote_ioctx, m_remote_image_id);
auto cct = reinterpret_cast<CephContext*>(m_local_ioctx.cct());
- m_threads.reset(new Threads<>(cct));
+ m_threads.reset(new Threads<>(m_local_cluster));
m_image_sync_throttler.reset(new Throttler<>(
cct, "rbd_mirror_concurrent_image_syncs"));
m_instance_watcher = InstanceWatcher<>::create(
- m_local_ioctx, m_threads->work_queue, nullptr,
+ m_local_ioctx, *m_threads->asio_engine, nullptr,
m_image_sync_throttler.get());
m_instance_watcher->handle_acquire_leader();
diff --git a/src/test/rbd_mirror/test_ImageSync.cc b/src/test/rbd_mirror/test_ImageSync.cc
index 6b9b2f7d407..646534ccbd7 100644
--- a/src/test/rbd_mirror/test_ImageSync.cc
+++ b/src/test/rbd_mirror/test_ImageSync.cc
@@ -80,7 +80,7 @@ public:
cct, "rbd_mirror_concurrent_image_syncs");
m_instance_watcher = rbd::mirror::InstanceWatcher<>::create(
- m_local_io_ctx, m_threads->work_queue, nullptr, m_image_sync_throttler);
+ m_local_io_ctx, *m_threads->asio_engine, nullptr, m_image_sync_throttler);
m_instance_watcher->handle_acquire_leader();
ContextWQ* context_wq;
diff --git a/src/test/rbd_mirror/test_InstanceWatcher.cc b/src/test/rbd_mirror/test_InstanceWatcher.cc
index ba19dc1f41e..6b8176d8a92 100644
--- a/src/test/rbd_mirror/test_InstanceWatcher.cc
+++ b/src/test/rbd_mirror/test_InstanceWatcher.cc
@@ -44,7 +44,7 @@ public:
TEST_F(TestInstanceWatcher, InitShutdown)
{
- InstanceWatcher<> instance_watcher(m_local_io_ctx, m_threads->work_queue,
+ InstanceWatcher<> instance_watcher(m_local_io_ctx, *m_threads->asio_engine,
nullptr, nullptr, m_instance_id);
std::vector<std::string> instance_ids;
get_instances(&instance_ids);
@@ -93,7 +93,7 @@ TEST_F(TestInstanceWatcher, Remove)
librados::IoCtx io_ctx;
ASSERT_EQ("", connect_cluster_pp(cluster));
ASSERT_EQ(0, cluster.ioctx_create(_local_pool_name.c_str(), io_ctx));
- InstanceWatcher<> instance_watcher(m_local_io_ctx, m_threads->work_queue,
+ InstanceWatcher<> instance_watcher(m_local_io_ctx, *m_threads->asio_engine,
nullptr, nullptr, "instance_id");
// Init
ASSERT_EQ(0, instance_watcher.init());
@@ -109,7 +109,7 @@ TEST_F(TestInstanceWatcher, Remove)
// Remove
C_SaferCond on_remove;
- InstanceWatcher<>::remove_instance(m_local_io_ctx, m_threads->work_queue,
+ InstanceWatcher<>::remove_instance(m_local_io_ctx, *m_threads->asio_engine,
"instance_id", &on_remove);
ASSERT_EQ(0, on_remove.wait());
@@ -126,7 +126,7 @@ TEST_F(TestInstanceWatcher, Remove)
// Remove NOENT
C_SaferCond on_remove_noent;
- InstanceWatcher<>::remove_instance(m_local_io_ctx, m_threads->work_queue,
+ InstanceWatcher<>::remove_instance(m_local_io_ctx, *m_threads->asio_engine,
instance_id, &on_remove_noent);
ASSERT_EQ(0, on_remove_noent.wait());
}
diff --git a/src/test/rbd_mirror/test_fixture.cc b/src/test/rbd_mirror/test_fixture.cc
index e271364033d..23191da0398 100644
--- a/src/test/rbd_mirror/test_fixture.cc
+++ b/src/test/rbd_mirror/test_fixture.cc
@@ -72,8 +72,7 @@ void TestFixture::SetUp() {
ASSERT_EQ(0, _rados->ioctx_create(_remote_pool_name.c_str(), m_remote_io_ctx));
m_image_name = get_temp_image_name();
- m_threads = new rbd::mirror::Threads<>(reinterpret_cast<CephContext*>(
- m_local_io_ctx.cct()));
+ m_threads = new rbd::mirror::Threads<>(_rados);
}
void TestFixture::TearDown() {
diff --git a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc
index 7b06424b702..9aadc33423a 100644
--- a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc
+++ b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc
@@ -29,7 +29,7 @@ struct ManagedLock<MockTestImageCtx> {
static ManagedLock* s_instance;
static ManagedLock *create(librados::IoCtx& ioctx,
- librbd::asio::ContextWQ *work_queue,
+ librbd::AsioEngine& asio_engine,
const std::string& oid, librbd::Watcher *watcher,
managed_lock::Mode mode,
bool blacklist_on_break_lock,
@@ -67,10 +67,11 @@ struct Threads<librbd::MockTestImageCtx> {
ceph::mutex &timer_lock;
SafeTimer *timer;
librbd::asio::ContextWQ *work_queue;
+ librbd::AsioEngine* asio_engine;
Threads(Threads<librbd::ImageCtx> *threads)
: timer_lock(threads->timer_lock), timer(threads->timer),
- work_queue(threads->work_queue) {
+ work_queue(threads->work_queue), asio_engine(threads->asio_engine) {
}
};
@@ -165,14 +166,14 @@ public:
void expect_register_instance(librados::MockTestMemIoCtxImpl &mock_io_ctx,
int r) {
EXPECT_CALL(mock_io_ctx, exec(RBD_MIRROR_LEADER, _, StrEq("rbd"),
- StrEq("mirror_instances_add"), _, _, _))
+ StrEq("mirror_instances_add"), _, _, _, _))
.WillOnce(Return(r));
}
void expect_unregister_instance(librados::MockTestMemIoCtxImpl &mock_io_ctx,
int r) {
EXPECT_CALL(mock_io_ctx, exec(RBD_MIRROR_LEADER, _, StrEq("rbd"),
- StrEq("mirror_instances_remove"), _, _, _))
+ StrEq("mirror_instances_remove"), _, _, _, _))
.WillOnce(Return(r));
}
@@ -219,7 +220,7 @@ TEST_F(TestMockInstanceWatcher, InitShutdown) {
librados::MockTestMemIoCtxImpl &mock_io_ctx(get_mock_io_ctx(m_local_io_ctx));
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, nullptr, nullptr,
+ m_local_io_ctx, *m_mock_threads->asio_engine, nullptr, nullptr,
m_instance_id);
InSequence seq;
@@ -244,7 +245,7 @@ TEST_F(TestMockInstanceWatcher, InitError) {
librados::MockTestMemIoCtxImpl &mock_io_ctx(get_mock_io_ctx(m_local_io_ctx));
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, nullptr, nullptr,
+ m_local_io_ctx, *m_mock_threads->asio_engine, nullptr, nullptr,
m_instance_id);
InSequence seq;
@@ -265,7 +266,7 @@ TEST_F(TestMockInstanceWatcher, ShutdownError) {
librados::MockTestMemIoCtxImpl &mock_io_ctx(get_mock_io_ctx(m_local_io_ctx));
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, nullptr, nullptr,
+ m_local_io_ctx, *m_mock_threads->asio_engine, nullptr, nullptr,
m_instance_id);
InSequence seq;
@@ -302,7 +303,7 @@ TEST_F(TestMockInstanceWatcher, Remove) {
C_SaferCond on_remove;
MockInstanceWatcher::remove_instance(m_local_io_ctx,
- m_mock_threads->work_queue,
+ *m_mock_threads->asio_engine,
"instance_id", &on_remove);
ASSERT_EQ(0, on_remove.wait());
ASSERT_EQ(0, on_destroy.wait());
@@ -321,7 +322,7 @@ TEST_F(TestMockInstanceWatcher, RemoveNoent) {
C_SaferCond on_remove;
MockInstanceWatcher::remove_instance(m_local_io_ctx,
- m_mock_threads->work_queue,
+ *m_mock_threads->asio_engine,
"instance_id", &on_remove);
ASSERT_EQ(0, on_remove.wait());
ASSERT_EQ(0, on_destroy.wait());
@@ -335,7 +336,7 @@ TEST_F(TestMockInstanceWatcher, ImageAcquireRelease) {
librados::MockTestMemIoCtxImpl &mock_io_ctx1(get_mock_io_ctx(io_ctx1));
MockInstanceReplayer mock_instance_replayer1;
auto instance_watcher1 = MockInstanceWatcher::create(
- io_ctx1, m_mock_threads->work_queue, &mock_instance_replayer1, nullptr);
+ io_ctx1, *m_mock_threads->asio_engine, &mock_instance_replayer1, nullptr);
librados::Rados cluster;
librados::IoCtx io_ctx2;
@@ -345,7 +346,7 @@ TEST_F(TestMockInstanceWatcher, ImageAcquireRelease) {
librados::MockTestMemIoCtxImpl &mock_io_ctx2(get_mock_io_ctx(io_ctx2));
MockInstanceReplayer mock_instance_replayer2;
auto instance_watcher2 = MockInstanceWatcher::create(
- io_ctx2, m_mock_threads->work_queue, &mock_instance_replayer2, nullptr);
+ io_ctx2, *m_mock_threads->asio_engine, &mock_instance_replayer2, nullptr);
InSequence seq;
@@ -418,7 +419,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageRemoved) {
librados::MockTestMemIoCtxImpl &mock_io_ctx1(get_mock_io_ctx(io_ctx1));
MockInstanceReplayer mock_instance_replayer1;
auto instance_watcher1 = MockInstanceWatcher::create(
- io_ctx1, m_mock_threads->work_queue, &mock_instance_replayer1, nullptr);
+ io_ctx1, *m_mock_threads->asio_engine, &mock_instance_replayer1, nullptr);
librados::Rados cluster;
librados::IoCtx io_ctx2;
@@ -428,7 +429,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageRemoved) {
librados::MockTestMemIoCtxImpl &mock_io_ctx2(get_mock_io_ctx(io_ctx2));
MockInstanceReplayer mock_instance_replayer2;
auto instance_watcher2 = MockInstanceWatcher::create(
- io_ctx2, m_mock_threads->work_queue, &mock_instance_replayer2, nullptr);
+ io_ctx2, *m_mock_threads->asio_engine, &mock_instance_replayer2, nullptr);
InSequence seq;
@@ -484,7 +485,7 @@ TEST_F(TestMockInstanceWatcher, ImageAcquireReleaseCancel) {
librados::MockTestMemIoCtxImpl &mock_io_ctx(get_mock_io_ctx(m_local_io_ctx));
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, nullptr, nullptr,
+ m_local_io_ctx, *m_mock_threads->asio_engine, nullptr, nullptr,
m_instance_id);
InSequence seq;
@@ -552,7 +553,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageAcquireWatchDNE) {
MockInstanceReplayer mock_instance_replayer;
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, &mock_instance_replayer,
+ m_local_io_ctx, *m_mock_threads->asio_engine, &mock_instance_replayer,
nullptr, m_instance_id);
InSequence seq;
@@ -584,7 +585,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageReleaseWatchDNE) {
MockInstanceReplayer mock_instance_replayer;
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, &mock_instance_replayer,
+ m_local_io_ctx, *m_mock_threads->asio_engine, &mock_instance_replayer,
nullptr, m_instance_id);
InSequence seq;
@@ -615,7 +616,7 @@ TEST_F(TestMockInstanceWatcher, PeerImageRemovedCancel) {
librados::MockTestMemIoCtxImpl &mock_io_ctx(get_mock_io_ctx(m_local_io_ctx));
auto instance_watcher = new MockInstanceWatcher(
- m_local_io_ctx, m_mock_threads->work_queue, nullptr, nullptr,
+ m_local_io_ctx, *m_mock_threads->asio_engine, nullptr, nullptr,
m_instance_id);
InSequence seq;
@@ -679,7 +680,7 @@ public:
librados::IoCtx& io_ctx1 = m_local_io_ctx;
librados::MockTestMemIoCtxImpl &mock_io_ctx1(get_mock_io_ctx(io_ctx1));
instance_watcher1 = MockInstanceWatcher::create(io_ctx1,
- m_mock_threads->work_queue,
+ *m_mock_threads->asio_engine,
nullptr,
&mock_image_sync_throttler);
EXPECT_EQ("", connect_cluster_pp(cluster));
@@ -687,7 +688,7 @@ public:
instance_id2 = stringify(io_ctx2.get_instance_id());
librados::MockTestMemIoCtxImpl &mock_io_ctx2(get_mock_io_ctx(io_ctx2));
instance_watcher2 = MockInstanceWatcher::create(io_ctx2,
- m_mock_threads->work_queue,
+ *m_mock_threads->asio_engine,
nullptr,
&mock_image_sync_throttler);
InSequence seq;
diff --git a/src/test/rbd_mirror/test_mock_LeaderWatcher.cc b/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
index 9365a9b4314..06ac8f69acb 100644
--- a/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
+++ b/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
@@ -1,6 +1,7 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
+#include "librbd/AsioEngine.h"
#include "librbd/Utils.h"
#include "test/librbd/mock/MockImageCtx.h"
#include "test/rbd_mirror/test_mock_fixture.h"
@@ -60,11 +61,11 @@ MockManagedLock *MockManagedLock::s_instance = nullptr;
template <>
struct ManagedLock<MockTestImageCtx> {
- ManagedLock(librados::IoCtx& ioctx, librbd::asio::ContextWQ *work_queue,
+ ManagedLock(librados::IoCtx& ioctx, librbd::AsioEngine& asio_engine,
const std::string& oid, librbd::Watcher *watcher,
managed_lock::Mode mode, bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds)
- : m_work_queue(work_queue) {
+ : m_work_queue(asio_engine.get_work_queue()) {
MockManagedLock::get_instance().construct();
}
@@ -185,10 +186,11 @@ struct Threads<librbd::MockTestImageCtx> {
ceph::mutex &timer_lock;
SafeTimer *timer;
librbd::asio::ContextWQ *work_queue;
+ librbd::AsioEngine* asio_engine;
Threads(Threads<librbd::ImageCtx> *threads)
: timer_lock(threads->timer_lock), timer(threads->timer),
- work_queue(threads->work_queue) {
+ work_queue(threads->work_queue), asio_engine(threads->asio_engine) {
}
};
diff --git a/src/test/rbd_mirror/test_mock_MirrorStatusUpdater.cc b/src/test/rbd_mirror/test_mock_MirrorStatusUpdater.cc
index 09805f78976..057159ceb4b 100644
--- a/src/test/rbd_mirror/test_mock_MirrorStatusUpdater.cc
+++ b/src/test/rbd_mirror/test_mock_MirrorStatusUpdater.cc
@@ -151,7 +151,7 @@ public:
const cls::rbd::MirrorImageSiteStatus& mirror_image_status, int r) {
EXPECT_CALL(*m_mock_local_io_ctx,
exec(RBD_MIRRORING, _, StrEq("rbd"),
- StrEq("mirror_image_status_set"), _, _, _))
+ StrEq("mirror_image_status_set"), _, _, _, _))
.WillOnce(WithArg<4>(Invoke(
[r, global_image_id, mirror_image_status](bufferlist& in_bl) {
auto bl_it = in_bl.cbegin();
diff --git a/src/test/rbd_mirror/test_mock_NamespaceReplayer.cc b/src/test/rbd_mirror/test_mock_NamespaceReplayer.cc
index 0470fb5efd8..3b262b77528 100644
--- a/src/test/rbd_mirror/test_mock_NamespaceReplayer.cc
+++ b/src/test/rbd_mirror/test_mock_NamespaceReplayer.cc
@@ -132,7 +132,7 @@ struct InstanceWatcher<librbd::MockTestImageCtx> {
static InstanceWatcher* s_instance;
static InstanceWatcher* create(
- librados::IoCtx &ioctx, librbd::asio::ContextWQ* work_queue,
+ librados::IoCtx &ioctx, librbd::AsioEngine& asio_engine,
InstanceReplayer<librbd::MockTestImageCtx>* instance_replayer,
Throttler<librbd::MockTestImageCtx> *image_sync_throttler) {
ceph_assert(s_instance != nullptr);
@@ -250,10 +250,11 @@ struct Threads<librbd::MockTestImageCtx> {
ceph::mutex &timer_lock;
SafeTimer *timer;
librbd::asio::ContextWQ *work_queue;
+ librbd::AsioEngine* asio_engine;
Threads(Threads<librbd::ImageCtx> *threads)
: timer_lock(threads->timer_lock), timer(threads->timer),
- work_queue(threads->work_queue) {
+ work_queue(threads->work_queue), asio_engine(threads->asio_engine) {
}
};
diff --git a/src/test/rbd_mirror/test_mock_PoolReplayer.cc b/src/test/rbd_mirror/test_mock_PoolReplayer.cc
index 42e5a42a6ea..0e2d44c4aab 100644
--- a/src/test/rbd_mirror/test_mock_PoolReplayer.cc
+++ b/src/test/rbd_mirror/test_mock_PoolReplayer.cc
@@ -332,7 +332,7 @@ public:
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_uuid_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
@@ -346,7 +346,7 @@ public:
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillOnce(DoAll(WithArg<5>(Invoke([out_bl](bufferlist *bl) {
*bl = out_bl;
})),
@@ -356,7 +356,7 @@ public:
void expect_mirror_mode_get(librados::MockTestMemIoCtxImpl *io_ctx_impl) {
EXPECT_CALL(*io_ctx_impl,
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
- _, _, _))
+ _, _, _, _))
.WillRepeatedly(DoAll(WithArg<5>(Invoke([](bufferlist *bl) {
encode(cls::rbd::MIRROR_MODE_POOL, *bl);
})),
diff --git a/src/tools/ceph-dencoder/common_types.h b/src/tools/ceph-dencoder/common_types.h
index 36ff42e81a1..fdad619a626 100644
--- a/src/tools/ceph-dencoder/common_types.h
+++ b/src/tools/ceph-dencoder/common_types.h
@@ -273,8 +273,8 @@ MESSAGE(MMDSResolve)
#include "messages/MMDSResolveAck.h"
MESSAGE(MMDSResolveAck)
-#include "messages/MMDSSlaveRequest.h"
-MESSAGE(MMDSSlaveRequest)
+#include "messages/MMDSPeerRequest.h"
+MESSAGE(MMDSPeerRequest)
#include "messages/MMDSSnapUpdate.h"
MESSAGE(MMDSSnapUpdate)
diff --git a/src/tools/ceph-dencoder/mds_types.h b/src/tools/ceph-dencoder/mds_types.h
index 583d5fc7c87..9406bf88bc7 100644
--- a/src/tools/ceph-dencoder/mds_types.h
+++ b/src/tools/ceph-dencoder/mds_types.h
@@ -90,12 +90,12 @@ TYPE_FEATUREFUL_NOCOPY(ESession)
#include "mds/events/ESessions.h"
TYPE_FEATUREFUL_NOCOPY(ESessions)
-#include "mds/events/ESlaveUpdate.h"
+#include "mds/events/EPeerUpdate.h"
TYPE(link_rollback)
TYPE(rmdir_rollback)
TYPE(rename_rollback::drec)
TYPE(rename_rollback)
-TYPE_FEATUREFUL_NOCOPY(ESlaveUpdate)
+TYPE_FEATUREFUL_NOCOPY(EPeerUpdate)
#include "mds/events/ESubtreeMap.h"
TYPE_FEATUREFUL_NOCOPY(ESubtreeMap)
diff --git a/src/tools/rbd/CMakeLists.txt b/src/tools/rbd/CMakeLists.txt
index 2a185f05204..cf069e8f58b 100644
--- a/src/tools/rbd/CMakeLists.txt
+++ b/src/tools/rbd/CMakeLists.txt
@@ -54,10 +54,13 @@ set(rbd_srcs
add_executable(rbd ${rbd_srcs}
$<TARGET_OBJECTS:common_texttable_obj>)
set_target_properties(rbd PROPERTIES OUTPUT_NAME rbd)
-target_link_libraries(rbd librbd librados
- cls_journal_client cls_rbd_client
+target_link_libraries(rbd librbd
+ cls_journal_client
+ cls_rbd_client
rbd_types
journal
+ libneorados
+ librados
ceph-common global ${CURSES_LIBRARIES}
${BLKID_LIBRARIES} ${CMAKE_DL_LIBS})
if(WITH_KRBD)
diff --git a/src/tools/rbd_mirror/CMakeLists.txt b/src/tools/rbd_mirror/CMakeLists.txt
index 9c1a71c57d1..5a89b6c3c9a 100644
--- a/src/tools/rbd_mirror/CMakeLists.txt
+++ b/src/tools/rbd_mirror/CMakeLists.txt
@@ -77,6 +77,7 @@ target_link_libraries(rbd-mirror
rbd_internal
rbd_types
journal
+ libneorados
librados
osdc
cls_rbd_client
diff --git a/src/tools/rbd_mirror/InstanceWatcher.cc b/src/tools/rbd_mirror/InstanceWatcher.cc
index 2ebce31e82e..f7c31013743 100644
--- a/src/tools/rbd_mirror/InstanceWatcher.cc
+++ b/src/tools/rbd_mirror/InstanceWatcher.cc
@@ -6,6 +6,7 @@
#include "common/debug.h"
#include "common/errno.h"
#include "cls/rbd/cls_rbd_client.h"
+#include "librbd/AsioEngine.h"
#include "librbd/ManagedLock.h"
#include "librbd/Utils.h"
#include "librbd/asio/ContextWQ.h"
@@ -59,9 +60,9 @@ struct C_RemoveInstanceRequest : public Context {
Context *on_finish;
C_RemoveInstanceRequest(librados::IoCtx &io_ctx,
- librbd::asio::ContextWQ *work_queue,
+ librbd::AsioEngine& asio_engine,
const std::string &instance_id, Context *on_finish)
- : instance_watcher(io_ctx, work_queue, nullptr, nullptr, instance_id),
+ : instance_watcher(io_ctx, asio_engine, nullptr, nullptr, instance_id),
on_finish(on_finish) {
}
@@ -303,37 +304,38 @@ void InstanceWatcher<I>::get_instances(librados::IoCtx &io_ctx,
template <typename I>
void InstanceWatcher<I>::remove_instance(librados::IoCtx &io_ctx,
- librbd::asio::ContextWQ *work_queue,
+ librbd::AsioEngine& asio_engine,
const std::string &instance_id,
Context *on_finish) {
- auto req = new C_RemoveInstanceRequest<I>(io_ctx, work_queue, instance_id,
+ auto req = new C_RemoveInstanceRequest<I>(io_ctx, asio_engine, instance_id,
on_finish);
req->send();
}
template <typename I>
InstanceWatcher<I> *InstanceWatcher<I>::create(
- librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
+ librados::IoCtx &io_ctx, librbd::AsioEngine& asio_engine,
InstanceReplayer<I> *instance_replayer,
Throttler<I> *image_sync_throttler) {
- return new InstanceWatcher<I>(io_ctx, work_queue, instance_replayer,
+ return new InstanceWatcher<I>(io_ctx, asio_engine, instance_replayer,
image_sync_throttler,
stringify(io_ctx.get_instance_id()));
}
template <typename I>
InstanceWatcher<I>::InstanceWatcher(librados::IoCtx &io_ctx,
- librbd::asio::ContextWQ *work_queue,
+ librbd::AsioEngine& asio_engine,
InstanceReplayer<I> *instance_replayer,
Throttler<I> *image_sync_throttler,
const std::string &instance_id)
- : Watcher(io_ctx, work_queue, RBD_MIRROR_INSTANCE_PREFIX + instance_id),
+ : Watcher(io_ctx, asio_engine.get_work_queue(),
+ RBD_MIRROR_INSTANCE_PREFIX + instance_id),
m_instance_replayer(instance_replayer),
m_image_sync_throttler(image_sync_throttler), m_instance_id(instance_id),
m_lock(ceph::make_mutex(
unique_lock_name("rbd::mirror::InstanceWatcher::m_lock", this))),
m_instance_lock(librbd::ManagedLock<I>::create(
- m_ioctx, m_work_queue, m_oid, this, librbd::managed_lock::EXCLUSIVE, true,
+ m_ioctx, asio_engine, m_oid, this, librbd::managed_lock::EXCLUSIVE, true,
m_cct->_conf.get_val<uint64_t>("rbd_blacklist_expire_seconds"))) {
}
diff --git a/src/tools/rbd_mirror/InstanceWatcher.h b/src/tools/rbd_mirror/InstanceWatcher.h
index c6d983c7e80..08e40b40bf1 100644
--- a/src/tools/rbd_mirror/InstanceWatcher.h
+++ b/src/tools/rbd_mirror/InstanceWatcher.h
@@ -17,9 +17,9 @@
namespace librbd {
+class AsioEngine;
class ImageCtx;
template <typename> class ManagedLock;
-namespace asio { struct ContextWQ; }
} // namespace librbd
@@ -38,19 +38,19 @@ public:
std::vector<std::string> *instance_ids,
Context *on_finish);
static void remove_instance(librados::IoCtx &io_ctx,
- librbd::asio::ContextWQ *work_queue,
+ librbd::AsioEngine& asio_engine,
const std::string &instance_id,
Context *on_finish);
static InstanceWatcher *create(
- librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
+ librados::IoCtx &io_ctx, librbd::AsioEngine& asio_engine,
InstanceReplayer<ImageCtxT> *instance_replayer,
Throttler<ImageCtxT> *image_sync_throttler);
void destroy() {
delete this;
}
- InstanceWatcher(librados::IoCtx &io_ctx, librbd::asio::ContextWQ *work_queue,
+ InstanceWatcher(librados::IoCtx &io_ctx, librbd::AsioEngine& asio_engine,
InstanceReplayer<ImageCtxT> *instance_replayer,
Throttler<ImageCtxT> *image_sync_throttler,
const std::string &instance_id);
diff --git a/src/tools/rbd_mirror/Instances.cc b/src/tools/rbd_mirror/Instances.cc
index d5ac0614f0e..4b59365cd43 100644
--- a/src/tools/rbd_mirror/Instances.cc
+++ b/src/tools/rbd_mirror/Instances.cc
@@ -262,7 +262,7 @@ void Instances<I>::remove_instances(const Instances<I>::clock_t::time_point& tim
auto gather_ctx = new C_Gather(m_cct, ctx);
for (auto& instance_id : instance_ids) {
- InstanceWatcher<I>::remove_instance(m_ioctx, m_threads->work_queue,
+ InstanceWatcher<I>::remove_instance(m_ioctx, *m_threads->asio_engine,
instance_id, gather_ctx->new_sub());
}
diff --git a/src/tools/rbd_mirror/LeaderWatcher.cc b/src/tools/rbd_mirror/LeaderWatcher.cc
index 844d7c7811d..c6eed29cf54 100644
--- a/src/tools/rbd_mirror/LeaderWatcher.cc
+++ b/src/tools/rbd_mirror/LeaderWatcher.cc
@@ -36,8 +36,8 @@ LeaderWatcher<I>::LeaderWatcher(Threads<I> *threads, librados::IoCtx &io_ctx,
io_ctx.get_pool_name())),
m_notifier_id(librados::Rados(io_ctx).get_instance_id()),
m_instance_id(stringify(m_notifier_id)),
- m_leader_lock(new LeaderLock(m_ioctx, m_work_queue, m_oid, this, true,
- m_cct->_conf.get_val<uint64_t>(
+ m_leader_lock(new LeaderLock(m_ioctx, *m_threads->asio_engine, m_oid, this,
+ true, m_cct->_conf.get_val<uint64_t>(
"rbd_blacklist_expire_seconds"))) {
}
diff --git a/src/tools/rbd_mirror/LeaderWatcher.h b/src/tools/rbd_mirror/LeaderWatcher.h
index 60dbd20bd99..223cf3e20c8 100644
--- a/src/tools/rbd_mirror/LeaderWatcher.h
+++ b/src/tools/rbd_mirror/LeaderWatcher.h
@@ -119,12 +119,13 @@ private:
public:
typedef librbd::ManagedLock<ImageCtxT> Parent;
- LeaderLock(librados::IoCtx& ioctx, librbd::asio::ContextWQ *work_queue,
+ LeaderLock(librados::IoCtx& ioctx, librbd::AsioEngine& asio_engine,
const std::string& oid, LeaderWatcher *watcher,
bool blacklist_on_break_lock,
uint32_t blacklist_expire_seconds)
- : Parent(ioctx, work_queue, oid, watcher, librbd::managed_lock::EXCLUSIVE,
- blacklist_on_break_lock, blacklist_expire_seconds),
+ : Parent(ioctx, asio_engine, oid, watcher,
+ librbd::managed_lock::EXCLUSIVE, blacklist_on_break_lock,
+ blacklist_expire_seconds),
watcher(watcher) {
}
diff --git a/src/tools/rbd_mirror/Mirror.cc b/src/tools/rbd_mirror/Mirror.cc
index e24a78ae805..590336b12a4 100644
--- a/src/tools/rbd_mirror/Mirror.cc
+++ b/src/tools/rbd_mirror/Mirror.cc
@@ -487,12 +487,7 @@ Mirror::Mirror(CephContext *cct, const std::vector<const char*> &args) :
m_local(new librados::Rados()),
m_cache_manager_handler(new CacheManagerHandler(cct)),
m_pool_meta_cache(new PoolMetaCache(cct)),
- m_asok_hook(new MirrorAdminSocketHook(cct, this))
-{
- m_threads =
- &(cct->lookup_or_create_singleton_object<Threads<librbd::ImageCtx>>(
- "rbd_mirror::threads", false, cct));
- m_service_daemon.reset(new ServiceDaemon<>(m_cct, m_local, m_threads));
+ m_asok_hook(new MirrorAdminSocketHook(cct, this)) {
}
Mirror::~Mirror()
@@ -539,6 +534,10 @@ int Mirror::init()
return r;
}
+ m_threads = &(m_cct->lookup_or_create_singleton_object<
+ Threads<librbd::ImageCtx>>("rbd_mirror::threads", false, m_local));
+ m_service_daemon.reset(new ServiceDaemon<>(m_cct, m_local, m_threads));
+
r = m_service_daemon->init();
if (r < 0) {
derr << "error registering service daemon: " << cpp_strerror(r) << dendl;
diff --git a/src/tools/rbd_mirror/NamespaceReplayer.cc b/src/tools/rbd_mirror/NamespaceReplayer.cc
index d86514967ed..2a45cd1c6a8 100644
--- a/src/tools/rbd_mirror/NamespaceReplayer.cc
+++ b/src/tools/rbd_mirror/NamespaceReplayer.cc
@@ -385,7 +385,7 @@ void NamespaceReplayer<I>::init_instance_watcher() {
ceph_assert(!m_instance_watcher);
m_instance_watcher.reset(InstanceWatcher<I>::create(
- m_local_io_ctx, m_threads->work_queue, m_instance_replayer.get(),
+ m_local_io_ctx, *m_threads->asio_engine, m_instance_replayer.get(),
m_image_sync_throttler));
auto ctx = create_context_callback<NamespaceReplayer<I>,
&NamespaceReplayer<I>::handle_init_instance_watcher>(this);
diff --git a/src/tools/rbd_mirror/Threads.cc b/src/tools/rbd_mirror/Threads.cc
index 702f26a0852..b0c76264119 100644
--- a/src/tools/rbd_mirror/Threads.cc
+++ b/src/tools/rbd_mirror/Threads.cc
@@ -11,8 +11,9 @@ namespace rbd {
namespace mirror {
template <typename I>
-Threads<I>::Threads(CephContext *cct) {
- asio_engine = new librbd::AsioEngine(cct);
+Threads<I>::Threads(std::shared_ptr<librados::Rados>& rados) {
+ auto cct = static_cast<CephContext*>(rados->cct());
+ asio_engine = new librbd::AsioEngine(rados);
work_queue = asio_engine->get_work_queue();
timer = new SafeTimer(cct, timer_lock, true);
diff --git a/src/tools/rbd_mirror/Threads.h b/src/tools/rbd_mirror/Threads.h
index 91c086b1e31..91c923ab4a0 100644
--- a/src/tools/rbd_mirror/Threads.h
+++ b/src/tools/rbd_mirror/Threads.h
@@ -5,7 +5,9 @@
#define CEPH_RBD_MIRROR_THREADS_H
#include "include/common_fwd.h"
+#include "include/rados/librados_fwd.hpp"
#include "common/ceph_mutex.h"
+#include <memory>
class SafeTimer;
class ThreadPool;
@@ -21,16 +23,14 @@ namespace mirror {
template <typename ImageCtxT = librbd::ImageCtx>
class Threads {
-private:
- librbd::AsioEngine* asio_engine = nullptr;
-
public:
+ librbd::AsioEngine* asio_engine = nullptr;
librbd::asio::ContextWQ* work_queue = nullptr;
SafeTimer *timer = nullptr;
ceph::mutex timer_lock = ceph::make_mutex("Threads::timer_lock");
- explicit Threads(CephContext *cct);
+ explicit Threads(std::shared_ptr<librados::Rados>& rados);
Threads(const Threads&) = delete;
Threads& operator=(const Threads&) = delete;
diff --git a/src/vstart.sh b/src/vstart.sh
index d1f4a7b16b6..3f4ab3fed25 100755
--- a/src/vstart.sh
+++ b/src/vstart.sh
@@ -1094,8 +1094,6 @@ start_ganesha() {
MDCACHE {
Dir_Chunk = 0;
- NParts = 1;
- Cache_Size = 1;
}
NFSv4 {
@@ -1188,7 +1186,7 @@ fi
[ -d $CEPH_OUT_DIR ] || mkdir -p $CEPH_OUT_DIR
[ -d $CEPH_DEV_DIR ] || mkdir -p $CEPH_DEV_DIR
if [ $inc_osd_num -eq 0 ]; then
- $SUDO rm -rf $CEPH_OUT_DIR/*
+ $SUDO find "$CEPH_OUT_DIR" -type f -delete
fi
[ -d gmon ] && $SUDO rm -rf gmon/*