'+
'
'+
@@ -4023,7 +4032,14 @@ function build_template(dialog){
addSectionJSON(vm_json,$('#capacityTab',dialog));
vm_json["DESCRIPTION"] = $('#DESCRIPTION',$('#capacityTab',dialog)).val();
vm_json["LOGO"] = $('#LOGO',$('#capacityTab',dialog)).val();
- vm_json["HYPERVISOR"] = $('input[name="hypervisor"]:checked', $('#capacityTab',dialog)).val();
+ var hypervisor = $('input[name="hypervisor"]:checked', $('#capacityTab',dialog)).val();
+ vm_json["HYPERVISOR"] = hypervisor;
+ if (hypervisor == "vcenter") {
+ vm_json["PUBLIC_CLOUD"] = {
+ "TYPE": "vcenter",
+ "VM_TEMPLATE": $("#vcenter_template_uuid", dialog).val()
+ }
+ }
//
// OS
@@ -4097,7 +4113,10 @@ function build_template(dialog){
// HYBRID
- vm_json["PUBLIC_CLOUD"] = [];
+ if ($.isEmptyObject(vm_json["PUBLIC_CLOUD"])) {
+ vm_json["PUBLIC_CLOUD"] = [];
+ }
+
vm_json["EC2"] = [];
$('.provider',dialog).each(function(){
@@ -4418,16 +4437,21 @@ var fillTemplatePopUp = function(template, dialog){
//
function fillProviderTab(provider, provider_type){
+ if (provider_type == "vcenter") {
+ $("#vcenter_template_uuid", dialog).val(provider["VM_TEMPLATE"])
+ } else {
if (number_of_providers > 0) {
$("#tf_btn_hybrid", dialog).trigger("click");
}
+ number_of_providers++;
+ }
+
var context = $(".provider", dialog).last();
$("input.hybridRadio[value='"+provider_type+"']", context).trigger("click");
autoFillInputs(provider, context);
- number_of_providers++;
}
var number_of_providers = 0;
@@ -4441,7 +4465,7 @@ var fillTemplatePopUp = function(template, dialog){
});
}
else if (providers instanceof Object) {
- fillProviderTab(providers, this.TYPE.toLowerCase());
+ fillProviderTab(providers, providers.TYPE.toLowerCase());
}
delete template.PUBLIC_CLOUD
diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb
index 71a0d08a1c..e5631eb562 100644
--- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb
+++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb
@@ -682,6 +682,7 @@ class VCenterVm
"CPU = \"#{@vm.config.hardware.numCPU}\"\n"\
"vCPU = \"#{@vm.config.hardware.numCPU}\"\n"\
"MEMORY = \"#{@vm.config.hardware.memoryMB}\"\n"\
+ "HYPERVISOR = \"vcenter\"\n"\
"PUBLIC_CLOUD = [\n"\
" TYPE =\"vcenter\",\n"\
" VM_TEMPLATE =\"#{@vm.config.uuid}\"\n"\