Exemplo 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);
        }
Exemplo n.º 2
0
        public static VirtualizationServer2012 GetVirtualizationProxy(int serviceId)
        {
            VirtualizationServer2012 ws = new VirtualizationServer2012();

            ServiceProviderProxy.Init(ws, serviceId);
            return(ws);
        }