Skip to content

Commit e3f06b8

Browse files
authored
Merge pull request ceph#62761 from rhcs-dashboard/tiering-fix
mgr/dashboard: RGW - Reatin Head Object Fix Reviewed-by: Afreen Misbah <[email protected]> Reviewed-by: Aashish Sharma <[email protected]>
2 parents 23f9d6d + edffbbe commit e3f06b8

File tree

8 files changed

+34
-11
lines changed

8 files changed

+34
-11
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/models/rgw-storage-class.model.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface StorageClassDetails {
1919
multipart_min_part_size: number;
2020
multipart_sync_threshold: number;
2121
host_style: string;
22+
retain_head_object: boolean;
2223
}
2324

2425
export interface S3Details {
@@ -38,6 +39,7 @@ export interface TierTarget {
3839
val: {
3940
storage_class: string;
4041
tier_type: string;
42+
retain_head_object: boolean;
4143
s3: S3Details;
4244
};
4345
}
@@ -55,6 +57,7 @@ export interface StorageClassDetails {
5557
multipart_sync_threshold: number;
5658
host_style: string;
5759
}
60+
5861
export interface ZoneGroup {
5962
name: string;
6063
id: string;
@@ -74,7 +77,6 @@ export interface S3Details {
7477
host_style: boolean;
7578
retain_head_object?: boolean;
7679
}
77-
7880
export interface RequestModel {
7981
zone_group: string;
8082
placement_targets: PlacementTarget[];

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@
107107
</td>
108108
<td>{{ selection?.multipart_sync_threshold }}</td>
109109
</tr>
110+
<tr>
111+
<td
112+
class="bold">
113+
Retain Head Object
114+
<cd-helper class="text-pre-wrap">
115+
<span i18n>
116+
Retain object metadata after transition to the cloud (default: false).
117+
</span>
118+
</cd-helper>
119+
</td>
120+
<td>{{ selection?.retain_head_object }}</td>
121+
</tr>
110122
</tbody>
111123
</table>
112124
</cds-tab>

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ describe('RgwStorageClassDetailsComponent', () => {
3838
target_path: '/test/path',
3939
multipart_min_part_size: 100,
4040
multipart_sync_threshold: 200,
41-
host_style: 'path'
41+
host_style: 'path',
42+
retain_head_object: true
4243
};
4344
component.selection = mockSelection;
4445
component.ngOnChanges();

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-details/rgw-storage-class-details.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export class RgwStorageClassDetailsComponent implements OnChanges {
2121
target_path: this.selection.target_path,
2222
multipart_min_part_size: this.selection.multipart_min_part_size,
2323
multipart_sync_threshold: this.selection.multipart_sync_threshold,
24-
host_style: this.selection.host_style
24+
host_style: this.selection.host_style,
25+
retain_head_object: this.selection.retain_head_object
2526
};
2627
}
2728
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe('RgwStorageClassFormComponent', () => {
7171
val: {
7272
storage_class: 'CLOUDIBM',
7373
tier_type: 'cloud-s3',
74+
retain_head_object: true,
7475
s3: {
7576
endpoint: 'https://s3.amazonaws.com',
7677
access_key: 'ACCESSKEY',
@@ -94,6 +95,7 @@ describe('RgwStorageClassFormComponent', () => {
9495
val: {
9596
storage_class: 'CloudIBM',
9697
tier_type: 'cloud-s3',
98+
retain_head_object: true,
9799
s3: {
98100
endpoint: 'https://s3.amazonaws.com',
99101
access_key: 'ACCESSKEY',

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-form/rgw-storage-class-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class RgwStorageClassFormComponent extends CdForm implements OnInit {
8080
this.targetSecretKeyText =
8181
"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.";
8282
this.retainHeadObjectText =
83-
'Retain object metadata after transition to the cloud (default: deleted).';
83+
'Retain object metadata after transition to the cloud (default: false).';
8484
this.createForm();
8585
this.loadingReady();
8686
this.loadZoneGroup();
@@ -111,7 +111,7 @@ export class RgwStorageClassFormComponent extends CdForm implements OnInit {
111111
this.storageClassForm.get('target_path').setValue(response.target_path);
112112
this.storageClassForm
113113
.get('retain_head_object')
114-
.setValue(response.retain_head_object || false);
114+
.setValue(this.tierTargetInfo?.val?.retain_head_object || false);
115115
this.storageClassForm
116116
.get('multipart_sync_threshold')
117117
.setValue(response.multipart_sync_threshold || '');

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/utils/rgw-bucket-tiering.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class BucketTieringUtils {
2727
zonegroup_name: zoneGroup,
2828
placement_target: targetName,
2929
storage_class: tierTarget.val.storage_class,
30+
retain_head_object: tierTarget.val.retain_head_object,
3031
...tierTarget.val.s3
3132
};
3233
}

src/pybind/mgr/dashboard/services/rgw_client.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,6 +1864,14 @@ def ensure_realm_and_sync_period(self):
18641864
else:
18651865
self.update_period()
18661866

1867+
def modify_retain_head(self, tier_config: dict) -> List[str]:
1868+
tier_config_items = []
1869+
for key, value in tier_config.items():
1870+
if isinstance(value, bool):
1871+
value = str(value).lower()
1872+
tier_config_items.append(f'{key}={value}')
1873+
return tier_config_items
1874+
18671875
def add_placement_targets(self, zonegroup_name: str, placement_targets: List[Dict]):
18681876
rgw_add_placement_cmd = ['zonegroup', 'placement', 'add']
18691877
STANDARD_STORAGE_CLASS = "STANDARD"
@@ -1882,9 +1890,7 @@ def add_placement_targets(self, zonegroup_name: str, placement_targets: List[Dic
18821890
):
18831891
tier_config = placement_target.get('tier_config', {})
18841892
if tier_config:
1885-
tier_config_items = (
1886-
f'{key}={value}' for key, value in tier_config.items()
1887-
)
1893+
tier_config_items = self.modify_retain_head(tier_config)
18881894
tier_config_str = ','.join(tier_config_items)
18891895
cmd_add_placement_options += [
18901896
'--tier-type', 'cloud-s3', '--tier-config', tier_config_str
@@ -1957,9 +1963,7 @@ def modify_placement_targets(self, zonegroup_name: str, placement_targets: List[
19571963
):
19581964
tier_config = placement_target.get('tier_config', {})
19591965
if tier_config:
1960-
tier_config_items = (
1961-
f'{key}={value}' for key, value in tier_config.items()
1962-
)
1966+
tier_config_items = self.modify_retain_head(tier_config)
19631967
tier_config_str = ','.join(tier_config_items)
19641968
cmd_add_placement_options += [
19651969
'--tier-type', 'cloud-s3', '--tier-config', tier_config_str

0 commit comments

Comments
 (0)