Skip to content

Commit 02ea1c4

Browse files
Timothy AsirTimothy Asir Jeyasingh
authored andcommitted
Fix DR Status is not displayed for discovered apps in Virtual Machine page
https://issues.redhat.com/browse/DFBUGS-2822 https://issues.redhat.com/browse/DFBUGS-2823 Signed-off-by: Timothy Asir Jeyasingh <[email protected]>
1 parent 9a0cac3 commit 02ea1c4

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

packages/mco/components/dr-status-popover/parsers/virtualmachine-parser.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import * as React from 'react';
2-
import {
3-
DISCOVERED_APP_NS,
4-
KUBE_INSTANCE_LABEL,
5-
ODF_RESOURCE_TYPE_LABEL,
6-
} from '@odf/mco/constants';
2+
import { DISCOVERED_APP_NS, KUBE_INSTANCE_LABEL } from '@odf/mco/constants';
73
import {
84
getApplicationResourceObj,
95
getApplicationSetResourceObj,
@@ -27,7 +23,6 @@ import {
2723
getLabel,
2824
getName,
2925
getNamespace,
30-
VirtualMachineModel,
3126
} from '@odf/shared';
3227
import {
3328
K8sResourceCommon,
@@ -75,12 +70,6 @@ const DiscoveredHelper: React.FC<ParserHelperProps> = ({
7570
>(
7671
getDRPlacementControlResourceObj({
7772
namespace: DISCOVERED_APP_NS,
78-
selector: {
79-
matchLabels: {
80-
// To optimize the VM DRPC watch
81-
[ODF_RESOURCE_TYPE_LABEL]: VirtualMachineModel.kind.toLowerCase(),
82-
},
83-
},
8473
})
8574
);
8675

packages/mco/components/modals/app-manage-policies/parsers/discovered-vm-parser.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import * as React from 'react';
22
import { getPlacementKindObj } from '@odf/mco/components/discovered-application-wizard/utils/k8s-utils';
3-
import {
4-
DISCOVERED_APP_NS,
5-
DRApplication,
6-
ODF_RESOURCE_TYPE_LABEL,
7-
} from '@odf/mco/constants';
3+
import { DISCOVERED_APP_NS, DRApplication } from '@odf/mco/constants';
84
import {
95
getDRPlacementControlResourceObj,
106
getDRPolicyResourceObj,
@@ -16,7 +12,7 @@ import {
1612
getSearchResultItems,
1713
queryAppWorkloadPVCs,
1814
} from '@odf/mco/utils';
19-
import { getName, getNamespace, VirtualMachineModel } from '@odf/shared';
15+
import { getName, getNamespace } from '@odf/shared';
2016
import {
2117
K8sResourceCommon,
2218
useK8sWatchResource,
@@ -53,12 +49,6 @@ export const DiscoveredVMParser: React.FC<DiscoveredVMParserProps> = ({
5349
>(
5450
getDRPlacementControlResourceObj({
5551
namespace: DISCOVERED_APP_NS,
56-
selector: {
57-
matchLabels: {
58-
// To optimize the VM DRPC watch
59-
[ODF_RESOURCE_TYPE_LABEL]: VirtualMachineModel.kind.toLowerCase(),
60-
},
61-
},
6252
})
6353
);
6454

packages/mco/components/modals/app-manage-policies/utils/parser-utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ export const findDRPCUsingVM = (
180180
): DRPlacementControlKind | undefined =>
181181
drpcs.find(
182182
(drpc) =>
183-
getVMNamesFromRecipe(drpc.spec).includes(vmName) &&
183+
(getVMNamesFromRecipe(drpc.spec).includes(vmName) ||
184+
(
185+
drpc.status?.resourceConditions?.resourceMeta?.protectedpvcs || []
186+
).some((pvc) => pvc.startsWith(vmName))) &&
184187
drpc.spec?.protectedNamespaces?.includes(vmNamespace) &&
185188
getPrimaryClusterName(drpc) === cluster
186189
);

0 commit comments

Comments
 (0)