0 Replies Latest reply: Apr 30, 2013 3:02 PM by Brett Curtis RSS

    wlst migratable target creation

    Brett Curtis
      I've been trying to dynamically add candidate servers within a wlst script. Here is what I have so far wondering how I can generate the jarray based on number of managed JMVs.

      migratableTargets = migratableTargetList.split(',')
      mgdNames = mgdNameList.split(',')

      # Migratable target function
      def createMigratableTarget(mtnFnc,cnFnc,mnFnc):
      cd('/')
      cmo.createMigratableTarget(mtnFnc)

      cd('/MigratableTargets/'+mtnFnc)
      cmo.setCluster(getMBean('/Clusters/'+cnFnc))
      cmo.setUserPreferredServer(getMBean('/Servers/'+mnFnc))
      cmo.setMigrationPolicy('manual')

      # Set servers for migratble target
      cd('/MigratableTargets/'+mtnFnc)
      *set('ConstrainedCandidateServers',jarray.array([ObjectName('com.bea:Name='+mgdNames[0]+',Type=Server'), ObjectName('com.bea:Name='+mgdNames[1]+',Type=Server')], ObjectName))*

      # Create a migratable target for each JVM
      count = 1
      while count <= int(clusterNodes):
      createMigratableTarget(migratableTargets[(count-1)],clusterName,mgdNames[(count-1)])
      count += 1

      The props file I'm loading:

      clusterNodes=2
      clusterName=jms_dv1
      mgdNameList=jms_dv1_01,jms_dv1_02
      migratableTargetList=ensMigratableTarget_01,ensMigratableTarget_02

      So in this example the script works fine but lets say I had a 4 node cluster I would need to come back to this script to edit the line in bold for each node and I really don't want to do that. My thought path right now is how to do this with python but maybe I can use different wlst to do what I'm after. I'm still digging in and might figure it out but figured I'd ask around.

      Thanks