2 Replies Latest reply on Aug 23, 2019 4:11 AM by eoinbyrne

    How to set the DRS Automation level to manual on an existing cluster.

    JEdNB Lurker

      Having trouble setting a DRS Cluster to a different automation level.

       

      Can't seem to set the defaultVmBehavior in the cluster object.

      tried a few ways, but can't seem to get there.

       

      current code below.

       

       

      strDrsAutomationLevel = "manual"

      var strVmBehaviour = objVcCluster.configurationEx.drsConfig.defaultVmBehavior.value;

       

      System.debug("Cluster " + objVcCluster.name + " was DRS was Set to " + strVmBehaviour);

      //try

      // objVcCluster.configurationEx.drsConfig.defaultVmBehavior.fromString(strDrsAutomationLevel);

      var objVcClusterConfigSpecEx = new VcClusterConfigSpecEx();

      objVcClusterConfigSpecEx.drsConfig = new VcClusterDrsConfigInfo();

      System.log(objVcClusterConfigSpecEx)

      objVcClusterConfigSpecEx.drsConfig.defaultVmBehavior.fromString(strDrsAutomationLevel);

       

      //configurationEx.drsConfig.defaultVmBehavior.fromString(strDrsAutomationLevel);

      objVcCluster.configurationEx.reconfigureComputeResource_Task(objVcClusterConfigSpecEx)

      System.debug("Cluster " + objVcCluster.name + "DRS now set to  " + strDrsAutomationLevel);

      //}catch(err){

      // throw "Error setting cluster level to " + strDrsAutomationLevel + " from " + strVmBehaviour + " error was " + err;

      //}

        • 2. Re: How to set the DRS Automation level to manual on an existing cluster.
          eoinbyrne Hot Shot

          this line looks odd - was there an error message or report on the task status after you tried this?

           

          objVcCluster.configurationEx.reconfigureComputeResource_Task(objVcClusterConfigSpecEx)

           

          The API for VcClusterComputeResource is here - vRO API Explorer by Dr Ruurd and Flores of ITQ

           

          Your line there is calling the "reconfigureComputeResource_Task" on the cluster configuration attribute....? Did that not throw an error about a missing method? I realize that the VC plugin has all sorts of internally weird inheritance going on but I'd have expected that part to be syntactically incorrect at least....

           

          Anyway, looking at the class docs for the method you want

           

           

          This is the documentation for the method

           

          So, your call to execute should be fine without the boolean for modify

           

          Maybe try changing to call the task method on the cluster object and trap any error messages? Also, that call will return a VcTask object which you should be able to inspect the contents of for clues / messages to decipher what happens when the task runs. Lastly the VC should have a record of the task in it's logs if it actually runs it

           

          HTH