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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012年05月08日 15:45, Lin Qing wrote:
1.With machine option,user can specify macine type to emulate.
   For example : define in xml file , machine='pc' or machine='pseries'.
2.Fix some indent issue in ksiso.sh.

Signed-off-by: Qing Lin<qinglbj@xxxxxxxxxxxxxxxxxx>
---
  cases/consumption_cpu_topology.conf                |    2 +
  cases/consumption_domain_nfs_start.conf            |    2 +
  cases/consumption_eventhandler.conf                |    2 +
  cases/consumption_libvirtd.conf                    |    2 +
  cases/consumption_ownership_test.conf              |    2 +
  cases/domain_linux_net_inst.conf                   |    2 +
  cases/linux_domain.conf                            |    6 ++
  cases/snapshot.conf                                |    2 +
  cases/windows_domain.conf                          |    4 ++
  global.cfg                                         |    2 +
  repos/domain/create.py                             |    2 +-
  repos/domain/define.py                             |    2 +-
  repos/domain/install_linux_cdrom.py                |    2 +-
  repos/domain/install_linux_net.py                  |    2 +-
  repos/domain/install_windows_cdrom.py              |    2 +-
  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      |    2 +-
  repos/regression/xmls/domain.xml                   |    2 +-
  utils/ksiso.sh                                     |   51 ++++++++++---------
  22 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/cases/consumption_cpu_topology.conf b/cases/consumption_cpu_topology.conf
index c02ef2a..3849808 100644
--- a/cases/consumption_cpu_topology.conf
+++ b/cases/consumption_cpu_topology.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/consumption_domain_nfs_start.conf b/cases/consumption_domain_nfs_start.conf
index 13b2449..3d70764 100644
--- a/cases/consumption_domain_nfs_start.conf
+++ b/cases/consumption_domain_nfs_start.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/consumption_eventhandler.conf b/cases/consumption_eventhandler.conf
index 07bee07..6843dc9 100644
--- a/cases/consumption_eventhandler.conf
+++ b/cases/consumption_eventhandler.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/consumption_libvirtd.conf b/cases/consumption_libvirtd.conf
index b0dfff9..6012e99 100644
--- a/cases/consumption_libvirtd.conf
+++ b/cases/consumption_libvirtd.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/consumption_ownership_test.conf b/cases/consumption_ownership_test.conf
index a906b39..ead4002 100644
--- a/cases/consumption_ownership_test.conf
+++ b/cases/consumption_ownership_test.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/domain_linux_net_inst.conf b/cases/domain_linux_net_inst.conf
index 7c97818..e2fb55c 100644
--- a/cases/domain_linux_net_inst.conf
+++ b/cases/domain_linux_net_inst.conf
@@ -5,6 +5,8 @@ domain:install_linux_net
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      netmethod
  	http
      vcpu
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index e7d6bac..5296212 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
@@ -45,6 +47,10 @@ domain:undefine
  domain:define
      guestname
          $defaultname
+    guestarch
+        $defaultarch
+    guestmachine
+        $defaultmachine
      diskpath
          /var/lib/libvirt/images/libvirt-test-api
      vcpu
diff --git a/cases/snapshot.conf b/cases/snapshot.conf
index 4aac68b..d957310 100644
--- a/cases/snapshot.conf
+++ b/cases/snapshot.conf
@@ -5,6 +5,8 @@ domain:install_linux_cdrom
          $defaultos
      guestarch
          $defaultarch
+    guestmachine
+        $defaultmachine
      vcpu
          $defaultvcpu
      memory
diff --git a/cases/windows_domain.conf b/cases/windows_domain.conf
index 68396a0..e89cdd6 100644
--- a/cases/windows_domain.conf
+++ b/cases/windows_domain.conf
@@ -33,6 +33,10 @@ domain:undefine
  domain:define
      guestname
          $defaultname
+    guestarch
+        $defaultarch
+    guestmachine
+        $defaultmachine
      virt_type
          $defaulthv

diff --git a/global.cfg b/global.cfg
index 9e28614..d4d78b9 100644
--- a/global.cfg
+++ b/global.cfg
@@ -130,6 +130,8 @@ defaultname = libvirt_test_api
  defaultos = rhel6u2
  # default architecture to use for installing a new guest
  defaultarch = x86_64
+# default machine type to use for installing a new guest
+defaultmachine = pc
  # default the number of vcpu to use for defining or installing a guest
  defaultvcpu = 1
  # default the memory size(kilobytes) to use for defining or installing a guest
diff --git a/repos/domain/create.py b/repos/domain/create.py
index cfe0efd..b181066 100644
--- a/repos/domain/create.py
+++ b/repos/domain/create.py
@@ -15,7 +15,7 @@ from utils import utils
  NONE = 0
  START_PAUSED = 1

-required_params = ('guestname', 'diskpath',)
+required_params = ('guestname', 'guestarch', 'guestmachine', 'diskpath',)

It should be in the optional_params.

  optional_params = {'memory': 1048576,
                     'vcpu': 1,
                     'hddriver' : 'virtio',
diff --git a/repos/domain/define.py b/repos/domain/define.py
index 42dea86..8018d80 100644
--- a/repos/domain/define.py
+++ b/repos/domain/define.py
@@ -13,7 +13,7 @@ from libvirt import libvirtError
  from src import sharedmod
  from utils import utils

-required_params = ('guestname', 'diskpath',)
+required_params = ('guestname', 'guestarch', 'guestmachine', 'diskpath',)
  optional_params = {'memory': 1048576,
                     'vcpu': 1,
                     'hddriver' : 'virtio',
diff --git a/repos/domain/install_linux_cdrom.py b/repos/domain/install_linux_cdrom.py
index 9bbd6da..9c02eb2 100644
--- a/repos/domain/install_linux_cdrom.py
+++ b/repos/domain/install_linux_cdrom.py
@@ -16,7 +16,7 @@ from src import sharedmod
  from src import env_parser
  from utils import utils

-required_params = ('guestname', 'guestos', 'guestarch',)
+required_params = ('guestname', 'guestos', 'guestarch', 'guestmachine',)
  optional_params = {
                     'memory': 1048576,
                     'vcpu': 1,
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index d976ce1..33fc60c 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -16,7 +16,7 @@ from src import sharedmod
  from src import env_parser
  from utils import utils

-required_params = ('guestname', 'guestos', 'guestarch',)
+required_params = ('guestname', 'guestos', 'guestarch', 'guestmachine',)
  optional_params = {'memory': 1048576,
                     'vcpu': 1,
                     'disksize' : 10,
diff --git a/repos/domain/install_windows_cdrom.py b/repos/domain/install_windows_cdrom.py
index 3104bcd..ba0a503 100644
--- a/repos/domain/install_windows_cdrom.py
+++ b/repos/domain/install_windows_cdrom.py
@@ -24,7 +24,7 @@ VM_UNDEFINE = "virsh undefine %s"
  FLOOPY_IMG = "/tmp/floppy.img"
  HOME_PATH = os.getcwd()

-required_params = ('guestname', 'guestos', 'guestarch',)
+required_params = ('guestname', 'guestos', 'guestarch', 'guestmachine',)
  optional_params = {'memory': 1048576,
                     'vcpu': 1,
                     'disksize' : 20,
diff --git a/repos/domain/xmls/kvm_guest_define.xml b/repos/domain/xmls/kvm_guest_define.xml
index 385ec66..ae533c2 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>

Ah, this should be fixed. Just uppercase is not enough to district
it from the valid XML value. e.g.

<name>IAMUPPERCASE</name>

But it can be a follow up patch.

      <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..b19951f 100644
--- a/repos/regression/multiple_thread_block_on_domain_create.py
+++ b/repos/regression/multiple_thread_block_on_domain_create.py
@@ -17,7 +17,7 @@ from src import sharedmod
  from utils import utils
  from src import env_parser

-required_params = ('guestos', 'guestarch', 'guestnum', 'uri')
+required_params = ('guestos', 'guestarch', 'guestmachine', 'guestnum', 'uri')
  optional_params = {'xml' : 'xmls/domain.xml',
                    }

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>
diff --git a/utils/ksiso.sh b/utils/ksiso.sh
index a431658..8cb3540 100755
--- a/utils/ksiso.sh
+++ b/utils/ksiso.sh

This should be separate patch, as it has no relationship
with introducing 'machine' type. Two different purposes.


@@ -26,37 +26,40 @@ umount $boot_iso_dir
  vlmid=`isoinfo -d -i $boot_iso |grep 'Volume id:'`
  vlmid=${vlmid#"Volume id: "}
  if [ -n "`echo $vlmid|grep ppc`" ];then
-       echo "- edit yaboot.conf and add kickstart entry"
-       WORKING_ISO="${custom_iso_dir}/etc/yaboot.conf"
-       # change timeout and  add kickstart entry
-       TIMEOUT_LINE=`cat $WORKING_ISO | grep timeout | head -1`
-       APPEND_LINE=`cat $WORKING_ISO | grep append | head -1`
-       cat $WORKING_ISO | sed "s#${TIMEOUT_LINE}#timeout=5#" | sed "s#${APPEND_LINE}#append= \"root=live:CDLABEL=$vlmid ks=cdrom:/$kscfg \"#">   isocfgtmp
-       mv -f isocfgtmp $WORKING_ISO
-       cd $custom_iso_dir
-       mkisofs -R -V "$vlmid" -sysid PPC -chrp-boot -U -prep-boot ppc/chrp/yaboot -hfs-bless ppc/mac -no-desktop -allow-multidot -volset 4 -volset-size 1 -volset-seqno 1 -hfs-volid 4 -o $cwd/$custom_iso .
+    echo "- copy kickstart to custom work directory"
+    cp $kscfg $custom_iso_dir

And NACK for this, we use '4' spaces for the indention in Shell
codes. If '2' spaces are used somewhere, it should be fixed to
'4' spaces instead, but not from '4' spaces to '2' spaces.

Regards,
Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]