1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-27 10:50:10 +03:00

Feature #4157: Add support for qemu guest agent

This commit is contained in:
Jaime Melis 2016-05-05 10:25:50 +02:00
parent 563b42cb32
commit 511b966ba4
6 changed files with 49 additions and 20 deletions

View File

@ -945,7 +945,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
This command also accepts a template, the full list of configuration
attributes are (not all supported via options):
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "DEVICE_MODEL"]
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
INPUT = ["TYPE", "BUS"]
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
RAW = ["DATA", "DATA_VMX", "TYPE"]

View File

@ -662,7 +662,7 @@ module OpenNebula
# will replace the existing ones or delete it if empty. Attributes that
# can be updated are: INPUT/{TYPE, BUS}; RAW/{TYPE, DATA, DATA_VMX},
# OS/{BOOT, BOOTLOADER, ARCH, MACHINE, KERNEL, INITRD},
# FEATURES/{ACPI, APIC, PAE, LOCALTIME, HYPERV, DEVICE_MODEL},
# FEATURES/{ACPI, APIC, PAE, LOCALTIME, HYPERV, GUEST_AGENT},
# and GRAPHICS/{TYPE, LISTEN, PASSWD, KEYMAP}
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise

View File

@ -218,6 +218,17 @@
</select>
</label>
</div>
<div class="medium-6 columns">
<label>
{{tr "GUEST AGENT"}}
{{{tip (tr "Enables the QEMU Guest Agent communication. This does not start the Guest Agent inside the VM.")}}}
<select wizard_field="GUEST_AGENT">
<option value=""></option>
<option value="yes">{{tr "Yes"}}</option>
<option value="no">{{tr "No"}}</option>
</select>
</label>
</div>
</div>
</div>
</div>

View File

@ -4936,7 +4936,7 @@ int VirtualMachine::updateconf(VirtualMachineTemplate& tmpl, string &err)
// Update FEATURES:
// -------------------------------------------------------------------------
string features_names[] = {"PAE", "ACPI", "APIC", "LOCALTIME", "HYPERV",
"DEVICE_MODEL"};
"GUEST_AGENT"};
replace_vector_values(obj_template, &tmpl, "FEATURES", features_names, 6);

View File

@ -191,17 +191,19 @@ int LibVirtDriver::deployment_description_kvm(
const VectorAttribute * features;
bool pae = false;
bool acpi = false;
bool apic = false;
bool hyperv = false;
bool localtime = false;
bool pae = false;
bool acpi = false;
bool apic = false;
bool hyperv = false;
bool localtime = false;
bool guest_agent = false;
int pae_found = -1;
int acpi_found = -1;
int apic_found = -1;
int hyperv_found = -1;
int localtime_found = -1;
int pae_found = -1;
int acpi_found = -1;
int apic_found = -1;
int hyperv_found = -1;
int localtime_found = -1;
int guest_agent_found = -1;
string hyperv_options = "";
@ -1043,11 +1045,12 @@ int LibVirtDriver::deployment_description_kvm(
if ( features != 0 )
{
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);
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);
guest_agent_found = features->vector_value("GUEST_AGENT", guest_agent);
}
if ( pae_found != 0 )
@ -1075,6 +1078,11 @@ int LibVirtDriver::deployment_description_kvm(
get_default("FEATURES", "LOCALTIME", localtime);
}
if ( guest_agent_found != 0 )
{
get_default("FEATURES", "GUEST_AGENT", guest_agent);
}
if ( acpi || pae || apic || hyperv )
{
file << "\t<features>" << endl;
@ -1111,6 +1119,16 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t<clock offset='localtime'/>" << endl;
}
if ( guest_agent )
{
file << "\t<devices>" << endl
<< "\t\t<channel type='unix'>" << endl
<< "\t\t\t<source mode='bind'/>"
<< "<target type='virtio' name='org.qemu.guest_agent.0'/>" << endl
<< "\t\t</channel>" << endl
<< "\t</devices>" << endl;
}
// ------------------------------------------------------------------------
// Raw KVM attributes
// ------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
# - emulator
# - os [kernel,initrd,boot,root,kernel_cmd,arch,machine]
# - vcpu
# - features [acpi, pae, apic, hyperv, localtime]
# - features [acpi, pae, apic, hyperv, localtime, guest_agent]
# - disk [driver, cache, io, discard, total_bytes_sec, total_iops_sec, read_bytes_sec, write_bytes_sec, read_iops_sec, write_iops_sec]
# - nic [filter, model]
# - raw
@ -32,7 +32,7 @@
#VCPU = 1
OS = [ arch = "x86_64" ]
FEATURES = [ PAE = "no", ACPI = "yes", APIC = "no", HYPERV = "no" ]
FEATURES = [ PAE = "no", ACPI = "yes", APIC = "no", HYPERV = "no", GUEST_AGENT = "no" ]
DISK = [ driver = "raw" , cache = "none"]