[libvirt] [PATCH] [libvirt-test-API] introduce "machine" option to supprot choose machine type in more architectures

Qing Lin qinglbj at linux.vnet.ibm.com
Wed May 9 08:17:30 UTC 2012


With machine option,user can specify macine type to emulate.
For example : define in xml file , machine='pc' or machine='pseries'.

Signed-off-by: Qing Lin <qinglbj at linux.vnet.ibm.com>
---
 repos/domain/create.py                             |    1 +
 repos/domain/define.py                             |    2 ++
 repos/domain/install_linux_cdrom.py                |    1 +
 repos/domain/install_linux_net.py                  |    1 +
 repos/domain/install_windows_cdrom.py              |    1 +
 repos/domain/xmls/kvm_guest_define.xml             |    2 +-
 .../domain/xmls/kvm_linux_guest_install_cdrom.xml  |    2 +-
 repos/domain/xmls/kvm_linux_guest_install_net.xml  |    2 +-
 .../xmls/kvm_windows_guest_install_cdrom.xml       |    2 +-
 .../multiple_thread_block_on_domain_create.py      |    1 +
 repos/regression/xmls/domain.xml                   |    2 +-
 11 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/repos/domain/create.py b/repos/domain/create.py
index cfe0efd..bb20a99 100644
--- a/repos/domain/create.py
+++ b/repos/domain/create.py
@@ -26,6 +26,7 @@ optional_params = {'memory': 1048576,
                    'xml': 'xmls/kvm_guest_define.xml',
                    'flags' : 'none',
                    'xml': 'xmls/kvm_guest_define.xml'
+                   'guestmachine': 'pc',
                   }
 
 def create(params):
diff --git a/repos/domain/define.py b/repos/domain/define.py
index 42dea86..0e72a7f 100644
--- a/repos/domain/define.py
+++ b/repos/domain/define.py
@@ -24,6 +24,8 @@ optional_params = {'memory': 1048576,
                    'password': None,
                    'virt_type': 'kvm',
                    'xml': 'xmls/kvm_guest_define.xml'
+                   'guestarch': 'x86_64',
+                   'guestmachine': 'pc',
                   }
 
 def check_define_domain(guestname, virt_type, hostname, username, \
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 9bbd6da..239f85e 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -29,6 +29,7 @@ optional_params = {
                    'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
                    'type' : 'define',
                    'xml': 'xmls/kvm_linux_guest_install_cdrom.xml',
+                   'guestmachine': 'pc',
                   }
 
 VIRSH_QUIET_LIST = "virsh --quiet list --all|awk '{print $2}'|grep \"^%s$\""
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index d976ce1..4367d97 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -29,6 +29,7 @@ optional_params = {'memory': 1048576,
                    'netmethod' : 'http',
                    'type' : 'define',
                    'xml': 'xmls/kvm_linux_guest_install_net.xml',
+                   'guestmachine': 'pc',
                   }
 
 VIRSH_QUIET_LIST = "virsh --quiet list --all|awk '{print $2}'|grep \"^%s$\""
diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
index 3104bcd..b4fb552 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -36,6 +36,7 @@ optional_params = {'memory': 1048576,
                    'type' : 'define',
                    'uuid' : '05867c1a-afeb-300e-e55e-2673391ae080',
                    'xml' : 'xmls/kvm_windows_guest_install_cdrom.xml',
+                   'guestmachine': 'pc',
                   }
 
 def cleanup(mount):
diff --git a/repos/domain/xmls/kvm_guest_define.xml b/repos/domain/xmls/kvm_guest_define.xml
index 385ec66..4599b2e 100644
--- a/repos/domain/xmls/kvm_guest_define.xml
+++ b/repos/domain/xmls/kvm_guest_define.xml
@@ -5,7 +5,7 @@
   <currentMemory unit='KiB'>MEMORY</currentMemory>
   <vcpu>VCPU</vcpu>
   <os>
-    <type arch='x86_64' machine='pc-0.14'>hvm</type>
+    <type arch='GUESTARCH' machine="GUESTMACHINE">hvm</type>
     <boot dev='hd'/>
   </os>
   <features>
diff --git a/repos/domain/xmls/kvm_linux_guest_install_cdrom.xml b/repos/domain/xmls/kvm_linux_guest_install_cdrom.xml
index 84aed75..cb59e76 100644
--- a/repos/domain/xmls/kvm_linux_guest_install_cdrom.xml
+++ b/repos/domain/xmls/kvm_linux_guest_install_cdrom.xml
@@ -4,7 +4,7 @@
   <memory>MEMORY</memory>
   <vcpu>VCPU</vcpu>
   <os>
-    <type>hvm</type>
+    <type machine="GUESTMACHINE">hvm</type>
     <boot dev="cdrom"/>
   </os>
   <features>
diff --git a/repos/domain/xmls/kvm_linux_guest_install_net.xml b/repos/domain/xmls/kvm_linux_guest_install_net.xml
index 7d5cb45..c4a7de7 100644
--- a/repos/domain/xmls/kvm_linux_guest_install_net.xml
+++ b/repos/domain/xmls/kvm_linux_guest_install_net.xml
@@ -3,7 +3,7 @@
   <memory>MEMORY</memory>
   <vcpu>VCPU</vcpu>
   <os>
-    <type>hvm</type>
+    <type machine="GUESTMACHINE">hvm</type>
     <kernel>KERNEL</kernel>
     <initrd>INITRD</initrd>
     <cmdline>ks=KS</cmdline>
diff --git a/repos/domain/xmls/kvm_windows_guest_install_cdrom.xml b/repos/domain/xmls/kvm_windows_guest_install_cdrom.xml
index 759a386..62bd002 100644
--- a/repos/domain/xmls/kvm_windows_guest_install_cdrom.xml
+++ b/repos/domain/xmls/kvm_windows_guest_install_cdrom.xml
@@ -4,7 +4,7 @@
   <memory>MEMORY</memory>
   <vcpu>VCPU</vcpu>
   <os>
-    <type>hvm</type>
+    <type machine="GUESTMACHINE">hvm</type>
     <boot dev="cdrom"/>
   </os>
   <features>
diff --git a/repos/regression/multiple_thread_block_on_domain_create.py b/repos/regression/multiple_thread_block_on_domain_create.py
index 571621f..6238905 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -19,6 +19,7 @@ from src import env_parser
 
 required_params = ('guestos', 'guestarch', 'guestnum', 'uri')
 optional_params = {'xml' : 'xmls/domain.xml',
+                   'guestmachine': 'pc',
                   }
 
 IMAG_PATH = "/var/lib/libvirt/images/"
diff --git a/repos/regression/xmls/domain.xml b/repos/regression/xmls/domain.xml
index 407f086..e70492d 100644
--- a/repos/regression/xmls/domain.xml
+++ b/repos/regression/xmls/domain.xml
@@ -3,7 +3,7 @@
   <memory>1048576</memory>
   <vcpu>1</vcpu>
   <os>
-    <type>hvm</type>
+    <type machine="GUESTMACHINE">hvm</type>
     <kernel>/var/lib/libvirt/boot/vmlinuz</kernel>
     <initrd>/var/lib/libvirt/boot/initrd.img</initrd>
     <cmdline>KS</cmdline>
-- 
1.7.4.1




More information about the libvir-list mailing list