public bool CompareImageStoreConnectionString(WindowsFabricSettings newWindowsFabricSettings) { var oldImageStoreConnectionChars = FabricValidatorUtility.SecureStringToCharArray(this.ImageStoreConnectionString); var newImageStoreConnectionChars = FabricValidatorUtility.SecureStringToCharArray( newWindowsFabricSettings.GetParameter( this.SectionName, FabricValidatorConstants.ParameterNames.ImageStoreConnectionString).GetSecureValue(this.StoreName)); if (FabricValidatorUtility.StartsWithIgnoreCase(oldImageStoreConnectionChars, FabricValidatorConstants.FileImageStoreConnectionStringPrefix)) { if (!FabricValidatorUtility.StartsWithIgnoreCase(newImageStoreConnectionChars, FabricValidatorConstants.FileImageStoreConnectionStringPrefix)) { WriteError("the old image store connection string starts with file prefix but new one is not"); return(false); } return(CompareFileImageStoreConnectionString(new string(oldImageStoreConnectionChars), new string(newImageStoreConnectionChars))); } else if (FabricValidatorUtility.StartsWithIgnoreCase(oldImageStoreConnectionChars, FabricValidatorConstants.XStoreImageStoreConnectionStringPrefix)) { if (!FabricValidatorUtility.StartsWithIgnoreCase(newImageStoreConnectionChars, FabricValidatorConstants.XStoreImageStoreConnectionStringPrefix)) { WriteError("the old image store connection string starts with xstore prefix but new one is not"); return(false); } return(CompareXStoreImageStoreConnectionString(new string(oldImageStoreConnectionChars), new string(newImageStoreConnectionChars))); } else if (FabricValidatorUtility.StartsWithIgnoreCase(oldImageStoreConnectionChars, FabricValidatorConstants.FabricImageStoreConnectionStringPrefix)) { if (!FabricValidatorUtility.StartsWithIgnoreCase(newImageStoreConnectionChars, FabricValidatorConstants.FabricImageStoreConnectionStringPrefix)) { WriteError("the old image store connection string starts with fabric prefix but new one is not"); return(false); } return(CompareFabricImageStoreConnectionString(new string(oldImageStoreConnectionChars), new string(newImageStoreConnectionChars))); } else if (FabricValidatorUtility.StartsWithIgnoreCase(oldImageStoreConnectionChars, FabricValidatorConstants.DefaultTag)) { if (!FabricValidatorUtility.StartsWithIgnoreCase(newImageStoreConnectionChars, FabricValidatorConstants.DefaultTag)) { WriteError("the old image store connection string starts with default prefix but new one is not"); return(false); } return(true); } else { WriteError( "Value for section {0} parameter {1} should start with {2}, {3} or {4}", this.SectionName, FabricValidatorConstants.ParameterNames.ImageStoreConnectionString, FabricValidatorConstants.XStoreImageStoreConnectionStringPrefix, FabricValidatorConstants.FileImageStoreConnectionStringPrefix, FabricValidatorConstants.FabricImageStoreConnectionStringPrefix); return(false); } }
protected override void ValidateInfrastructure() { TopologyProvider.TopologyProviderType topologyProviderType = TopologyProvider.GetTopologyProviderTypeFromClusterManifestTypeInfrastructure(this.infrastructure); if (topologyProviderType == TopologyProvider.TopologyProviderType.ServiceRuntimeTopologyProvider) { ValidateInfrastructureWithServiceRuntimeTopologyProvider(this.infrastructure.Item as ClusterManifestTypeInfrastructureWindowsAzure); } else if (topologyProviderType == TopologyProvider.TopologyProviderType.StaticTopologyProvider) { ValidateInfrastructureWithStaticTopologyProvider(this.infrastructure.Item as ClusterManifestTypeInfrastructureWindowsAzureStaticTopology); } #if !DotNetCoreClr if (this.IsV2NodeIdGeneratorEnabled && (this.NodeIdGeneratorVersion.Equals("V3", StringComparison.InvariantCultureIgnoreCase) || this.NodeIdGeneratorVersion.Equals("V4", StringComparison.InvariantCultureIgnoreCase))) #else if (this.IsV2NodeIdGeneratorEnabled && (this.NodeIdGeneratorVersion.Equals("V3") || this.NodeIdGeneratorVersion.Equals("V4"))) #endif { throw new ArgumentException(FabricValidatorUtility.TraceTag, "V2 and V3/V4 NodeIdGenerator cannot be enabled simultaneously."); } #if !DotNetCoreClr if (!string.IsNullOrEmpty(this.NodeIdGeneratorVersion) && !this.NodeIdGeneratorVersion.Equals("V3", StringComparison.InvariantCultureIgnoreCase) && !this.NodeIdGeneratorVersion.Equals("V4", StringComparison.InvariantCultureIgnoreCase)) #else if (!string.IsNullOrEmpty(this.NodeIdGeneratorVersion) && !this.NodeIdGeneratorVersion.Equals("V3") && !this.NodeIdGeneratorVersion.Equals("V4")) #endif { throw new ArgumentException(FabricValidatorUtility.TraceTag, "v3/V3 and v4/V4 are the only allowed values for the NodeIdGeneratorVersion configuration."); } if (this.DiagnosticsFileStoreConnectionString != null) { char[] secureFileStoreConnection = FabricValidatorUtility.SecureStringToCharArray(this.DiagnosticsFileStoreConnectionString); try { if (!FabricValidatorUtility.StartsWithIgnoreCase(secureFileStoreConnection, FabricValidatorConstants.XStoreImageStoreConnectionStringPrefix)) { throw new ArgumentException(FabricValidatorUtility.TraceTag, "Only xstore store diagnostics file connection string is officially supported for file stores in azure deployment."); } } finally { Array.Clear(secureFileStoreConnection, 0, secureFileStoreConnection.Length); } } if (this.DiagnosticsTableStoreConnectionString != null) { char[] secureTableStoreConnection = FabricValidatorUtility.SecureStringToCharArray(this.DiagnosticsTableStoreConnectionString); try { if (!FabricValidatorUtility.StartsWithIgnoreCase(secureTableStoreConnection, FabricValidatorConstants.XStoreImageStoreConnectionStringPrefix)) { throw new ArgumentException("Only xstore store diagnostics table connection string is officially supported for table stores in azure deployment."); } } finally { Array.Clear(secureTableStoreConnection, 0, secureTableStoreConnection.Length); } } }