[Kimchi-devel] [PATCH v5] Backend support for templates with sockets, cores, and threads

Christy Perez christy at linux.vnet.ibm.com
Tue Oct 14 17:04:51 UTC 2014


In order to allow a guest to use SMT/hyperthreading, we should
enable passing in of the sockets, cores, and threads values when
creating a template.

All three values must be specified, as per the topology descr at
http://libvirt.org/formatdomain.html#elementsCPU

v4->v5:
- Fix format issues
- Remove if check for cpu_info in control, and set cpu_info
  to the empty string in model if None
- Add format requirements error for topology requirements.
- Add new error to toplogy in API.json
- Update po files

v3->v4:
- Remove the unused cpu_ elements from common_spec
- Pass new_t into validate function to reduce complexity
- Rearrange code to decrese indents in _get_cpu_xml

v2->v3:
- Set vcpus based on topology, if specified.
- Move the update cpu+topology validation out to a function
  for redability
- Add a minimum value of 1 for topology values
- Leave new English error msg as empty string
- Update the API documentation on cpu defaults

v1->v2:
- Added a check to make sure that vcpus = sockets*cores*threads
- Set individual topoology params to required in API.json
- Change the topology object types from string to integer
- Always return cpu_info from templates lookup()
- Removed check for cpu_info in to_vm_xml
- Build cpu_info xml using lxml.builder instead of string
- CPU and topology verification on template update

Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
 docs/API.md                     | 13 ++++++++++-
 po/de_DE.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/en_US.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/es_ES.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/fr_FR.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/it_IT.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/ja_JP.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/kimchi.pot                   | 49 +++++++++++++++++++++++++++++++++++++-
 po/ko_KR.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/pt_BR.po                     | 48 ++++++++++++++++++++++++++++++++++++-
 po/ru_RU.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 po/zh_CN.po                     | 52 +++++++++++++++++++++++++++++++++++++----
 po/zh_TW.po                     | 49 +++++++++++++++++++++++++++++++++++++-
 src/kimchi/API.json             | 36 ++++++++++++++++++++++++++--
 src/kimchi/control/templates.py | 31 +++++++++++++-----------
 src/kimchi/i18n.py              |  2 ++
 src/kimchi/model/templates.py   | 33 ++++++++++++++++++++++++++
 src/kimchi/osinfo.py            |  5 ++--
 src/kimchi/vmtemplate.py        | 16 +++++++++++++
 19 files changed, 690 insertions(+), 36 deletions(-)

diff --git a/docs/API.md b/docs/API.md
index 92fbbd5..6984649 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -194,7 +194,9 @@ Represents a snapshot of the Virtual Machine's primary monitor.
     * name: The name of the Template.  Used to identify the Template in this API
     * os_distro *(optional)*: The operating system distribution
     * os_version *(optional)*: The version of the operating system distribution
-    * cpus *(optional)*: The number of CPUs assigned to the VM. Default is 1.
+    * cpus *(optional)*: The number of CPUs assigned to the VM.
+          Default is 1, unlees specifying a cpu topology. In that case, cpus
+          will default to a product of the topology values (see cpu_info).
     * memory *(optional)*: The amount of memory assigned to the VM.
       Default is 1024M.
     * cdrom *(optional)*: A volume name or URI to an ISO image.
@@ -216,6 +218,15 @@ Represents a snapshot of the Virtual Machine's primary monitor.
                      Independent Computing Environments
             * null: Graphics is disabled or type not supported
         * listen: The network which the vnc/spice server listens on.
+    * cpu_info *(optional)*: CPU-specific information.
+        * topology: Specify sockets, threads, and cores to run the virtual CPU
+            threads on.
+            All three are required in order to specify cpu topology.
+            * sockets - The number of sockets to use.
+            * cores   - The number of cores per socket.
+            * threads - The number of threads per core.
+            If specifying both cpus and CPU topology, make sure cpus is
+            equal to the product of sockets, cores, and threads.
 
 ### Sub-Collection: Virtual Machine Network Interfaces
 
diff --git a/po/de_DE.po b/po/de_DE.po
index 98bde90..9d4cf00 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -70,6 +70,15 @@ msgstr "Sie sind nicht berechtigt, auf Kimchi zuzugreifen"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Geben Sie %(item)s an, um sich bei Kimchi anzumelden"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "Fehler beim Abrufen von Blockeinheiten. Details: %(err)s"
@@ -284,6 +293,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr ""
 "Schnittstelle %(iface)s ist in virtueller Maschine %(name)s nicht vorhanden"
@@ -416,6 +445,16 @@ msgstr "Vorlagen-CD-ROM muss eine lokale oder ferne ISO-Datei sein"
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Speicherpool %(name)s ist bereits vorhanden"
@@ -850,6 +889,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr "Knoteneinheit '%(name)s' nicht gefunden"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "Keine Pakete für Aktualisierung markiert"
 
@@ -1055,6 +1097,11 @@ msgstr "Repository konnte nicht hinzugefügt werden. Details: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "Repository konnte nicht entfernt werden. Details: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "FEHLERCODE"
 
diff --git a/po/en_US.po b/po/en_US.po
index eb571ca..14ed24b 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -68,6 +68,15 @@ msgstr ""
 msgid "Specify %(item)s to login into Kimchi"
 msgstr ""
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr ""
@@ -259,6 +268,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr ""
 
@@ -371,6 +400,16 @@ msgstr ""
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr ""
@@ -744,6 +783,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr ""
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr ""
 
@@ -931,6 +973,11 @@ msgstr ""
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr ""
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr ""
 
diff --git a/po/es_ES.po b/po/es_ES.po
index 5a3fa46..1709b10 100644
--- a/po/es_ES.po
+++ b/po/es_ES.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -69,6 +69,15 @@ msgstr "No tiene autorización para acceder a Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Especifique %(item)s para iniciar la sesión en Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr ""
@@ -284,6 +293,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "La interfaz %(iface)s no existe en la máquina virtual %(name)s"
 
@@ -413,6 +442,16 @@ msgstr "El CDROM de plantilla debe ser un archivo ISO local o remoto"
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "La agrupación de almacenamiento %(name)s ya existe"
@@ -863,6 +902,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr "No se ha encontrado el dispositivo de nodo '%(name)s'"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "No hay paquetes marcados para su actualización"
 
@@ -1073,6 +1115,11 @@ msgstr "No se puede añadir el repositorio. Detalles: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "No se puede eliminar el repositorio. Detalles: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "CÓDIGO DE ERROR"
 
diff --git a/po/fr_FR.po b/po/fr_FR.po
index 414dd4a..b1b4702 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2014-08-27 21:30+0000\n"
 "Last-Translator: BobSynfig\n"
 "Language-Team: French (http://www.transifex.com/projects/p/kimchi/language/"
@@ -74,6 +74,15 @@ msgstr "Vous n'êtes pas autorisé à accéder à  Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Spécifiez %(item)s pour vous logguer dans Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "Erreur durant l'accès aux périphériques de bloc. Détails: %(err)s"
@@ -290,6 +299,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "L'interface %(iface)s n'existe pas dans la machine virtuelle %(name)s"
 
@@ -421,6 +450,16 @@ msgstr "L'image de base de modèle doit petre un fichier image local valide"
 msgid "Cannot identify base image %(path)s format"
 msgstr "Ne peut identifier le format de l'image de base %(path)s"
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Le pool de stockage %(name)s existe déjà"
@@ -855,6 +894,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr "Périphérique de noeud '%(name)s' non trouvé"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "Aucun paquet marqué pour mise à jour"
 
@@ -1061,6 +1103,11 @@ msgstr "Impossible d'ajouter un dépôt. Détails: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "Impossible de supprimer un dépôt. Détails: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "ERROR CODE"
 
diff --git a/po/it_IT.po b/po/it_IT.po
index 4a6c919..91e17d4 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -69,6 +69,15 @@ msgstr "Non si dispone dell'autorizzazione ad accedere a Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Specificare %(item)s per accedere a Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr ""
@@ -278,6 +287,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "L'interfaccia %(iface)s non esiste nella macchina virtuale %(name)s"
 
@@ -406,6 +435,16 @@ msgstr "Il CDROM del modello deve essere un file ISO locale o remoto"
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Pool di memoria %(name)s già esistente"
@@ -834,6 +873,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr "Dispositivo nodo '%(name)s' non trovato"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "Nessun pacchetto contrassegnato per l'aggiornamento"
 
@@ -1042,6 +1084,11 @@ msgstr "Impossibile aggiungere il repository. Dettagli: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "Impossibile rimuovere il repository. Dettagli: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "CODICE DI ERRORE"
 
diff --git a/po/ja_JP.po b/po/ja_JP.po
index af00487..23c1ce7 100644
--- a/po/ja_JP.po
+++ b/po/ja_JP.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -68,6 +68,15 @@ msgstr "Kimchi へのアクセスを許可されていません"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Kimchi にログインするには、%(item)s を指定します"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr ""
@@ -275,6 +284,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "インターフェース %(iface)s は仮想マシン %(name)s には存在しません"
 
@@ -413,6 +442,16 @@ msgstr ""
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "ストレージ・プール %(name)s は既に存在します"
@@ -847,6 +886,9 @@ msgstr "稼働中の仮想マシンがあるため、ホスト・マシンをリ
 msgid "Node device '%(name)s' not found"
 msgstr "ノード・デバイス「%(name)s」が見つかりません"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "更新の対象としてマークされているパッケージはありません"
 
@@ -1054,6 +1096,11 @@ msgstr "リポジトリーを追加できません。詳細: 「%(err)s」"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "リポジトリーを削除できません。詳細: 「%(err)s」"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "エラー・コード"
 
diff --git a/po/kimchi.pot b/po/kimchi.pot
index 685802e..9fe3491 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -68,6 +68,15 @@ msgstr ""
 msgid "Specify %(item)s to login into Kimchi"
 msgstr ""
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr ""
@@ -259,6 +268,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr ""
 
@@ -371,6 +400,16 @@ msgstr ""
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr ""
@@ -744,6 +783,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr ""
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr ""
 
@@ -931,6 +973,11 @@ msgstr ""
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr ""
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr ""
 
diff --git a/po/ko_KR.po b/po/ko_KR.po
index a9f82e4..f36d782 100644
--- a/po/ko_KR.po
+++ b/po/ko_KR.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -67,6 +67,15 @@ msgstr "Kimchi에 액세스할 권한이 없습니다."
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Kimchi에 로그인하려면 %(item)s을(를) 지정하십시오."
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "블록 장치를 가져오는 중에 오류가 발생했습니다. 세부사항: %(err)s"
@@ -268,6 +277,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "가상 머신 %(name)s에 %(iface)s 인터페이스가 없습니다."
 
@@ -387,6 +416,16 @@ msgstr "템플리트 CDROM은 로컬 또는 원격 ISO 파일이어야 합니다
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "스토리지 풀 %(name)s이(가) 이미 존재합니다."
@@ -796,6 +835,9 @@ msgstr "가상 머신을 실행 중인 호스트 머신을 다시 부팅할 수
 msgid "Node device '%(name)s' not found"
 msgstr "노드 장치 '%(name)s'이(가) 없습니다."
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "업데이트 표시된 패키지가 없습니다."
 
@@ -985,6 +1027,11 @@ msgstr "저장소를 추가할 수 없습니다. 세부사항: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "저장소를 제거할 수 없습니다. 세부사항: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "오류 코드"
 
diff --git a/po/pt_BR.po b/po/pt_BR.po
index f2fba64..ff1a7a8 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2014-09-16 18:45+0000\n"
 "Last-Translator: Crístian Deives dos Santos Viana <cristiandeives at gmail."
 "com>\n"
@@ -87,6 +87,15 @@ msgstr "Você não está autorizado para acessar o Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Especifique %(item)s para autenticar no Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "Erro ao consultar block devices. Detalhes %(err)s"
@@ -303,6 +312,25 @@ msgid "The life time for the guest console password must be a number."
 msgstr "O tempo de vida da senha do console do guest deve ser um número."
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "Interface %(iface)s não existe na máquina virtual %(name)s"
 
@@ -424,6 +452,16 @@ msgstr "Imagem base do modelo deve ser um arquivo de imagem local válido"
 msgid "Cannot identify base image %(path)s format"
 msgstr "Não foi possível identificar o formato da imagem base %(path)s"
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Storage pool %(name)s já existe"
@@ -853,6 +891,9 @@ msgstr ""
 msgid "Node device '%(name)s' not found"
 msgstr "Dispositivo de nó '%(name)s' não encontrado"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "Nenhum pacote marcado para atualização"
 
@@ -1064,6 +1105,11 @@ msgstr "Não foi possível adicionar o repositório. Detalhes: '%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "Não foi possível remover o repositório. Detalhes: '%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "CÓDIGO DE ERRO"
 
diff --git a/po/ru_RU.po b/po/ru_RU.po
index 059b999..e55d170 100644
--- a/po/ru_RU.po
+++ b/po/ru_RU.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2014-08-28 17:32+0000\n"
 "Last-Translator: Aline Manera <aline.manera at gmail.com>\n"
 "Language-Team: Russian (http://www.transifex.com/projects/p/kimchi/language/"
@@ -68,6 +68,15 @@ msgstr "Нет прав доступа к Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "Укажите %(item)s для входа в Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "Ошибка получения блочных устройств. Сведения: %(err)s"
@@ -271,6 +280,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "Интерфейс %(iface)s не существует в виртуальной машине %(name)s"
 
@@ -385,6 +414,16 @@ msgstr "CDROM шаблона должен быть локальным или у
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Пул памяти %(name)s уже существует"
@@ -791,6 +830,9 @@ msgstr "Не удалось перезагрузить систему хоста
 msgid "Node device '%(name)s' not found"
 msgstr "Устройство %(name)s узла не найдено"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "Нет пакетов, помеченных для обновления"
 
@@ -985,6 +1027,11 @@ msgstr "Не удалось добавить хранилище. Сведени
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "Не удалось удалить хранилище. Сведения: %(err)s"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "Код ошибки"
 
diff --git a/po/zh_CN.po b/po/zh_CN.po
index f77e405..a6f511f 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-06-27 10:48+0000\n"
 "Last-Translator: ShaoHe Feng <shaohef at linux.vnet.ibm.com>\n"
 "Language-Team: ShaoHe Feng <shaohef at linux.vnet.ibm.com>\n"
@@ -84,6 +84,15 @@ msgstr "您没有被授权访问Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "指定登录Kimchi的%(item)s"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "获取块设备时出错。详情:%(err)s"
@@ -280,6 +289,25 @@ msgid "The life time for the guest console password must be a number."
 msgstr "客户机命令行密码有效时间必须是一个数字。"
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "虚拟机 %(name)s 中没有接口 %(iface)s"
 
@@ -392,6 +420,16 @@ msgstr "模板基础镜像必须为一个有效的本地镜像文件"
 msgid "Cannot identify base image %(path)s format"
 msgstr "未能识别基础镜像%(path)s格式"
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "存储池%(name)s已经存在"
@@ -767,6 +805,9 @@ msgstr "有虚拟机在运行,不能重起主机"
 msgid "Node device '%(name)s' not found"
 msgstr "没有找到节点设备'%(name)s'"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "没有软件包标识要升级"
 
@@ -954,6 +995,11 @@ msgstr "不能增加软件仓库。详情:'%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "不能移除软件仓库。详情:'%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr "软件仓库不支持配置类型: %(items)s"
+
 msgid "ERROR CODE"
 msgstr "错误码"
 
@@ -1866,7 +1912,3 @@ msgstr "没有发现模板"
 
 msgid "Clone"
 msgstr "制作副本"
-
-#~ msgid ""
-#~ "Configuration items: '%(items)s' are not supported by repository manager"
-#~ msgstr "软件仓库不支持配置类型: %(items)s"
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 4040b2a..792d004 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -5,7 +5,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: kimchi 0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-25 13:47-0300\n"
+"POT-Creation-Date: 2014-10-14 10:45-0500\n"
 "PO-Revision-Date: 2013-07-11 17:32-0400\n"
 "Last-Translator: Crístian Viana <vianac at linux.vnet.ibm.com>\n"
 "Language-Team: English\n"
@@ -67,6 +67,15 @@ msgstr "您未獲授權來存取 Kimchi"
 msgid "Specify %(item)s to login into Kimchi"
 msgstr "指定 %(item)s 以登入 Kimchi"
 
+msgid "Unknown \"_cap\" specified"
+msgstr ""
+
+msgid "\"_passthrough\" should be \"true\" or \"false\""
+msgstr ""
+
+msgid "\"_passthrough_affected_by\" should be a device name string"
+msgstr ""
+
 #, python-format
 msgid "Error while getting block devices. Details: %(err)s"
 msgstr "取得區塊裝置時發生錯誤。詳細資料:%(err)s"
@@ -262,6 +271,26 @@ msgid "The life time for the guest console password must be a number."
 msgstr ""
 
 #, python-format
+msgid ""
+"VM %(vmid)s does not contain directly assigned host device %(dev_name)s."
+msgstr ""
+
+#, python-format
+msgid "The host device %(dev_name)s is not allowed to directly assign to VM."
+msgstr ""
+
+msgid ""
+"No IOMMU groups found. Host PCI pass through needs IOMMU group to function "
+"correctly. Please enable Intel VT-d or AMD IOMMU in your BIOS, then verify "
+"the Kernel is compiled with IOMMU support. For Intel CPU, add intel_iommu=on "
+"to your Kernel parameter in /boot/grub2/grub.conf. For AMD CPU, add iommu=pt "
+"iommu=1."
+msgstr ""
+
+msgid "\"name\" should be a device name string"
+msgstr ""
+
+#, python-format
 msgid "Interface %(iface)s does not exist in virtual machine %(name)s"
 msgstr "介面 %(iface)s 不存在於虛擬機器 %(name)s 中"
 
@@ -374,6 +403,16 @@ msgstr "範本 CDROM 必須是本端或遠端 ISO 檔案"
 msgid "Cannot identify base image %(path)s format"
 msgstr ""
 
+msgid ""
+"When specifying CPU topology, VCPUs must be a product of sockets, cores, and "
+"threads."
+msgstr ""
+
+msgid ""
+"When specifying CPU topology, each element must be an integer greater than "
+"zero."
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "儲存區 %(name)s 已存在"
@@ -747,6 +786,9 @@ msgstr "無法將主機重新開機,因為有一些虛擬機器正在執行中
 msgid "Node device '%(name)s' not found"
 msgstr "找不到節點裝置 '%(name)s'"
 
+msgid "Conflicting flag filters specified."
+msgstr ""
+
 msgid "No packages marked for update"
 msgstr "沒有套件標示為要進行更新"
 
@@ -934,6 +976,11 @@ msgstr "無法新增儲存庫。詳細資料:'%(err)s'"
 msgid "Unable to remove repository. Details: '%(err)s'"
 msgstr "無法移除儲存庫。詳細資料:'%(err)s'"
 
+#, python-format
+msgid ""
+"Configuration items: '%(items)s' are not supported by repository manager"
+msgstr ""
+
 msgid "ERROR CODE"
 msgstr "錯誤碼"
 
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index d9e13f0..a1156d5 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -26,6 +26,36 @@
                         ]
                 }
             }
+        },
+        "cpu_info": {
+            "description": "Configure CPU specifics for a VM.",
+            "type": "object",
+            "properties": {
+                "topology": {
+                    "description": "Configure the guest CPU topology.",
+                    "type": "object",
+                    "properties": {
+                        "sockets": {
+                            "type": "integer",
+                            "required": true,
+                            "minimum": 1,
+                            "error": "KCHTMPL0026E"
+                        },
+                        "cores": {
+                            "type": "integer",
+                            "required": true,
+                            "minimum": 1,
+                            "error": "KCHTMPL0026E"
+                        },
+                        "threads": {
+                            "type": "integer",
+                            "required": true,
+                            "minimum": 1,
+                            "error": "KCHTMPL0026E"
+                        }
+                    }
+                }
+            }
         }
     },
     "properties": {
@@ -448,7 +478,8 @@
                     "type": "array",
                     "items": { "type": "string" }
                 },
-                "graphics": { "$ref": "#/kimchitype/graphics" }
+                "graphics": { "$ref": "#/kimchitype/graphics" },
+                "cpu_info": { "$ref": "#/kimchitype/cpu_info" }
             },
             "additionalProperties": false,
             "error": "KCHAPI0001E"
@@ -612,7 +643,8 @@
                     "type": "array",
                     "items": { "type": "string" }
                 },
-                "graphics": { "$ref": "#/kimchitype/graphics" }
+                "graphics": { "$ref": "#/kimchitype/graphics" },
+                "cpu_info": { "$ref": "#/kimchitype/cpu_info" }
             },
             "additionalProperties": false,
             "error": "KCHAPI0001E"
diff --git a/src/kimchi/control/templates.py b/src/kimchi/control/templates.py
index e17fa54..70c9457 100644
--- a/src/kimchi/control/templates.py
+++ b/src/kimchi/control/templates.py
@@ -38,22 +38,25 @@ def __init__(self, model, ident):
         self.update_params = ["name", "folder", "icon", "os_distro",
                               "storagepool", "os_version", "cpus",
                               "memory", "cdrom", "disks", "networks",
-                              "graphics"]
+                              "graphics", "cpu_info"]
         self.uri_fmt = "/templates/%s"
         self.clone = self.generate_action_handler('clone')
 
     @property
     def data(self):
-        return {'name': self.ident,
-                'icon': self.info['icon'],
-                'invalid': self.info['invalid'],
-                'os_distro': self.info['os_distro'],
-                'os_version': self.info['os_version'],
-                'cpus': self.info['cpus'],
-                'memory': self.info['memory'],
-                'cdrom': self.info.get('cdrom', None),
-                'disks': self.info['disks'],
-                'storagepool': self.info['storagepool'],
-                'networks': self.info['networks'],
-                'folder': self.info.get('folder', []),
-                'graphics': self.info['graphics']}
+        return {
+            'name': self.ident,
+            'icon': self.info['icon'],
+            'invalid': self.info['invalid'],
+            'os_distro': self.info['os_distro'],
+            'os_version': self.info['os_version'],
+            'cpus': self.info['cpus'],
+            'memory': self.info['memory'],
+            'cdrom': self.info.get('cdrom', None),
+            'disks': self.info['disks'],
+            'storagepool': self.info['storagepool'],
+            'networks': self.info['networks'],
+            'folder': self.info.get('folder', []),
+            'graphics': self.info['graphics'],
+            'cpu_info': self.info.get('cpu_info')
+        }
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 75fb076..74ea98e 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -143,6 +143,8 @@
     "KCHTMPL0022E": _("Disk size must be an integer greater than 1GB."),
     "KCHTMPL0023E": _("Template base image must be a valid local image file"),
     "KCHTMPL0024E": _("Cannot identify base image %(path)s format"),
+    "KCHTMPL0025E": _("When specifying CPU topology, VCPUs must be a product of sockets, cores, and threads."),
+    "KCHTMPL0026E": _("When specifying CPU topology, each element must be an integer greater than zero."),
 
     "KCHPOOL0001E": _("Storage pool %(name)s already exists"),
     "KCHPOOL0002E": _("Storage pool %(name)s does not exist"),
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 9278cdc..c75fc7b 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -48,6 +48,23 @@ def create(self, params):
                                        {'filename': iso, 'user': user,
                                         'err': excp})
 
+        cpu_info = params.get('cpu_info')
+        if cpu_info:
+            topology = cpu_info.get('topology')
+            # Check, even though currently only topology
+            #   is supported.
+            if topology:
+                sockets = topology['sockets']
+                cores = topology['cores']
+                threads = topology['threads']
+                vcpus = params.get('cpus')
+                if vcpus is None:
+                    params['cpus'] = sockets * cores * threads
+                elif vcpus != sockets * cores * threads:
+                    raise InvalidParameter("KCHTMPL0025E")
+        else:
+            params['cpu_info'] = ''
+
         conn = self.conn.get()
         pool_uri = params.get(u'storagepool', '')
         if pool_uri:
@@ -156,6 +173,10 @@ def update(self, name, params):
         old_t = self.lookup(name)
         new_t = copy.copy(old_t)
         new_t.update(params)
+
+        if not self._validate_updated_cpu_params(new_t):
+            raise InvalidParameter('KCHTMPL0025E')
+
         ident = name
 
         conn = self.conn.get()
@@ -187,6 +208,18 @@ def update(self, name, params):
             raise
         return ident
 
+    def _validate_updated_cpu_params(self, info):
+        # Note: cpu_info is the parent of topology. cpus is vcpus
+        vcpus = info['cpus']
+        cpu_info = info.get('cpu_info')
+        if cpu_info is None:
+            return True
+        topology = cpu_info.get('topology')
+        if topology is None:
+            return True
+        return vcpus == topology['sockets'] * topology['cores'] * \
+            topology['threads']
+
 
 class LibvirtVMTemplate(VMTemplate):
     def __init__(self, args, scan=False, conn=None):
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index 6ee5e48..0e16b50 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -32,9 +32,8 @@
                    'power': ('ppc', 'ppc64')}
 
 
-common_spec = {'cpus': 1, 'cpu_cores': 1, 'cpu_threads': 1, 'memory': 1024,
-               'disks': [{'index': 0, 'size': 10}], 'cdrom_bus': 'ide',
-               'cdrom_index': 2, 'mouse_bus': 'ps2'}
+common_spec = {'cpus': 1, 'memory': 1024, 'disks': [{'index': 0, 'size': 10}],
+               'cdrom_bus': 'ide', 'cdrom_index': 2, 'mouse_bus': 'ps2'}
 
 
 modern_spec = dict(common_spec, disk_bus='virtio', nic_model='virtio')
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 5f22db9..18d802b 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -358,6 +358,20 @@ def _get_input_output_xml(self):
             input_output += sound % self.info
         return input_output
 
+    def _get_cpu_xml(self):
+
+        cpu_info = self.info.get('cpu_info')
+        if cpu_info is None:
+            return ""
+        cpu_topo = cpu_info.get('topology')
+        if cpu_topo is None:
+            return ""
+        return etree.tostring(E.cpu(E.topology(
+            sockets=str(cpu_topo['sockets']),
+            cores=str(cpu_topo['cores']),
+            threads=str(cpu_topo['threads']))))
+
+
     def to_vm_xml(self, vm_name, vm_uuid, **kwargs):
         params = dict(self.info)
         params['name'] = vm_name
@@ -369,6 +383,7 @@ def to_vm_xml(self, vm_name, vm_uuid, **kwargs):
         params['qemu-stream-cmdline'] = ''
         graphics = kwargs.get('graphics')
         params['graphics'] = self._get_graphics_xml(graphics)
+        params['cpu_info'] = self._get_cpu_xml()
 
         # Current implementation just allows to create disk in one single
         # storage pool, so we cannot mix the types (scsi volumes vs img file)
@@ -400,6 +415,7 @@ def to_vm_xml(self, vm_name, vm_uuid, **kwargs):
           <uuid>%(uuid)s</uuid>
           <memory unit='MiB'>%(memory)s</memory>
           <vcpu>%(cpus)s</vcpu>
+          %(cpu_info)s
           <os>
             <type arch='%(arch)s'>hvm</type>
             <boot dev='hd'/>
-- 
1.9.3




More information about the Kimchi-devel mailing list