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; }
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; }
private string SetAzureCouchStorageAccountProcess(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); GetRoleOccurrence(svcDef, out webRoleOccurrence, out workerRoleOccurrence); ConfigureRoleStorageAccountKeys(); return string.Format(Resources.AzureStorageAccountConfiguredForCouchRoleMessage, this.StorageAccountName.ToLower(), this.CouchDBRoleName); }