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_05_1140_add_online_cpu_list.sql
M packaging/dbscripts/vds_sp.sql
15 files changed, 112 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/34769/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..9b365cf 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
@@ -125,6 +125,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.getOnlineCpus() != null) {
+            String[] onlinePcpusStr = dedicatedVds.getOnlineCpus().split(",");
+
+            for (String Pcpu : onlinePcpusStr) {
+                onlinePcpus.add(Integer.parseInt(Pcpu));
+            }
+        }
 
         for (String rule : rules) {
             // [0] vcpu, [1] pcpu
@@ -149,21 +167,23 @@
                 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) {
+            // check only from cluster version 3.2
+            if (dedicatedVds.getVdsGroupCompatibilityVersion() != null &&
+                    
dedicatedVds.getVdsGroupCompatibilityVersion().compareTo(Version.v3_2) >= 0) {
+
+                if (dedicatedVds.getOnlineCpus() != 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 if (dedicatedVds.getCpuThreads() != null) {
                     if (Collections.max(currPcpus) >= 
dedicatedVds.getCpuThreads()) {
                         // ERROR maps to a non existent 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..5ed1709 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.setOnlineCpus("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.setOnlineCpus("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.setOnlineCpus("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 de2beb8..6932b2e 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
@@ -124,6 +124,7 @@
         vds.setCpuCores(getCpuCores());
         vds.setCpuThreads(getCpuThreads());
         vds.setCpuModel(getCpuModel());
+        vds.setOnlineCpus(getOnlineCpus());
         vds.setCpuSpeedMh(getCpuSpeedMh());
         vds.setIfTotalSpeed(getIfTotalSpeed());
         vds.setKvmEnabled(getKvmEnabled());
@@ -469,6 +470,14 @@
         this.mVdsDynamic.setcpu_model(value);
     }
 
+    public String getOnlineCpus() {
+        return this.mVdsDynamic.getOnlineCpus();
+    }
+
+    public void setOnlineCpus(String value) {
+        this.mVdsDynamic.setOnlineCpus(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 ff14ec2..d417987 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
@@ -29,6 +29,8 @@
 
     private String cpu_model;
 
+    private String onlineCpus;
+
     private BigDecimal cpu_speed_mh;
 
     private String if_total_speed;
@@ -232,6 +234,14 @@
 
     public void setcpu_model(String value) {
         this.cpu_model = value;
+    }
+
+    public String getOnlineCpus() {
+        return this.onlineCpus;
+    }
+
+    public void setOnlineCpus(String value) {
+        this.onlineCpus = value;
     }
 
     public Double getcpu_speed_mh() {
@@ -671,6 +681,7 @@
         result = prime * result + ((cpu_model == null) ? 0 : 
cpu_model.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 + ((onlineCpus == null) ? 0 : 
onlineCpus.hashCode());
         result = prime * result + ((guest_overhead == null) ? 0 : 
guest_overhead.hashCode());
         result = prime * result + ((hooksStr == null) ? 0 : 
hooksStr.hashCode());
         result = prime * result + ((host_os == null) ? 0 : host_os.hashCode());
@@ -743,6 +754,7 @@
                 && ObjectUtils.objectsEqual(cpu_model, other.cpu_model)
                 && ObjectUtils.objectsEqual(cpu_sockets, other.cpu_sockets)
                 && ObjectUtils.objectsEqual(cpu_speed_mh, other.cpu_speed_mh)
+                && ObjectUtils.objectsEqual(onlineCpus, other.onlineCpus)
                 && ObjectUtils.objectsEqual(guest_overhead, 
other.guest_overhead)
                 && ObjectUtils.objectsEqual(hooksStr, other.hooksStr)
                 && ObjectUtils.objectsEqual(host_os, other.host_os)
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 b06eb2c..f70031e 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
@@ -249,6 +249,7 @@
             entity.setCpuCores((Integer) rs.getObject("cpu_cores"));
             entity.setCpuThreads((Integer) rs.getObject("cpu_threads"));
             entity.setCpuModel(rs.getString("cpu_model"));
+            entity.setOnlineCpus(rs.getString("online_cpus"));
             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 cd965d7..6de9298 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.setOnlineCpus(rs.getString("online_cpus"));
             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"));
@@ -211,6 +212,7 @@
                 .addValue("cpu_cores", vds.getcpu_cores())
                 .addValue("cpu_threads", vds.getCpuThreads())
                 .addValue("cpu_model", vds.getcpu_model())
+                .addValue("online_cpus", vds.getOnlineCpus())
                 .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 e0c60bc..9a52eb1 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -2984,6 +2984,7 @@
         <column>supported_rng_sources</column>
         <column>is_live_snapshot_supported</column>
         <column>is_live_merge_supported</column>
+        <column>online_cpus</column>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value>
             <value>3</value>
@@ -3037,6 +3038,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>
@@ -3091,6 +3093,7 @@
             <value></value>
             <value>false</value>
             <value>false</value>
+            <value>0,2,4</value>
         </row>
         <row>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value>
@@ -3145,6 +3148,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>
@@ -3199,6 +3203,7 @@
             <value>RANDOM</value>
             <value>true</value>
             <value>true</value>
+            <value>0,128</value>
         </row>
         <row>
             <value>2001751e-549b-4e7a-aff6-32d36856c125</value>
@@ -3253,6 +3258,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 101703f..4d24960 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.setOnlineCpus(AssignStringValue(xmlRpcStruct, 
VdsProperties.online_cpus));
         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..ee82ddf 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 online_cpus = "onlineCpus";
     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 66f06e8..450004f 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
@@ -843,6 +843,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() {
@@ -987,6 +1002,8 @@
         } else {
             setLogicalCores(vds.getCpuThreads());
         }
+
+        setOnlineCores(vds.getOnlineCpus());
     }
 
     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 37d809c..75b95c8 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
@@ -1485,6 +1485,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 851467f..f978322 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
@@ -63,6 +63,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();
@@ -150,6 +151,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 82d15b0..176491a 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -785,7 +785,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.online_cpus as online_cpus
 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
@@ -833,7 +833,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.online_cpus as online_cpus
 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_05_1140_add_online_cpu_list.sql 
b/packaging/dbscripts/upgrade/03_05_1140_add_online_cpu_list.sql
new file mode 100644
index 0000000..48093e6
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_1140_add_online_cpu_list.sql
@@ -0,0 +1 @@
+select fn_db_add_column('vds_dynamic', 'online_cpus', 'TEXT');
diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql
index b5a4ac3..5e85a43 100644
--- a/packaging/dbscripts/vds_sp.sql
+++ b/packaging/dbscripts/vds_sp.sql
@@ -209,14 +209,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_online_cpus TEXT)
 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, 
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);
+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);
    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_online_cpus TEXT)
 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,
+      online_cpus = v_online_cpus
       WHERE vds_id = v_vds_id;
    END;
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib20f20d6003502fe2f2864abb5ad8f4f5a19ecdc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
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