Commit 4b2ce29a authored by Spiros Koulouzis's avatar Spiros Koulouzis

make sure we read the disk size

parent 0a8cfe25
...@@ -4,10 +4,10 @@ echo "----------Building manager Docker--------------" ...@@ -4,10 +4,10 @@ echo "----------Building manager Docker--------------"
cd manager && mvn -Dmaven.test.skip=true dockerfile:build cd manager && mvn -Dmaven.test.skip=true dockerfile:build
status=$? status=$?
[ $status -eq 0 ] && echo "build successful" || exit -1 [ $status -eq 0 ] && echo "build successful" || exit -1
cd ../ # cd ../
echo "----------Building provisioner Docker--------------" # echo "----------Building provisioner Docker--------------"
cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build # cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
[ $status -eq 0 ] && echo "build successful" || exit -1 # [ $status -eq 0 ] && echo "build successful" || exit -1
# cd ../ # cd ../
# echo "----------Building sure_tosca-flask-server Docker--------------" # echo "----------Building sure_tosca-flask-server Docker--------------"
# cd sure_tosca-flask-server && docker build -t sure-tosca:3.0.0 . # cd sure_tosca-flask-server && docker build -t sure-tosca:3.0.0 .
...@@ -26,5 +26,5 @@ cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build ...@@ -26,5 +26,5 @@ cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
# docker tag sure-tosca:3.0.0 qcdis/sure-tosca:3.0.0 # docker tag sure-tosca:3.0.0 qcdis/sure-tosca:3.0.0
# docker tag planner:3.0.0 qcdis/planner:3.0.0 # docker tag planner:3.0.0 qcdis/planner:3.0.0
# docker tag deployer:3.0.0 qcdis/deployer:3.0.0 # docker tag deployer:3.0.0 qcdis/deployer:3.0.0
# docker tag manager:3.0.0 qcdis/manager:3.0.0 docker tag manager:3.0.0 qcdis/manager:3.0.0
docker tag provisioner:3.0.0 qcdis/provisioner:3.0.0 # docker tag provisioner:3.0.0 qcdis/provisioner:3.0.0
import base64 import base64
import logging import logging
from time import sleep from time import sleep
import datetime
import yaml import yaml
from semaphore_client.semaphore_helper import SemaphoreHelper from semaphore_client.semaphore_helper import SemaphoreHelper
...@@ -41,7 +42,8 @@ class AnsibleService: ...@@ -41,7 +42,8 @@ class AnsibleService:
desired_state = application.node_template.attributes['desired_state'] desired_state = application.node_template.attributes['desired_state']
if desired_state: if desired_state:
project_id = self.semaphore_helper.create_project(application.name) now = datetime.datetime.now()
project_id = self.semaphore_helper.create_project(application.name+'_'+str(now))
inventory_contents = yaml.dump( self.build_yml_inventory(vms),default_flow_style=False) inventory_contents = yaml.dump( self.build_yml_inventory(vms),default_flow_style=False)
private_key = self.get_private_key(vms) private_key = self.get_private_key(vms)
key_id = self.semaphore_helper.create_ssh_key(application.name, project_id, private_key) key_id = self.semaphore_helper.create_ssh_key(application.name, project_id, private_key)
......
...@@ -238,7 +238,6 @@ class CloudStormService { ...@@ -238,7 +238,6 @@ class CloudStormService {
CloudsStormVM bestMatchingVM = null; CloudsStormVM bestMatchingVM = null;
List<CloudsStormVM> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider)); List<CloudsStormVM> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider));
for (CloudsStormVM vmInfo : vmInfos) { for (CloudsStormVM vmInfo : vmInfos) {
if (requestedOs.toLowerCase().equals(vmInfo.getOstype().toLowerCase())) { if (requestedOs.toLowerCase().equals(vmInfo.getOstype().toLowerCase())) {
Double cloudsStormVMdiskSize; Double cloudsStormVMdiskSize;
if (vmInfo.getDiskSize() == null) { if (vmInfo.getDiskSize() == null) {
...@@ -253,7 +252,9 @@ class CloudStormService { ...@@ -253,7 +252,9 @@ class CloudStormService {
} else { } else {
cloudsStormVMdiskSize = Double.valueOf(vmInfo.getDiskSize()); cloudsStormVMdiskSize = Double.valueOf(vmInfo.getDiskSize());
} }
double[] aveliableVector = convert2ArrayofDoubles(Double.valueOf(vmInfo.getCPU()), Double.valueOf(vmInfo.getMEM()), cloudsStormVMdiskSize); double[] aveliableVector = convert2ArrayofDoubles(Double.valueOf(vmInfo.getCPU()),
Double.valueOf(vmInfo.getMEM()),
cloudsStormVMdiskSize);
EuclideanDistance dist = new EuclideanDistance(); EuclideanDistance dist = new EuclideanDistance();
double res = dist.compute(requestedVector, aveliableVector); double res = dist.compute(requestedVector, aveliableVector);
if (res < min) { if (res < min) {
...@@ -262,10 +263,15 @@ class CloudStormService { ...@@ -262,10 +263,15 @@ class CloudStormService {
} }
} }
} }
if (bestMatchingVM != null && bestMatchingVM.getDiskSize() == null if (bestMatchingVM != null && provider.equals("EC2")) {
&& bestMatchingVM.getExtraInfo() == null && !bestMatchingVM.getExtraInfo().containsKey("DiskSize")) {
bestMatchingVM.setDiskSize(requestedDiskSize.intValue()); bestMatchingVM.setDiskSize(requestedDiskSize.intValue());
bestMatchingVM.getExtraInfo().put("DiskSize", requestedDiskSize.intValue());
bestMatchingVM.getExtraInfo().put("diskSize", requestedDiskSize.intValue());
} }
// if (bestMatchingVM != null && bestMatchingVM.getDiskSize() == null
// && bestMatchingVM.getExtraInfo() == null && !bestMatchingVM.getExtraInfo().containsKey("DiskSize")) {
// bestMatchingVM.setDiskSize(requestedDiskSize.intValue());
// }
Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "Found best matching VM: {0}", bestMatchingVM); Logger.getLogger(CloudStormService.class.getName()).log(Level.FINE, "Found best matching VM: {0}", bestMatchingVM);
return bestMatchingVM; return bestMatchingVM;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment