private void ReplaceDefaultImageStoreConnectionString(ClusterManifestType manifest)
        {
            SettingsOverridesTypeSection managementSection = manifest.FabricSettings.FirstOrDefault(
                section => section.Name.Equals(System.Fabric.FabricDeployer.Constants.SectionNames.Management, StringComparison.OrdinalIgnoreCase));

            SettingsOverridesTypeSectionParameter imageStoreParameter = null;

            if (managementSection != null)
            {
                imageStoreParameter = managementSection.Parameter.FirstOrDefault(
                    parameter => parameter.Name.Equals(System.Fabric.FabricDeployer.Constants.ParameterNames.ImageStoreConnectionString, StringComparison.OrdinalIgnoreCase));
            }

            if (imageStoreParameter == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(imageStoreParameter.Value) ||
                imageStoreParameter.Value.Equals(System.Fabric.FabricDeployer.Constants.DefaultTag, StringComparison.OrdinalIgnoreCase))
            {
                string defaultImageStoreRoot = Path.Combine(FabricEnvironment.GetDataRoot(), System.Fabric.FabricDeployer.Constants.DefaultImageStoreRootFolderName);
                imageStoreParameter.Value = string.Format(CultureInfo.InvariantCulture, "{0}{1}", System.Fabric.FabricValidatorConstants.FileImageStoreConnectionStringPrefix, defaultImageStoreRoot);
            }
        }
예제 #2
0
        protected override void OnExecuteOperation(DeploymentParameters parameters, ClusterManifestType clusterManifest, Infrastructure infrastructure)
        {
            var containerNetworkName = (parameters != null) ? (parameters.ContainerNetworkName) : (FlatNetworkConstants.NetworkName);
            var operation            = (parameters != null) ? (parameters.Operation) : (DeploymentOperations.None);

            ExecuteOperation(containerNetworkName, operation);
        }
예제 #3
0
        static void SetImageStoreParams(Dictionary <string, string> d, ClusterManifestType manifest)
        {
            var settings         = new List <SettingsOverridesTypeSection>(manifest.FabricSettings);
            var management       = settings.Find((s) => s.Name == "Management");
            var parameters       = new List <SettingsOverridesTypeSectionParameter>(management.Parameter);
            var store            = parameters.Find((s) => s.Name == "ImageStoreConnectionString");
            var connectionString = store.Value;

            if (connectionString == "_default_" || connectionString == "fabric:ImageStore")
            {
                return;
            }

            MatchCollection mc = azureXStoreRegex.Matches(connectionString);

            if (mc.Count == 0)
            {
                return;
            }

            foreach (Match m in mc)
            {
                d["ImageStore" + m.Groups["name"].Value] = m.Groups["value"].Value;
            }
        }
예제 #4
0
        public static FabricValidator Create(ClusterManifestType clusterManifest, List <InfrastructureNodeType> infrastructure, WindowsFabricSettings windowsFabricSettings, DeploymentOperations deploymentOperation)
        {
#if DotNetCoreClrLinux
            var isServer = clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureLinux;
#else
            var isServer = clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsServer;
#endif
            if (isServer)
            {
                return(new FabricValidatorServer(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsAzure || clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsAzureStaticTopology)
            {
                return(new FabricValidatorAzure(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureBlackbird)
            {
                return(new FabricValidatorBlackbird(clusterManifest, infrastructure, windowsFabricSettings));
            }
            if (clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructurePaaS)
            {
                var paasValidator = new FabricValidatorPaaS(clusterManifest, infrastructure, windowsFabricSettings);
                paasValidator.DeploymentOperation = deploymentOperation;
                return(paasValidator);
            }

            throw new InvalidOperationException("The Infrastucture type is not supported");
        }
        private async Task <bool> IsCurrentDeploymentOneboxAsync(CancellationToken token)
        {
            ClusterManifestType clusterManifest =
                this.GetClusterManifestFromString(await FabricClientRetryHelper.ExecuteFabricActionWithRetryAsync(
                                                      () => this.fabricClient.ClusterManager.GetClusterManifestAsync(TimeSpan.FromSeconds(30), token),
                                                      TimeSpan.FromMinutes(2),
                                                      token).ConfigureAwait(false));

            var windowsInfra = clusterManifest.Infrastructure.Item as ClusterManifestTypeInfrastructureWindowsServer;

            if (windowsInfra != null)
            {
                this.logger.LogMessage("Windows Infra");

                return(windowsInfra.IsScaleMin && windowsInfra.NodeList.Length > 0 &&
                       windowsInfra.NodeList.All(node => node.IPAddressOrFQDN == windowsInfra.NodeList[0].IPAddressOrFQDN));
            }

            var linuxInfra = clusterManifest.Infrastructure.Item as ClusterManifestTypeInfrastructureLinux;

            if (linuxInfra != null)
            {
                this.logger.LogMessage("Linux Infra");

                return(linuxInfra.IsScaleMin && linuxInfra.NodeList.Length > 0 &&
                       linuxInfra.NodeList.All(node => node.IPAddressOrFQDN == linuxInfra.NodeList[0].IPAddressOrFQDN));
            }

            this.logger.LogMessage("Unrecognized OS.");

            return(false);
        }
예제 #6
0
        private static void RemoveLogicalDirectoies(ClusterManifestType clusterManifest, FabricNodeType[] nodelist, string machineName)
        {
            List <LogicalDirectoryType[]> LogicalDirectoriesSetForThisMachine = new List <LogicalDirectoryType[]>();

            foreach (var node in nodelist)
            {
                var LogicalDirectory = clusterManifest.NodeTypes.Where(nodeType => nodeType.Name == node.NodeTypeRef).First().LogicalDirectories;
                if (LogicalDirectory != null)
                {
                    LogicalDirectoriesSetForThisMachine.Add(LogicalDirectory);
                }
            }

            if (LogicalDirectoriesSetForThisMachine.Any())
            {
                foreach (LogicalDirectoryType[] LogicalDirectories in LogicalDirectoriesSetForThisMachine)
                {
                    foreach (LogicalDirectoryType dir in LogicalDirectories)
                    {
                        try
                        {
                            Helpers.DeleteDirectoryIfExist(dir.MappedTo, machineName);
                        }
                        catch (Exception e)
                        {
                            DeployerTrace.WriteError(StringResources.Error_FailedToRemoveLogicalDirectory, dir.MappedTo, machineName, e);
                        }
                    }
                }
            }
        }
예제 #7
0
        protected override void OnExecuteOperation(DeploymentParameters parameters, ClusterManifestType targetClusterManifest, Infrastructure infrastructure)
        {
            ClusterManifestType           currentClusterManifest;
            InfrastructureInformationType currentInfrastructureManifest;

            //Powershell Test-ServiceFabricClusterManifest Command
            if (!string.IsNullOrEmpty(parameters.OldClusterManifestLocation))
            {
                currentClusterManifest        = XmlHelper.ReadXml <ClusterManifestType>(parameters.OldClusterManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
                currentInfrastructureManifest = parameters.InfrastructureManifestLocation == null ?
                                                null :
                                                XmlHelper.ReadXml <InfrastructureInformationType>(parameters.InfrastructureManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
            }
            else //Hosting2 Fabric Upgrade Diff Validation
            {
                string currentClusterManifestPath = parameters.DeploymentSpecification.GetCurrentClusterManifestFile(parameters.NodeName);
                string infrastructureManifestPath = parameters.DeploymentSpecification.GetInfrastructureManfiestFile(parameters.NodeName);
                currentClusterManifest        = XmlHelper.ReadXml <ClusterManifestType>(currentClusterManifestPath, SchemaLocation.GetWindowsFabricSchemaLocation());
                currentInfrastructureManifest = XmlHelper.ReadXml <InfrastructureInformationType>(infrastructureManifestPath, SchemaLocation.GetWindowsFabricSchemaLocation());
            }

            //Update to the newest infrastructure
            infrastructure = targetClusterManifest == null ? null : Infrastructure.Create(targetClusterManifest.Infrastructure, currentInfrastructureManifest == null ? null : currentInfrastructureManifest.NodeList, targetClusterManifest.NodeTypes);
            FabricValidatorWrapper.CompareAndAnalyze(currentClusterManifest, targetClusterManifest, infrastructure, parameters);
        }
예제 #8
0
        protected override void OnExecuteOperation(DeploymentParameters parameters, ClusterManifestType targetClusterManifest, Infrastructure infrastructure)
        {
            DeployerTrace.UpdateConsoleLevel(EventLevel.Verbose);

            try
            {
                string currentNodeIPAddressOrFQDN = string.Empty;
                if ((infrastructure != null) && (infrastructure.InfrastructureNodes != null))
                {
                    foreach (var infraNode in infrastructure.InfrastructureNodes)
                    {
                        if (NetworkApiHelper.IsAddressForThisMachine(infraNode.IPAddressOrFQDN))
                        {
                            currentNodeIPAddressOrFQDN = infraNode.IPAddressOrFQDN;
                            break;
                        }
                    }
                }

                new DockerDnsHelper(parameters, currentNodeIPAddressOrFQDN).SetupAsync().GetAwaiter().GetResult();
            }
            catch (Exception ex)
            {
                DeployerTrace.WriteWarning(
                    StringResources.Warning_FabricDeployer_DockerDnsSetup_ErrorContinuing2,
                    ex);
            }
        }
        /// <summary>
        /// Overload this method to allow different seed node types.
        /// TODO: refactor to combine the two methods
        /// </summary>
        /// <param name="security"></param>
        /// <param name="existingClusterManifest"></param>
        /// <param name="nodeTypes"></param>
        /// <param name="currentFabricSettingsMetadata"></param>
        /// <param name="clusterManifestVersion"></param>
        /// <returns></returns>
        private ClusterManifestType UpdateClusterManifest(
            Security security,
            ClusterManifestType existingClusterManifest,
            IEnumerable <ClusterManifestTypeNodeType> nodeTypes,
            FabricSettingsMetadata currentFabricSettingsMetadata,
            string clusterManifestVersion,
            List <NodeDescription> existingSeedNodes)
        {
            CertificateDescription       thumbprintClusterCert;
            List <string>                thumbprintClusterCertList;
            ServerCertificateCommonNames commonNameClusterCert;
            Dictionary <string, string>  commonNameClusterCertList;

            this.GetClusterCertConfig(
                security,
                out thumbprintClusterCert,
                out thumbprintClusterCertList,
                out commonNameClusterCert,
                out commonNameClusterCertList);

            return(this.UpdateClusterManifest(
                       security,
                       existingClusterManifest,
                       nodeTypes,
                       currentFabricSettingsMetadata,
                       clusterManifestVersion,
                       thumbprintClusterCert,
                       thumbprintClusterCertList,
                       commonNameClusterCert,
                       commonNameClusterCertList,
                       existingSeedNodes));
        }
예제 #10
0
        protected void SortClusterManifest(ClusterManifestType clusterManifest)
        {
            if (clusterManifest == null)
            {
                return;
            }

            clusterManifest.NodeTypes = clusterManifest.NodeTypes.OrderBy(nodeType => nodeType.Name).ToArray();
            foreach (var nodeType in clusterManifest.NodeTypes)
            {
                nodeType.Capacities          = nodeType.Capacities == null ? null : nodeType.Capacities.OrderBy(capacity => capacity.Name).ToArray();
                nodeType.PlacementProperties = nodeType.PlacementProperties == null
                                               ? null
                                               : nodeType.PlacementProperties.OrderBy(placementProperty => placementProperty.Name).ToArray();
            }

            // var paasInfrastructureItem = ((ClusterManifestTypeInfrastructurePaaS)clusterManifest.Infrastructure.Item);
            // paasInfrastructureItem.Roles = paasInfrastructureItem.Roles.OrderBy(role => role.RoleName).ToArray();
            // paasInfrastructureItem.Votes = paasInfrastructureItem.Votes.OrderBy(vote => vote.NodeName).ToArray();
            clusterManifest.Infrastructure = this.OnSortInfrastructure(clusterManifest.Infrastructure);

            clusterManifest.FabricSettings = clusterManifest.FabricSettings.OrderBy(section => section.Name).ToArray();
            foreach (var section in clusterManifest.FabricSettings)
            {
                section.Parameter = section.Parameter == null ? null : section.Parameter.OrderBy(param => param.Name).ToArray();
            }
        }
예제 #11
0
        public ClusterManifestType UpdateClusterManifest(ClusterManifestType existingClusterManifest, FabricSettingsMetadata currentFabricSettingsMetadata)
        {
            List <NodeDescription> existingSeedNodes = this.OnGetExistingSeedNodes(existingClusterManifest);

            Security security = this.TargetCsmConfig.Security;
            CertificateDescription       thumbprintClusterCert;
            List <string>                thumbprintClusterCertList;
            ServerCertificateCommonNames commonNameClusterCert;
            Dictionary <string, string>  commonNameClusterCertList;

            this.GetClusterCertConfig(
                security,
                out thumbprintClusterCert,
                out thumbprintClusterCertList,
                out commonNameClusterCert,
                out commonNameClusterCertList);

            return(this.UpdateClusterManifest(
                       security,
                       existingClusterManifest,
                       this.GetNodeTypes(this.TargetCsmConfig.NodeTypes, security),
                       currentFabricSettingsMetadata,
                       this.VersionGenerator.GetNextClusterManifestVersion(),
                       thumbprintClusterCert,
                       thumbprintClusterCertList,
                       commonNameClusterCert,
                       commonNameClusterCertList,
                       existingSeedNodes));
        }
        // Checks if current node should be removed for Windows Server deployments only.
        private bool ShouldRemoveCurrentNode(string nodeName, ClusterManifestType clusterManifest)
        {
            var infrastructureType = clusterManifest.Infrastructure.Item as ClusterManifestTypeInfrastructureWindowsServer;

            // For deployments that are not standalone, this section will not be present. Continue update operation for this node as is.
            if (infrastructureType == null)
            {
                DeployerTrace.WriteInfo("Node section not found in cluster manifest infrastructure section.");
                return(false);
            }

            if (nodeName == null)
            {
                return(false);
            }
            else
            {
                var nodesToBeRemovedSection = clusterManifest.FabricSettings.FirstOrDefault(section => section.Name.Equals(Constants.SectionNames.Setup, StringComparison.OrdinalIgnoreCase) &&
                                                                                            section.Parameter != null &&
                                                                                            section.Parameter.Any(parameter => parameter.Name.Equals(Constants.ParameterNames.NodesToBeRemoved)));
                List <string> nodesToRemove = new List <string>();
                if (nodesToBeRemovedSection != null)
                {
                    nodesToRemove = nodesToBeRemovedSection.Parameter.First(parameter => parameter.Name.Equals(Constants.ParameterNames.NodesToBeRemoved, StringComparison.OrdinalIgnoreCase)).Value.Split(',').Select(p => p.Trim()).ToList();
                }

                bool isNodeToBeRemoved = !infrastructureType.NodeList.Any(n => n.NodeName == nodeName) && nodesToRemove.Contains(nodeName);
                DeployerTrace.WriteInfo("Checking if current node needs to be removed : {0}", isNodeToBeRemoved);
                return(isNodeToBeRemoved);
            }
        }
예제 #13
0
 internal void VerifyManifestReplaceCertLists(
     ClusterManifestType manifest,
     string originalPrimaryThumbprint,
     string newPrimaryThumbprint,
     int currentPhase)
 {
     this.VerifyLoadCertList_Replace(manifest, originalPrimaryThumbprint, newPrimaryThumbprint, currentPhase);
 }
예제 #14
0
 /// <summary>
 /// Writes the cluster Manifest
 /// </summary>
 /// <param name="path">Path of the cluster manifest.</param>
 /// <param name="value">ClusterManifest Type.</param>
 internal static void WriteClusterManifest(string path, ClusterManifestType value)
 {
     using (FileStream fileStream = new FileStream(path, FileMode.Create))
     {
         XmlSerializer xmlSerializer = new XmlSerializer(typeof(ClusterManifestType));
         xmlSerializer.Serialize(fileStream, value);
     }
 }
예제 #15
0
        /** Inputs a ClusterManifestType object; returns an corresponding string. */
        internal static string GetClusterManifestXMLString(ClusterManifestType clusterManifest)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ClusterManifestType));
            StringWriter  generatedClusterManifestWriter = new StringWriter();

            xmlSerializer.Serialize(generatedClusterManifestWriter, clusterManifest);
            return(generatedClusterManifestWriter.ToString());
        }
예제 #16
0
        protected override void OnExecuteOperation(DeploymentParameters parameters, ClusterManifestType clusteManifest, Infrastructure infrastructure)
        {
            var isolatedNetworkName = (parameters != null) ? (parameters.IsolatedNetworkName) : (IsolatedNetworkConstants.NetworkName);
            var operation           = (parameters != null) ? (parameters.Operation) : (DeploymentOperations.None);
            var fabricBinRoot       = (parameters != null) ? (parameters.FabricBinRoot) : (string.Empty);

            ExecuteOperation(isolatedNetworkName, fabricBinRoot, operation);
        }
        internal static void AclClusterLevelCerts(ClusterManifestType clusterManifest)
        {
            DeployerTrace.WriteInfo("AclClusterLevelCerts: Enter");

            ClusterManifestTypeNodeType[] nodeTypes = clusterManifest.NodeTypes;
            if (nodeTypes == null)
            {
                DeployerTrace.WriteWarning("AclClusterLevelCerts: No node type is defined on the cluster manifest.");
                return;
            }

            IEnumerable <FabricCertificateType> certs = nodeTypes.Where(nodeType => nodeType.Certificates != null).Select(nodeType => nodeType.Certificates)
                                                        .SelectMany(certificates => new FabricCertificateType[]
            {
                certificates.ClientCertificate,
                certificates.ClusterCertificate,
                certificates.ServerCertificate
            }).Where(cert => cert != null);

            if (!certs.Any())
            {
                DeployerTrace.WriteWarning("AclClusterLevelCerts: No load cert is defined.");
                return;
            }

            List <CertId> certIds = new List <CertId>();

            foreach (FabricCertificateType cert in certs)
            {
                certIds.Add(new CertId(cert.X509FindType, cert.X509FindValue, cert.X509StoreName));
                if (!string.IsNullOrWhiteSpace(cert.X509FindValueSecondary) &&
                    cert.X509FindValueSecondary != cert.X509FindValue)
                {
                    certIds.Add(new CertId(cert.X509FindType, cert.X509FindValueSecondary, cert.X509StoreName));
                }
            }

            string accountName  = "NT AUTHORITY\\NETWORK SERVICE";
            string runasAccount = TryGetRunAsAccountName(clusterManifest);

            if (runasAccount != null)
            {
                accountName = runasAccount;
            }

            List <CertId> acledCertIds = new List <CertId>();

            foreach (CertId certId in certIds)
            {
                if (!acledCertIds.Any(p => p.Equals(certId)))
                {
                    DeployerTrace.WriteInfo("AclClusterLevelCerts: processing {0}", certId);
                    AclCert(certId, accountName);
                    acledCertIds.Add(certId);
                    DeployerTrace.WriteInfo("AclClusterLevelCerts: {0} processed", certId);
                }
            }
        }
예제 #18
0
        protected override void OnExecuteOperation(DeploymentParameters parameters, ClusterManifestType targetClusterManifest, Infrastructure infrastructure)
        {
            DeployerTrace.UpdateConsoleLevel(EventLevel.Verbose);
#if !DotNetCoreClrIOT
            new DockerDnsHelper(parameters, string.Empty).CleanupAsync().GetAwaiter().GetResult();
#else
            DeployerTrace.WriteInfo("CoreClrIOT: Dns cleanup skipped on CoreClrIOT.");
#endif
        }
예제 #19
0
        public static FileInfo ClusterManifestToFile(ClusterManifestType cm, string clusterName, string version)
        {
            string clusterManifestName = string.Format(Microsoft.ServiceFabric.DeploymentManager.Constants.ClusterManifestNameFormat, clusterName, version);
            string clusterManifestPath = Path.Combine(Path.GetTempPath(), clusterManifestName);

            SFDeployerTrace.WriteNoise(StringResources.Info_SFWritingClusterManifest, clusterManifestPath);
            XMLHelper.WriteXmlExclusive <ClusterManifestType>(clusterManifestPath, cm);
            return(new FileInfo(clusterManifestPath));
        }
예제 #20
0
 public static void VerifyAreEqual(ClusterManifestType cm1, ClusterManifestType cm2)
 {
     Assert.AreEqual(cm1.Name, cm2.Name, "Name");
     Assert.AreEqual(cm1.Description, cm2.Description, "Description");
     Assert.AreEqual(cm1.Version, cm2.Version, "Version");
     VerifyAreEqual(cm1.NodeTypes, cm2.NodeTypes);
     VerifyAreEqual(cm1.FabricSettings, cm2.FabricSettings);
     VerifyAreEqual(cm1.Infrastructure, cm2.Infrastructure);
 }
예제 #21
0
 public static void ValidateClusterManifestVersion(ClusterManifestType manifest)
 {
     if (string.IsNullOrEmpty(manifest.Version) || manifest.Version.Contains(":"))
     {
         throw new ArgumentException(
                   string.Format(
                       StringResources.ImageBuilderError_InvalidClusterManifestVersion));
     }
 }
예제 #22
0
 internal void VerifyManifestAddCertLists(
     ClusterManifestType manifest,
     string originalThumbprint,
     string newThumbprint,
     bool addPrimarythumbprint,
     int currentPhase)
 {
     this.VerifyLoadCertList_Add(manifest, originalThumbprint, newThumbprint, addPrimarythumbprint, currentPhase);
 }
예제 #23
0
 internal void VerifyManifestRemoveCertLists(
     ClusterManifestType manifest,
     string originalPrimaryThumbprint,
     string originalSecondaryThumbprint,
     bool removePrimarythumbprint,
     int currentPhase)
 {
     this.VerifyLoadCertList_Remove(manifest, originalPrimaryThumbprint, originalSecondaryThumbprint, removePrimarythumbprint);
 }
예제 #24
0
        public ClusterExternalState(ClusterManifestType clusterManifest, string msiVersion)
        {
            clusterManifest.MustNotBeNull("clusterManifest");
            msiVersion.MustNotBeNull("msiVersion");

            this.ClusterManifest       = clusterManifest;
            this.ClusterManifestBase64 = GetBase64ClusterManifest(clusterManifest);
            this.MsiVersion            = msiVersion;
        }
예제 #25
0
 public FabricSettingsGeneratorBase CreateLinuxSettingsGenerator(
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     FabricSettingsMetadata settingsMetadata,
     ClusterManifestType existingClusterManifest,
     ClusterManifestGeneratorSettings clusterManifestGeneratorSettings,
     ITraceLogger traceLogger)
 {
     throw new System.NotImplementedException();
 }
예제 #26
0
        /// <summary>
        /// Helper method to create WindowsFabricSettings object for the provided List of SettingsOverridesTypeSectionParameter.
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private WindowsFabricSettings GetWindowsFabricSettings(List <SettingsOverridesTypeSectionParameter> parameters)
        {
            ClusterManifestType clusterManifest = (new ClusterManifestHelper(true, false)).ClusterManifest;

            clusterManifest.FabricSettings    = new SettingsOverridesTypeSection[1];
            clusterManifest.FabricSettings[0] = new SettingsOverridesTypeSection()
            {
                Name = FabricValidatorConstants.SectionNames.FailoverManager, Parameter = parameters.ToArray()
            };
            return(new WindowsFabricSettings(clusterManifest));
        }
 public MockupFabricSettingsGenerator(
     string clusterIdOrName,
     IUserConfig targetCsmConfig,
     IAdminConfig targetWrpConfig,
     FabricSettingsMetadata settingsMetadata,
     ClusterManifestType existingClusterManifest,
     ClusterManifestGeneratorSettings clusterManifestGeneratorSettings,
     ITraceLogger traceLogger)
     : base(clusterIdOrName, targetCsmConfig, targetWrpConfig, settingsMetadata, existingClusterManifest, clusterManifestGeneratorSettings, traceLogger)
 {
 }
예제 #28
0
        internal void InternalReplaceCertRollbackTest(int maxSuccessIteration, bool rollbackSuccess)
        {
            Assert.IsTrue(maxSuccessIteration < 2);

            MockupCluster cluster = Utility.DoBaselineUpgrade("ClusterConfig.X509.DevCluster.Replace.V1.json");

            Assert.AreEqual(ClusterCertificateUpgradeTest.BaselineConfigVersion, cluster.Current.CSMConfig.Version.Version);

            ClusterManifestType baselineClusterManifest = cluster.Current.ExternalState.ClusterManifest;

            Utility.UpdateCluster("ClusterConfig.X509.DevCluster.Replace.V2.json", cluster);
            Assert.IsTrue(cluster.RunStateMachine());

            if (maxSuccessIteration < 0)
            {
                Utility.RollBackOneIteration(cluster);
                Assert.IsFalse(cluster.RunStateMachine());
                Assert.IsNull(cluster.Pending);
                Assert.AreEqual(baselineClusterManifest, cluster.Current.ExternalState.ClusterManifest);
            }
            else
            {
                for (int i = 0; i <= maxSuccessIteration; i++)
                {
                    Utility.RollForwardOneIteration(cluster);
                    Assert.AreEqual(baselineClusterManifest, cluster.Current.ExternalState.ClusterManifest);
                    Assert.IsFalse(cluster.RunStateMachine());
                }

                Utility.RollBackOneIteration(cluster);
                Assert.IsFalse(cluster.RunStateMachine());
                ClusterManifestType expectedManifest = maxSuccessIteration == 0 ? baselineClusterManifest : ((MultiphaseClusterUpgradeState)cluster.Pending).ClusterManifestList[maxSuccessIteration - 1];
                Assert.AreEqual(expectedManifest, cluster.Pending.ExternalState.ClusterManifest);

                if (rollbackSuccess)
                {
                    for (int i = 0; i <= maxSuccessIteration; i++)
                    {
                        Utility.RollForwardOneIteration(cluster);
                        Assert.IsFalse(cluster.RunStateMachine());
                    }

                    Assert.IsNull(cluster.Pending);
                }
                else
                {
                    Utility.RollBackOneIteration(cluster);
                    Assert.IsFalse(cluster.RunStateMachine());
                    Assert.IsNotNull(cluster.Pending);
                }

                Assert.AreEqual(baselineClusterManifest, cluster.Current.ExternalState.ClusterManifest);
            }
        }
예제 #29
0
 private static string GetStoreName(ClusterManifestType manifest)
 {
     if (manifest.Certificates != null && manifest.Certificates.SecretsCertificate != null)
     {
         return(manifest.Certificates.SecretsCertificate.X509StoreName);
     }
     else
     {
         return(DefaultX509StoreName);
     }
 }
예제 #30
0
        public FabricValidatorBlackbird(ClusterManifestType clusterManifest, List <InfrastructureNodeType> infrastructureInformation, WindowsFabricSettings windowsFabricSettings)
            : base(clusterManifest, infrastructureInformation, windowsFabricSettings)
        {
            ReleaseAssert.AssertIf(clusterManifest == null, "clusterManifest should be non-null");

            ReleaseAssert.AssertIfNot(
                clusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureBlackbird,
                "Only ClusterManifestTypeInfrastructureBlackbird is supported by ServerDeployer");

            this.IsScaleMin = infrastructureInformation != null && FabricValidatorUtility.IsNodeListScaleMin(this.infrastructureInformation);
        }