Federico Simoncelli has uploaded a new change for review.

Change subject: core: Add the QEMU guest agent support
......................................................................

core: Add the QEMU guest agent support

This patch adds the core support for the QEMU guest agent. The new
option QEMUGuestAgentEnabled configures whether if by default the VMs
should have the guest agent channel enabled or not.
It is also possible to configure this option per VM using the method
VmDynamic.setqga_enable(Boolean value) (qga_enable column in the
vm_dynamic table).

Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
Change-Id: I78f6f2d372fd94ae235b1803bcde6ec0f188d488
---
M backend/manager/dbscripts/create_tables.sql
M backend/manager/dbscripts/create_views.sql
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M backend/manager/dbscripts/vms_sp.sql
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDynamicDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
M 
backend/manager/tools/engine-config/src/main/resources/engine-config.properties
14 files changed, 52 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/79/7179/1

diff --git a/backend/manager/dbscripts/create_tables.sql 
b/backend/manager/dbscripts/create_tables.sql
index 7239eca..1faaec8 100644
--- a/backend/manager/dbscripts/create_tables.sql
+++ b/backend/manager/dbscripts/create_tables.sql
@@ -496,6 +496,7 @@
    app_list VARCHAR(4000),
    display INTEGER,
    acpi_enable BOOLEAN,
+   qga_enable BOOLEAN,
    session INTEGER,
    display_ip VARCHAR(255),
    display_type INTEGER,
diff --git a/backend/manager/dbscripts/create_views.sql 
b/backend/manager/dbscripts/create_views.sql
index 4f2e4fc..6c01af0 100644
--- a/backend/manager/dbscripts/create_views.sql
+++ b/backend/manager/dbscripts/create_views.sql
@@ -504,8 +504,8 @@
                       vm_dynamic.console_user_id as console_user_id,
                       vm_dynamic.run_on_vds as run_on_vds, 
vm_dynamic.migrating_to_vds as migrating_to_vds, vm_dynamic.app_list as 
app_list, vm_dynamic.display as display, vm_dynamic.hibernation_vol_handle as 
hibernation_vol_handle,
                       vm_pool_map_view.vm_pool_name as vm_pool_name, 
vm_pool_map_view.vm_pool_id as vm_pool_id, vm_static.vm_guid as vm_guid, 
vm_static.num_of_monitors as num_of_monitors, vm_static.allow_console_reconnect 
as allow_console_reconnect, vm_static.is_initialized as is_initialized,
-                      vm_static.is_auto_suspend as is_auto_suspend, 
vm_static.num_of_sockets as num_of_sockets, vm_static.cpu_per_socket as 
cpu_per_socket, vm_static.usb_policy as usb_policy, vm_dynamic.acpi_enable as 
acpi_enable, vm_dynamic.session as session,
-                      vm_static.num_of_sockets*vm_static.cpu_per_socket as 
num_of_cpus,
+                      vm_static.is_auto_suspend as is_auto_suspend, 
vm_static.num_of_sockets as num_of_sockets, vm_static.cpu_per_socket as 
cpu_per_socket, vm_static.usb_policy as usb_policy, vm_dynamic.acpi_enable as 
acpi_enable,
+                      vm_dynamic.qga_enable as qga_enable, vm_dynamic.session 
as session, vm_static.num_of_sockets*vm_static.cpu_per_socket as num_of_cpus,
                       vm_static.quota_id as quota_id, quota.quota_name as 
quota_name, storage_pool.quota_enforcement_type as quota_enforcement_type,
                       vm_dynamic.display_ip as display_ip, 
vm_dynamic.display_type as display_type, vm_dynamic.kvm_enable as kvm_enable, 
vm_dynamic.boot_sequence as boot_sequence,
                       vm_dynamic.display_secure_port as display_secure_port, 
vm_dynamic.utc_diff as utc_diff, vm_dynamic.last_vds_run_on as last_vds_run_on,
@@ -543,7 +543,7 @@
             vms.hibernation_vol_handle, vms.vm_pool_name, vms.vm_pool_id, 
vms.vm_guid, vms.num_of_monitors,
             vms.allow_console_reconnect,
             vms.is_initialized, vms.is_auto_suspend, vms.num_of_sockets, 
vms.cpu_per_socket, vms.usb_policy, vms.acpi_enable,
-            vms.session, vms.num_of_sockets * vms.cpu_per_socket AS 
num_of_cpus, vms.display_ip, vms.display_type,
+            vms.qga_enable, vms.session, vms.num_of_sockets * 
vms.cpu_per_socket AS num_of_cpus, vms.display_ip, vms.display_type,
             vms.kvm_enable, vms.boot_sequence, vms.display_secure_port, 
vms.utc_diff, vms.last_vds_run_on, vms.client_ip,
             vms.guest_requested_memory, vms.time_zone, vms.cpu_user, 
vms.cpu_sys, vms.elapsed_time,
             vms.usage_network_percent, vms.usage_mem_percent, 
vms.usage_cpu_percent, vms.run_on_vds_name,
diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 465acb3..cfadb76 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -104,6 +104,8 @@
 select fn_db_add_config_value('EnableSwapCheck','true','general');
 --Handling Enable USB devices attachment to the VM by default
 select fn_db_add_config_value('EnableUSBAsDefault','true','general');
+--Handling QEMU Guest Agent
+select fn_db_add_config_value('QEMUGuestAgentEnabled','true','general');
 --Handling Enables Host Load Balancing system.
 select fn_db_add_config_value('EnableVdsLoadBalancing','true','general');
 select 
fn_db_add_config_value('ENGINEEARLib','%JBOSS_HOME%/server/engine-slimmed/deploy/engine.ear','general');
diff --git a/backend/manager/dbscripts/vms_sp.sql 
b/backend/manager/dbscripts/vms_sp.sql
index fc0e842..5f5920f 100644
--- a/backend/manager/dbscripts/vms_sp.sql
+++ b/backend/manager/dbscripts/vms_sp.sql
@@ -109,6 +109,7 @@
        v_vm_pid INTEGER ,
        v_display INTEGER ,
        v_acpi_enable BOOLEAN ,
+       v_qga_enable BOOLEAN ,
        v_session INTEGER ,
        v_display_ip VARCHAR(255) ,
        v_display_type INTEGER ,
@@ -126,8 +127,8 @@
 RETURNS VOID
    AS $procedure$
 BEGIN
-INSERT INTO vm_dynamic(app_list,       guest_cur_user_id, guest_cur_user_name, 
guest_last_login_time, guest_last_logout_time, console_user_id, guest_os, 
migrating_to_vds, RUN_ON_VDS, status, vm_guid, vm_host, vm_ip, last_start_time, 
vm_pid, display, acpi_enable, session, display_ip, display_type, kvm_enable, 
boot_sequence, display_secure_port, utc_diff, last_vds_run_on, client_ip, 
guest_requested_memory, 
hibernation_vol_handle,exit_status,pause_status,exit_message)
-       VALUES(v_app_list, v_guest_cur_user_id, v_guest_cur_user_name, 
v_guest_last_login_time, v_guest_last_logout_time, v_console_user_id, 
v_guest_os, v_migrating_to_vds, v_run_on_vds, v_status, v_vm_guid, v_vm_host, 
v_vm_ip, v_last_start_time, v_vm_pid, v_display, v_acpi_enable, v_session, 
v_display_ip, v_display_type, v_kvm_enable, v_boot_sequence, 
v_display_secure_port, v_utc_diff, v_last_vds_run_on, v_client_ip, 
v_guest_requested_memory, v_hibernation_vol_handle, v_exit_status, 
v_pause_status, v_exit_message);
+INSERT INTO vm_dynamic(app_list,       guest_cur_user_id, guest_cur_user_name, 
guest_last_login_time, guest_last_logout_time, console_user_id, guest_os, 
migrating_to_vds, RUN_ON_VDS, status, vm_guid, vm_host, vm_ip, last_start_time, 
vm_pid, display, acpi_enable, qga_enable, session, display_ip, display_type, 
kvm_enable, boot_sequence, display_secure_port, utc_diff, last_vds_run_on, 
client_ip, guest_requested_memory, 
hibernation_vol_handle,exit_status,pause_status,exit_message)
+       VALUES(v_app_list, v_guest_cur_user_id, v_guest_cur_user_name, 
v_guest_last_login_time, v_guest_last_logout_time, v_console_user_id, 
v_guest_os, v_migrating_to_vds, v_run_on_vds, v_status, v_vm_guid, v_vm_host, 
v_vm_ip, v_last_start_time, v_vm_pid, v_display, v_acpi_enable, v_qga_enable, 
v_session, v_display_ip, v_display_type, v_kvm_enable, v_boot_sequence, 
v_display_secure_port, v_utc_diff, v_last_vds_run_on, v_client_ip, 
v_guest_requested_memory, v_hibernation_vol_handle, v_exit_status, 
v_pause_status, v_exit_message);
 END; $procedure$
 LANGUAGE plpgsql;    
 
@@ -152,6 +153,7 @@
        v_vm_pid INTEGER ,
        v_display INTEGER ,
        v_acpi_enable BOOLEAN ,
+       v_qga_enable BOOLEAN ,
        v_session INTEGER ,
        v_display_ip VARCHAR(255) ,
        v_display_type INTEGER ,
@@ -180,7 +182,7 @@
       guest_os = v_guest_os,migrating_to_vds = v_migrating_to_vds,RUN_ON_VDS = 
v_run_on_vds, 
       status = v_status,vm_host = v_vm_host,vm_ip = v_vm_ip, 
       last_start_time = v_last_start_time, 
-      vm_pid = v_vm_pid,display = v_display,acpi_enable = v_acpi_enable, 
+      vm_pid = v_vm_pid,display = v_display,acpi_enable = v_acpi_enable, 
qga_enable = v_qga_enable,
       session = v_session,display_ip = v_display_ip, 
       display_type = v_display_type,kvm_enable = v_kvm_enable,boot_sequence = 
v_boot_sequence, 
       display_secure_port = v_display_secure_port, 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index 8282588..902e3ce 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -633,6 +633,14 @@
         this.mVmDynamic.setacpi_enable(value);
     }
 
+    public Boolean getqga_enable() {
+        return this.mVmDynamic.getqga_enable();
+    }
+
+    public void setqga_enable(Boolean value) {
+        this.mVmDynamic.setqga_enable(value);
+    }
+
     public String getdisplay_ip() {
         return this.mVmDynamic.getdisplay_ip();
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
index 054641f..3041a86 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
@@ -13,6 +13,8 @@
 import org.hibernate.annotations.Type;
 import org.hibernate.annotations.TypeDef;
 import org.ovirt.engine.core.common.businessentities.mapping.GuidType;
+import org.ovirt.engine.core.common.config.Config;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.NGuid;
 
@@ -83,6 +85,9 @@
 
     @Column(name = "acpi_enable")
     private Boolean acpi_enable;
+
+    @Column(name = "qga_enable")
+    private Boolean qga_enable;
 
     @Column(name = "session")
     private SessionState session = SessionState.Unknown;
@@ -446,6 +451,7 @@
         mExitStatus = VmExitStatus.Normal;
         mWin2kHackEnable = false;
         acpi_enable = true;
+        qga_enable = Config.<Boolean> 
GetValue(ConfigValues.QEMUGuestAgentEnabled);
         kvm_enable = true;
         session = SessionState.Unknown;
         boot_sequence = BootSequence.C;
@@ -455,9 +461,9 @@
             java.util.Date guest_last_login_time, java.util.Date 
guest_last_logout_time, String guest_os,
             NGuid migrating_to_vds, NGuid run_on_vds, int status, Guid 
vm_guid, String vm_host, String vm_ip,
             java.util.Date lastStartTime, java.util.Date vm_last_up_time, 
Integer vm_pid, Integer display,
-            Boolean acpi_enable, String display_ip, Integer display_type, 
Boolean kvm_enable, Integer session,
-            Integer boot_sequence, Integer display_secure_port, Integer 
utc_diff, Guid last_vds_run_on,
-            String client_ip, Integer guest_requested_memory) {
+            Boolean acpi_enable, Boolean qga_enable, String display_ip, 
Integer display_type, Boolean kvm_enable,
+            Integer session, Integer boot_sequence, Integer 
display_secure_port, Integer utc_diff,
+            Guid last_vds_run_on, String client_ip, Integer 
guest_requested_memory) {
         mExitStatus = VmExitStatus.Normal;
         mWin2kHackEnable = false;
 
@@ -626,6 +632,14 @@
         this.acpi_enable = value;
     }
 
+    public Boolean getqga_enable() {
+        return this.qga_enable;
+    }
+
+    public void setqga_enable(Boolean value) {
+        this.qga_enable = value;
+    }
+
     public String getdisplay_ip() {
         return this.display_ip;
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 6998a43..bd3aea4 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1405,6 +1405,11 @@
     )
     BootstrapNodeIDCommand(372),
 
+    @Reloadable
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
+    QEMUGuestAgentEnabled(373),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index de0606c..0105e58 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -77,7 +77,8 @@
     WANDisableEffects(ConfigAuthType.User),
     WANColorDepth(ConfigAuthType.User),
     SupportForceCreateVG,
-    NetworkConnectivityCheckTimeoutInSeconds;
+    NetworkConnectivityCheckTimeoutInSeconds,
+    QEMUGuestAgentEnabled(ConfigAuthType.User);
 
     public static enum ConfigAuthType {
         Admin,
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
index b2aebb4..c147f81 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAODbFacadeImpl.java
@@ -294,6 +294,7 @@
             entity.setcpu_per_socket(rs.getInt("cpu_per_socket"));
             entity.setusb_policy(UsbPolicy.forValue(rs.getInt("usb_policy")));
             entity.setacpi_enable((Boolean) rs.getObject("acpi_enable"));
+            entity.setqga_enable((Boolean) rs.getObject("qga_enable"));
             entity.setsession(SessionState.forValue(rs.getInt("session")));
             entity.setdisplay_ip(rs.getString("display_ip"));
             
entity.setdisplay_type(DisplayType.forValue(rs.getInt("display_type")));
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDynamicDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDynamicDAODbFacadeImpl.java
index 074d31f..a6117a2 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDynamicDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDynamicDAODbFacadeImpl.java
@@ -89,6 +89,7 @@
                 .addValue("vm_pid", vm.getvm_pid())
                 .addValue("display", vm.getdisplay())
                 .addValue("acpi_enable", vm.getacpi_enable())
+                .addValue("qga_enable", vm.getqga_enable())
                 .addValue("session", vm.getsession())
                 .addValue("display_ip", vm.getdisplay_ip())
                 .addValue("display_type", vm.getdisplay_type())
@@ -139,7 +140,7 @@
                         .getTimestamp("last_start_time")));
                 entity.setvm_pid((Integer) rs.getObject("vm_pid"));
                 entity.setdisplay((Integer) rs.getObject("display"));
-                entity.setacpi_enable((Boolean) rs.getObject("acpi_enable"));
+                entity.setqga_enable((Boolean) rs.getObject("qga_enable"));
                 entity.setsession(SessionState.forValue(rs.getInt("session")));
                 entity.setdisplay_ip(rs.getString("display_ip"));
                 entity.setdisplay_type(DisplayType.forValue(rs
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 9fcb269..650aa3d 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -1371,6 +1371,7 @@
         <column>app_list</column>
         <column>display</column>
         <column>acpi_enable</column>
+        <column>qga_enable</column>
         <column>session</column>
         <column>display_ip</column>
         <column>display_type</column>
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
index b913a00..166ac61 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
@@ -175,6 +175,7 @@
 
     public static final String kvmEnable = "kvmEnable"; // Optional
     public static final String acpiEnable = "acpiEnable"; // Optional
+    public static final String qgaEnable = "qgaEnable"; // Optional
     public static final String win2kHackEnable = "win2kHackEnable"; // Optional
     public static final String initFromFloppy = "initFromFloppy"; // Optional
     public static final String sysprepInf = "sysprepInf"; // for the binary sys
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
index fed1b96..a107432 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
@@ -62,6 +62,8 @@
                 .toLowerCase());
         createInfo.add(VdsProperties.acpiEnable, vm.getacpi_enable().toString()
                 .toLowerCase());
+        createInfo.add(VdsProperties.qgaEnable, vm.getqga_enable().toString()
+                .toLowerCase());
 
         createInfo.add(VdsProperties.Custom,
                 
VmPropertiesUtils.getInstance().getVMProperties(vm.getvds_group_compatibility_version(),
diff --git 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
index 87d38d3..12ae4d3 100644
--- 
a/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
+++ 
b/backend/manager/tools/engine-config/src/main/resources/engine-config.properties
@@ -210,3 +210,5 @@
 NetworkConnectivityCheckTimeoutInSeconds.description="The time to wait before 
rolling back network changes in case the engine losses connectivity with the 
host in seconds"
 NetworkConnectivityCheckTimeoutInSeconds.type=Integer
 NetworkConnectivityCheckTimeoutInSeconds.validValues=10..160
+QEMUGuestAgentEnabled.description="Whether the QEMU Guest Agent channel should 
be enabled or not"
+QEMUGuestAgentEnabled.validValues=true,false


--
To view, visit http://gerrit.ovirt.org/7179
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78f6f2d372fd94ae235b1803bcde6ec0f188d488
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to