Skip to content

Commit 2072274

Browse files
committed
Add dom0 to clusterview exadata export
1 parent c515388 commit 2072274

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

api-service/database/exadata.go

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,50 @@ func (md *MongoDatabase) FindExadataClusterViews() ([]dto.OracleExadataClusterVi
267267
{Key: "hostType", Value: "$components.hostType"},
268268
{Key: "clustername", Value: "$components.vms.clusterName"},
269269
{Key: "vmname", Value: "$components.vms.name"},
270-
{Key: "totalRAM", Value: bson.D{{Key: "$sum", Value: "$components.vms.ramCurrent"}}},
271-
{Key: "totalCPU", Value: bson.D{{Key: "$sum", Value: "$components.vms.cpuCurrent"}}},
270+
{Key: "totalRAM",
271+
Value: bson.D{
272+
{Key: "$sum",
273+
Value: bson.D{
274+
{Key: "$cond",
275+
Value: bson.A{
276+
bson.D{
277+
{Key: "$eq",
278+
Value: bson.A{
279+
"$components.hostType",
280+
model.DOM0,
281+
},
282+
},
283+
},
284+
"$components.vms.ramOnline",
285+
"$components.vms.ramCurrent",
286+
},
287+
},
288+
},
289+
},
290+
},
291+
},
292+
{Key: "totalCPU",
293+
Value: bson.D{
294+
{Key: "$sum",
295+
Value: bson.D{
296+
{Key: "$cond",
297+
Value: bson.A{
298+
bson.D{
299+
{Key: "$eq",
300+
Value: bson.A{
301+
"$components.hostType",
302+
model.DOM0,
303+
},
304+
},
305+
},
306+
"$components.vms.cpuOnline",
307+
"$components.vms.cpuCurrent",
308+
},
309+
},
310+
},
311+
},
312+
},
313+
},
272314
},
273315
},
274316
},

0 commit comments

Comments
 (0)