def reporterMSCluster(self, vector, ms_cluster, groups, ipDictByGroupName, nodesWithIP): clusterOsh = ms_cluster.create_osh() vector.add(clusterOsh) vector.add(modeling.createLinkOSH('membership', clusterOsh, self.applicationOsh)) for node in nodesWithIP: ips = nodesWithIP[node] hostOsh = (modeling.createHostOSH(str(ips[0]), 'nt') or ObjectStateHolder('nt')) hostOsh.setStringAttribute('name', node) hostOsh.setStringAttribute('os_family', 'windows') for ip_obj in ips: ipOSH = modeling.createIpOSH(ip_obj) vector.add(ipOSH) vector.add(modeling.createLinkOSH('containment', hostOsh, ipOSH)) softwareOsh = modeling.createClusterSoftwareOSH(hostOsh, 'Microsoft Cluster SW', ms_cluster.version) softwareOsh.setAttribute("application_version_number", ms_cluster.version) vector.add(softwareOsh) vector.add(modeling.createLinkOSH('membership', clusterOsh, softwareOsh)) for group in groups: ips = ipDictByGroupName.get(group.name, None) if ips: for ip in ips: groupOsh = group.create_osh() vector.add(groupOsh) vector.add(modeling.createLinkOSH('contained', clusterOsh, groupOsh)) ipOsh = modeling.createIpOSH(ip) vector.add(modeling.createLinkOSH('contained', groupOsh, ipOsh)) vector.add(ipOsh) self.__crgMap[str(ip)] = groupOsh
def _reportNode(node, cluster, ips, clusterOsh, fqdn=None, nodeDetailsContent=None): r'@types: Node, Cluster, list[ip_addr.IPAddress], ObjectStateHolder, str, str -> tuple[ObjectStateHolder, ObjectStateHolderVector]' assert node and cluster and ips and clusterOsh vector = ObjectStateHolderVector() hostOsh, nodeVector = _reportHost(ips, fqdn) vector.addAll(nodeVector) # report cluster software running on the node softwareOsh = modeling.createClusterSoftwareOSH(hostOsh, 'Microsoft Cluster SW', cluster.version) vector.add(softwareOsh) vector.add(modeling.createLinkOSH('membership', clusterOsh, softwareOsh)) if nodeDetailsContent: vector.add(_reportNodeDetails(node, nodeDetailsContent, softwareOsh)) return softwareOsh, vector
def build(self, node, domainName, parentNodeOsh, version=None): if node is None: raise ValueError("node is None") if not domainName: raise ValueError("domainName is empty") _versionString = None if version: _versionString = version.fullString or version.shortString if not _versionString: _versionString = node.autoStartVersionFull clusterSoftwareOsh = modeling.createClusterSoftwareOSH(parentNodeOsh, 'EMC AutoStart Cluster SW', _versionString) clusterSoftwareOsh.setStringAttribute('name', domainName) if node.autoStartVersionShort: clusterSoftwareOsh.setStringAttribute('version', node.autoStartVersionShort) return clusterSoftwareOsh
def createClusterSoftwareObject(parentHostOsh, cluster, resultsVector): vendor = 'sun_microsystems_inc' clusterSoftwareOsh = modeling.createClusterSoftwareOSH( parentHostOsh, 'Sun Cluster Software', cluster.version, vendor) resultsVector.add(clusterSoftwareOsh) return clusterSoftwareOsh
def report(self, cluster): ''' Main report method for creation of generic Service Guard Topology @param cluster: instance of Cluster Data Object ''' vector = ObjectStateHolderVector() clusterOsh = cluster.build() vector.add(clusterOsh) configFileOsh = modeling.createConfigurationDocumentOSH( 'cmviewcl.properties', '', cluster.propertiesFileContent, clusterOsh) vector.add(configFileOsh) quorumServer = cluster.quorumServer # report Quorum Server in 'UP' status if (quorumServer and quorumServer.status == QuorumServer.Status.UP): reportTopology = self.__quorumServerReporter.reportTopology try: qsVector = reportTopology(quorumServer, clusterOsh)[3] vector.addAll(qsVector) except Exception: logger.warnException("Failed to report Quorum Server") clusterIpOsh = None if cluster.ipAddress: clusterIpOsh = modeling.createIpOSH(cluster.ipAddress) if clusterIpOsh: vector.add(clusterIpOsh) nodeToClusterSoftwareOshMap = {} nodeNameToNodeOsh = {} #creating cluster Nodes and linking them to cluster for clusterNode in cluster.nodes: nodeOsh = modeling.createHostOSH(clusterNode.ipAddress) vector.add(nodeOsh) nodeNameToNodeOsh[clusterNode.name] = nodeOsh clusterSoftwareOsh = modeling.createClusterSoftwareOSH(nodeOsh, 'HP Service Guard Cluster SW', cluster.version) vector.add(clusterSoftwareOsh) memberLinkOsh = modeling.createLinkOSH('member', clusterOsh, clusterSoftwareOsh) vector.add(memberLinkOsh) if clusterNode.propertiesFileContent: configfileOsh = self.createConfigFileOsh(clusterNode.name, clusterNode.propertiesFileContent, clusterSoftwareOsh) vector.add(configfileOsh) nodeToClusterSoftwareOshMap[clusterNode.name] = clusterSoftwareOsh for package in cluster.packages: clusteredServiceOsh = self.createClusteredServiceOsh(package.name, cluster.name) package.osh = clusteredServiceOsh containedLinkOsh = modeling.createLinkOSH('contained', clusterOsh, clusteredServiceOsh) vector.add(clusteredServiceOsh) vector.add(containedLinkOsh) if clusterIpOsh is not None: containedLinkOSH = modeling.createLinkOSH('contained', clusteredServiceOsh, clusterIpOsh) vector.add(containedLinkOSH) packageOsh = self.createPackageOsh(package.name, clusteredServiceOsh) vector.add(packageOsh) if package.packageIp: resourceOsh = self.createIpResourceOsh(package.packageIp, packageOsh) vector.add(resourceOsh) packageIpOsh = modeling.createIpOSH(package.packageIp) linkOsh = modeling.createLinkOSH('containment', clusteredServiceOsh, packageIpOsh) vector.add(packageIpOsh) vector.add(linkOsh) if package.additionalIpList: for packageIp in package.additionalIpList: if packageIp: resourceOsh = self.createIpResourceOsh(packageIp.ipAddress, packageOsh, packageIp.fqdn) vector.add(resourceOsh) #fix start packageIpOsh = modeling.createIpOSH(packageIp.ipAddress) linkOsh = modeling.createLinkOSH('containment', clusteredServiceOsh, packageIpOsh) vector.add(packageIpOsh) vector.add(linkOsh) #fix end configFileOsh = self.createConfigFileOsh(package.name, package.propertiesFileContent, packageOsh) if configFileOsh: vector.add(configFileOsh) for network in package.ipNetworkList: network.build() networkOsh = network.osh if networkOsh: dependLinkOsh = modeling.createLinkOSH('depend', packageOsh, networkOsh) vector.add(networkOsh) vector.add(dependLinkOsh) for packageNodeInfo in package.distrNodeInfoList: clusterSoftwareOsh = nodeToClusterSoftwareOshMap.get(packageNodeInfo.name, None) if clusterSoftwareOsh: if packageNodeInfo.status in ('primary', 'alternate'): currOwnerOsh = modeling.createLinkOSH('potentially_run', clusterSoftwareOsh, clusteredServiceOsh) currOwnerOsh.setAttribute('data_name', packageNodeInfo.status) isOwner = 0 if packageNodeInfo.status == 'primary': isOwner = 1 currOwnerOsh.setBoolAttribute('is_owner', isOwner) vector.add(currOwnerOsh) if packageNodeInfo.isCurrent: if package.mountPoints: for mountPoint in package.mountPoints: if mountPoint and mountPoint.strip() and nodeNameToNodeOsh.get(packageNodeInfo.name): clusteredFsOsh = self.createFileSystemOsh(mountPoint, clusteredServiceOsh) localFsOsh = self.createFileSystemOsh(mountPoint, nodeNameToNodeOsh.get(packageNodeInfo.name)) linkOsh = modeling.createLinkOSH('usage', clusteredFsOsh, localFsOsh) vector.add(clusteredFsOsh) vector.add(localFsOsh) vector.add(linkOsh) runOsh = modeling.createLinkOSH('run', clusterSoftwareOsh, clusteredServiceOsh) vector.add(runOsh) return vector
def createClusterSoftwareObject(parentHostOsh, cluster, resultsVector): vendor = 'sun_microsystems_inc' clusterSoftwareOsh = modeling.createClusterSoftwareOSH(parentHostOsh, 'Sun Cluster Software', cluster.version, vendor) resultsVector.add(clusterSoftwareOsh) return clusterSoftwareOsh
def mainFunction(resBuffer, cfPath, shUtils, OSHVResult, protocol, Framework, lastUpdateTime): # Parsing the main.cf file by a reg exp that returns (Element type, name and properties) reg = '(\w+)\s([^\s]+)\s\(([^\)]+)\)' compiled = re.compile(reg) matches = compiled.findall(resBuffer) clusterName = None groupName = None veritasclusterOSH = None vcsGroupOSH = None clusterDeviceOSH = None resourceNameToOSH = {} nodeNameToOSH = {} nodeNameToFSSWOSH = {} for match in matches: element_type = match[0].strip() element_name = match[1].strip() element_prop = match[2].strip() # Handle the cluster element if element_type == 'cluster': clusterName = element_name veritasclusterOSH = ObjectStateHolder('veritascluster') veritasclusterOSH.setAttribute('data_name', clusterName) modeling.setAppSystemVendor(veritasclusterOSH) OSHVResult.add(veritasclusterOSH) # Create configuration file object containing the zipped main.cf configFileOsh = modeling.createConfigurationDocumentOSH("main.cf.properties", "NA", resBuffer, veritasclusterOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, 'main.cf') OSHVResult.add(configFileOsh) # Handle the system element (Cluster nodes) elif element_type == 'system': nodeName = element_name hostOSH = shUtils.resolveHost(nodeName.strip()) if hostOSH == None: continue hostOSH.setAttribute('host_hostname', nodeName) OSHVResult.add(hostOSH) clusterSoftware = modeling.createClusterSoftwareOSH(hostOSH, 'Veritas Cluster SW') memberOSH = modeling.createLinkOSH('member', veritasclusterOSH, clusterSoftware) OSHVResult.add(clusterSoftware) OSHVResult.add(memberOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): # create config file object containing the zipped cf file and link it to host configFileName = "%s.properties" % nodeName configFileOsh = modeling.createConfigurationDocumentOSH(configFileName, "NA", element_prop, clusterSoftware, modeling.MIME_TEXT_PLAIN, lastUpdateTime, nodeName) OSHVResult.add(configFileOsh) # add hostosh to nodenames map so it will be easy to access later based on nodename nodeNameToOSH[nodeName] = hostOSH nodeNameToFSSWOSH[nodeName] = clusterSoftware # Handle the group element elif element_type == 'group': groupName = element_name clusterDeviceOSH = ObjectStateHolder('clusteredservice') clusterDeviceOSH.setAttribute('data_name', groupName) clusterName = veritasclusterOSH.getAttribute('data_name').getValue() clusterDeviceOSH.setAttribute('host_key', '%s:%s' % (clusterName, groupName)) clusterDeviceOSH.setBoolAttribute('host_iscomplete', 1) containsOSH = modeling.createLinkOSH('contained', veritasclusterOSH, clusterDeviceOSH) OSHVResult.add(clusterDeviceOSH) OSHVResult.add(containsOSH) # for clusterSoftware in clusterSoftwares: # runOSH = modeling.createLinkOSH('run', clusterSoftware, clusterDeviceOSH) # OSHVResult.add(runOSH) # create group object and link it to the cluster vcsGroupOSH = ObjectStateHolder('vcsgroup') vcsGroupOSH.setAttribute('data_name', groupName) vcsGroupOSH.setContainer(clusterDeviceOSH) OSHVResult.add(vcsGroupOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): # create config file object containing the current group related section in cf file, zipped and link it to cluster configFileName = "%s.properties" % groupName configFileOsh = modeling.createConfigurationDocumentOSH(configFileName, "NA", element_prop, vcsGroupOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, groupName) OSHVResult.add(configFileOsh) m = re.search('SystemList\s*\=\s*\{(.*)\}', element_prop, re.M) if m: systemList = m.group(1) systemsWithPriorities = getSystemsWithPriorities(systemList) for nodeName, priority in systemsWithPriorities.items(): if nodeNameToFSSWOSH.has_key(nodeName): clusterSoftware = nodeNameToFSSWOSH[nodeName] ownerOSH = modeling.createLinkOSH('potentially_run', clusterSoftware, clusterDeviceOSH) if priority == 0: ownerOSH.setAttribute('data_name', 'Preferred Owner') ownerOSH.setBoolAttribute('is_owner', 1) else: ownerOSH.setAttribute('data_name', 'Alternate Owner') ownerOSH.setBoolAttribute('is_owner', 0) OSHVResult.add(ownerOSH) # Handle the resource element elif element_type != None: if vcsGroupOSH == None: continue resourceName = element_name vcsresourceOSH = ObjectStateHolder('vcsresource') vcsresourceOSH.setAttribute('data_name', resourceName) vcsresourceOSH.setAttribute('type', element_type) vcsresourceOSH.setContainer(vcsGroupOSH) OSHVResult.add(vcsresourceOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): (zippedBytes, checksumValue, dataLength) = modeling.processBytesAttribute(element_prop) vcsresourceOSH.setBytesAttribute('resource_properties', zippedBytes) resourceNameToOSH[resourceName] = vcsresourceOSH # Create the real resource element behine the vcs resource and link the two objects with a depend link handleResource(element_name, element_type, element_prop, vcsresourceOSH, nodeNameToOSH, OSHVResult, clusterDeviceOSH) # Handle the resources dependencies reg = '([\w-]+)\srequires\s([\w-]+)' compiled = re.compile(reg) matches = compiled.findall(resBuffer) for match in matches: depended = match[0].strip() master = match[1].strip() # link each resource with the resource it depends on dependOSH = modeling.createLinkOSH('depend', resourceNameToOSH[depended], resourceNameToOSH[master]) OSHVResult.add(dependOSH) # Handle the CF included files reg = 'include\s\"(.*)\"' compiled = re.compile(reg) matches = compiled.findall(resBuffer) for match in matches: cfFileName = match.strip() try: includeFilePath = cfPath + cfFileName currCFBuffer = shUtils.safecat(includeFilePath) except: errorMessage = 'Failed to handle include file %s' % includeFilePath logger.debugException(errorMessage) errobj = errorobject.createError(errorcodes.FAILED_HANDLING_INCLUDE_FILE, [includeFilePath], errorMessage) logger.reportWarningObject(errobj) if not shUtils.getLastCmdReturnCode(): currCFBuffer = currCFBuffer.strip() if (currCFBuffer != None) and (currCFBuffer != ''): # create configuration file object with the included cf file zipped configFileName = "%s.properties" % cfFileName configFileOsh = modeling.createConfigurationDocumentOSH(configFileName, "NA", currCFBuffer, veritasclusterOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, cfFileName) OSHVResult.add(configFileOsh)
def report(self, cluster): ''' Main report method for creation of generic Service Guard Topology @param cluster: instance of Cluster Data Object ''' vector = ObjectStateHolderVector() clusterOsh = cluster.build() vector.add(clusterOsh) configFileOsh = modeling.createConfigurationDocumentOSH( 'cmviewcl.properties', '', cluster.propertiesFileContent, clusterOsh) vector.add(configFileOsh) quorumServer = cluster.quorumServer # report Quorum Server in 'UP' status if (quorumServer and quorumServer.status == QuorumServer.Status.UP): reportTopology = self.__quorumServerReporter.reportTopology try: qsVector = reportTopology(quorumServer, clusterOsh)[3] vector.addAll(qsVector) except Exception: logger.warnException("Failed to report Quorum Server") clusterIpOsh = None if cluster.ipAddress: clusterIpOsh = modeling.createIpOSH(cluster.ipAddress) if clusterIpOsh: vector.add(clusterIpOsh) nodeToClusterSoftwareOshMap = {} nodeNameToNodeOsh = {} #creating cluster Nodes and linking them to cluster for clusterNode in cluster.nodes: nodeOsh = modeling.createHostOSH(clusterNode.ipAddress) vector.add(nodeOsh) nodeNameToNodeOsh[clusterNode.name] = nodeOsh clusterSoftwareOsh = modeling.createClusterSoftwareOSH( nodeOsh, 'HP Service Guard Cluster SW', cluster.version) vector.add(clusterSoftwareOsh) memberLinkOsh = modeling.createLinkOSH('member', clusterOsh, clusterSoftwareOsh) vector.add(memberLinkOsh) if clusterNode.propertiesFileContent: configfileOsh = self.createConfigFileOsh( clusterNode.name, clusterNode.propertiesFileContent, clusterSoftwareOsh) vector.add(configfileOsh) nodeToClusterSoftwareOshMap[ clusterNode.name] = clusterSoftwareOsh for package in cluster.packages: clusteredServiceOsh = self.createClusteredServiceOsh( package.name, cluster.name) package.osh = clusteredServiceOsh containedLinkOsh = modeling.createLinkOSH('contained', clusterOsh, clusteredServiceOsh) vector.add(clusteredServiceOsh) vector.add(containedLinkOsh) if clusterIpOsh is not None: containedLinkOSH = modeling.createLinkOSH( 'contained', clusteredServiceOsh, clusterIpOsh) vector.add(containedLinkOSH) packageOsh = self.createPackageOsh(package.name, clusteredServiceOsh) vector.add(packageOsh) if package.packageIp: resourceOsh = self.createIpResourceOsh(package.packageIp, packageOsh) vector.add(resourceOsh) packageIpOsh = modeling.createIpOSH(package.packageIp) linkOsh = modeling.createLinkOSH('containment', clusteredServiceOsh, packageIpOsh) vector.add(packageIpOsh) vector.add(linkOsh) if package.additionalIpList: for packageIp in package.additionalIpList: if packageIp: resourceOsh = self.createIpResourceOsh( packageIp.ipAddress, packageOsh, packageIp.fqdn) vector.add(resourceOsh) #fix start packageIpOsh = modeling.createIpOSH( packageIp.ipAddress) linkOsh = modeling.createLinkOSH( 'containment', clusteredServiceOsh, packageIpOsh) vector.add(packageIpOsh) vector.add(linkOsh) #fix end configFileOsh = self.createConfigFileOsh( package.name, package.propertiesFileContent, packageOsh) if configFileOsh: vector.add(configFileOsh) for network in package.ipNetworkList: network.build() networkOsh = network.osh if networkOsh: dependLinkOsh = modeling.createLinkOSH( 'depend', packageOsh, networkOsh) vector.add(networkOsh) vector.add(dependLinkOsh) for packageNodeInfo in package.distrNodeInfoList: clusterSoftwareOsh = nodeToClusterSoftwareOshMap.get( packageNodeInfo.name, None) if clusterSoftwareOsh: if packageNodeInfo.status in ('primary', 'alternate'): currOwnerOsh = modeling.createLinkOSH( 'potentially_run', clusterSoftwareOsh, clusteredServiceOsh) currOwnerOsh.setAttribute('data_name', packageNodeInfo.status) isOwner = 0 if packageNodeInfo.status == 'primary': isOwner = 1 currOwnerOsh.setBoolAttribute('is_owner', isOwner) vector.add(currOwnerOsh) if packageNodeInfo.isCurrent: if package.mountPoints: for mountPoint in package.mountPoints: if mountPoint and mountPoint.strip( ) and nodeNameToNodeOsh.get( packageNodeInfo.name): clusteredFsOsh = self.createFileSystemOsh( mountPoint, clusteredServiceOsh) localFsOsh = self.createFileSystemOsh( mountPoint, nodeNameToNodeOsh.get( packageNodeInfo.name)) linkOsh = modeling.createLinkOSH( 'usage', clusteredFsOsh, localFsOsh) vector.add(clusteredFsOsh) vector.add(localFsOsh) vector.add(linkOsh) runOsh = modeling.createLinkOSH( 'run', clusterSoftwareOsh, clusteredServiceOsh) vector.add(runOsh) return vector
def mainFunction(resBuffer, cfPath, shUtils, OSHVResult, protocol, Framework, lastUpdateTime): # Parsing the main.cf file by a reg exp that returns (Element type, name and properties) reg = '(\w+)\s([^\s]+)\s\(([^\)]+)\)' compiled = re.compile(reg) matches = compiled.findall(resBuffer) clusterName = None groupName = None veritasclusterOSH = None vcsGroupOSH = None clusterDeviceOSH = None resourceNameToOSH = {} nodeNameToOSH = {} nodeNameToFSSWOSH = {} for match in matches: element_type = match[0].strip() element_name = match[1].strip() element_prop = match[2].strip() # Handle the cluster element if element_type == 'cluster': clusterName = element_name veritasclusterOSH = ObjectStateHolder('veritascluster') veritasclusterOSH.setAttribute('data_name', clusterName) modeling.setAppSystemVendor(veritasclusterOSH) OSHVResult.add(veritasclusterOSH) # Create configuration file object containing the zipped main.cf configFileOsh = modeling.createConfigurationDocumentOSH( "main.cf.properties", "NA", resBuffer, veritasclusterOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, 'main.cf') OSHVResult.add(configFileOsh) # Handle the system element (Cluster nodes) elif element_type == 'system': nodeName = element_name hostOSH = shUtils.resolveHost(nodeName.strip()) if hostOSH == None: continue hostOSH.setAttribute('host_hostname', nodeName) OSHVResult.add(hostOSH) clusterSoftware = modeling.createClusterSoftwareOSH( hostOSH, 'Veritas Cluster SW') memberOSH = modeling.createLinkOSH('member', veritasclusterOSH, clusterSoftware) OSHVResult.add(clusterSoftware) OSHVResult.add(memberOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): # create config file object containing the zipped cf file and link it to host configFileName = "%s.properties" % nodeName configFileOsh = modeling.createConfigurationDocumentOSH( configFileName, "NA", element_prop, clusterSoftware, modeling.MIME_TEXT_PLAIN, lastUpdateTime, nodeName) OSHVResult.add(configFileOsh) # add hostosh to nodenames map so it will be easy to access later based on nodename nodeNameToOSH[nodeName] = hostOSH nodeNameToFSSWOSH[nodeName] = clusterSoftware # Handle the group element elif element_type == 'group': groupName = element_name clusterDeviceOSH = ObjectStateHolder('clusteredservice') clusterDeviceOSH.setAttribute('data_name', groupName) clusterName = veritasclusterOSH.getAttribute( 'data_name').getValue() clusterDeviceOSH.setAttribute('host_key', '%s:%s' % (clusterName, groupName)) clusterDeviceOSH.setBoolAttribute('host_iscomplete', 1) containsOSH = modeling.createLinkOSH('contained', veritasclusterOSH, clusterDeviceOSH) OSHVResult.add(clusterDeviceOSH) OSHVResult.add(containsOSH) # for clusterSoftware in clusterSoftwares: # runOSH = modeling.createLinkOSH('run', clusterSoftware, clusterDeviceOSH) # OSHVResult.add(runOSH) # create group object and link it to the cluster vcsGroupOSH = ObjectStateHolder('vcsgroup') vcsGroupOSH.setAttribute('data_name', groupName) vcsGroupOSH.setContainer(clusterDeviceOSH) OSHVResult.add(vcsGroupOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): # create config file object containing the current group related section in cf file, zipped and link it to cluster configFileName = "%s.properties" % groupName configFileOsh = modeling.createConfigurationDocumentOSH( configFileName, "NA", element_prop, vcsGroupOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, groupName) OSHVResult.add(configFileOsh) m = re.search('SystemList\s*\=\s*\{(.*)\}', element_prop, re.M) if m: systemList = m.group(1) systemsWithPriorities = getSystemsWithPriorities(systemList) for nodeName, priority in systemsWithPriorities.items(): if nodeNameToFSSWOSH.has_key(nodeName): clusterSoftware = nodeNameToFSSWOSH[nodeName] ownerOSH = modeling.createLinkOSH( 'potentially_run', clusterSoftware, clusterDeviceOSH) if priority == 0: ownerOSH.setAttribute('data_name', 'Preferred Owner') ownerOSH.setBoolAttribute('is_owner', 1) else: ownerOSH.setAttribute('data_name', 'Alternate Owner') ownerOSH.setBoolAttribute('is_owner', 0) OSHVResult.add(ownerOSH) # Handle the resource element elif element_type != None: if vcsGroupOSH == None: continue resourceName = element_name vcsresourceOSH = ObjectStateHolder('vcsresource') vcsresourceOSH.setAttribute('data_name', resourceName) vcsresourceOSH.setAttribute('type', element_type) vcsresourceOSH.setContainer(vcsGroupOSH) OSHVResult.add(vcsresourceOSH) element_prop = element_prop.strip() if (element_prop != '') and (len(element_prop) > 3): (zippedBytes, checksumValue, dataLength) = modeling.processBytesAttribute(element_prop) vcsresourceOSH.setBytesAttribute('resource_properties', zippedBytes) resourceNameToOSH[resourceName] = vcsresourceOSH # Create the real resource element behine the vcs resource and link the two objects with a depend link handleResource(element_name, element_type, element_prop, vcsresourceOSH, nodeNameToOSH, OSHVResult, clusterDeviceOSH) # Handle the resources dependencies reg = '([\w-]+)\srequires\s([\w-]+)' compiled = re.compile(reg) matches = compiled.findall(resBuffer) for match in matches: depended = match[0].strip() master = match[1].strip() # link each resource with the resource it depends on dependOSH = modeling.createLinkOSH('depend', resourceNameToOSH[depended], resourceNameToOSH[master]) OSHVResult.add(dependOSH) # Handle the CF included files reg = 'include\s\"(.*)\"' compiled = re.compile(reg) matches = compiled.findall(resBuffer) for match in matches: cfFileName = match.strip() try: includeFilePath = cfPath + cfFileName currCFBuffer = shUtils.safecat(includeFilePath) except: errorMessage = 'Failed to handle include file %s' % includeFilePath logger.debugException(errorMessage) errobj = errorobject.createError( errorcodes.FAILED_HANDLING_INCLUDE_FILE, [includeFilePath], errorMessage) logger.reportWarningObject(errobj) if not shUtils.getLastCmdReturnCode(): currCFBuffer = currCFBuffer.strip() if (currCFBuffer != None) and (currCFBuffer != ''): # create configuration file object with the included cf file zipped configFileName = "%s.properties" % cfFileName configFileOsh = modeling.createConfigurationDocumentOSH( configFileName, "NA", currCFBuffer, veritasclusterOSH, modeling.MIME_TEXT_PLAIN, lastUpdateTime, cfFileName) OSHVResult.add(configFileOsh)