Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/12 11:16:50 (12 years ago)
Author:
spimming
Message:

#1680:

  • Check if role instance list is not null (while deploying a package)
  • Remove a hosted service when it's deleted
Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/CloudManagerClient.cs

    r7441 r7577  
    102102              Add(s);
    103103            }
     104
     105            List<HostedService> listToDelete = new List<HostedService>();
     106            foreach (HostedService s in HostedServices) {
     107              if (!servs.Contains(s)) {
     108                //Remove(s);
     109                listToDelete.Add(s);
     110              }
     111            }
     112            foreach (HostedService s in listToDelete) {
     113              Remove(s);
     114            }
    104115          }
    105116        }
     
    131142      if (Subscriptions.Contains(subscription)) {
    132143        Subscriptions.Remove(subscription);
     144      }
     145    }
     146
     147    public void Remove(HostedService hostedService) {
     148      if (hostedService == null) {
     149        throw new ArgumentNullException("hostedService", "HostedService must not be null.");
     150      }
     151      if (HostedServices.Contains(hostedService)) {
     152        HostedServices.Remove(hostedService);
    133153      }
    134154    }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/HeuristicLab.Clients.Hive.CloudManager-3.3.csproj

    r7550 r7577  
    132132  <ItemGroup>
    133133    <None Include="HeuristicLab.snk" />
     134    <None Include="PackageFiles\HeuristicLab.Clients.Hive.Slave.Azure.ExtraLarge.cspkg">
     135      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     136    </None>
     137    <None Include="PackageFiles\HeuristicLab.Clients.Hive.Slave.Azure.Large.cspkg">
     138      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     139    </None>
     140    <None Include="PackageFiles\HeuristicLab.Clients.Hive.Slave.Azure.Medium.cspkg">
     141      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     142    </None>
     143    <None Include="PackageFiles\HeuristicLab.Clients.Hive.Slave.Azure.Small.cspkg">
     144      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     145    </None>
     146    <None Include="PackageFiles\ServiceConfiguration.Cloud.cscfg">
     147      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     148    </None>
    134149    <None Include="Plugin.cs.frame" />
    135150    <None Include="Properties\AssemblyInfo.cs.frame" />
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Model/HostedService.cs

    r7433 r7577  
    8181      }
    8282
     83      List<Deployment> listToDelete = new List<Deployment>();
    8384      foreach (Deployment dep in this.Deployments) {
    8485        int idx = hostedService.Deployments.IndexOf(dep);
    8586        if (idx == -1) {
    86           this.Deployments.Remove(dep);
     87          //this.Deployments.Remove(dep);
     88          listToDelete.Add(dep);
    8789        }
     90      }
     91      foreach (Deployment d in listToDelete) {
     92        this.Deployments.Remove(d);
    8893      }
    8994    }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/DeploymentView.cs

    r7441 r7577  
    3636        txtDeploymentSlot.Text = Content.DeploymentSlot;
    3737        txtDeploymentStatus.Text = Content.Status;
    38         txtInstanceCount.Text = Content.RoleInstanceList.Count.ToString();
    39         if (Content.RoleInstanceList.Count > 0) {
    40           txtInstanceSize.Text = Content.RoleInstanceList[0].InstanceSize;
     38        if (Content.RoleInstanceList != null) {
     39          txtInstanceCount.Text = Content.RoleInstanceList.Count.ToString();
     40          if (Content.RoleInstanceList.Count > 0) {
     41            txtInstanceSize.Text = Content.RoleInstanceList[0].InstanceSize;
     42          }
     43        } else {
     44          txtInstanceCount.Text = "";
     45          txtInstanceSize.Text = "";
    4146        }
     47
    4248
    4349        tbChangeCores.Minimum = 1;
     
    4753          lblChanges.Text = SaveChangesString;
    4854        } else {
    49           tbChangeCores.Value = Content.RoleInstanceList.Count;
     55          if (Content.RoleInstanceList == null) {
     56            tbChangeCores.Value = tbChangeCores.Minimum;
     57          } else {
     58            tbChangeCores.Value = Content.RoleInstanceList.Count;
     59          }
    5060          lblChanges.Text = "";
    5161        }
     
    7585
    7686    private int GetCoresFromInstanceSize(string instanceSize) {
    77       HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize size =
    78        (HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize)Enum.Parse(
    79          typeof(HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize),
    80          instanceSize,
    81          true);
    82       return (int)size;
     87      if (instanceSize != string.Empty) {
     88        HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize size =
     89         (HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize)Enum.Parse(
     90           typeof(HeuristicLab.Clients.Hive.CloudManager.Azure.Constants.InstanceSize),
     91           instanceSize,
     92           true);
     93        return (int)size;
     94      } else {
     95        return 0;
     96      }
     97
    8398    }
    8499  }
Note: See TracChangeset for help on using the changeset viewer.