Skip to content

Commit

Permalink
Merge pull request #642 from ejweber/3823-disk-anti-affinity
Browse files Browse the repository at this point in the history
Add ReplicaDiskSoftAntiAffinity setting
  • Loading branch information
votdev authored Nov 20, 2023
2 parents 0b54117 + 11833eb commit a209885
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/routes/volume/CreateVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,15 @@ const modal = ({
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
</Select>)}
</FormItem>
<FormItem label="Replica Disk Soft Anti Affinity" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('replicaDiskSoftAntiAffinity', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
</Select>)}
</FormItem>
{ getFieldsValue().backendStoreDriver === 'v2' && <FormItem label="Offline Replica Rebuilding" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('offlineReplicaRebuilding', {
initialValue: 'ignored',
Expand Down
5 changes: 5 additions & 0 deletions src/routes/volume/VolumeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function actions({
showUpdateSnapshotDataIntegrityModal,
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
commandKeyDown,
}) {
Expand Down Expand Up @@ -137,6 +138,9 @@ function actions({
case 'updateReplicaZoneSoftAntiAffinity':
showUpdateReplicaZoneSoftAntiAffinityModal(record)
break
case 'updateReplicaDiskSoftAntiAffinity':
showUpdateReplicaDiskSoftAntiAffinityModal(record)
break
case 'updateOfflineReplicaRebuilding':
showOfflineReplicaRebuildingModal(record)
break
Expand Down Expand Up @@ -209,6 +213,7 @@ function actions({
{ key: 'updateUnmapMarkSnapChainRemoved', name: 'Allow snapshots removal during trim', disabled: false },
{ key: 'updateReplicaSoftAntiAffinity', name: 'Update Replica Soft Anti Affinity', disabled: false },
{ key: 'updateReplicaZoneSoftAntiAffinity', name: 'Update Replica Zone Soft Anti Affinity', disabled: false },
{ key: 'updateReplicaDiskSoftAntiAffinity', name: 'Update Replica Disk Soft Anti Affinity', disabled: false },
{ key: 'updateOfflineReplicaRebuilding', name: 'Update Offline Replica Rebuilding', disabled: false || selected.backendStoreDriver !== 'v2' },
]
const availableActions = [{ key: 'backups', name: 'Backups', disabled: selected.standby || isRestoring(selected) }, { key: 'delete', name: 'Delete' }]
Expand Down
5 changes: 5 additions & 0 deletions src/routes/volume/VolumeBulkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function bulkActions({
showUpdateBulkSnapshotDataIntegrityModal,
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
}) {
const deleteWranElement = (rows) => {
Expand Down Expand Up @@ -129,6 +130,9 @@ function bulkActions({
case 'updateReplicaZoneSoftAntiAffinity':
showUpdateReplicaZoneSoftAntiAffinityModal(selectedRows)
break
case 'updateReplicaDiskSoftAntiAffinity':
showUpdateReplicaDiskSoftAntiAffinityModal(selectedRows)
break
case 'updateOfflineReplicaRebuilding':
showOfflineReplicaRebuildingModal(selectedRows)
break
Expand Down Expand Up @@ -196,6 +200,7 @@ function bulkActions({
{ key: 'updateUnmapMarkSnapChainRemoved', name: 'Allow snapshots removal during trim', disabled() { return selectedRows.length === 0 } },
{ key: 'updateReplicaSoftAntiAffinity', name: 'Update Replica Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateReplicaZoneSoftAntiAffinity', name: 'Update Replica Zone Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateReplicaDiskSoftAntiAffinity', name: 'Update Replica Disk Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateOfflineReplicaRebuilding', name: 'Update Offline Replica Rebuilding', disabled() { return selectedRows.length === 0 || selectedRows.some((item) => item.backendStoreDriver !== 'v2') } },
{ key: 'trimFilesystem', name: 'Trim Filesystem', disabled() { return selectedRows.length === 0 || notAttached() } },
]
Expand Down
2 changes: 2 additions & 0 deletions src/routes/volume/VolumeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function list({
showUpdateSnapshotDataIntegrityModal,
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
onRowClick = f => f,
}) {
Expand Down Expand Up @@ -89,6 +90,7 @@ function list({
showUpdateSnapshotDataIntegrityModal,
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
onRowClick,
}
Expand Down
4 changes: 4 additions & 0 deletions src/routes/volume/detail/VolumeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ function VolumeInfo({ selectedVolume, snapshotModalState, engineImages, hosts, c
<span className={styles.label}> Replica Zone Soft Anti Affinity:</span>
{selectedVolume?.replicaZoneSoftAntiAffinity}
</div>
<div className={styles.row}>
<span className={styles.label}> Replica Disk Soft Anti Affinity:</span>
{selectedVolume?.replicaDiskSoftAntiAffinity}
</div>
{ selectedVolume.kubernetesStatus ? <div>
{ selectedVolume.kubernetesStatus.lastPVCRefAt ? <div className={styles.row}>
<span className={styles.label}> Last time bound with PVC:</span>
Expand Down
9 changes: 9 additions & 0 deletions src/routes/volume/detail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
},
})
},
showUpdateReplicaDiskSoftAntiAffinityModal(record) {
dispatch({
type: 'volume/showUpdateReplicaSoftAntiAffinityModal',
payload: {
volume: record,
softAntiAffinityKey: 'updateReplicaDiskSoftAntiAffinity',
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showOfflineReplicaRebuildingModal',
Expand Down
16 changes: 16 additions & 0 deletions src/routes/volume/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,22 @@ export function getUpdateReplicaSoftAntiAffinityModalProps(volume, volumes, upda
}
replicaSoftAntiAffinityVolumes = volumes
break
case 'updateReplicaDiskSoftAntiAffinity':
feilds = {
actionKey: 'updateReplicaDiskSoftAntiAffinity',
key: 'replicaDiskSoftAntiAffinity',
name: 'Replica Disk Soft Anti Affinity',
}
replicaSoftAntiAffinityVolumes = [volume]
break
case 'updateBulkReplicaDiskSoftAntiAffinity':
feilds = {
actionKey: 'updateReplicaDiskSoftAntiAffinity',
key: 'replicaDiskSoftAntiAffinity',
name: 'Replica Disk Soft Anti Affinity',
}
replicaSoftAntiAffinityVolumes = volumes
break
default:
}
return {
Expand Down
18 changes: 18 additions & 0 deletions src/routes/volume/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,15 @@ class Volume extends React.Component {
},
})
},
showUpdateReplicaDiskSoftAntiAffinityModal(record) {
dispatch({
type: 'volume/showUpdateReplicaSoftAntiAffinityModal',
payload: {
volume: record,
softAntiAffinityKey: 'updateReplicaDiskSoftAntiAffinity',
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showOfflineReplicaRebuildingModal',
Expand Down Expand Up @@ -1032,6 +1041,15 @@ class Volume extends React.Component {
},
})
},
showUpdateReplicaDiskSoftAntiAffinityModal(record) {
dispatch({
type: 'volume/showBulkUpdateReplicaSoftAntiAffinityModal',
payload: {
volumes: record,
softAntiAffinityKey: 'updateBulkReplicaDiskSoftAntiAffinity',
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showBulkOfflineReplicaRebuildingModal',
Expand Down

0 comments on commit a209885

Please sign in to comment.