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--------------"
cd manager && mvn -Dmaven.test.skip=true dockerfile:build
status=$?
[ $status -eq 0 ] && echo "build successful" || exit -1
cd ../
echo "----------Building provisioner Docker--------------"
cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
[ $status -eq 0 ] && echo "build successful" || exit -1
# cd ../
# echo "----------Building provisioner Docker--------------"
# cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
# [ $status -eq 0 ] && echo "build successful" || exit -1
# cd ../
# echo "----------Building sure_tosca-flask-server Docker--------------"
# 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
# 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 deployer:3.0.0 qcdis/deployer: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 manager:3.0.0 qcdis/manager:3.0.0
# docker tag provisioner:3.0.0 qcdis/provisioner:3.0.0
import base64
import logging
from time import sleep
import datetime
import yaml
from semaphore_client.semaphore_helper import SemaphoreHelper
......@@ -41,7 +42,8 @@ class AnsibleService:
desired_state = application.node_template.attributes['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)
private_key = self.get_private_key(vms)
key_id = self.semaphore_helper.create_ssh_key(application.name, project_id, private_key)
......
......@@ -238,7 +238,6 @@ class CloudStormService {
CloudsStormVM bestMatchingVM = null;
List<CloudsStormVM> vmInfos = cloudStormDAO.findVmMetaInfoByProvider(CloudProviderEnum.fromValue(provider));
for (CloudsStormVM vmInfo : vmInfos) {
if (requestedOs.toLowerCase().equals(vmInfo.getOstype().toLowerCase())) {
Double cloudsStormVMdiskSize;
if (vmInfo.getDiskSize() == null) {
......@@ -253,7 +252,9 @@ class CloudStormService {
} else {
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();
double res = dist.compute(requestedVector, aveliableVector);
if (res < min) {
......@@ -262,10 +263,15 @@ class CloudStormService {
}
}
}
if (bestMatchingVM != null && bestMatchingVM.getDiskSize() == null
&& bestMatchingVM.getExtraInfo() == null && !bestMatchingVM.getExtraInfo().containsKey("DiskSize")) {
if (bestMatchingVM != null && provider.equals("EC2")) {
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);
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