Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 13721)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 13722)
@@ -146,9 +146,7 @@
     hrc = pMachine->COMGETTER(MemorySize)(&cRamMBs);                                H();
 
+    ULONG cCpus = 1;
 #ifdef VBOX_WITH_SMP_GUESTS
-    /* @todo nike: Testing code, should use actual getter when ready */
-    uint16_t cCpus = 2;
-#else
-    uint16_t cCpus = 1;
+    hrc = pMachine->COMGETTER(CPUCount)(&cCpus);                                    H();
 #endif
 
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 13721)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 13722)
@@ -188,4 +188,5 @@
     /* default values for a newly created machine */
     mMemorySize = 128;
+    mCPUCount = 1;
     mMemoryBalloonSize = 0;
     mStatisticsUpdateInterval = 0;
@@ -226,4 +227,5 @@
         mHWVirtExVPIDEnabled != that.mHWVirtExVPIDEnabled ||
         mPAEEnabled != that.mPAEEnabled ||
+        mCPUCount != that.mCPUCount ||
         mClipboardMode != that.mClipboardMode)
         return false;
@@ -932,4 +934,42 @@
     mHWData.backup();
     mHWData->mMemorySize = memorySize;
+
+    return S_OK;
+}
+
+STDMETHODIMP Machine::COMGETTER(CPUCount) (ULONG *CPUCount)
+{
+    if (!CPUCount)
+        return E_POINTER;
+
+    AutoCaller autoCaller (this);
+    CheckComRCReturnRC (autoCaller.rc());
+
+    AutoReadLock alock (this);
+
+    *CPUCount = mHWData->mCPUCount;
+
+    return S_OK;
+}
+
+STDMETHODIMP Machine::COMSETTER(CPUCount) (ULONG CPUCount)
+{
+    /* check RAM limits */
+    if (CPUCount < SchemaDefs::MinCPUCount ||
+        CPUCount > SchemaDefs::MaxCPUCount)
+        return setError (E_INVALIDARG,
+            tr ("Invalid virtual CPU count: %lu (must be in range [%lu, %lu])"),
+                CPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount);
+
+    AutoCaller autoCaller (this);
+    CheckComRCReturnRC (autoCaller.rc());
+
+    AutoWriteLock alock (this);
+
+    HRESULT rc = checkStateDependency (MutableStateDep);
+    CheckComRCReturnRC (rc);
+
+    mHWData.backup();
+    mHWData->mCPUCount = CPUCount;
 
     return S_OK;
@@ -4940,4 +4980,11 @@
                 mHWData->mPAEEnabled = PAENode.value <bool> ("enabled");
             }
+
+            /* CPUCount(optional, default is 1) */
+            Key CPUCountNode = cpuNode.findKey ("CPUCount");
+            if (!CPUCountNode.isNull())
+            {
+                mHWData->mCPUCount = CPUCountNode.value <ULONG> ("CPUCount");
+            }
         }
     }
@@ -6310,4 +6357,8 @@
             PAENode.setValue <bool> ("enabled", true);
         }
+
+        /* CPU count */
+        Key CPUCountNode = cpuNode.createKey ("CPUCount");
+        CPUCountNode.setValue <ULONG> ("CPUCount", mHWData->mCPUCount);
     }
 
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 13721)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 13722)
@@ -2536,5 +2536,5 @@
   <interface
      name="IMachine" extends="$unknown"
-     uuid="ceb17b5b-fd1f-424f-9dd3-2ab04c06eefc"
+     uuid="b5d1baca-da5b-4202-905f-ee53a5f60ae5"
      wsmap="managed"
      >
@@ -2718,4 +2718,8 @@
         </note>
       </desc>
+    </attribute>
+
+    <attribute name="CPUCount" type="unsigned long">
+      <desc>Number of virtual CPUs in the VM.</desc>
     </attribute>
 
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 13721)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 13722)
@@ -259,4 +259,5 @@
         BOOL           mHWVirtExVPIDEnabled;
         BOOL           mPAEEnabled;
+        ULONG          mCPUCount;
 
         DeviceType_T   mBootOrder [SchemaDefs::MaxBootPosition];
@@ -474,4 +475,6 @@
     STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize);
     STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize);
+    STDMETHOD(COMGETTER(CPUCount))(ULONG *cpuCount);
+    STDMETHOD(COMSETTER(CPUCount))(ULONG cpuCount);
     STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize);
     STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize);
Index: /trunk/src/VBox/Main/xml/SchemaDefs.xsl
===================================================================
--- /trunk/src/VBox/Main/xml/SchemaDefs.xsl	(revision 13721)
+++ /trunk/src/VBox/Main/xml/SchemaDefs.xsl	(revision 13722)
@@ -157,4 +157,17 @@
 
   <xsl:call-template name="defineEnumMember">
+    <xsl:with-param name="member" select="'        MinCPUCount'"/>
+    <xsl:with-param name="select" select="
+      xsd:complexType[@name='TCPUCount']/xsd:attribute[@name='CPUCount']//xsd:minInclusive/@value
+    "/>
+  </xsl:call-template>
+  <xsl:call-template name="defineEnumMember">
+    <xsl:with-param name="member" select="'        MaxCPUCount'"/>
+    <xsl:with-param name="select" select="
+      xsd:complexType[@name='TCPUCount']/xsd:attribute[@name='CPUCount']//xsd:maxInclusive/@value
+    "/>
+  </xsl:call-template>
+
+  <xsl:call-template name="defineEnumMember">
     <xsl:with-param name="member" select="'        MaxGuestMonitors'"/>
     <xsl:with-param name="select" select="
Index: /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
===================================================================
--- /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 13721)
+++ /trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd	(revision 13722)
@@ -392,4 +392,15 @@
 </xsd:complexType>
 
+<xsd:complexType name="TCPUCount">
+  <xsd:attribute name="CPUCount">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:unsignedInt">
+        <xsd:minInclusive value="1"/>
+        <xsd:maxInclusive value="63"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+</xsd:complexType>
+
 <xsd:complexType name="TCPU">
   <xsd:sequence>
@@ -398,4 +409,5 @@
     <xsd:element name="HardwareVirtExVPID" type="THWVirtExVPIDType" minOccurs="0"/>
     <xsd:element name="PAE" type="TPAEType" minOccurs="0"/>
+    <xsd:element name="CPUCount" type="TCPUCount" minOccurs="0"/>
   </xsd:sequence>
 </xsd:complexType>
