Liran Zelkha has uploaded a new change for review.

Change subject: core: Move cpu_over_commit from VdsDynamic to VdsStatistics
......................................................................

core: Move cpu_over_commit from VdsDynamic to VdsStatistics

cpu_over_commit field is rapidly changing, and should be located in 
VdsStatistics.
This patch moves it to vds_statistics and updates the relevant stored procedures
and DAOs

Change-Id: I604132f9f05c8470ff09196db77eea2957899e2a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1114285
Signed-off-by: lzel...@redhat.com <lzel...@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/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql
M packaging/dbscripts/vds_sp.sql
10 files changed, 47 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/33794/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 00d9fb6..de2beb8 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
@@ -842,11 +842,11 @@
     }
 
     public Date getCpuOverCommitTimestamp() {
-        return mVdsDynamic.getcpu_over_commit_time_stamp();
+        return mVdsStatistics.getcpu_over_commit_time_stamp();
     }
 
     public void setCpuOverCommitTimestamp(Date value) {
-        mVdsDynamic.setcpu_over_commit_time_stamp(value);
+        mVdsStatistics.setcpu_over_commit_time_stamp(value);
     }
 
     public int getVdsStrength() {
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 fa930b9..ff14ec2 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
@@ -2,7 +2,6 @@
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -59,8 +58,6 @@
     private VDSStatus previous_status;
 
     private String cpu_flags;
-
-    private Date cpu_over_commit_time_stamp;
 
     private Integer vms_cores_count;
 
@@ -377,14 +374,6 @@
         this.cpu_flags = value;
     }
 
-    public Date getcpu_over_commit_time_stamp() {
-        return this.cpu_over_commit_time_stamp;
-    }
-
-    public void setcpu_over_commit_time_stamp(Date value) {
-        this.cpu_over_commit_time_stamp = value;
-    }
-
     public Integer getpending_vcpus_count() {
         return this.pending_vcpus_count;
     }
@@ -680,7 +669,6 @@
         result = prime * result + ((cpuThreads == null) ? 0 : 
cpuThreads.hashCode());
         result = prime * result + ((cpu_flags == null) ? 0 : 
cpu_flags.hashCode());
         result = prime * result + ((cpu_model == null) ? 0 : 
cpu_model.hashCode());
-        result = prime * result + ((cpu_over_commit_time_stamp == null) ? 0 : 
cpu_over_commit_time_stamp.hashCode());
         result = prime * result + ((cpu_sockets == null) ? 0 : 
cpu_sockets.hashCode());
         result = prime * result + ((cpu_speed_mh == null) ? 0 : 
cpu_speed_mh.hashCode());
         result = prime * result + ((guest_overhead == null) ? 0 : 
guest_overhead.hashCode());
@@ -753,7 +741,6 @@
                 && ObjectUtils.objectsEqual(cpuThreads, other.cpuThreads)
                 && ObjectUtils.objectsEqual(cpu_flags, other.cpu_flags)
                 && ObjectUtils.objectsEqual(cpu_model, other.cpu_model)
-                && ObjectUtils.objectsEqual(cpu_over_commit_time_stamp, 
other.cpu_over_commit_time_stamp)
                 && ObjectUtils.objectsEqual(cpu_sockets, other.cpu_sockets)
                 && ObjectUtils.objectsEqual(cpu_speed_mh, other.cpu_speed_mh)
                 && ObjectUtils.objectsEqual(guest_overhead, 
other.guest_overhead)
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java
index c140c1f..a6699c2 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java
@@ -2,6 +2,7 @@
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import org.ovirt.engine.core.common.utils.ObjectUtils;
@@ -37,6 +38,7 @@
     private boolean highlyAvailableIsActive;
     private boolean highlyAvailableGlobalMaintenance;
     private boolean highlyAvailableLocalMaintenance;
+    private Date cpu_over_commit_time_stamp;
 
     private List<CpuStatistics> cpuCoreStatistics;
 
@@ -95,6 +97,7 @@
         result = prime * result + (highlyAvailableGlobalMaintenance ? 1231 : 
1237);
         result = prime * result + (highlyAvailableLocalMaintenance ? 1231 : 
1237);
         result = prime * result + ((cpuCoreStatistics == null) ? 0 : 
cpuCoreStatistics.hashCode());
+        result = prime * result + ((cpu_over_commit_time_stamp == null) ? 0 : 
cpu_over_commit_time_stamp.hashCode());
         return result;
     }
 
@@ -132,7 +135,8 @@
                 && (highlyAvailableIsActive == other.highlyAvailableIsActive)
                 && (highlyAvailableGlobalMaintenance == 
other.highlyAvailableGlobalMaintenance)
                 && (highlyAvailableLocalMaintenance == 
other.highlyAvailableLocalMaintenance)
-                && ObjectUtils.objectsEqual(cpuCoreStatistics, 
other.cpuCoreStatistics));
+                && ObjectUtils.objectsEqual(cpuCoreStatistics, 
other.cpuCoreStatistics)
+                && ObjectUtils.objectsEqual(cpu_over_commit_time_stamp, 
other.cpu_over_commit_time_stamp));
     }
 
     public Double getcpu_idle() {
@@ -334,4 +338,11 @@
         this.cpuCoreStatistics = cpuCoreStatistics;
     }
 
+    public Date getcpu_over_commit_time_stamp() {
+        return this.cpu_over_commit_time_stamp;
+    }
+
+    public void setcpu_over_commit_time_stamp(Date value) {
+        this.cpu_over_commit_time_stamp = value;
+    }
 }
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 e092ed5..cd965d7 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
@@ -15,7 +15,6 @@
 import org.ovirt.engine.core.common.businessentities.VmRngDevice;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.RpmVersion;
-import org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils;
 import org.ovirt.engine.core.dal.dbbroker.MapSqlParameterMapper;
 import org.ovirt.engine.core.utils.log.Log;
 import org.ovirt.engine.core.utils.log.LogFactory;
@@ -68,8 +67,6 @@
             entity.setprevious_status(VDSStatus.forValue(rs
                     .getInt("previous_status")));
             entity.setcpu_flags(rs.getString("cpu_flags"));
-            entity.setcpu_over_commit_time_stamp(DbFacadeUtils.fromDate(rs
-                    .getTimestamp("cpu_over_commit_time_stamp")));
             entity.setpending_vcpus_count((Integer) rs
                     .getObject("pending_vcpus_count"));
             entity.setpending_vmem_size(rs.getInt("pending_vmem_size"));
@@ -233,8 +230,6 @@
                 .addValue("build_name", vds.getbuild_name())
                 .addValue("previous_status", vds.getprevious_status())
                 .addValue("cpu_flags", vds.getcpu_flags())
-                .addValue("cpu_over_commit_time_stamp",
-                        vds.getcpu_over_commit_time_stamp())
                 .addValue("pending_vcpus_count", vds.getpending_vcpus_count())
                 .addValue("pending_vmem_size", vds.getpending_vmem_size())
                 .addValue("cpu_sockets", vds.getcpu_sockets())
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java
index 38d04d0..90ea511 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java
@@ -7,6 +7,7 @@
 import org.apache.commons.lang.NotImplementedException;
 import org.ovirt.engine.core.common.businessentities.VdsStatistics;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 
@@ -52,6 +53,8 @@
             entity.setHighlyAvailableIsActive(rs.getBoolean("ha_active"));
             
entity.setHighlyAvailableGlobalMaintenance(rs.getBoolean("ha_global_maintenance"));
             
entity.setHighlyAvailableLocalMaintenance(rs.getBoolean("ha_local_maintenance"));
+            entity.setcpu_over_commit_time_stamp(DbFacadeUtils.fromDate(rs
+                    .getTimestamp("cpu_over_commit_time_stamp")));
             return entity;
         }
     }
@@ -92,7 +95,8 @@
                 .addValue("ha_configured", 
stats.getHighlyAvailableIsConfigured())
                 .addValue("ha_active", stats.getHighlyAvailableIsActive())
                 .addValue("ha_global_maintenance", 
stats.getHighlyAvailableGlobalMaintenance())
-                .addValue("ha_local_maintenance", 
stats.getHighlyAvailableLocalMaintenance());
+                .addValue("ha_local_maintenance", 
stats.getHighlyAvailableLocalMaintenance())
+                .addValue("cpu_over_commit_time_stamp", 
stats.getcpu_over_commit_time_stamp());
 
         getCallsHandler().executeModification("InsertVdsStatistics", 
parameterSource);
     }
@@ -123,7 +127,8 @@
                 .addValue("ha_configured", 
stats.getHighlyAvailableIsConfigured())
                 .addValue("ha_active", stats.getHighlyAvailableIsActive())
                 .addValue("ha_global_maintenance", 
stats.getHighlyAvailableGlobalMaintenance())
-                .addValue("ha_local_maintenance", 
stats.getHighlyAvailableLocalMaintenance());
+                .addValue("ha_local_maintenance", 
stats.getHighlyAvailableLocalMaintenance())
+                .addValue("cpu_over_commit_time_stamp", 
stats.getcpu_over_commit_time_stamp());
 
         getCallsHandler().executeModification("UpdateVdsStatistics", 
parameterSource);
     }
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index ad90406..16cf011 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -2952,7 +2952,6 @@
         <column>build_name</column>
         <column>previous_status</column>
         <column>cpu_flags</column>
-        <column>cpu_over_commit_time_stamp</column>
         <column>vms_cores_count</column>
         <column>pending_vcpus_count</column>
         <column>cpu_sockets</column>
@@ -3006,7 +3005,6 @@
             <null />
             <value>12</value>
             
<value>fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,dca,sse4_1,lahf_lm,tpr_shadow,vnmi,flexpriority,model_486,model_pentium,model_pentium2,model_pentium3,model_pentiumpro,model_qemu32,model_coreduo,model_core2duo,model_n270,model_Conroe,model_Penryn,model_Opteron_G1</value>
-            <value>2010-11-17 17:26:10</value>
             <value>0</value>
             <value>0</value>
             <value>2</value>
@@ -3061,7 +3059,6 @@
             <null />
             <value>12</value>
             
<value>fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,dca,sse4_1,lahf_lm,tpr_shadow,vnmi,flexpriority,model_486,model_pentium,model_pentium2,model_pentium3,model_pentiumpro,model_qemu32,model_coreduo,model_core2duo,model_n270,model_Conroe,model_Penryn,model_Opteron_G1</value>
-            <value>2010-11-17 17:26:10</value>
             <value>0</value>
             <value>0</value>
             <value>2</value>
@@ -3116,7 +3113,6 @@
             <null />
             <value>12</value>
             
<value>fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,dca,sse4_1,lahf_lm,tpr_shadow,vnmi,flexpriority,model_486,model_pentium,model_pentium2,model_pentium3,model_pentiumpro,model_qemu32,model_coreduo,model_core2duo,model_n270,model_Conroe,model_Penryn,model_Opteron_G1</value>
-            <value>2010-11-17 17:26:10</value>
             <value>0</value>
             <value>0</value>
             <value>2</value>
@@ -3171,7 +3167,6 @@
             <null />
             <value>12</value>
             
<value>fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,dca,sse4_1,lahf_lm,tpr_shadow,vnmi,flexpriority,model_486,model_pentium,model_pentium2,model_pentium3,model_pentiumpro,model_qemu32,model_coreduo,model_core2duo,model_n270,model_Conroe,model_Penryn,model_Opteron_G1</value>
-            <value>2010-11-17 17:26:10</value>
             <value>0</value>
             <value>0</value>
             <value>2</value>
@@ -3226,7 +3221,6 @@
             <null />
             <value>12</value>
             
<value>fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,aperfmperf,pni,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,cx16,xtpr,pdcm,dca,sse4_1,lahf_lm,tpr_shadow,vnmi,flexpriority,model_486,model_pentium,model_pentium2,model_pentium3,model_pentiumpro,model_qemu32,model_coreduo,model_core2duo,model_n270,model_Conroe,model_Penryn,model_Opteron_G1</value>
-            <value>2010-11-17 17:26:10</value>
             <value>0</value>
             <value>0</value>
             <value>2</value>
@@ -3285,7 +3279,8 @@
         <column>ha_active</column>
         <column>ha_global_maintenance</column>
         <column>ha_local_maintenance</column>
-       <column>boot_time</column>
+        <column>boot_time</column>
+        <column>cpu_over_commit_time_stamp</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>100</value>
@@ -3310,6 +3305,7 @@
             <value>false</value>
             <value>false</value>
             <value>123456789</value>
+            <value>2010-12-01 14:13:10</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
@@ -3335,6 +3331,7 @@
             <value>false</value>
             <value>false</value>
             <value>123456789</value>
+            <value>2010-12-01 14:13:10</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -3360,6 +3357,7 @@
             <value>false</value>
             <value>false</value>
             <value>123456789</value>
+            <value>2010-12-01 14:13:10</value>
         </row>
         <row>
             <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value>
@@ -3385,6 +3383,7 @@
             <value>false</value>
             <value>false</value>
             <value>123456789</value>
+            <value>2010-12-01 14:13:10</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -3409,8 +3408,8 @@
             <value>false</value>
             <value>false</value>
             <value>false</value>
-            <null />
             <value>123456789</value>
+            <value>2010-12-01 14:13:10</value>
         </row>
     </table>
 
diff --git 
a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java
 
b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java
index bcd7a8e..5e9ec54 100644
--- 
a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java
+++ 
b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java
@@ -123,7 +123,6 @@
         vdsDynamic.setprevious_status(random.nextEnum(VDSStatus.class));
         vdsDynamic.setsoftware_version(random.nextNumericString(5) + '.' + 
random.nextNumericString(5));
         vdsDynamic.setversion_name(random.nextString(10));
-        vdsDynamic.setcpu_over_commit_time_stamp(new Date(random.nextLong()));
         vdsDynamic.setpending_vcpus_count(random.nextInt());
         vdsDynamic.setpending_vmem_size(random.nextInt());
         vdsDynamic.setnet_config_dirty(random.nextBoolean());
@@ -151,6 +150,7 @@
         vdsStatistics.setusage_cpu_percent(random.nextInt());
         vdsStatistics.setusage_mem_percent(random.nextInt());
         vdsStatistics.setusage_network_percent(random.nextInt());
+        vdsStatistics.setcpu_over_commit_time_stamp(new 
Date(random.nextLong()));
         return vdsStatistics;
     }
 
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 9074c4c..3717d52 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -765,7 +765,7 @@
                       vds_dynamic.cpu_cores as cpu_cores, 
vds_dynamic.cpu_threads as cpu_threads, vds_dynamic.cpu_model as cpu_model, 
vds_dynamic.cpu_speed_mh as cpu_speed_mh,
                       vds_dynamic.if_total_speed as if_total_speed, 
vds_dynamic.kvm_enabled as kvm_enabled, vds_dynamic.physical_mem_mb as 
physical_mem_mb,
                       vds_dynamic.pending_vcpus_count as pending_vcpus_count, 
vds_dynamic.pending_vmem_size as pending_vmem_size,vds_dynamic.mem_commited as 
mem_commited, vds_dynamic.vm_active as vm_active, vds_dynamic.vm_count as 
vm_count,
-                      vds_dynamic.vm_migrating as vm_migrating, 
vds_dynamic.vms_cores_count as vms_cores_count, 
vds_dynamic.cpu_over_commit_time_stamp as cpu_over_commit_time_stamp,
+                      vds_dynamic.vm_migrating as vm_migrating, 
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, vds_dynamic.net_config_dirty as net_config_dirty, 
vds_groups.count_threads_as_cores as count_threads_as_cores,
                       storage_pool.id as storage_pool_id, storage_pool.name as 
storage_pool_name, vds_dynamic.reserved_mem as reserved_mem,
                       vds_dynamic.guest_overhead as guest_overhead, 
vds_dynamic.rpm_version as rpm_version, vds_dynamic.software_version as 
software_version, vds_dynamic.version_name as version_name, 
vds_dynamic.build_name as build_name,
@@ -811,7 +811,7 @@
                       vds_dynamic.cpu_threads, vds_dynamic.cpu_model, 
vds_dynamic.cpu_speed_mh, vds_dynamic.if_total_speed, vds_dynamic.kvm_enabled,
                       vds_dynamic.physical_mem_mb, 
vds_dynamic.pending_vcpus_count, vds_dynamic.pending_vmem_size,
                       vds_dynamic.mem_commited, vds_dynamic.vm_active, 
vds_dynamic.vm_count, vds_dynamic.vm_migrating,
-                      vds_dynamic.vms_cores_count, 
vds_dynamic.cpu_over_commit_time_stamp,
+                      vds_dynamic.vms_cores_count, 
vds_statistics.cpu_over_commit_time_stamp,
                       vds_dynamic.net_config_dirty, 
vds_groups.max_vds_memory_over_commit, vds_groups.count_threads_as_cores,
                       storage_pool.id AS storage_pool_id, storage_pool.name AS 
storage_pool_name, tags_vds_map_view.tag_name,
                       tags_vds_map_view.tag_id, vds_dynamic.reserved_mem, 
vds_dynamic.guest_overhead, vds_dynamic.rpm_version, 
vds_dynamic.software_version,
diff --git 
a/packaging/dbscripts/upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql 
b/packaging/dbscripts/upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql
new file mode 100644
index 0000000..a6dfe30
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql
@@ -0,0 +1,6 @@
+-- add network qos columns to qos table
+SELECT fn_db_add_column('vds_statistics', 'cpu_over_commit_time_stamp', 
'TIMESTAMP WITH TIME ZONE');
+
+update vds_statistics set cpu_over_commit_time_stamp = (select 
cpu_over_commit_time_stamp from vds_dynamic where vds_dynamic.vds_id = 
vds_statistics.vds_id);
+
+SELECT fn_db_drop_column('vds_dynamic', 'cpu_over_commit_time_stamp');
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 9602cbc..15f5442 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -30,14 +30,15 @@
  v_ha_configured BOOLEAN,
  v_ha_active BOOLEAN,
  v_ha_global_maintenance BOOLEAN,
- v_ha_local_maintenance BOOLEAN)
+ v_ha_local_maintenance BOOLEAN,
+ v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE )
 RETURNS VOID
    AS $procedure$
 BEGIN
 
    BEGIN
-INSERT INTO vds_statistics(cpu_idle, cpu_load, cpu_sys, cpu_user, 
usage_cpu_percent, usage_mem_percent, usage_network_percent, vds_id, 
mem_available, mem_free, 
mem_shared,swap_free,swap_total,ksm_cpu_percent,ksm_pages,ksm_state, 
anonymous_hugepages, boot_time, ha_score, ha_configured, ha_active, 
ha_global_maintenance, ha_local_maintenance)
-       VALUES(v_cpu_idle, v_cpu_load, v_cpu_sys, v_cpu_user, 
v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_vds_id, 
v_mem_available, v_mem_free, 
v_mem_shared,v_swap_free,v_swap_total,v_ksm_cpu_percent,v_ksm_pages,v_ksm_state,
 v_anonymous_hugepages, v_boot_time, v_ha_score, v_ha_configured, v_ha_active, 
v_ha_global_maintenance, v_ha_local_maintenance);
+INSERT INTO vds_statistics(cpu_idle, cpu_load, cpu_sys, cpu_user, 
usage_cpu_percent, usage_mem_percent, usage_network_percent, vds_id, 
mem_available, mem_free, 
mem_shared,swap_free,swap_total,ksm_cpu_percent,ksm_pages,ksm_state, 
anonymous_hugepages, boot_time, ha_score, ha_configured, ha_active, 
ha_global_maintenance, ha_local_maintenance,cpu_over_commit_time_stamp)
+       VALUES(v_cpu_idle, v_cpu_load, v_cpu_sys, v_cpu_user, 
v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_vds_id, 
v_mem_available, v_mem_free, 
v_mem_shared,v_swap_free,v_swap_total,v_ksm_cpu_percent,v_ksm_pages,v_ksm_state,
 v_anonymous_hugepages, v_boot_time, v_ha_score, v_ha_configured, v_ha_active, 
v_ha_global_maintenance, v_ha_local_maintenance,v_cpu_over_commit_time_stamp);
    END;
 
    RETURN;
@@ -70,7 +71,8 @@
  v_ha_configured BOOLEAN,
  v_ha_active BOOLEAN,
  v_ha_global_maintenance BOOLEAN,
- v_ha_local_maintenance BOOLEAN)
+ v_ha_local_maintenance BOOLEAN,
+ v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE)
 RETURNS VOID
 
        --The [vds_dynamic] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -88,7 +90,7 @@
       boot_time = v_boot_time,
       ha_score = v_ha_score, ha_configured = v_ha_configured, ha_active = 
v_ha_active,
       ha_global_maintenance = v_ha_global_maintenance, ha_local_maintenance = 
v_ha_local_maintenance,
-      _update_date = LOCALTIMESTAMP
+      _update_date = LOCALTIMESTAMP, cpu_over_commit_time_stamp = 
v_cpu_over_commit_time_stamp
       WHERE vds_id = v_vds_id;
    END;
 
@@ -177,7 +179,6 @@
  v_build_name VARCHAR(40) ,
  v_previous_status INTEGER ,
  v_cpu_flags VARCHAR(4000) ,
- v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE ,
  v_pending_vcpus_count INTEGER ,
  v_pending_vmem_size INTEGER ,
  v_cpu_sockets INTEGER ,
@@ -214,8 +215,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, 
cpu_over_commit_time_stamp, 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)
-       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_cpu_over_commit_time_stamp, 
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_support!
 ed);
+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)
+       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);
    END;
 
    RETURN;
@@ -260,7 +261,6 @@
  v_build_name VARCHAR(40) ,
  v_previous_status INTEGER ,
  v_cpu_flags VARCHAR(4000) ,
- v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE ,
  v_pending_vcpus_count INTEGER ,
  v_pending_vmem_size INTEGER ,
  v_cpu_sockets INTEGER ,
@@ -308,7 +308,7 @@
       vm_migrating = v_vm_migrating,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,cpu_over_commit_time_stamp = 
v_cpu_over_commit_time_stamp,
+      cpu_flags = v_cpu_flags,
       vms_cores_count = v_vms_cores_count,pending_vcpus_count = 
v_pending_vcpus_count,
       pending_vmem_size = v_pending_vmem_size,
       cpu_sockets = v_cpu_sockets,net_config_dirty = v_net_config_dirty,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I604132f9f05c8470ff09196db77eea2957899e2a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Liran Zelkha <lzel...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to