From 33f766ddbb9cb7278550d9f265f15ebf567cff67 Mon Sep 17 00:00:00 2001 From: Jack Del Vecchio Date: Mon, 16 Dec 2024 11:15:13 -0500 Subject: [PATCH] HPCC-33057 Allow attributes for implicit storage planes to be merged Signed-off-by: Jack Del Vecchio --- dali/base/dafdesc.cpp | 65 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/dali/base/dafdesc.cpp b/dali/base/dafdesc.cpp index df1c816f8a4..7a02c2b6c19 100644 --- a/dali/base/dafdesc.cpp +++ b/dali/base/dafdesc.cpp @@ -3572,10 +3572,13 @@ void GroupInformation::createStoragePlane(IPropertyTree * storage, unsigned copy { // Check that storage plane does not already have a definition VStringBuffer xpath("planes[@name='%s']", name.str()); - if (storage->hasProp(xpath)) - return; + IPropertyTree * plane = storage->queryPropTree(xpath); + if (!plane || (copy != 0)) + { + plane = storage->addPropTree("planes"); + plane->setPropBool("@fromGroup", true); + } - IPropertyTree * plane = storage->addPropTree("planes"); StringBuffer mirrorname; const char * planeName = name; if (copy != 0) @@ -3586,37 +3589,47 @@ void GroupInformation::createStoragePlane(IPropertyTree * storage, unsigned copy //URL style drop zones don't generate a host entry, and will have a single device if (ordinality() != 0) { - if (container) - { - const char * containerName = container->name; - if (copy != 0) - containerName = mirrorname.clear().append(containerName).append("_mirror"); - //hosts will be expanded by normalizeHostGroups - plane->setProp("@hostGroup", containerName); - } - else + if (!plane->hasProp("@hostGroup")) { - //Host group has been created that matches the name of the storage plane - plane->setProp("@hostGroup", planeName); + if (container) + { + const char * containerName = container->name; + if (copy != 0) + containerName = mirrorname.clear().append(containerName).append("_mirror"); + //hosts will be expanded by normalizeHostGroups + plane->setProp("@hostGroup", containerName); + } + else + { + //Host group has been created that matches the name of the storage plane + plane->setProp("@hostGroup", planeName); + } } - if (ordinality() > 1) + if (!plane->hasProp("@numDevices")) { - plane->setPropInt("@numDevices", ordinality()); - if (dropZoneIndex == 0) - plane->setPropInt("@defaultSprayParts", ordinality()); + if (ordinality() > 1) + { + plane->setPropInt("@numDevices", ordinality()); + if (dropZoneIndex == 0) + plane->setPropInt("@defaultSprayParts", ordinality()); + } } } - if (dir.length()) - plane->setProp("@prefix", dir); - else - plane->setProp("@prefix", queryBaseDirectory(groupType, copy)); - - const char * category = (dropZoneIndex != 0) ? "lz" : "data"; - plane->setProp("@category", category); + if (!plane->hasProp("@prefix")) + { + if (dir.length()) + plane->setProp("@prefix", dir); + else + plane->setProp("@prefix", queryBaseDirectory(groupType, copy)); + } - plane->setPropBool("@fromGroup", true); + if (!plane->hasProp("@category")) + { + const char * category = (dropZoneIndex != 0) ? "lz" : "data"; + plane->setProp("@category", category); + } //MORE: If container is identical to this except for the name we could generate an information tag @alias }