Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/06/12 16:04:29 (13 years ago)
Author:
spimming
Message:

#1680:

  • Certificate file panel moved
  • If selected use running hosted service for deployment
  • Selection of different vm sizes
  • Selection of deployment slot
  • Change DefaultConnectionLimit for parallel upload
  • copy service package file to storage account
Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.Designer.cs

    r7551 r7565  
    328328      //
    329329      this.lblCertificateFile.AutoSize = true;
    330       this.lblCertificateFile.Location = new System.Drawing.Point(118, 341);
     330      this.lblCertificateFile.Location = new System.Drawing.Point(120, 605);
    331331      this.lblCertificateFile.Name = "lblCertificateFile";
    332332      this.lblCertificateFile.Size = new System.Drawing.Size(0, 13);
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/AddAzureServiceDialog.cs

    r7551 r7565  
    22using System.Collections.Generic;
    33using System.ComponentModel;
     4using System.IO;
     5using System.Net;
    46using System.Text.RegularExpressions;
    57using System.Windows.Forms;
     
    171173          bool newHostedServiceChecked = cbNewHostedService.Checked;
    172174          bool regionChecked = rbRegion.Checked;
     175          HostedService hostedService = null;
     176          if (cbNewHostedService.Checked) {
     177            hostedService = new HostedService();
     178            hostedService.ServiceName = tbServiceName.Text;
     179            HostedServiceProperties properties = new HostedServiceProperties();
     180
     181            if (regionChecked) {
     182              properties.AffinityGroup = string.Empty;
     183              properties.Location = (string)cmbLocation.SelectedItem;
     184            } else {
     185              properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
     186              properties.Location = string.Empty;
     187            }
     188
     189            if (cmbAffinityGroup.SelectedItem != null) {
     190              properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
     191            }
     192            properties.Label = tbLabel.Text;
     193            properties.Location = (string)cmbLocation.SelectedItem;
     194            hostedService.HostedServiceProperties = properties;
     195          } else {
     196            hostedService = (HostedService)cmbChooseHostedService.SelectedItem;
     197          }
     198
     199
    173200          string certFile = certificateFile;
    174201          string certPw = certificatePassword;
    175202          int instanceCount = Convert.ToInt32(tbInstanceCount.Text);
    176           HostedService hostedService = new HostedService();
    177           hostedService.ServiceName = tbServiceName.Text;
    178           HostedServiceProperties properties = new HostedServiceProperties();
    179           if (regionChecked) {
    180             properties.AffinityGroup = string.Empty;
    181             properties.Location = (string)cmbLocation.SelectedItem;
    182           } else {
    183             properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
    184             properties.Location = string.Empty;
     203
     204
     205
     206          string packagefilepath = string.Empty;
     207          if (rbVMSizeSmall.Checked) {
     208            packagefilepath = Constants.DeploymentPackagePathSmall;
     209          } else if (rbVMSizeMedium.Checked) {
     210            packagefilepath = Constants.DeploymentPackagePathMedium;
     211          } else if (rbVMSizeLarge.Checked) {
     212            packagefilepath = Constants.DeploymentPackagePathLarge;
     213          } else if (rbVMSizeExtraLarge.Checked) {
     214            packagefilepath = Constants.DeploymentPackagePathExtraLarge;
    185215          }
    186216
    187           if (cmbAffinityGroup.SelectedItem != null) {
    188             properties.AffinityGroup = ((AffinityGroup)cmbAffinityGroup.SelectedItem).Name;
     217          string deploymentSlot = string.Empty;
     218          if (rbDeployToProduction.Checked) {
     219            deploymentSlot = Constants.DeploymentSlotProduction;
     220          } else if (rbDeployToStaging.Checked) {
     221            deploymentSlot = Constants.DeploymentSlotStaging;
    189222          }
    190           properties.Label = tbLabel.Text;
    191           properties.Location = (string)cmbLocation.SelectedItem;
    192           hostedService.HostedServiceProperties = properties;
    193223
    194224          //var parameters1 = Tuple.Create<Subscription, bool, bool, string, string, HostedService, int>
     
    203233          parameters.InstanceCount = instanceCount;
    204234          parameters.StorageService = (StorageService)cmbStorageServices.SelectedItem;
     235          parameters.CreateContainerIfNotExists = cbCreateBlobIfNotExists.Checked;
    205236          parameters.BlobContainerName = tbBlobContainer.Text;
     237          parameters.DeploymentPackageFilePath = packagefilepath;
     238          parameters.DeploymentSlot = deploymentSlot;
    206239
    207240          bwCompleted = false;
     
    258291      string blobContainerName = parameters.BlobContainerName;
    259292      bool createContainerIfNotExists = parameters.CreateContainerIfNotExists;
    260 
    261       CloudStorageAccount storageAccount;
    262       CloudBlobClient blobClient;
    263       CloudBlobContainer blobContainer;
     293      string packageFilePath = parameters.DeploymentPackageFilePath;
     294      FileInfo packageFile = new FileInfo(packageFilePath);
     295      string deploymentSlot = parameters.DeploymentSlot;
     296
     297      int defaultCollectionLimit = ServicePointManager.DefaultConnectionLimit;
     298
     299      CloudStorageAccount storageAccount = null; ;
     300      CloudBlobClient blobClient = null;
     301      CloudBlobContainer blobContainer = null;
    264302
    265303      // STEP 1 - Initialize storage account
    266304      try {
    267         // get access key to storage service
    268305        StorageServiceKeys keys = CloudManagerClient.Instance.AzureProvider.GetStorageKeys(sub, storageService.ServiceName);
    269306        storageAccount = CloudStorageAccount.Parse(string.Format(Constants.StorageServiceConnectionFormat, storageService.ServiceName, keys.Primary));
     
    283320      }
    284321
     322      // STEP 2 - Copy service package file to storage account
     323      CloudBlockBlob blobPackage = null;
     324      try {
     325        blobPackage = blobContainer.GetBlockBlobReference(packageFile.Name);
     326        if (!blobPackage.Exists()) {
     327          ServicePointManager.DefaultConnectionLimit = 64;
     328          blobPackage.UploadParallel(packageFile.FullName);
     329        }
     330
     331      }
     332      catch (Exception ex) {
     333        errorOccured = true;
     334        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     335      }
     336
    285337
    286338      // STEP 1 - Create Hosted Service
     
    317369      try {
    318370        if (!errorOccured) {
    319           CloudManagerClient.Instance.AzureProvider.CreateDeployment(sub, hostedService.ServiceName, Guid.NewGuid().ToString(), Constants.DeploymentSlotStaging, Constants.DeploymentPackageUrl, Constants.DeploymentConfigurationUrl, Constants.DeploymentLabel, instanceCount);
     371          //CloudManagerClient.Instance.AzureProvider.CreateDeployment(sub, hostedService.ServiceName, Guid.NewGuid().ToString(), Constants.DeploymentSlotStaging, Constants.DeploymentPackageUrl, Constants.DeploymentConfigurationUrl, Constants.DeploymentLabel, instanceCount);
     372          CloudManagerClient.Instance.AzureProvider.CreateDeployment(sub, hostedService.ServiceName, Guid.NewGuid().ToString(), deploymentSlot, blobPackage.Uri.ToString(), new FileInfo(Constants.DeploymentConfigurationPath), Constants.DeploymentLabel, instanceCount);
    320373        }
    321374      }
     
    328381      }
    329382
     383      ServicePointManager.DefaultConnectionLimit = defaultCollectionLimit;
    330384      e.Result = errorOccured;
    331385    }
     
    403457        if (instanceCount > subscription.MaxCoreCount - subscription.CurrentCoreCount) {
    404458          errorProvider.SetError(tbInstanceCount, "Instance count must be less or equal than the difference between maximum and available cores.");
     459          e.Cancel = true;
    405460        } else {
    406           e.Cancel = true;
    407461          errorProvider.SetError(tbInstanceCount, "");
    408462        }
     
    464518      public string BlobContainerName { get; set; }
    465519      public bool CreateContainerIfNotExists { get; set; }
     520      public string DeploymentPackageFilePath { get; set; }
     521      public string DeploymentSlot { get; set; }
    466522    }
    467523  }
Note: See TracChangeset for help on using the changeset viewer.