コード例 #1
0
        private string SetSolrStorageAccountProcess(string rootPath)
        {
            InitializeArgs(rootPath);
            if (!StorageAccountExists(this.StorageAccountName))
            {
                CreateStorageAccount(this.StorageAccountName.ToLower(),
                    this.StorageAccountName.ToLower(),
                    azureService.Components.Settings.Location,
                    this.AffinityGroup);
                WriteObject(string.Format(Resources.AzureStorageAccountCreatedMessage, this.StorageAccountName));
            }
            else
            {
                WriteObject(string.Format(Resources.AzureStorageAccountAlreadyExistsMessage, this.StorageAccountName));
            }

            session = Session.GetSession(SessionState.Path.ParseParent(rootPath, null), false);
            serviceDefinitionFileName = General.Instance.SvcDefinitionFilePath(rootPath);
            cloudSvcConfigFileName = General.Instance.CloudSvcConfigFilePath(rootPath);

            // Loading *.cscfg and *csdef files
            cloudSvcConfig = General.Instance.ParseFile<ServiceConfiguration>(cloudSvcConfigFileName);
            svcDef = General.Instance.ParseFile<ServiceDefinition>(serviceDefinitionFileName);

            ConfigureRoleStorageAccountKeys();

            return string.Format(Resources.AzureStorageAccountConfiguredForSolrRoleMessage, this.StorageAccountName.ToLower());
        }
コード例 #2
0
        private void AddNewWorkerRole(ServiceDefinition sd, WorkerRole newWorkerRole)
        {
            int count = (sd.WorkerRole == null) ? 0 : sd.WorkerRole.Length;
            WorkerRole[] workerRoles = new WorkerRole[count + 1];

            if (count > 0)
            {
                sd.WorkerRole.CopyTo(workerRoles, 0);
            }
            workerRoles[count] = newWorkerRole;
            sd.WorkerRole = workerRoles;
        }
コード例 #3
0
 private int GetRoleOccurrence(ServiceDefinition serviceDefinition)
 {
     int slaveWorkerRoleOccurrence = 0;
     if (serviceDefinition.WorkerRole != null)
     {
         for (int i = 0; i < serviceDefinition.WorkerRole.Length; i++)
         {
             WorkerRole workerRoleAtIndex = serviceDefinition.WorkerRole[i];
             if (workerRoleAtIndex.Endpoints != null &&
                 workerRoleAtIndex.Endpoints.InputEndpoint != null &&
                 workerRoleAtIndex.Endpoints.InputEndpoint[0].name == Resources.SlaveWorkerRoleInputEndpointName)
             {
                 slaveWorkerRoleOccurrence++;
                 break;
             }
         }
     }
     return slaveWorkerRoleOccurrence;
 }
コード例 #4
0
 private void GetRoleOccurrence(ServiceDefinition serviceDefinition, out int webRoleOccurrence, out int workerRoleOccurrence)
 {
     webRoleOccurrence = (serviceDefinition.WebRole == null) ? 0 : serviceDefinition.WebRole.Length;
     workerRoleOccurrence = (serviceDefinition.WorkerRole == null) ? 0 : serviceDefinition.WorkerRole.Length;
 }