diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index f40ebbca98..4fdd14a4c1 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -49,6 +49,8 @@ int LibVirtDriver::deployment_description_kvm( string target = ""; string bus = ""; string ro = ""; + string driver = ""; + string default_driver = ""; bool readonly; const VectorAttribute * nic; @@ -245,6 +247,13 @@ int LibVirtDriver::deployment_description_kvm( file << "\t\t/usr/bin/kvm" << endl; } + get_default("DISK","DRIVER",default_driver); + + if (default_driver.empty()) + { + default_driver = "raw"; + } + num = vm->get_template_attribute("DISK",attrs); for (int i=0; i < num ;i++) @@ -260,6 +269,7 @@ int LibVirtDriver::deployment_description_kvm( target = disk->vector_value("TARGET"); ro = disk->vector_value("READONLY"); bus = disk->vector_value("BUS"); + driver = disk->vector_value("DRIVER"); if (target.empty()) { @@ -278,6 +288,8 @@ int LibVirtDriver::deployment_description_kvm( } } + // ---- Disk type and source for the image ---- + if (type.empty() == false) { transform(type.begin(),type.end(),type.begin(),(int(*)(int))toupper); @@ -302,8 +314,12 @@ int LibVirtDriver::deployment_description_kvm( << i << "'/>" << endl; } + // ---- target device to map the disk ---- + file << "\t\t\t" << endl; @@ -313,11 +329,26 @@ int LibVirtDriver::deployment_description_kvm( file << "/>" << endl; } + // ---- readonly attribute for the disk ---- + if (readonly) { file << "\t\t\t" << endl; } + // ---- Image Format using qemu driver ---- + + file << "\t\t\t" << endl; + } + else + { + file << default_driver << "'/>" << endl; + } + file << "\t\t" << endl; } @@ -331,6 +362,7 @@ int LibVirtDriver::deployment_description_kvm( { context = dynamic_cast(attrs[0]); target = context->vector_value("TARGET"); + driver = context->vector_value("DRIVER"); if ( !target.empty() ) { @@ -339,6 +371,18 @@ int LibVirtDriver::deployment_description_kvm( << num << "'/>" << endl; file << "\t\t\t" << endl; file << "\t\t\t" << endl; + + file << "\t\t\t" << endl; + } + else + { + file << default_driver << "'/>" << endl; + } + file << "\t\t" << endl; } else @@ -587,4 +631,3 @@ error_disk: file.close(); return -1; } - diff --git a/src/vmm_mad/ssh/vmm_ssh_kvm.conf b/src/vmm_mad/ssh/vmm_ssh_kvm.conf index 7ba58ee1f4..17b50215d5 100644 --- a/src/vmm_mad/ssh/vmm_ssh_kvm.conf +++ b/src/vmm_mad/ssh/vmm_ssh_kvm.conf @@ -6,13 +6,11 @@ # - cpu # - vcpu # - features [acpi, pae] +# - disk [driver ] #VCPU = 1 #MEMORY = 128 -#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", boot=hd,kernel_cmd="ro"] -OS = [ boot = "hd" ] +OS = [ boot = "hd" ] +FEATURES = [ PAE = "no", ACPI = "yes" ] -FEATURES = [ - PAE=no, - ACPI=yes -] +DISK = [ driver = "raw" ]