Esempio n. 1
0
        public static ReplicationServerInfo GetReplicaInfoForService(int serviceId, ref ResultObject result)
        {
            // Get service id of replica server
            StringDictionary vsSesstings      = ServerController.GetServiceSettings(serviceId);
            string           replicaServiceId = vsSesstings["ReplicaServerId"];

            if (string.IsNullOrEmpty(replicaServiceId))
            {
                result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
                return(null);
            }

            // get replica server info for replica service id
            VirtualizationServer2012 vsReplica          = VirtualizationHelper.GetVirtualizationProxy(Convert.ToInt32(replicaServiceId));
            StringDictionary         vsReplicaSesstings = ServerController.GetServiceSettings(Convert.ToInt32(replicaServiceId));
            string computerName      = vsReplicaSesstings["ServerName"];
            var    replicaServerInfo = vsReplica.GetReplicaServer(computerName);

            if (!replicaServerInfo.Enabled)
            {
                result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
                return(null);
            }

            return(replicaServerInfo);
        }
Esempio n. 2
0
        public static VirtualizationServer2012 GetReplicaForService(int serviceId, ref ResultObject result)
        {
            // Get service id of replica server
            StringDictionary vsSesstings      = ServerController.GetServiceSettings(serviceId);
            string           replicaServiceId = vsSesstings["ReplicaServerId"];

            if (string.IsNullOrEmpty(replicaServiceId))
            {
                result.ErrorCodes.Add(VirtualizationErrorCodes.NO_REPLICA_SERVER_ERROR);
                return(null);
            }

            // get replica server for replica service id
            return(VirtualizationHelper.GetVirtualizationProxy(Convert.ToInt32(replicaServiceId)));
        }