Exemple #1
0
        public override ClusterState ClusterUpgradeStarted()
        {
            this.TraceLogger.WriteInfo(
                TraceType,
                "ClusterUpgradeStarted called for {0} initiated upgrade. TargetCsmVersion: {1}, TargetWrpVersion: {2}",
                this.IsAdminInitiatedUpgrade() ? "Admin" : "User",
                this.TargetCsmConfig.Version,
                this.TargetWrpConfig.Version);

            // If there is no pending upgrade, check if the ClusterManifest result of the upgrade results in any change
            // If there is not change, then there is no need to start an upgrade
            if (this.ClusterResource.Pending == null)
            {
                bool isClusterManifestEqual = IsClusterManfiestEqual(this.ExternalState.ClusterManifest, this.ClusterResource.Current.ExternalState.ClusterManifest);
                bool isMsiEqual             = EqualityUtility.Equals(this.TargetWrpConfig.Version.MsiVersion, this.ClusterResource.Current.ExternalState.MsiVersion);

                if (isClusterManifestEqual && isMsiEqual)
                {
                    this.TraceLogger.WriteInfo(
                        TraceType,
                        "The target cluster manifest and msi version is same as current. FabricUpgrade is not required.");

                    return(new ClusterState(this.TargetCsmConfig, this.TargetWrpConfig, this.TargetNodeConfig, this.ClusterResource.Current.ExternalState));
                }
            }

            this.ClusterResource.ClusterState = this.IsAdminInitiatedUpgrade() ? ClusterProvisioningState.UpdatingInfrastructure : ClusterProvisioningState.UpdatingUserConfiguration;
            this.OnSimpleClusterUpgradeStarted();
            return(null);
        }
Exemple #2
0
        public override bool Equals(object other)
        {
            var otherResourceId = other as ResourceId;

            if (otherResourceId == null)
            {
                return(false);
            }

            return(this.SubscriptionId == otherResourceId.SubscriptionId &&
                   EqualityUtility.Equals(this.ResourceGroupName, otherResourceId.ResourceGroupName) &&
                   EqualityUtility.Equals(this.Name, otherResourceId.Name));
        }
Exemple #3
0
        private static bool IsClusterManfiestEqual(
            ClusterManifestType updatedClusterManifestType,
            ClusterManifestType existingClusterManifestType)
        {
            var updatedClusterManifestVersion  = updatedClusterManifestType.Version;
            var existingClusterManifestVersion = existingClusterManifestType.Version;

            updatedClusterManifestType.Version = existingClusterManifestType.Version = "*";

            var isEqual = EqualityUtility.IsEqual(updatedClusterManifestType, existingClusterManifestType);

            updatedClusterManifestType.Version  = updatedClusterManifestVersion;
            existingClusterManifestType.Version = existingClusterManifestVersion;

            return(isEqual);
        }