diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index dbb18c0252..5ba6fbd171 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -2655,6 +2655,62 @@ function add_osTab(dialog) { '
'+tr("Add support in the VM for Physical Address Extension (PAE)")+'
'+ ''+ ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+tr("Enables the advanced programmable IRQ management.")+'
'+ + '
'+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+tr("Add support in the VM for hyper-v features (HYPERV)")+'
'+ + '
'+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+tr("The guest clock will be synchronized to the host's configured timezone when booted.")+'
'+ + '
'+ + '
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+tr("Used to change the IO emulator in Xen HVM. Only XEN.")+'
'+ + '
'+ + '
'+ ''+ '
'+ '
'+ diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index 65b2ff9aae..5fcbaa2838 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -96,6 +96,7 @@ int LibVirtDriver::deployment_description_kvm( string kernel_cmd = ""; string bootloader = ""; string arch = ""; + string machine = ""; vector boots; @@ -137,20 +138,29 @@ int LibVirtDriver::deployment_description_kvm( const VectorAttribute * graphics; - string listen = ""; - string port = ""; - string passwd = ""; - string keymap = ""; + string listen = ""; + string port = ""; + string passwd = ""; + string keymap = ""; + string spice_options = ""; const VectorAttribute * input; const VectorAttribute * features; - bool pae = false; - bool acpi = false; + bool pae = false; + bool acpi = false; + bool apic = false; + bool hyperv = false; + bool localtime = false; - int pae_found = -1; - int acpi_found = -1; + int pae_found = -1; + int acpi_found = -1; + int apic_found = -1; + int hyperv_found = -1; + int localtime_found = -1; + + string hyperv_options = ""; const VectorAttribute * raw; string default_raw; @@ -240,6 +250,7 @@ int LibVirtDriver::deployment_description_kvm( kernel_cmd = os->vector_value("KERNEL_CMD"); bootloader = os->vector_value("BOOTLOADER"); arch = os->vector_value("ARCH"); + machine = os->vector_value("MACHINE"); } } @@ -253,7 +264,19 @@ int LibVirtDriver::deployment_description_kvm( } } - file << "\t\thvm" << endl; + if ( machine.empty() ) + { + get_default("OS", "MACHINE", machine); + } + + file << "\t\thvm" << endl; if ( kernel.empty() ) { @@ -712,6 +735,16 @@ int LibVirtDriver::deployment_description_kvm( } file << "/>" << endl; + + if ( type == "spice" ) + { + get_default("SPICE_OPTIONS", spice_options); + + if ( spice_options != "" ) + { + file << "\t\t" << spice_options << endl; + } + } } else { @@ -766,8 +799,11 @@ int LibVirtDriver::deployment_description_kvm( if ( features != 0 ) { - pae_found = features->vector_value("PAE", pae); - acpi_found = features->vector_value("ACPI", acpi); + pae_found = features->vector_value("PAE", pae); + acpi_found = features->vector_value("ACPI", acpi); + apic_found = features->vector_value("APIC", apic); + hyperv_found = features->vector_value("HYPERV", hyperv); + localtime_found = features->vector_value("LOCALTIME", localtime); } } @@ -781,7 +817,22 @@ int LibVirtDriver::deployment_description_kvm( get_default("FEATURES", "ACPI", acpi); } - if( acpi || pae ) + if ( apic_found != 0 ) + { + get_default("FEATURES", "APIC", apic); + } + + if ( hyperv_found != 0 ) + { + get_default("FEATURES", "HYPERV", hyperv); + } + + if ( localtime_found != 0 ) + { + get_default("FEATURES", "LOCALTIME", localtime); + } + + if ( acpi || pae || apic || hyperv ) { file << "\t" << endl; @@ -795,9 +846,28 @@ int LibVirtDriver::deployment_description_kvm( file << "\t\t" << endl; } + if ( apic ) + { + file << "\t\t" << endl; + } + + if ( hyperv ) + { + get_default("HYPERV_OPTIONS", hyperv_options); + + file << "\t\t" << endl; + file << hyperv_options << endl; + file << "\t\t" << endl; + } + file << "\t" << endl; } + if ( localtime ) + { + file << "\t" << endl; + } + attrs.clear(); // ------------------------------------------------------------------------ diff --git a/src/vmm/XenDriver.cc b/src/vmm/XenDriver.cc index c93104ed0d..3d1828dcc7 100644 --- a/src/vmm/XenDriver.cc +++ b/src/vmm/XenDriver.cc @@ -21,6 +21,12 @@ #include #include + +string on_off_string(bool value) +{ + return value? "1" : "0"; +} + int XenDriver::deployment_description( const VirtualMachine * vm, const string& file_name) const @@ -76,6 +82,24 @@ int XenDriver::deployment_description( string passwd = ""; string keymap = ""; + const VectorAttribute * input; + + string bus = ""; + + const VectorAttribute * features; + + bool pae = false; + bool acpi = false; + bool apic = false; + string device_model = ""; + bool localtime = false; + + int pae_found = -1; + int acpi_found = -1; + int apic_found = -1; + int device_model_found = -1; + int localtime_found = -1; + const VectorAttribute * raw; string data; string default_raw; @@ -577,6 +601,119 @@ int XenDriver::deployment_description( attrs.clear(); + // ------------------------------------------------------------------------ + // Input (only usb tablet) + // ------------------------------------------------------------------------ + + if ( vm->get_template_attribute("INPUT",attrs) > 0 ) + { + input = dynamic_cast(attrs[0]); + + if ( input != 0 ) + { + type = input->vector_value("TYPE"); + bus = input->vector_value("BUS"); + + if ( type == "tablet" && bus == "usb" ) + { + file << "usb = 1" << endl; + file << "usbdevice = 'tablet'" << endl; + } + else + { + vm->log("VMM", Log::WARNING, + "Not supported input, only usb tablet, ignored."); + } + } + } + + attrs.clear(); + + // ------------------------------------------------------------------------ + // Features (only for HVM) + // ------------------------------------------------------------------------ + + if ( is_hvm ) + { + num = vm->get_template_attribute("FEATURES",attrs); + + if ( num > 0 ) + { + features = dynamic_cast(attrs[0]); + + if ( features != 0 ) + { + pae_found = features->vector_value("PAE", pae); + acpi_found = features->vector_value("ACPI", acpi); + apic_found = features->vector_value("APIC", apic); + localtime_found = + features->vector_value("LOCALTIME", localtime); + + device_model = features->vector_value("DEVICE_MODEL"); + if ( device_model != "" ) + { + device_model_found = 0; + } + } + } + + if ( pae_found != 0 && get_default("FEATURES", "PAE", pae) ) + { + pae_found = 0; + } + + if ( acpi_found != 0 && get_default("FEATURES", "ACPI", acpi) ) + { + acpi_found = 0; + } + + if ( apic_found != 0 && get_default("FEATURES", "APIC", apic) ) + { + apic_found = 0; + } + + if ( device_model_found != 0 ) + { + get_default("FEATURES", "DEVICE_MODEL", device_model); + if ( device_model != "" ) + { + device_model_found = 0; + } + } + + if ( localtime_found != 0 ) + { + get_default("FEATURES", "LOCALTIME", localtime); + } + + if ( pae_found == 0) + { + file << "pae = " << on_off_string(pae) << endl; + } + + if ( acpi_found == 0) + { + file << "acpi = " << on_off_string(acpi) << endl; + } + + if ( apic_found == 0) + { + file << "apic = " << on_off_string(apic) << endl; + } + + if ( device_model_found == 0) + { + file << "device_model = '" << device_model << "'" << endl; + } + + if ( localtime ) + { + file << "localtime = 'yes'" << endl; + } + + attrs.clear(); + } + // ------------------------------------------------------------------------ // Raw XEN attributes // ------------------------------------------------------------------------ diff --git a/src/vmm_mad/exec/vmm_exec_kvm.conf b/src/vmm_mad/exec/vmm_exec_kvm.conf index 4f3bb432da..8e068e40f7 100644 --- a/src/vmm_mad/exec/vmm_exec_kvm.conf +++ b/src/vmm_mad/exec/vmm_exec_kvm.conf @@ -18,12 +18,13 @@ # (all domains will use these values as defaults). These values can # be overridden in each VM template. Valid atributes are: # - emulator -# - os [kernel,initrd,boot,root,kernel_cmd,arch] +# - os [kernel,initrd,boot,root,kernel_cmd,arch,machine] # - vcpu -# - features [acpi, pae] +# - features [acpi, pae, apic, hyperv, localtime] # - disk [driver, cache, io] # - nic [filter, model] # - raw +# - hyperv_options: options used for FEATURES = [ HYPERV = yes ] # NOTE: raw attribute value is appended to that on the VM template #EMULATOR = /usr/libexec/qemu-kvm @@ -31,9 +32,24 @@ #VCPU = 1 OS = [ boot = "hd", arch = "i686" ] -FEATURES = [ PAE = "no", ACPI = "yes" ] +FEATURES = [ PAE = "no", ACPI = "yes", APIC = "no", HYPERV = "no" ] DISK = [ driver = "raw" , cache = "none"] #NIC = [ filter = "clean-traffic", model="virtio" ] #RAW = [ type = "kvm", data = "" ] + +HYPERV_OPTIONS="" + +SPICE_OPTIONS=" + + + + + + + + " + diff --git a/src/vmm_mad/exec/vmm_exec_xen4.conf b/src/vmm_mad/exec/vmm_exec_xen4.conf index 77fd4624a0..eabf2dbc30 100644 --- a/src/vmm_mad/exec/vmm_exec_xen4.conf +++ b/src/vmm_mad/exec/vmm_exec_xen4.conf @@ -20,12 +20,14 @@ # - credit # - os [kernel,initrd,root,kernel_cmd,hvm] # - vcpu +# - features [acpi, pae, apic, device_model, localtime] # - disk[driver] # - nic[model] # - raw #VCPU = 1 #OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro", hvm="yes" ] +#FEATURES = [ PAE = "no", ACPI = "yes", APIC = "yes" ] CREDIT = 256 DISK = [ driver = "raw:" ]