From: Dnyaneshwari Date: Thu, 10 Apr 2025 08:22:47 +0000 (+0530) Subject: mgr/dashboard: RGW - Reatin Head Object Fix X-Git-Tag: v20.3.0~104^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=edffbbee95134101167bae75730c12e95f006ac4;p=ceph.git mgr/dashboard: RGW - Reatin Head Object Fix Fixes: https://tracker.ceph.com/issues/70871 Signed-off-by: Dnyaneshwari Talwekar --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-storage-class.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-storage-class.model.ts index 85b0bf75d0afa..6e7b1d745d119 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-storage-class.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-storage-class.model.ts @@ -19,6 +19,7 @@ export interface StorageClassDetails { multipart_min_part_size: number; multipart_sync_threshold: number; host_style: string; + retain_head_object: boolean; } export interface S3Details { @@ -38,6 +39,7 @@ export interface TierTarget { val: { storage_class: string; tier_type: string; + retain_head_object: boolean; s3: S3Details; }; } @@ -55,6 +57,7 @@ export interface StorageClassDetails { multipart_sync_threshold: number; host_style: string; } + export interface ZoneGroup { name: string; id: string; @@ -74,7 +77,6 @@ export interface S3Details { host_style: boolean; retain_head_object?: boolean; } - export interface RequestModel { zone_group: string; placement_targets: PlacementTarget[]; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.html index 1f724fc7a2d1b..378c0b6372a8b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.html @@ -107,6 +107,18 @@ {{ selection?.multipart_sync_threshold }} + + + Retain Head Object + + + Retain object metadata after transition to the cloud (default: false). + + + + {{ selection?.retain_head_object }} + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.spec.ts index 90541d45855c9..ca7e9fcaac796 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.spec.ts @@ -38,7 +38,8 @@ describe('RgwStorageClassDetailsComponent', () => { target_path: '/test/path', multipart_min_part_size: 100, multipart_sync_threshold: 200, - host_style: 'path' + host_style: 'path', + retain_head_object: true }; component.selection = mockSelection; component.ngOnChanges(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.ts index 7494e6deac2c8..aeb72b0bdc213 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.ts @@ -21,7 +21,8 @@ export class RgwStorageClassDetailsComponent implements OnChanges { target_path: this.selection.target_path, multipart_min_part_size: this.selection.multipart_min_part_size, multipart_sync_threshold: this.selection.multipart_sync_threshold, - host_style: this.selection.host_style + host_style: this.selection.host_style, + retain_head_object: this.selection.retain_head_object }; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.spec.ts index c6582e46af2c8..80f5fcf7a108d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.spec.ts @@ -71,6 +71,7 @@ describe('RgwStorageClassFormComponent', () => { val: { storage_class: 'CLOUDIBM', tier_type: 'cloud-s3', + retain_head_object: true, s3: { endpoint: 'https://s3.amazonaws.com', access_key: 'ACCESSKEY', @@ -94,6 +95,7 @@ describe('RgwStorageClassFormComponent', () => { val: { storage_class: 'CloudIBM', tier_type: 'cloud-s3', + retain_head_object: true, s3: { endpoint: 'https://s3.amazonaws.com', access_key: 'ACCESSKEY', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.ts index d380f08bcc0f6..47669107d2174 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.ts @@ -80,7 +80,7 @@ export class RgwStorageClassFormComponent extends CdForm implements OnInit { this.targetSecretKeyText = "To view or copy your secret key, go to your cloud service's user management or credentials section, find your user profile, and locate the access key. You can view and copy the key by following the instructions provided."; this.retainHeadObjectText = - 'Retain object metadata after transition to the cloud (default: deleted).'; + 'Retain object metadata after transition to the cloud (default: false).'; this.createForm(); this.loadingReady(); this.loadZoneGroup(); @@ -111,7 +111,7 @@ export class RgwStorageClassFormComponent extends CdForm implements OnInit { this.storageClassForm.get('target_path').setValue(response.target_path); this.storageClassForm .get('retain_head_object') - .setValue(response.retain_head_object || false); + .setValue(this.tierTargetInfo?.val?.retain_head_object || false); this.storageClassForm .get('multipart_sync_threshold') .setValue(response.multipart_sync_threshold || ''); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/utils/rgw-bucket-tiering.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/utils/rgw-bucket-tiering.ts index 7c33d89f236da..33cd412c3666c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/utils/rgw-bucket-tiering.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/utils/rgw-bucket-tiering.ts @@ -27,6 +27,7 @@ export class BucketTieringUtils { zonegroup_name: zoneGroup, placement_target: targetName, storage_class: tierTarget.val.storage_class, + retain_head_object: tierTarget.val.retain_head_object, ...tierTarget.val.s3 }; } diff --git a/src/pybind/mgr/dashboard/services/rgw_client.py b/src/pybind/mgr/dashboard/services/rgw_client.py index fb633726805f7..13c03ec9c95a2 100755 --- a/src/pybind/mgr/dashboard/services/rgw_client.py +++ b/src/pybind/mgr/dashboard/services/rgw_client.py @@ -1864,6 +1864,14 @@ class RgwMultisite: else: self.update_period() + def modify_retain_head(self, tier_config: dict) -> List[str]: + tier_config_items = [] + for key, value in tier_config.items(): + if isinstance(value, bool): + value = str(value).lower() + tier_config_items.append(f'{key}={value}') + return tier_config_items + def add_placement_targets(self, zonegroup_name: str, placement_targets: List[Dict]): rgw_add_placement_cmd = ['zonegroup', 'placement', 'add'] STANDARD_STORAGE_CLASS = "STANDARD" @@ -1882,9 +1890,7 @@ class RgwMultisite: ): tier_config = placement_target.get('tier_config', {}) if tier_config: - tier_config_items = ( - f'{key}={value}' for key, value in tier_config.items() - ) + tier_config_items = self.modify_retain_head(tier_config) tier_config_str = ','.join(tier_config_items) cmd_add_placement_options += [ '--tier-type', 'cloud-s3', '--tier-config', tier_config_str @@ -1957,9 +1963,7 @@ class RgwMultisite: ): tier_config = placement_target.get('tier_config', {}) if tier_config: - tier_config_items = ( - f'{key}={value}' for key, value in tier_config.items() - ) + tier_config_items = self.modify_retain_head(tier_config) tier_config_str = ','.join(tier_config_items) cmd_add_placement_options += [ '--tier-type', 'cloud-s3', '--tier-config', tier_config_str