Martin Peřina has uploaded a new change for review.

Change subject: core: Add number of in/out migrations to VdsDynamic
......................................................................

core: Add number of in/out migrations to VdsDynamic

Adds number of incoming and outgoing migrations to VdsDynamic.

Change-Id: I673abf4e45e87d93ea9c103487c9561039bf749b
Bug-Url: https://bugzilla.redhat.com/1113664
Signed-off-by: Martin Perina <mper...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_06_0950_add_in_out_migrations.sql
M 
packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
M packaging/dbscripts/vds_sp.sql
9 files changed, 75 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/38324/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index fb083a3..c47e9f5 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -630,6 +630,22 @@
         vdsDynamic.setVmMigrating(value);
     }
 
+    public int getIncomingMigrations() {
+        return vdsDynamic.getIncomingMigrations();
+    }
+
+    public void setIncomingMigrations(int value) {
+        vdsDynamic.setIncomingMigrations(value);
+    }
+
+    public int getOutgoingMigrations() {
+        return vdsDynamic.getOutgoingMigrations();
+    }
+
+    public void setOutgoingMigrations(int value) {
+        vdsDynamic.setOutgoingMigrations(value);
+    }
+
     public Integer getUsageMemPercent() {
         return vdsStatistics.getUsageMemPercent();
     }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
index 8f65a97..a46864c 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java
@@ -46,6 +46,10 @@
 
     private Integer vmMigrating;
 
+    private int incomingMigrations;
+
+    private int outgoingMigrations;
+
     private Integer reservedMem;
 
     private Integer guestOverhead;
@@ -310,6 +314,22 @@
 
     public void setVmMigrating(Integer value) {
         vmMigrating = value;
+    }
+
+    public int getIncomingMigrations() {
+        return incomingMigrations;
+    }
+
+    public void setIncomingMigrations(int incomingMigrations) {
+        this.incomingMigrations = incomingMigrations;
+    }
+
+    public int getOutgoingMigrations() {
+        return outgoingMigrations;
+    }
+
+    public void setOutgoingMigrations(int outgoingMigrations) {
+        this.outgoingMigrations = outgoingMigrations;
     }
 
     public Integer getReservedMem() {
@@ -712,6 +732,8 @@
         result = prime * result + vmCount;
         result = prime * result + (supportedRngSources == null ? 0 : 
supportedRngSources.hashCode());
         result = prime * result + (vmMigrating == null ? 0 : 
vmMigrating.hashCode());
+        result = prime * result + incomingMigrations;
+        result = prime * result + outgoingMigrations;
         result = prime * result + (vmsCoresCount == null ? 0 : 
vmsCoresCount.hashCode());
         result = prime * result + (hwManufacturer == null ? 0 : 
hwManufacturer.hashCode());
         result = prime * result + (hwProductName == null ? 0 : 
hwProductName.hashCode());
@@ -781,6 +803,8 @@
                 && ObjectUtils.objectsEqual(vmActive, other.vmActive)
                 && vmCount == other.vmCount
                 && ObjectUtils.objectsEqual(vmMigrating, other.vmMigrating)
+                && incomingMigrations == other.incomingMigrations
+                && outgoingMigrations == other.outgoingMigrations
                 && ObjectUtils.objectsEqual(vmsCoresCount, other.vmsCoresCount)
                 && ObjectUtils.objectsEqual(hwManufacturer, 
other.hwManufacturer)
                 && ObjectUtils.objectsEqual(hwProductName, other.hwProductName)
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
index 12e573a..bb7da7e 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java
@@ -279,6 +279,8 @@
             entity.setVmsCoresCount((Integer) rs
                     .getObject("vms_cores_count"));
             entity.setVmMigrating((Integer) rs.getObject("vm_migrating"));
+            entity.setIncomingMigrations(rs.getInt("incoming_migrations"));
+            entity.setOutgoingMigrations(rs.getInt("outgoing_migrations"));
             entity.setUsageCpuPercent((Integer) rs
                     .getObject("usage_cpu_percent"));
             entity.setUsageMemPercent((Integer) rs
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
index 27bbefd..aec2067 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
@@ -58,6 +58,8 @@
             entity.setVmCount(rs.getInt("vm_count"));
             entity.setVmsCoresCount(rs.getInt("vms_cores_count"));
             entity.setVmMigrating((Integer) rs.getObject("vm_migrating"));
+            entity.setIncomingMigrations(rs.getInt("incoming_migrations"));
+            entity.setOutgoingMigrations(rs.getInt("outgoing_migrations"));
             entity.setReservedMem((Integer) rs.getObject("reserved_mem"));
             entity.setGuestOverhead(rs.getInt("guest_overhead"));
             entity.setSoftwareVersion(rs.getString("software_version"));
@@ -212,6 +214,8 @@
                 .addValue("vm_count", vds.getVmCount())
                 .addValue("vms_cores_count", vds.getVmsCoresCount())
                 .addValue("vm_migrating", vds.getVmMigrating())
+                .addValue("incoming_migrations", vds.getIncomingMigrations())
+                .addValue("outgoing_migrations", vds.getOutgoingMigrations())
                 .addValue("reserved_mem", vds.getReservedMem())
                 .addValue("guest_overhead", vds.getGuestOverhead())
                 .addValue("rpm_version", vds.getVersion().getRpmName())
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index bfa2b5a..4d71ea0 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -3241,6 +3241,8 @@
         <column>is_live_snapshot_supported</column>
         <column>is_live_merge_supported</column>
         <column>online_cpus</column>
+        <column>incoming_migrations</column>
+        <column>outgoing_migrations</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>3</value>
@@ -3295,6 +3297,8 @@
             <value>true</value>
             <value>true</value>
             <value>0,1,2,3</value>
+            <value>0</value>
+            <value>0</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
@@ -3350,6 +3354,8 @@
             <value>false</value>
             <value>false</value>
             <value>0,2,4</value>
+            <value>0</value>
+            <value>0</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -3405,6 +3411,8 @@
             <value>false</value>
             <value>false</value>
             <value>0,8,16,24,32</value>
+            <value>0</value>
+            <value>0</value>
         </row>
         <row>
             <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value>
@@ -3460,6 +3468,8 @@
             <value>true</value>
             <value>true</value>
             <value>0,128</value>
+            <value>0</value>
+            <value>0</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -3515,6 +3525,8 @@
             <value>true</value>
             <value>true</value>
             <value>0,1,2,3,4,5,6,7,8</value>
+            <value>0</value>
+            <value>0</value>
         </row>
     </table>
 
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 0a8ea46..4cc48f4 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -1314,6 +1314,8 @@
     vds_dynamic.vm_active AS vm_active,
     vds_dynamic.vm_count AS vm_count,
     vds_dynamic.vm_migrating AS vm_migrating,
+    vds_dynamic.incoming_migrations AS incoming_migrations,
+    vds_dynamic.outgoing_migrations AS outgoing_migrations,
     vds_dynamic.vms_cores_count AS vms_cores_count,
     vds_statistics.cpu_over_commit_time_stamp AS cpu_over_commit_time_stamp,
     vds_groups.max_vds_memory_over_commit AS max_vds_memory_over_commit,
@@ -1459,6 +1461,8 @@
     vds_dynamic.vm_active,
     vds_dynamic.vm_count,
     vds_dynamic.vm_migrating,
+    vds_dynamic.incoming_migrations,
+    vds_dynamic.outgoing_migrations,
     vds_dynamic.vms_cores_count,
     vds_statistics.cpu_over_commit_time_stamp,
     vds_dynamic.net_config_dirty,
diff --git a/packaging/dbscripts/upgrade/03_06_0950_add_in_out_migrations.sql 
b/packaging/dbscripts/upgrade/03_06_0950_add_in_out_migrations.sql
new file mode 100644
index 0000000..0de9d59
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_06_0950_add_in_out_migrations.sql
@@ -0,0 +1,2 @@
+select fn_db_add_column('vds_dynamic', 'incoming_migrations', 'INTEGER NOT 
NULL DEFAULT 0');
+select fn_db_add_column('vds_dynamic', 'outgoing_migrations', 'INTEGER NOT 
NULL DEFAULT 0');
diff --git 
a/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
 
b/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
index 12d71df..6c52feb 100644
--- 
a/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
+++ 
b/packaging/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql
@@ -43,7 +43,7 @@
           'server_ssl_enabled', 'vds_type', 'pm_enabled', 
'pm_proxy_preferences', 'vds_spm_priority', 'hooks', 'status', 'cpu_cores',
           'cpu_model', 'cpu_speed_mh', 'if_total_speed', 'kvm_enabled', 
'physical_mem_mb',
           'pending_vcpus_count', 'pending_vmem_size', 'mem_commited', 
'vm_active', 'vm_count',
-          'vm_migrating', 'vms_cores_count', 'cpu_over_commit_time_stamp', 
'hypervisor_type',
+          'vm_migrating', 'incoming_migrations', 'outgoing_migrations', 
'vms_cores_count', 'cpu_over_commit_time_stamp', 'hypervisor_type',
           'net_config_dirty', 'max_vds_memory_over_commit', 'storage_pool_id', 
'storage_pool_name', 'reserved_mem',
           'guest_overhead', 'software_version', 'version_name', 'build_name', 
'previous_status',
           'cpu_idle', 'cpu_load', 'cpu_sys', 'cpu_user', 'usage_mem_percent', 
'usage_cpu_percent',
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 66232ca..be97037 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -171,6 +171,8 @@
  v_vm_count INTEGER ,
  v_vms_cores_count INTEGER ,
  v_vm_migrating INTEGER ,
+ v_incoming_migrations INTEGER ,
+ v_outgoing_migrations INTEGER ,
  v_reserved_mem INTEGER ,
  v_guest_overhead INTEGER ,
  v_rpm_version VARCHAR(255),
@@ -216,8 +218,8 @@
 BEGIN
 
    BEGIN
-INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, reserved_mem, guest_overhead, rpm_version, 
software_version, version_name, build_name, previous_status, cpu_flags, 
vms_cores_count, pending_vcpus_count, pending_vmem_size, 
cpu_sockets,net_config_dirty, supported_cluster_levels, supported_engines, 
host_os, kvm_version, libvirt_version, spice_version, gluster_version, 
kernel_version, iscsi_initiator_name, transparent_hugepages_state, hooks, 
hw_manufacturer, hw_product_name, hw_version, hw_serial_number, hw_uuid, 
hw_family, hbas, supported_emulated_machines, controlled_by_pm_policy, 
kdump_status, selinux_enforce_mode, auto_numa_balancing, is_numa_supported, 
supported_rng_sources, is_live_snapshot_supported, is_live_merge_supported, 
online_cpus)
-       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating,    v_reserved_mem, 
v_guest_overhead, v_rpm_version, v_software_version, v_version_name, 
v_build_name, v_previous_status, v_cpu_flags, 
v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, 
v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, 
v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, 
v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, 
v_hooks, v_hw_manufacturer, v_hw_product_name, v_hw_version, 
v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, 
v_supported_emulated_machines, v_controlled_by_pm_policy, v_kdump_status, 
v_selinux_enforce_mode, v_auto_numa_balancing, v_is_numa_supported, 
v_supported_rng_sources, v_is_live_snapshot_supported, 
v_is_live_merge_supported, v_online_cpus);
+INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, 
if_total_speed, kvm_enabled, mem_commited, physical_mem_mb,   status, vds_id, 
vm_active, vm_count, vm_migrating, incoming_migrations, outgoing_migrations, 
reserved_mem, guest_overhead, rpm_version, software_version, version_name, 
build_name, previous_status, cpu_flags, vms_cores_count, pending_vcpus_count, 
pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, 
supported_engines, host_os, kvm_version, libvirt_version, spice_version, 
gluster_version, kernel_version, iscsi_initiator_name, 
transparent_hugepages_state, hooks, hw_manufacturer, hw_product_name, 
hw_version, hw_serial_number, hw_uuid, hw_family, hbas, 
supported_emulated_machines, controlled_by_pm_policy, kdump_status, 
selinux_enforce_mode, auto_numa_balancing, is_numa_supported, 
supported_rng_sources, is_live_snapshot_supported, is_live_merge_supported, 
online_cpus)
+       VALUES(v_cpu_cores,     v_cpu_threads, v_cpu_model,     v_cpu_speed_mh, 
v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb,     
v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating, 
v_incoming_migrations, v_outgoing_migrations, v_reserved_mem, v_guest_overhead, 
v_rpm_version, v_software_version, v_version_name, v_build_name, 
v_previous_status, v_cpu_flags, v_vms_cores_count,v_pending_vcpus_count, 
v_pending_vmem_size, v_cpu_sockets, v_net_config_dirty, 
v_supported_cluster_levels, v_supported_engines, v_host_os, v_kvm_version, 
v_libvirt_version, v_spice_version, v_gluster_version, v_kernel_version, 
v_iscsi_initiator_name, v_transparent_hugepages_state, v_hooks, 
v_hw_manufacturer, v_hw_product_name, v_hw_version, v_hw_serial_number, 
v_hw_uuid, v_hw_family, v_hbas, v_supported_emulated_machines, 
v_controlled_by_pm_policy, v_kdump_status, v_selinux_enforce_mode, 
v_auto_numa_balancing, v_is_numa_supported, v_supported_rng_sources, 
v_is_live_snapshot_supported, v_is_li!
 ve_merge_supported, v_online_cpus);
    END;
 
    RETURN;
@@ -254,6 +256,8 @@
  v_vm_count INTEGER ,
  v_vms_cores_count INTEGER ,
  v_vm_migrating INTEGER ,
+ v_incoming_migrations INTEGER ,
+ v_outgoing_migrations INTEGER ,
  v_reserved_mem INTEGER ,
  v_guest_overhead INTEGER ,
  v_rpm_version VARCHAR(255),
@@ -307,7 +311,8 @@
       if_total_speed = v_if_total_speed,kvm_enabled = v_kvm_enabled,
       mem_commited = v_mem_commited,physical_mem_mb = v_physical_mem_mb,
       status = v_status,vm_active = v_vm_active,vm_count = v_vm_count,
-      vm_migrating = v_vm_migrating,reserved_mem = v_reserved_mem,
+      vm_migrating = v_vm_migrating, incoming_migrations = 
v_incoming_migrations,
+      outgoing_migrations = v_outgoing_migrations, reserved_mem = 
v_reserved_mem,
       guest_overhead = v_guest_overhead,rpm_version = v_rpm_version, 
software_version = v_software_version,
       version_name = v_version_name,build_name = v_build_name,previous_status 
= v_previous_status,
       cpu_flags = v_cpu_flags,
@@ -425,10 +430,10 @@
    IF v_vds_unique_id IS NULL OR NOT EXISTS(SELECT vds_name FROM vds_static 
WHERE vds_unique_id = v_vds_unique_id) then
       BEGIN
          INSERT INTO vds_static(vds_id,host_name, free_text_comment, 
vds_unique_id, port, protocol, vds_group_id, vds_name, server_SSL_enabled,
-                               vds_type,vds_strength,pm_enabled, 
pm_proxy_preferences, pm_detect_kdump, vds_spm_priority, sshKeyFingerprint, 
console_address, 
+                               vds_type,vds_strength,pm_enabled, 
pm_proxy_preferences, pm_detect_kdump, vds_spm_priority, sshKeyFingerprint, 
console_address,
                                ssh_port, ssh_username, disable_auto_pm, 
host_provider_id)
                        VALUES(v_vds_id,v_host_name, v_free_text_comment, 
v_vds_unique_id, v_port, v_protocol, v_vds_group_id, v_vds_name, 
v_server_SSL_enabled,
-                               v_vds_type,v_vds_strength,v_pm_enabled, 
v_pm_proxy_preferences, v_pm_detect_kdump, v_vds_spm_priority, 
v_sshKeyFingerprint, 
+                               v_vds_type,v_vds_strength,v_pm_enabled, 
v_pm_proxy_preferences, v_pm_detect_kdump, v_vds_spm_priority, 
v_sshKeyFingerprint,
                                v_console_address, v_ssh_port, v_ssh_username, 
v_disable_auto_pm, v_host_provider_id);
       END;
    end if;


-- 
To view, visit https://gerrit.ovirt.org/38324
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I673abf4e45e87d93ea9c103487c9561039bf749b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to