def __init__(self, installationId=None, mdmIPs=None, mdmPassword=None, liaPassword=None, licenseKey=None, primaryMdm=None, secondaryMdm=None, tb=None, sdsList=None, sdcList=None, callHomeConfiguration=None, remoteSyslogConfiguration=None ): self.installationId=installationId self.mdmIPs = [] for mdmIP in mdmIPs: self.mdmIPs.append(mdmIP) self.mdmPassword=mdmPassword self.liaPassword=liaPassword self.licenseKey=licenseKey self.primaryMdm=Mdm_Object.from_dict(primaryMdm) self.secondaryMdm=Mdm_Object.from_dict(secondaryMdm) self.tb=Tb_Object.from_dict(tb) self.sdsList=[] for sds in sdsList: self.sdsList.append(Sds_Object.from_dict(sds)) self.sdcList=[] for sdc in sdcList: self.sdcList.append(Sdc_Object.from_dict(sdc)) if callHomeConfiguration is None: self.callHomeConfiguration = None else: self.callHomeConfiguration = callHomeConfiguration if remoteSyslogConfiguration is None: self.remoteSyslogConfiguration = None else: # Might be a good idea to check type(remoteSyslogConfiguration) and verify class type self.remoteSyslogConfiguration = remoteSyslogConfiguration
def __init__(self, installationId=None, mdmIPs=None, mdmPassword=None, liaPassword=None, licenseKey=None, primaryMdm=None, secondaryMdm=None, tb=None, sdsList=None, sdcList=None, callHomeConfiguration=None, remoteSyslogConfiguration=None): self.installationId = installationId self.mdmIPs = [] for mdmIP in mdmIPs: self.mdmIPs.append(mdmIP) self.mdmPassword = mdmPassword self.liaPassword = liaPassword self.licenseKey = licenseKey self.primaryMdm = Mdm_Object.from_dict(primaryMdm) self.secondaryMdm = Mdm_Object.from_dict(secondaryMdm) self.tb = Tb_Object.from_dict(tb) self.sdsList = [] for sds in sdsList: self.sdsList.append(Sds_Object.from_dict(sds)) self.sdcList = [] for sdc in sdcList: self.sdcList.append(Sdc_Object.from_dict(sdc)) if callHomeConfiguration is None: self.callHomeConfiguration = None else: self.callHomeConfiguration = callHomeConfiguration if remoteSyslogConfiguration is None: self.remoteSyslogConfiguration = None else: # Might be a good idea to check type(remoteSyslogConfiguration) and verify class type self.remoteSyslogConfiguration = remoteSyslogConfiguration
def create_minimal_scaleio_cluster(self, mdmPassword, liaPassword): """ Using IM this method create a 3-node ScaleIO cluster with 2xMDM, 1xTB, 3x SDS (using /dev/sdb), 3x SDC """ """ self.read_cluster_config_from_disk("minimal-cluster.json") #self._cluster_config_cached.setMdmPassword(setMdmPassword) #self._cluster_config_cached.setLiaPassword(setLiaPassword) self.push_cached_cluster_configuration(setMdmPassword, setLiaPassword) """ ########################### # Create a ScaleIO System # ########################### # Flow: # Create Nodes # Create basic info. mdmPass, liaPass and some others # Construct MDM and TB and basic info # Create list of SDS # Create list of SDC ################### # Construct nodes # ################### nodeUsername = '******' nodePassword = '******' #node1 = ScaleIO_Node_Object(None, None, ['192.168.102.11'], None, 'linux', nodePassword, nodeUsername) #node2 = ScaleIO_Node_Object(None, None, ['192.168.102.12'], None, 'linux', nodePassword, nodeUsername) #node3 = ScaleIO_Node_Object(None, None, ['192.168.102.13'], None, 'linux', nodePassword, nodeUsername) node1 = ScaleIO_Node_Object(None, None, ['192.168.100.101'], None, 'linux', nodePassword, nodeUsername) node2 = ScaleIO_Node_Object(None, None, ['192.168.100.102'], None, 'linux', nodePassword, nodeUsername) node3 = ScaleIO_Node_Object(None, None, ['192.168.100.103'], None, 'linux', nodePassword, nodeUsername) print "Node Object:" pprint (node1.to_JSON()) pprint (node2.to_JSON()) pprint (node2.to_JSON()) print "" ########################################## # Construct basic info for System_Object # ########################################## mdmIPs = ['192.168.100.101','192.168.100.102'] sdcList = [] sdsList = [] #mdmPassword = '******' #liaPassword = '******' licenseKey = None installationId = None ######################################## # Create MDMs and TB for System_Object # ######################################## primaryMdm = Mdm_Object(json.loads(node2.to_JSON()), None, None, node2.nodeIPs) # WHY ISNT ManagementIPs pupulated???? Its not in a working config either. mdmIPs need to be populated though secondaryMdm = Mdm_Object(json.loads(node3.to_JSON()), None, None, node3.nodeIPs) tb = Tb_Object(json.loads(node1.to_JSON()), None, node1.nodeIPs) callHomeConfiguration = None # {'callHomeConfiguration':'None'} remoteSyslogConfiguration = None # {'remoteSysogConfiguration':'None'} ################################################################ #Create SDS objects - To be added to SDS list in System_Object # ################################################################ sds1 = Sds_Object(json.loads(node1.to_JSON()), None, 'SDS_' + str(node1.nodeIPs[0]), 'default', None, node1.nodeIPs, None, None, None, False, '7072') sds1.addDevice("/dev/sdb", None, None) sds2 = Sds_Object(json.loads(node2.to_JSON()), None, 'SDS_' + str(node2.nodeIPs[0]), 'default', None, node2.nodeIPs, None, None, None, False, '7072') sds2.addDevice("/dev/sdb", None, None) sds3 = Sds_Object(json.loads(node3.to_JSON()), None, 'SDS_' + str(node3.nodeIPs[0]), 'default', None, node3.nodeIPs, None, None, None, False, '7072') sds3.addDevice("/dev/sdb", None, None) sdsList.append(json.loads(sds1.to_JSON())) sdsList.append(json.loads(sds2.to_JSON())) sdsList.append(json.loads(sds3.to_JSON())) print "sdsList:" pprint (sdsList) ############################################################# # Create SDC objects - To be added as list to System_Object # ############################################################# """ node=None, nodeInfo=None, splitterRpaIp=None """ sdc1 = Sdc_Object(json.loads(node1.to_JSON()), None, None) sdc2 = Sdc_Object(json.loads(node2.to_JSON()), None, None) sdc3 = Sdc_Object(json.loads(node3.to_JSON()), None, None) sdcList.append(json.loads(sdc1.to_JSON())) sdcList.append(json.loads(sdc2.to_JSON())) sdcList.append(json.loads(sdc3.to_JSON())) ###################################################### # Construct a complete ScaleIO cluster configuration # ###################################################### sioobj = ScaleIO_System_Object(installationId, mdmIPs, mdmPassword, liaPassword, licenseKey, json.loads(primaryMdm.to_JSON()), json.loads(secondaryMdm.to_JSON()), json.loads(tb.to_JSON()), sdsList, sdcList, callHomeConfiguration, remoteSyslogConfiguration ) # Export sioobj to JSON (should upload clean in IM) ########################################################################### # Push System_Object JSON - To be used by IM to install ScaleIO on nodes # ########################################################################### #pprint (sioobj.to_JSON()) self._cluster_config_cached = sioobj.to_JSON() # PUSH CONFIGURATION INTO CONFIGURATION CACHE self._cache_contains_uncommitted= False # New config pushed into cache - Nothing oncommitted self.push_cluster_configuration(self._cluster_config_cached) # sioobj.to_JSON())