Vitor de Lima has uploaded a new change for review.

Change subject: core, engine, webadmin: Consider only online logical CPUs
......................................................................

core, engine, webadmin: Consider only online logical CPUs

This patch reports the ids of the logical CPUs which are online in the
Hosts tab of the webadmin interface, and uses this information to
validate the CPU pinning during the VM creation.

A new column in the vds_dynamic table was added to store this list.

Change-Id: Ib20f20d6003502fe2f2864abb5ad8f4f5a19ecdc
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1148092
Signed-off-by: Vitor de Lima <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/VmManagementCommandBaseTest.java
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 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
M packaging/dbscripts/create_views.sql
A packaging/dbscripts/upgrade/03_06_0410_add_online_cpu_list.sql
M packaging/dbscripts/vds_sp.sql
15 files changed, 107 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/88/33788/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
index 50469f5..181b589 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
@@ -1,7 +1,6 @@
 package org.ovirt.engine.core.bll;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -125,6 +124,24 @@
 
         int maxvCPU = vmStatic.getNumOfCpus();
 
+        VDS dedicatedVds = null;
+
+        // can not check if no dedicated vds was configured
+        if (vmStatic.getDedicatedVmForVds() != null) {
+            dedicatedVds = getVds(vmStatic.getDedicatedVmForVds());
+        } else {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST);
+        }
+
+        Collection<Integer> onlinePcpus = new HashSet<>();
+
+        if (dedicatedVds.getCpuList() != null) {
+            String[] onlinePcpusStr = dedicatedVds.getCpuList().split(",");
+
+            for (String Pcpu : onlinePcpusStr) {
+                onlinePcpus.add(Integer.parseInt(Pcpu));
+            }
+        }
 
         for (String rule : rules) {
             // [0] vcpu, [1] pcpu
@@ -149,21 +166,18 @@
                 return 
failCanDoAction(VdcBllMessages.VM_PINNING_PINNED_TO_NO_CPU);
             }
 
-            // can not check if no dedicated vds was configured
-            if (vmStatic.getDedicatedVmForVds() != null) {
-                VDS dedicatedVds = getVds(vmStatic.getDedicatedVmForVds());
-                // check only from cluster version 3.2
-                if (dedicatedVds != null &&
-                        dedicatedVds.getVdsGroupCompatibilityVersion() != null 
&&
-                        
dedicatedVds.getVdsGroupCompatibilityVersion().compareTo(Version.v3_2) >= 0 &&
-                        dedicatedVds.getCpuThreads() != null) {
-                    if (Collections.max(currPcpus) >= 
dedicatedVds.getCpuThreads()) {
-                        // ERROR maps to a non existent pcpu
+            // check only from cluster version 3.2
+            if (dedicatedVds != null &&
+                    dedicatedVds.getVdsGroupCompatibilityVersion() != null &&
+                    
dedicatedVds.getVdsGroupCompatibilityVersion().compareTo(Version.v3_2) >= 0 &&
+                    dedicatedVds.getCpuList() != null) {
+
+                for (Integer pCPU : currPcpus) {
+                    if (!onlinePcpus.contains(pCPU)) {
+                        // ERROR maps to a non existent or offline pcpu
                         return 
failCanDoAction(VdcBllMessages.VM_PINNING_PCPU_DOES_NOT_EXIST);
                     }
                 }
-            } else {
-                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST);
             }
         }
 
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/VmManagementCommandBaseTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/VmManagementCommandBaseTest.java
index 7862e30..917bba1 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/VmManagementCommandBaseTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/VmManagementCommandBaseTest.java
@@ -43,6 +43,7 @@
         vmStatic.setDedicatedVmForVds(Guid.Empty);
         final VDS dedicatedVds = new VDS();
         dedicatedVds.setCpuThreads(16);
+        dedicatedVds.setCpuList("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15");
         dedicatedVds.setVdsGroupCompatibilityVersion(Version.v3_2);
 
         doReturn(dedicatedVds).when(test).getVds(Guid.Empty);
@@ -125,6 +126,21 @@
             
Assert.assertEquals(VdcBllMessages.VM_PINNING_PCPU_DOES_NOT_EXIST.toString(), 
canDoActionMessages.get(0));
         }
 
+        // additional tests for CPUs disabled on-the-fly
+        dedicatedVds.setCpuList("0,1,2,4,5,6,7,8,9,10,11,12,13,14,15");
+
+        Assert.assertFalse("use of disabled cpu", 
test.isCpuPinningValid("0#3", vmStatic));
+        Assert.assertTrue(canDoActionMessages.size() > 0);
+        if (canDoActionMessages.size() > 0) {
+            
Assert.assertEquals(VdcBllMessages.VM_PINNING_PCPU_DOES_NOT_EXIST.toString(), 
canDoActionMessages.get(0));
+        }
+
+        // additional tests for CPUs disabled on-the-fly
+        dedicatedVds.setCpuList("0,4,8,16,24,32,40,48,56,64,68,72,76,80,84");
+
+        Assert.assertTrue("use of cpu with a id larger than the number of CPU 
threads",
+                test.isCpuPinningValid("0#84", vmStatic));
+
         // making sure cluster < 3.2 does not get validated on pCPU as we cant 
tell the number for sure
         dedicatedVds.setVdsGroupCompatibilityVersion(Version.v3_1);
         Assert.assertTrue(test.isCpuPinningValid("10#1,2,3_11#1-20,^3", 
vmStatic));
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 611fb83..aea524b 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
@@ -127,6 +127,7 @@
         vds.setCpuCores(getCpuCores());
         vds.setCpuThreads(getCpuThreads());
         vds.setCpuModel(getCpuModel());
+        vds.setCpuList(getCpuList());
         vds.setCpuSpeedMh(getCpuSpeedMh());
         vds.setIfTotalSpeed(getIfTotalSpeed());
         vds.setKvmEnabled(getKvmEnabled());
@@ -473,6 +474,14 @@
         this.mVdsDynamic.setcpu_model(value);
     }
 
+    public String getCpuList() {
+        return this.mVdsDynamic.getcpu_list();
+    }
+
+    public void setCpuList(String value) {
+        this.mVdsDynamic.setcpu_list(value);
+    }
+
     public Double getCpuSpeedMh() {
         return this.mVdsDynamic.getcpu_speed_mh();
     }
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 782da11..0cf65de 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
@@ -30,6 +30,8 @@
 
     private String cpu_model;
 
+    private String cpu_list;
+
     private BigDecimal cpu_speed_mh;
 
     private String if_total_speed;
@@ -237,6 +239,14 @@
         this.cpu_model = value;
     }
 
+    public String getcpu_list() {
+        return this.cpu_list;
+    }
+
+    public void setcpu_list(String value) {
+        this.cpu_list = value;
+    }
+
     public Double getcpu_speed_mh() {
         return this.cpu_speed_mh.doubleValue();
     }
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 e235806..988be69 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
@@ -239,6 +239,7 @@
             entity.setCpuCores((Integer) rs.getObject("cpu_cores"));
             entity.setCpuThreads((Integer) rs.getObject("cpu_threads"));
             entity.setCpuModel(rs.getString("cpu_model"));
+            entity.setCpuList(rs.getString("cpu_list"));
             entity.setCpuUser(rs.getDouble("cpu_user"));
             entity.setCpuSpeedMh(rs.getDouble("cpu_speed_mh"));
             entity.setIfTotalSpeed(rs.getString("if_total_speed"));
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 50c90d8..14d1ad2 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
@@ -46,6 +46,7 @@
             entity.setcpu_cores((Integer) rs.getObject("cpu_cores"));
             entity.setCpuThreads((Integer) rs.getObject("cpu_threads"));
             entity.setcpu_model(rs.getString("cpu_model"));
+            entity.setcpu_list(rs.getString("cpu_list"));
             entity.setcpu_speed_mh(rs.getDouble("cpu_speed_mh"));
             entity.setif_total_speed(rs.getString("if_total_speed"));
             entity.setkvm_enabled((Boolean) rs.getObject("kvm_enabled"));
@@ -202,6 +203,7 @@
                 .addValue("cpu_cores", vds.getcpu_cores())
                 .addValue("cpu_threads", vds.getCpuThreads())
                 .addValue("cpu_model", vds.getcpu_model())
+                .addValue("cpu_list", vds.getcpu_list())
                 .addValue("cpu_speed_mh", vds.getcpu_speed_mh())
                 .addValue("if_total_speed", vds.getif_total_speed())
                 .addValue("kvm_enabled", vds.getkvm_enabled())
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 701ec74..9241f11 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -3048,6 +3048,7 @@
         <column>supported_rng_sources</column>
         <column>is_live_snapshot_supported</column>
         <column>is_live_merge_supported</column>
+        <column>cpu_list</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>3</value>
@@ -3102,6 +3103,7 @@
             <value>RANDOM</value>
             <value>true</value>
             <value>true</value>
+            <value>0,1,2,3</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
@@ -3157,6 +3159,7 @@
             <value></value>
             <value>false</value>
             <value>false</value>
+            <value>0,2,4</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -3212,6 +3215,7 @@
             <value>HWRNG</value>
             <value>false</value>
             <value>false</value>
+            <value>0,8,16,24,32</value>
         </row>
         <row>
             <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value>
@@ -3267,6 +3271,7 @@
             <value>RANDOM</value>
             <value>true</value>
             <value>true</value>
+            <value>0,128</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -3322,6 +3327,7 @@
             <value>RANDOM,HWRNG</value>
             <value>true</value>
             <value>true</value>
+            <value>0,1,2,3,4,5,6,7,8</value>
         </row>
     </table>
 
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
index 862f765..3bc70b4 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
@@ -458,6 +458,7 @@
         vds.setCpuCores(AssignIntValue(xmlRpcStruct, VdsProperties.cpu_cores));
         vds.setCpuSockets(AssignIntValue(xmlRpcStruct, 
VdsProperties.cpu_sockets));
         vds.setCpuModel(AssignStringValue(xmlRpcStruct, 
VdsProperties.cpu_model));
+        vds.setCpuList(AssignStringValue(xmlRpcStruct, 
VdsProperties.cpu_list));
         vds.setCpuSpeedMh(AssignDoubleValue(xmlRpcStruct, 
VdsProperties.cpu_speed_mh));
         vds.setPhysicalMemMb(AssignIntValue(xmlRpcStruct, 
VdsProperties.physical_mem_mb));
 
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 2eaa0f4..9aabe90 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
@@ -35,6 +35,7 @@
     public static final String cpu_cores = "cpuCores";
     public static final String cpu_sockets = "cpuSockets";
     public static final String cpu_model = "cpuModel";
+    public static final String cpu_list = "cpuList";
     public static final String cpu_speed_mh = "cpuSpeed";
     public static final String if_total_speed = "eth0Speed";
     public static final String kvm_enabled = "kvmEnabled";
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
index f727c2c..35fe022 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
@@ -841,6 +841,21 @@
         }
     }
 
+    private String onlineCores;
+
+    public String getOnlineCores() {
+        return onlineCores;
+    }
+
+    public void setOnlineCores(String value) {
+        if (onlineCores == null && value == null) {
+            return;
+        } if (onlineCores == null || !onlineCores.equals(value)) {
+            onlineCores = value;
+            onPropertyChanged(new PropertyChangedEventArgs("onlineCores")); 
//$NON-NLS-1$
+        }
+    }
+
     private String selinuxEnforceMode;
 
     public String getSelinuxEnforceMode() {
@@ -985,6 +1000,8 @@
         } else {
             setLogicalCores(vds.getCpuThreads());
         }
+
+        setOnlineCores(vds.getCpuList());
     }
 
     private void updateAlerts()
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 2cea001..f21459f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -1518,6 +1518,9 @@
     @DefaultStringValue("Logical CPU Cores")
     String logicalCores();
 
+    @DefaultStringValue("Online Logical CPU Cores")
+    String onlineCores();
+
     @DefaultStringValue("CPU Model")
     String cpuModelHostGeneral();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
index 146aab7..0e5ae55 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/host/SubTabHostGeneralView.java
@@ -68,6 +68,7 @@
     BooleanTextBoxLabel memoryPageSharing = new 
BooleanTextBoxLabel(constants.active(), constants.inactive());
     NullableNumberTextBoxLabel<Integer> activeVms = new 
NullableNumberTextBoxLabel<Integer>();
     NullableNumberTextBoxLabel<Integer> logicalCores = new 
NullableNumberTextBoxLabel<Integer>();
+    TextBoxLabel onlineCores = new TextBoxLabel();
     TextBoxLabel spmPriority = new TextBoxLabel();
     TextBoxLabel hostedEngineHa = new TextBoxLabel();
     FullDateTimeLabel bootTime = new FullDateTimeLabel();
@@ -155,6 +156,7 @@
         formBuilder.addFormItem(new FormItem(constants.spmPriority(), 
spmPriority, 0, 1, virtSupported).withAutoPlacement());
         formBuilder.addFormItem(new FormItem(constants.activeVmsHostGeneral(), 
activeVms, 1, virtSupported).withAutoPlacement());
         formBuilder.addFormItem(new FormItem(constants.logicalCores(), 
logicalCores, 1).withAutoPlacement());
+        formBuilder.addFormItem(new FormItem(constants.onlineCores(), 
onlineCores, 1).withAutoPlacement());
         formBuilder.addFormItem(new FormItem(constants.bootTimeHostGeneral(), 
bootTime, 1).withAutoPlacement());
         formBuilder.addFormItem(new 
FormItem(constants.hostedEngineHaHostGeneral(), hostedEngineHa, 1, 
virtSupported).withAutoPlacement());
         formBuilder.addFormItem(new 
FormItem(constants.isciInitNameHostGeneral(), iScsiInitiatorName, 1, 
virtSupported).withAutoPlacement());
diff --git a/packaging/dbscripts/create_views.sql 
b/packaging/dbscripts/create_views.sql
index 60d9a16..a2c59a1 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -787,7 +787,7 @@
                       vds_statistics.ha_local_maintenance as 
ha_local_maintenance, vds_static.disable_auto_pm as disable_auto_pm, 
vds_dynamic.controlled_by_pm_policy as controlled_by_pm_policy, 
vds_statistics.boot_time as boot_time,
                       vds_dynamic.kdump_status as kdump_status, 
vds_dynamic.selinux_enforce_mode as selinux_enforce_mode,
                       vds_dynamic.auto_numa_balancing as auto_numa_balancing, 
vds_dynamic.is_numa_supported as is_numa_supported, 
vds_dynamic.is_live_snapshot_supported as is_live_snapshot_supported, 
vds_static.protocol as protocol,
-                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported
+                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported, vds_dynamic.cpu_list as cpu_list
 FROM         vds_groups INNER JOIN
 vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN
 vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN
@@ -835,7 +835,8 @@
                       vds_dynamic.auto_numa_balancing as auto_numa_balancing, 
vds_dynamic.is_numa_supported as is_numa_supported,
                       vds_dynamic.supported_rng_sources as 
supported_rng_sources,
                       vds_dynamic.is_live_snapshot_supported as 
is_live_snapshot_supported, vds_static.protocol as protocol,
-                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported
+                      vds_dynamic.is_live_merge_supported as 
is_live_merge_supported,
+                      vds_dynamic.cpu_list as cpu_list
 FROM         vds_groups INNER JOIN
 vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN
 vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN
diff --git a/packaging/dbscripts/upgrade/03_06_0410_add_online_cpu_list.sql 
b/packaging/dbscripts/upgrade/03_06_0410_add_online_cpu_list.sql
new file mode 100644
index 0000000..708b0c9
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_06_0410_add_online_cpu_list.sql
@@ -0,0 +1 @@
+select fn_db_add_column('vds_dynamic', 'cpu_list', 'VARCHAR(1000)');
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index 9602cbc..666be9f 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -208,14 +208,15 @@
  v_is_numa_supported BOOLEAN,
  v_supported_rng_sources VARCHAR(255),
  v_is_live_snapshot_supported BOOLEAN,
- v_is_live_merge_supported BOOLEAN)
+ v_is_live_merge_supported BOOLEAN,
+ v_cpu_list VARCHAR(1000))
 RETURNS VOID
    AS $procedure$
 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, 
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, 
cpu_list)
+       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, v_cpu_list);
    END;
 
    RETURN;
@@ -291,7 +292,8 @@
  v_is_numa_supported BOOLEAN,
  v_supported_rng_sources VARCHAR(255),
  v_is_live_snapshot_supported BOOLEAN,
- v_is_live_merge_supported BOOLEAN)
+ v_is_live_merge_supported BOOLEAN,
+ v_cpu_list VARCHAR(1000))
 RETURNS VOID
 
        --The [vds_dynamic] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -328,7 +330,8 @@
       is_numa_supported = v_is_numa_supported,
       supported_rng_sources = v_supported_rng_sources,
       is_live_snapshot_supported = v_is_live_snapshot_supported,
-      is_live_merge_supported = v_is_live_merge_supported
+      is_live_merge_supported = v_is_live_merge_supported,
+      cpu_list = v_cpu_list
       WHERE vds_id = v_vds_id;
    END;
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib20f20d6003502fe2f2864abb5ad8f4f5a19ecdc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vitor de Lima <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to