示例#1
0
        //
        // Calls for zertoFailover
        //
        public static JToken FailoverTest(string vpgName, string vmName)
        {
            ZertoZvm.Parameters.Clear();
            try
            {
                if (vpgName.Length > 0)
                {
                    ZertoZvm.Parameters.Add("vpgName", vpgName);
                }
                if (vmName.Length > 0)
                {
                    ZertoZvm.Parameters.Add("vmName", vmName);
                }

                JArray vms           = (JArray)(ZertoZvmApi.GetResult("/v1/vms", ZertoZvm.Parameters));
                var    vpgId         = vms.SelectToken("[0].VpgIdentifier");
                var    checkpointId  = ZertoZvmApi.GetResult("/v1/vpgs/" + vpgId + "/checkpoints/stats", ZertoZvm.Parameters).SelectToken("Latest.CheckpointIdentifier");
                JArray VmIdentifiers = new JArray();
                foreach (var vm in vms)
                {
                    VmIdentifiers.Add(vm.SelectToken("VmIdentifier"));
                }
                JToken request = new JObject(
                    new JProperty("CheckpointIdentifier", checkpointId),
                    new JProperty("VmIdentifiers", VmIdentifiers));

                var result = JToken.Parse(ZertoZvmApi.PostRequest("/v1/vpgs/" + vpgId + "/FailoverTest", request));
                return(result);
            }
            catch (Exception e)
            {
                return(JToken.Parse(e.ToString()));
            }
        }
示例#2
0
 public static string CommitVpgSettingsObject(string VpgSettingsIdentifier, bool cloud = false)
 {
     ZertoZvm.Parameters.Clear();
     try
     {
         return(ZertoZvmApi.PostRequest("/v1/vpgSettings/" + VpgSettingsIdentifier + "/commit", "", cloud));
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }
示例#3
0
 public static string GetVpgSettingsIdentifier(JToken body, bool cloud = false)
 {
     ZertoZvm.Parameters.Clear();
     try
     {
         return(ZertoZvmApi.PostRequest("/v1/vpgSettings", body, cloud));
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }
示例#4
0
 public static JToken FailoverRollback(string vpgName)
 {
     try
     {
         var vpgId  = GetVpgId(vpgName);
         var result = JToken.Parse(ZertoZvmApi.PostRequest("/v1/vpgs/" + vpgId + "/FailoverRollback", ""));
         return(result);
     }
     catch (Exception e)
     {
         return(JToken.Parse(e.ToString()));
     }
 }
示例#5
0
        public static JToken FailoverCommit(string vpgName)
        {
            try
            {
                var vpgId = GetVpgId(vpgName);

                JToken request = new JObject(
                    new JProperty("IsReverseProtection", false));

                var result = JToken.Parse(ZertoZvmApi.PostRequest("/v1/vpgs/" + vpgId + "/FailoverCommit", ""));
                return(result);
            }
            catch (Exception e)
            {
                return(JToken.Parse(e.ToString()));
            }
        }