/// <summary>
        /// Get the progress of the current upgrade
        /// </summary>
        /// <param name="timeout"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <FabricOrchestrationUpgradeProgress> ProcessGetClusterConfigurationUpgradeProgressAsync(TimeSpan timeout, CancellationToken cancellationToken)
        {
            UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "Entering ProcessGetUpgradeProgressAsync.");
            FabricOrchestrationUpgradeProgress upgradeProgress = null;

            try
            {
                string configVersion = await this.GetCurrentJsonConfigVersionAsync(this.cancellationToken).ConfigureAwait(false);

                FabricUpgradeProgress fabricUpgradeProgress = await FabricClientRetryHelper.ExecuteFabricActionWithRetryAsync(
                    () =>
                    this.fabricClient.ClusterManager.GetFabricUpgradeProgressAsync(Constants.UpgradeServiceMaxOperationTimeout, this.cancellationToken),
                    Constants.UpgradeServiceMaxOperationTimeout,
                    this.cancellationToken).ConfigureAwait(false);

                ConfigUpgradeErrorDetail errorDetails = await this.storeManager.GetConfigUpgradeErrorDetailsAsync(Constants.ConfigUpgradeErrorDetails, cancellationToken);

                uint manifestVersion;
                upgradeProgress = new FabricOrchestrationUpgradeProgress()
                {
                    UpgradeState   = fabricUpgradeProgress.UpgradeState,
                    ProgressStatus = uint.TryParse(fabricUpgradeProgress.TargetConfigVersion, out manifestVersion) ? manifestVersion : 0,
                    ConfigVersion  = configVersion,
                    Details        = (errorDetails != null) ? errorDetails.ToString() : null
                };
            }
            catch (Exception e)
            {
                UpgradeOrchestrationTrace.TraceSource.WriteWarning(TraceType, "ProcessGetUpgradeProgressAsync exception: {0}", e);
                throw;
            }

            UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "Exiting ProcessGetUpgradeProgressAsync.");
            return(upgradeProgress);
        }
Пример #2
0
            internal static FabricOrchestrationUpgradeProgress CreateFromNative(NativeClient.IFabricOrchestrationUpgradeStatusResult nativeResult)
            {
                if (nativeResult == null)
                {
                    return(null);
                }

                var progress = FabricOrchestrationUpgradeProgress.FromNative(nativeResult.get_Progress());

                GC.KeepAlive(nativeResult);
                return(progress);
            }
        public async Task <FabricOrchestrationUpgradeProgress> GetClusterConfigurationUpgradeStatus(TimeSpan timeout, CancellationToken cancellationToken)
        {
            UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "Enter GetClusterConfigurationUpgradeStatus.");
            FabricOrchestrationUpgradeProgress upgradeProgress = null;

            try
            {
                upgradeProgress = await this.MessageProcessor.ProcessGetClusterConfigurationUpgradeProgressAsync(timeout, cancellationToken);
            }
            catch (Exception e)
            {
                UpgradeOrchestrationTrace.TraceSource.WriteWarning(TraceType, "{0} - Exception occurred", e);
                throw;
            }

            UpgradeOrchestrationTrace.TraceSource.WriteInfo(TraceType, "Exit GetClusterConfigurationUpgradeStatus.");
            return(upgradeProgress);
        }