Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-04 Thread Yolkfull Chow
Differences between previous patch:

- Use a loop waiting for some seconds to compare output of a command
- Use a loop waiting for some seconds to catch string indicates which
  PCI device
- Add option kill_vm_on_error in block_hotplug since once a model failed
  to be hot removed, it will affect next model

A better result I can get is:
---
./scan_results.py
teststatus
seconds info
--
--- 
Fedora.11.32.nic_hotplug.nic_8139   GOOD
107 completed successfully
Fedora.11.32.nic_hotplug.nic_virtio FAIL
76  Not found pci model:virtio; Command is:lspci | tail -n1
Fedora.11.32.block_hotplug.fmt_qcow2.block_virtio   GOOD
92  completed successfully
Fedora.11.32.block_hotplug.fmt_qcow2.block_scsi GOOD
48  completed successfully
RHEL.5.3.i386.nic_hotplug.nic_8139  GOOD
144 completed successfully
RHEL.5.3.i386.nic_hotplug.nic_virtioGOOD
48  completed successfully
RHEL.5.3.i386.block_hotplug.fmt_qcow2.block_virtio  GOOD
47  completed successfully
RHEL.5.3.i386.block_hotplug.fmt_qcow2.block_scsiGOOD
47  completed successfully
Win2008.32.nic_hotplug.nic_8139 GOOD
141 completed successfully
Win2008.32.nic_hotplug.nic_virtio   GOOD
99  completed successfully
Win2008.32.block_hotplug.fmt_qcow2.block_scsi   GOOD
90  completed successfully
GOOD
953 



Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/kvm.py   |1 +
 client/tests/kvm/kvm_tests.cfg.sample |   67 +
 client/tests/kvm/kvm_tests.py |  105 +
 client/tests/kvm/kvm_vm.py|2 +
 4 files changed, 175 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 070e463..f985388 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -56,6 +56,7 @@ class kvm(test.test):
 linux_s3: test_routine(kvm_tests, run_linux_s3),
 stress_boot:  test_routine(kvm_tests, run_stress_boot),
 timedrift:test_routine(kvm_tests, run_timedrift),
+pci_hotplug:   test_routine(kvm_tests, run_pci_hotplug),
 }
 
 # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 7cd12cb..9af1bc8 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -118,6 +118,53 @@ variants:
 kill_vm = yes
 kill_vm_gracefully = no
 
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = no
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+wait_secs_for_hook_up = 3
+variants:
+- nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size_stg = 1G
+remove_image_stg = yes
+force_create_image_stg = yes
+pci_test_cmd = yes | mke2fs `fdisk -l 21 | awk '/\/dev\/[sv]d[a-z] 
doesn/ {print $2}'`
+wait_secs_for_hook_up = 3
+kill_vm_on_error = yes
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+only Fedora Ubuntu Windows
+
 
 # NICs
 variants:
@@ -259,6 +306,10 @@ variants:
 - RHEL:
 no setup
 ssh_prompt = \[r...@.{0,50}][\#\$] 
+nic_hotplug:
+modprobe_module = acpiphp
+block_hotplug:
+modprobe_module = acpiphp
 
 variants:
 - 5.3.i386:
@@ -345,6 +396,22 @@ variants:
 # Alternative host load:
 #host_load_command = dd 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-04 Thread Yolkfull Chow

Sorry for just submitting a wrong patch file which including a bug, please 
ignore previous one
and review following patch:

Differences between previous patch:

- Use a loop waiting for some seconds to compare output of a command
- Use a loop waiting for some seconds to catch string indicates which
  PCI device
- Add option kill_vm_on_error in block_hotplug since once a model failed
  to be hot removed, it will affect next model

A better result I can get is:
---
./scan_results.py
test   status   seconds 
info
   --   --- 

Fedora.11.32.nic_hotplug.nic_8139  GOOD 107 
completed successfully
Fedora.11.32.nic_hotplug.nic_virtioFAIL 76  Not 
found pci model:virtio; Command is:lspci | tail -n1
Fedora.11.32.block_hotplug.fmt_qcow2.block_virtio  GOOD 92  
completed successfully
Fedora.11.32.block_hotplug.fmt_qcow2.block_scsiGOOD 48  
completed successfully
RHEL.5.3.i386.nic_hotplug.nic_8139 GOOD 144 
completed successfully
RHEL.5.3.i386.nic_hotplug.nic_virtio   GOOD 48  
completed successfully
RHEL.5.3.i386.block_hotplug.fmt_qcow2.block_virtio GOOD 47  
completed successfully
RHEL.5.3.i386.block_hotplug.fmt_qcow2.block_scsi   GOOD 47  
completed successfully
Win2008.32.nic_hotplug.nic_8139GOOD 141 
completed successfully
Win2008.32.nic_hotplug.nic_virtio  GOOD 99  
completed successfully
Win2008.32.block_hotplug.fmt_qcow2.block_scsi  GOOD 90  
completed successfully
   GOOD 953


Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/kvm.py   |1 +
 client/tests/kvm/kvm_tests.cfg.sample |   67 +
 client/tests/kvm/kvm_tests.py |  105 +
 client/tests/kvm/kvm_vm.py|2 +
 4 files changed, 175 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 070e463..f985388 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -56,6 +56,7 @@ class kvm(test.test):
 linux_s3: test_routine(kvm_tests, run_linux_s3),
 stress_boot:  test_routine(kvm_tests, run_stress_boot),
 timedrift:test_routine(kvm_tests, run_timedrift),
+pci_hotplug:   test_routine(kvm_tests, run_pci_hotplug),
 }
 
 # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 7cd12cb..9af1bc8 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -118,6 +118,53 @@ variants:
 kill_vm = yes
 kill_vm_gracefully = no
 
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = no
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+wait_secs_for_hook_up = 3
+variants:
+- nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size_stg = 1G
+remove_image_stg = yes
+force_create_image_stg = yes
+pci_test_cmd = yes | mke2fs `fdisk -l 21 | awk '/\/dev\/[sv]d[a-z] 
doesn/ {print $2}'`
+wait_secs_for_hook_up = 3
+kill_vm_on_error = yes
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+only Fedora Ubuntu Windows
+
 
 # NICs
 variants:
@@ -259,6 +306,10 @@ variants:
 - RHEL:
 no setup
 ssh_prompt = \[r...@.{0,50}][\#\$] 
+nic_hotplug:
+modprobe_module = acpiphp
+block_hotplug:
+modprobe_module = acpiphp
 
 variants:
 - 5.3.i386:
@@ -345,6 +396,22 @@ variants:
   

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-03 Thread Yolkfull Chow

On 06/30/2009 09:58 PM, Dor Laor wrote:

On 06/30/2009 02:11 PM, Yolkfull Chow wrote:

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
  client/tests/kvm/kvm.py   |1 +
  client/tests/kvm/kvm_tests.cfg.sample |   56 
  client/tests/kvm/kvm_tests.py |   93 
+

  client/tests/kvm/kvm_vm.py|2 +
  4 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 4c7bae4..4fbce5b 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
  kvm_install:  test_routine(kvm_install, 
run_kvm_install),
  linux_s3: test_routine(kvm_tests, 
run_linux_s3),
  stress_boot:  test_routine(kvm_tests, 
run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, 
run_pci_hotplug),


Cool! It's very good since it tends to break.



  }

  # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample

index 2f864de..50b5765 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,52 @@ variants:
  max_vms = 5
  alive_test_cmd = ps aux

+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+no Windows
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:


There is no need to test qcow2/raw here since it shouldn't matter.
You can test qcow2 only, it is enough.


Hi Glauber,  according to Dor's comments on this, I did some testing and 
got an interesting result for block_hotplug:

1) hotplug storage of raw + SCSI  will always fail on Windows
2) hotplug storage of Raw + Virtio will always fail on Fedora
3) hotplug storage with image format Raw will also fail often on RHEL

Does block_hotplug relate to image format?  Would you give me any clue 
on this?

Thanks in advance.




+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
  # NICs
  variants:
  - @rtl8139:
@@ -306,6 +352,12 @@ variants:
  migration_test_command = ver  vol
  stress_boot:
  alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network 
Connection


  variants:
  - Win2000:
@@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
  only Fedora.9 openSUSE-11 Ubuntu-8.10-server


+nic_hotplug.nic_virtio|block_hotplug:
+no Windows
+
+
  variants:
  - @qcow2:
  image_format = qcow2
diff --git a/client/tests/kvm/kvm_tests.py 
b/client/tests/kvm/kvm_tests.py

index 2d11fed..21280b9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
  for se in sessions:
  se.close()
  logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-03 Thread Dor Laor

On 08/03/2009 12:19 PM, Yolkfull Chow wrote:

On 06/30/2009 09:58 PM, Dor Laor wrote:

On 06/30/2009 02:11 PM, Yolkfull Chow wrote:

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
client/tests/kvm/kvm.py | 1 +
client/tests/kvm/kvm_tests.cfg.sample | 56 
client/tests/kvm/kvm_tests.py | 93 +
client/tests/kvm/kvm_vm.py | 2 +
4 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 4c7bae4..4fbce5b 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
kvm_install: test_routine(kvm_install, run_kvm_install),
linux_s3: test_routine(kvm_tests, run_linux_s3),
stress_boot: test_routine(kvm_tests, run_stress_boot),
+ pci_hotplug: test_routine(kvm_tests, run_pci_hotplug),


Cool! It's very good since it tends to break.



}

# Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..50b5765 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,52 @@ variants:
max_vms = 5
alive_test_cmd = ps aux

+
+ - nic_hotplug:
+ type = pci_hotplug
+ pci_type = nic
+ modprobe_acpiphp = yes
+ reference_cmd = lspci
+ find_pci_cmd = 'lspci | tail -n1'
+ pci_test_cmd = 'nslookup www.redhat.com'
+ variants:
+ - @nic_8139:
+ pci_model = rtl8139
+ match_string = 8139
+ - nic_virtio:
+ pci_model = virtio
+ match_string = Virtio network device
+ - nic_e1000:
+ pci_model = e1000
+ match_string = Gigabit Ethernet Controller
+
+ - block_hotplug:
+ type = pci_hotplug
+ pci_type = block
+ modprobe_acpiphp = yes
+ reference_cmd = lspci
+ find_pci_cmd = 'lspci | tail -n1'
+ images +=  stg
+ boot_drive_stg = no
+ image_name_stg = storage
+ image_size = 1G
+ force_create_image_stg = yes
+ pci_test_cmd = 'dir'
+ no Windows
+ variants:
+ - block_virtio:
+ pci_model = virtio
+ match_string = Virtio block device
+ - block_scsi:
+ pci_model = scsi
+ match_string = SCSI storage controller
+ variants:


There is no need to test qcow2/raw here since it shouldn't matter.
You can test qcow2 only, it is enough.


Hi Glauber, according to Dor's comments on this, I did some testing and
got an interesting result for block_hotplug:
1) hotplug storage of raw + SCSI will always fail on Windows
2) hotplug storage of Raw + Virtio will always fail on Fedora
3) hotplug storage with image format Raw will also fail often on RHEL

Does block_hotplug relate to image format? Would you give me any clue on
this?


It shouldn't matter. In case the test is sensitive for timeout, it might.

Can you describe what's working and what's not on each combination?
As for scsi, it is not reliable so it might be scsi's fault.

Can you provide the fdisk -l ouput on Fedora when it is not working?
From the test below, there is not time/event for letting the guest hook 
up the new block device.
Maybe you need to do several retries in a loop or check a real event in 
the guest (better one)



Thanks in advance.




+ - fmt_qcow2:
+ image_format_stg = qcow2
+ - fmt_raw:
+ image_format_stg = raw
+
+
# NICs
variants:
- @rtl8139:
@@ -306,6 +352,12 @@ variants:
migration_test_command = ver vol
stress_boot:
alive_test_cmd = systeminfo
+ nic_hotplug:
+ modprobe_acpiphp = no
+ reference_cmd = systeminfo
+ find_pci_cmd = ipconfig /all | find Description
+ nic_e1000:
+ match_string = Intel(R) PRO/1000 MT Network Connection

variants:
- Win2000:
@@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
only Fedora.9 openSUSE-11 Ubuntu-8.10-server


+nic_hotplug.nic_virtio|block_hotplug:
+ no Windows
+
+
variants:
- @qcow2:
image_format = qcow2
diff --git a/client/tests/kvm/kvm_tests.py
b/client/tests/kvm/kvm_tests.py
index 2d11fed..21280b9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
for se in sessions:
se.close()
logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+ 
+ Test pci devices' hotplug
+ 1) pci_add a deivce (nic or storage)
+ 2) Compare 'info pci' output
+ 3) Compare $reference_cmd output
+ 4) Verify whether pci_model is shown in $pci_find_cmd
+ 5) pci_del the device, verify whether could remove the pci device
+
+ @param test: kvm test object
+ @param params: Dictionary with the test parameters
+ @param env: Dictionary with test environment.
+ 
+ vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+ if not vm:
+ raise error.TestError(VM object not found in environment)
+ if not vm.is_alive():
+ raise error.TestError(VM seems to be dead; Test requires a living
VM)
+
+ logging.info(Waiting for guest to be up...)
+
+ session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+ if not session:
+ raise error.TestFail(Could not log into guest)
+
+ logging.info(Logged in)
+
+ # modprobe the module that enable hotplug
+ if params.get(modprobe_acpiphp) == 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-03 Thread Glauber Costa
On Mon, Aug 03, 2009 at 05:19:17PM +0800, Yolkfull Chow wrote:
 On 06/30/2009 09:58 PM, Dor Laor wrote:
 On 06/30/2009 02:11 PM, Yolkfull Chow wrote:
 Signed-off-by: Yolkfull Chowyz...@redhat.com
 ---
   client/tests/kvm/kvm.py   |1 +
   client/tests/kvm/kvm_tests.cfg.sample |   56 
   client/tests/kvm/kvm_tests.py |   93  
 +
   client/tests/kvm/kvm_vm.py|2 +
   4 files changed, 152 insertions(+), 0 deletions(-)

 diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
 index 4c7bae4..4fbce5b 100644
 --- a/client/tests/kvm/kvm.py
 +++ b/client/tests/kvm/kvm.py
 @@ -55,6 +55,7 @@ class kvm(test.test):
   kvm_install:  test_routine(kvm_install,  
 run_kvm_install),
   linux_s3: test_routine(kvm_tests,  
 run_linux_s3),
   stress_boot:  test_routine(kvm_tests,  
 run_stress_boot),
 +pci_hotplug:  test_routine(kvm_tests,  
 run_pci_hotplug),

 Cool! It's very good since it tends to break.


   }

   # Make it possible to import modules from the test's bindir
 diff --git a/client/tests/kvm/kvm_tests.cfg.sample  
 b/client/tests/kvm/kvm_tests.cfg.sample
 index 2f864de..50b5765 100644
 --- a/client/tests/kvm/kvm_tests.cfg.sample
 +++ b/client/tests/kvm/kvm_tests.cfg.sample
 @@ -94,6 +94,52 @@ variants:
   max_vms = 5
   alive_test_cmd = ps aux

 +
 +- nic_hotplug:
 +type = pci_hotplug
 +pci_type = nic
 +modprobe_acpiphp = yes
 +reference_cmd = lspci
 +find_pci_cmd = 'lspci | tail -n1'
 +pci_test_cmd = 'nslookup www.redhat.com'
 +variants:
 +- @nic_8139:
 +pci_model = rtl8139
 +match_string = 8139
 +- nic_virtio:
 +pci_model = virtio
 +match_string = Virtio network device
 +- nic_e1000:
 +pci_model = e1000
 +match_string = Gigabit Ethernet Controller
 +
 +- block_hotplug:
 +type = pci_hotplug
 +pci_type = block
 +modprobe_acpiphp = yes
 +reference_cmd = lspci
 +find_pci_cmd = 'lspci | tail -n1'
 +images +=  stg
 +boot_drive_stg = no
 +image_name_stg = storage
 +image_size = 1G
 +force_create_image_stg = yes
 +pci_test_cmd = 'dir'
 +no Windows
 +variants:
 +- block_virtio:
 +pci_model = virtio
 +match_string = Virtio block device
 +- block_scsi:
 +pci_model = scsi
 +match_string = SCSI storage controller
 +variants:

 There is no need to test qcow2/raw here since it shouldn't matter.
 You can test qcow2 only, it is enough.

 Hi Glauber,  according to Dor's comments on this, I did some testing and  
 got an interesting result for block_hotplug:
 1) hotplug storage of raw + SCSI  will always fail on Windows
 2) hotplug storage of Raw + Virtio will always fail on Fedora
 3) hotplug storage with image format Raw will also fail often on RHEL

 Does block_hotplug relate to image format?  Would you give me any clue  
 on this?

Hi,

hotplugging a pci device should have nothing to do with the underlying format.
However, if we are using a format that is more racy and subject to breaks, the
hotplug window may make easy for race conditions to happen. For example, qcow2
with writeback caching.

As for the failures you describe, I'd like to see details. They surely sound 
like
a bug.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-08-03 Thread Yolkfull Chow
On Mon, Aug 03, 2009 at 02:37:29PM +0300, Dor Laor wrote:
 On 08/03/2009 12:19 PM, Yolkfull Chow wrote:
 On 06/30/2009 09:58 PM, Dor Laor wrote:
 On 06/30/2009 02:11 PM, Yolkfull Chow wrote:
 Signed-off-by: Yolkfull Chowyz...@redhat.com
 ---
 client/tests/kvm/kvm.py | 1 +
 client/tests/kvm/kvm_tests.cfg.sample | 56 
 client/tests/kvm/kvm_tests.py | 93 +
 client/tests/kvm/kvm_vm.py | 2 +
 4 files changed, 152 insertions(+), 0 deletions(-)

 diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
 index 4c7bae4..4fbce5b 100644
 --- a/client/tests/kvm/kvm.py
 +++ b/client/tests/kvm/kvm.py
 @@ -55,6 +55,7 @@ class kvm(test.test):
 kvm_install: test_routine(kvm_install, run_kvm_install),
 linux_s3: test_routine(kvm_tests, run_linux_s3),
 stress_boot: test_routine(kvm_tests, run_stress_boot),
 + pci_hotplug: test_routine(kvm_tests, run_pci_hotplug),

 Cool! It's very good since it tends to break.


 }

 # Make it possible to import modules from the test's bindir
 diff --git a/client/tests/kvm/kvm_tests.cfg.sample
 b/client/tests/kvm/kvm_tests.cfg.sample
 index 2f864de..50b5765 100644
 --- a/client/tests/kvm/kvm_tests.cfg.sample
 +++ b/client/tests/kvm/kvm_tests.cfg.sample
 @@ -94,6 +94,52 @@ variants:
 max_vms = 5
 alive_test_cmd = ps aux

 +
 + - nic_hotplug:
 + type = pci_hotplug
 + pci_type = nic
 + modprobe_acpiphp = yes
 + reference_cmd = lspci
 + find_pci_cmd = 'lspci | tail -n1'
 + pci_test_cmd = 'nslookup www.redhat.com'
 + variants:
 + - @nic_8139:
 + pci_model = rtl8139
 + match_string = 8139
 + - nic_virtio:
 + pci_model = virtio
 + match_string = Virtio network device
 + - nic_e1000:
 + pci_model = e1000
 + match_string = Gigabit Ethernet Controller
 +
 + - block_hotplug:
 + type = pci_hotplug
 + pci_type = block
 + modprobe_acpiphp = yes
 + reference_cmd = lspci
 + find_pci_cmd = 'lspci | tail -n1'
 + images +=  stg
 + boot_drive_stg = no
 + image_name_stg = storage
 + image_size = 1G
 + force_create_image_stg = yes
 + pci_test_cmd = 'dir'
 + no Windows
 + variants:
 + - block_virtio:
 + pci_model = virtio
 + match_string = Virtio block device
 + - block_scsi:
 + pci_model = scsi
 + match_string = SCSI storage controller
 + variants:

 There is no need to test qcow2/raw here since it shouldn't matter.
 You can test qcow2 only, it is enough.

 Hi Glauber, according to Dor's comments on this, I did some testing and
 got an interesting result for block_hotplug:
 1) hotplug storage of raw + SCSI will always fail on Windows
 2) hotplug storage of Raw + Virtio will always fail on Fedora
 3) hotplug storage with image format Raw will also fail often on RHEL

 Does block_hotplug relate to image format? Would you give me any clue on
 this?

 It shouldn't matter. In case the test is sensitive for timeout, it might.

 Can you describe what's working and what's not on each combination?
 As for scsi, it is not reliable so it might be scsi's fault.

 Can you provide the fdisk -l ouput on Fedora when it is not working?
 From the test below, there is not time/event for letting the guest hook  
 up the new block device.
 Maybe you need to do several retries in a loop or check a real event in  
 the guest (better one)

I can make sure now there is a bug in block hotplug feature since segfault has 
been found in
dmesg on my laptop Fedora. Also, both guest RHEL.5.3-i386 and Windows 2008 have
crashed during running block_hotplug test. 
For example, for Windows 2008-32 guest, sometimes issue command 'systeminfo' 
during block_hotplug
can crash the guest.

I had added a loop wait for the PCI device hooked up, before this, I
used sleep(some_seconds) wait for module installed. 


 Thanks in advance.


 + - fmt_qcow2:
 + image_format_stg = qcow2
 + - fmt_raw:
 + image_format_stg = raw
 +
 +
 # NICs
 variants:
 - @rtl8139:
 @@ -306,6 +352,12 @@ variants:
 migration_test_command = ver vol
 stress_boot:
 alive_test_cmd = systeminfo
 + nic_hotplug:
 + modprobe_acpiphp = no
 + reference_cmd = systeminfo
 + find_pci_cmd = ipconfig /all | find Description
 + nic_e1000:
 + match_string = Intel(R) PRO/1000 MT Network Connection

 variants:
 - Win2000:
 @@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
 only Fedora.9 openSUSE-11 Ubuntu-8.10-server


 +nic_hotplug.nic_virtio|block_hotplug:
 + no Windows
 +
 +
 variants:
 - @qcow2:
 image_format = qcow2
 diff --git a/client/tests/kvm/kvm_tests.py
 b/client/tests/kvm/kvm_tests.py
 index 2d11fed..21280b9 100644
 --- a/client/tests/kvm/kvm_tests.py
 +++ b/client/tests/kvm/kvm_tests.py
 @@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
 for se in sessions:
 se.close()
 logging.info(Total number booted: %d % (num -1))
 +
 +
 +def run_pci_hotplug(test, params, env):
 + 
 + Test pci devices' hotplug
 + 1) pci_add a deivce (nic or storage)
 + 2) Compare 'info pci' output
 + 3) Compare $reference_cmd output
 + 4) Verify whether pci_model is shown in $pci_find_cmd
 + 5) pci_del the device, verify whether could remove the pci 

Re: [Autotest] [PATCH] Add a subtest pci_hotplug in kvm test

2009-07-14 Thread Yolkfull Chow

On 07/08/2009 09:51 AM, Lucas Meneghel Rodrigues wrote:

I've spent some time doing a second review and test of the code.
During my tests:

  * I found some problems with PCI hotplug itself and would like help
to figure out why things are not working as expected.
  * Made suggestions regarding the phrasing of the error messages
thrown by the test. Mostly nipticking. Let me know if you think the
new messages make sense.
  * The order of the final test steps looks a bit weird to me

Comments follow.

On Fri, Jul 3, 2009 at 3:00 AM, Yolkfull Chowyz...@redhat.com  wrote:
   

On 07/03/2009 01:57 PM, Yolkfull Chow wrote:
 

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
   client/tests/kvm/kvm.py   |1 +
   client/tests/kvm/kvm_tests.cfg.sample |   65 ++-
   client/tests/kvm/kvm_tests.py |   94 
+
   client/tests/kvm/kvm_vm.py|2 +
   4 files changed, 161 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index b18b643..fc92e10 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
   kvm_install:  test_routine(kvm_install, 
run_kvm_install),
   linux_s3: test_routine(kvm_tests, run_linux_s3),
   stress_boot:  test_routine(kvm_tests, run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),
   }

   # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..a9e16d6 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,53 @@ variants:
   max_vms = 5
   alive_test_cmd = ps aux

+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
   

I tried block device hotplug, lspci doesn't show up the newly added
devices. Already tried with F8 and F9. Any idea why?
   
  It doesn't need to modprobe acpiphp on Fedora, also, both F8 and F9 
don't have virtio  virtio_ring modules.  I ran it on guest Fedora-11 
and Win2008,  both ran successfully:


# ./scan_results.py
teststatus
secondsinfo
--
---
Fedora.11.32.nic_hotplug.nic_rtl8139GOOD
68completed successfully
Fedora.11.32.nic_hotplug.nic_virtio GOOD46
completed successfully
Fedora.11.32.block_hotplug.fmt_qcow2.block_virtioGOOD46
completed successfully
Fedora.11.32.block_hotplug.fmt_qcow2.block_scsi GOOD44
completed successfully
Fedora.11.32.block_hotplug.fmt_raw.block_virtio GOOD45
completed successfully
Fedora.11.32.block_hotplug.fmt_raw.block_scsi   GOOD46
completed successfully
Win2008.32.nic_hotplug.nic_rtl8139  GOOD
66completed successfully
Win2008.32.block_hotplug.fmt_qcow2.block_scsi   GOOD186
completed successfully
Win2008.32.block_hotplug.fmt_raw.block_scsi GOOD71
completed successfully


   

+pci_test_cmd = 'nslookupwww.redhat.com'
+seconds_wait_for_device_install = 3
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
   

Pretty much all block hotplug 'guest side check' is failing during the
stage where the output  of lspci | tail -n1 is being compared with the
match strings. Hypervisor is qemu 0.10.5 (kvm-87 upstream).

   

+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+seconds_wait_for_device_install = 3
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
   # NICs
   variants:
   - @rtl8139:
@@ -306,6 +353,22 @@ variants:
   

Re: [Autotest] [PATCH] Add a subtest pci_hotplug in kvm test

2009-07-07 Thread Lucas Meneghel Rodrigues
I've spent some time doing a second review and test of the code.
During my tests:

 * I found some problems with PCI hotplug itself and would like help
to figure out why things are not working as expected.
 * Made suggestions regarding the phrasing of the error messages
thrown by the test. Mostly nipticking. Let me know if you think the
new messages make sense.
 * The order of the final test steps looks a bit weird to me

Comments follow.

On Fri, Jul 3, 2009 at 3:00 AM, Yolkfull Chowyz...@redhat.com wrote:
 On 07/03/2009 01:57 PM, Yolkfull Chow wrote:
 Signed-off-by: Yolkfull Chowyz...@redhat.com
 ---
   client/tests/kvm/kvm.py               |    1 +
   client/tests/kvm/kvm_tests.cfg.sample |   65 ++-
   client/tests/kvm/kvm_tests.py         |   94 
 +
   client/tests/kvm/kvm_vm.py            |    2 +
   4 files changed, 161 insertions(+), 1 deletions(-)

 diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
 index b18b643..fc92e10 100644
 --- a/client/tests/kvm/kvm.py
 +++ b/client/tests/kvm/kvm.py
 @@ -55,6 +55,7 @@ class kvm(test.test):
                   kvm_install:  test_routine(kvm_install, 
 run_kvm_install),
                   linux_s3:     test_routine(kvm_tests, run_linux_s3),
                   stress_boot:  test_routine(kvm_tests, 
 run_stress_boot),
 +                pci_hotplug:  test_routine(kvm_tests, 
 run_pci_hotplug),
                   }

           # Make it possible to import modules from the test's bindir
 diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
 b/client/tests/kvm/kvm_tests.cfg.sample
 index 2f864de..a9e16d6 100644
 --- a/client/tests/kvm/kvm_tests.cfg.sample
 +++ b/client/tests/kvm/kvm_tests.cfg.sample
 @@ -94,6 +94,53 @@ variants:
           max_vms = 5
           alive_test_cmd = ps aux

 +
 +    - nic_hotplug:
 +        type = pci_hotplug
 +        pci_type = nic
 +        modprobe_acpiphp = yes
 +        reference_cmd = lspci
 +        find_pci_cmd = 'lspci | tail -n1'

I tried block device hotplug, lspci doesn't show up the newly added
devices. Already tried with F8 and F9. Any idea why?

 +        pci_test_cmd = 'nslookup www.redhat.com'
 +        seconds_wait_for_device_install = 3
 +        variants:
 +            - @nic_8139:
 +                pci_model = rtl8139
 +                match_string = 8139
 +            - nic_virtio:
 +                pci_model = virtio
 +                match_string = Virtio network device
 +            - nic_e1000:
 +                pci_model = e1000
 +                match_string = Gigabit Ethernet Controller

Pretty much all block hotplug 'guest side check' is failing during the
stage where the output  of lspci | tail -n1 is being compared with the
match strings. Hypervisor is qemu 0.10.5 (kvm-87 upstream).

 +    - block_hotplug:
 +        type = pci_hotplug
 +        pci_type = block
 +        modprobe_acpiphp = yes
 +        reference_cmd = lspci
 +        find_pci_cmd = 'lspci | tail -n1'
 +        images +=  stg
 +        boot_drive_stg = no
 +        image_name_stg = storage
 +        image_size = 1G
 +        force_create_image_stg = yes
 +        pci_test_cmd = 'dir'
 +        seconds_wait_for_device_install = 3
 +        variants:
 +            - block_virtio:
 +                pci_model = virtio
 +                match_string = Virtio block device
 +            - block_scsi:
 +                pci_model = scsi
 +                match_string = SCSI storage controller
 +        variants:
 +            - fmt_qcow2:
 +                image_format_stg = qcow2
 +            - fmt_raw:
 +                image_format_stg = raw
 +
 +
   # NICs
   variants:
       - @rtl8139:
 @@ -306,6 +353,22 @@ variants:
               migration_test_command = ver  vol
           stress_boot:
               alive_test_cmd = systeminfo
 +        nic_hotplug:
 +            modprobe_acpiphp = no
 +            reference_cmd = systeminfo
 +            seconds_wait_for_device_install = 10
 +            find_pci_cmd = ipconfig /all | find Description
 +            nic_e1000:
 +                match_string = Intel(R) PRO/1000 MT Network Connection
 +        block_hotplug:
 +            use_telnet = yes
 +            modprobe_acpiphp = no
 +            reference_cmd = wmic diskdrive
 +            find_pci_cmd = wmic diskdrive | find disk drives
 +            seconds_wait_for_device_install = 10
 +            only block_scsi
 +            block_scsi:
 +                match_string = SCSI

 It supports Windows block_hotplug now. But we need use_telnet to login
 Windows OS since command 'wmic' could only run on telnet session.

           variants:
               - Win2000:
 @@ -571,4 +634,4 @@ variants:
           only rtl8139

   # Choose your test list
 -only fc8_quick
 +#only fc8_quick
 diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
 index 2d11fed..230385a 100644
 --- a/client/tests/kvm/kvm_tests.py
 +++ b/client/tests/kvm/kvm_tests.py
 @@ -585,3 +585,97 @@ def 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-07-03 Thread Yolkfull Chow

On 07/03/2009 01:57 PM, Yolkfull Chow wrote:

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
  client/tests/kvm/kvm.py   |1 +
  client/tests/kvm/kvm_tests.cfg.sample |   65 ++-
  client/tests/kvm/kvm_tests.py |   94 +
  client/tests/kvm/kvm_vm.py|2 +
  4 files changed, 161 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index b18b643..fc92e10 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
  kvm_install:  test_routine(kvm_install, 
run_kvm_install),
  linux_s3: test_routine(kvm_tests, run_linux_s3),
  stress_boot:  test_routine(kvm_tests, run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),
  }

  # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..a9e16d6 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,53 @@ variants:
  max_vms = 5
  alive_test_cmd = ps aux

+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+seconds_wait_for_device_install = 3
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+seconds_wait_for_device_install = 3
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
  # NICs
  variants:
  - @rtl8139:
@@ -306,6 +353,22 @@ variants:
  migration_test_command = ver  vol
  stress_boot:
  alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+seconds_wait_for_device_install = 10
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network Connection
+block_hotplug:
+use_telnet = yes
+modprobe_acpiphp = no
+reference_cmd = wmic diskdrive
+find_pci_cmd = wmic diskdrive | find disk drives
+seconds_wait_for_device_install = 10
+only block_scsi
+block_scsi:
+match_string = SCSI
   
It supports Windows block_hotplug now. But we need use_telnet to login 
Windows OS since command 'wmic' could only run on telnet session.


  variants:
  - Win2000:
@@ -571,4 +634,4 @@ variants:
  only rtl8139

  # Choose your test list
-only fc8_quick
+#only fc8_quick
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 2d11fed..230385a 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,97 @@ def run_stress_boot(tests, params, env):
  for se in sessions:
  se.close()
  logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise error.TestError(VM seems to be dead; Test requires a living VM)
+
+logging.info(Waiting for guest to be up...)
+
+session = 

[PATCH] Add a subtest pci_hotplug in kvm test

2009-07-02 Thread Yolkfull Chow

Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/kvm.py   |1 +
 client/tests/kvm/kvm_tests.cfg.sample |   65 ++-
 client/tests/kvm/kvm_tests.py |   94 +
 client/tests/kvm/kvm_vm.py|2 +
 4 files changed, 161 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index b18b643..fc92e10 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
 kvm_install:  test_routine(kvm_install, run_kvm_install),
 linux_s3: test_routine(kvm_tests, run_linux_s3),
 stress_boot:  test_routine(kvm_tests, run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),
 }
 
 # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..a9e16d6 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,53 @@ variants:
 max_vms = 5
 alive_test_cmd = ps aux
 
+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+seconds_wait_for_device_install = 3
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+seconds_wait_for_device_install = 3
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
 # NICs
 variants:
 - @rtl8139:
@@ -306,6 +353,22 @@ variants:
 migration_test_command = ver  vol
 stress_boot:
 alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+seconds_wait_for_device_install = 10
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network Connection
+block_hotplug:
+use_telnet = yes
+modprobe_acpiphp = no
+reference_cmd = wmic diskdrive
+find_pci_cmd = wmic diskdrive | find disk drives
+seconds_wait_for_device_install = 10
+only block_scsi
+block_scsi:
+match_string = SCSI
 
 variants:
 - Win2000:
@@ -571,4 +634,4 @@ variants:
 only rtl8139
 
 # Choose your test list
-only fc8_quick
+#only fc8_quick
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 2d11fed..230385a 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,97 @@ def run_stress_boot(tests, params, env):
 for se in sessions:
 se.close()
 logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise error.TestError(VM seems to be dead; Test requires a living VM)
+
+logging.info(Waiting for guest to be up...)
+
+session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+if not session:
+raise error.TestFail(Could not log into guest)
+
+logging.info(Logged in)
+
+# modprobe the module that enable hotplug
+if 

[PATCH] Add a subtest pci_hotplug in kvm test

2009-06-30 Thread Yolkfull Chow

Signed-off-by: Yolkfull Chow yz...@redhat.com
---
 client/tests/kvm/kvm.py   |1 +
 client/tests/kvm/kvm_tests.cfg.sample |   56 
 client/tests/kvm/kvm_tests.py |   93 +
 client/tests/kvm/kvm_vm.py|2 +
 4 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 4c7bae4..4fbce5b 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
 kvm_install:  test_routine(kvm_install, run_kvm_install),
 linux_s3: test_routine(kvm_tests, run_linux_s3),
 stress_boot:  test_routine(kvm_tests, run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),
 }
 
 # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..50b5765 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,52 @@ variants:
 max_vms = 5
 alive_test_cmd = ps aux
 
+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+no Windows
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:
+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
 # NICs
 variants:
 - @rtl8139:
@@ -306,6 +352,12 @@ variants:
 migration_test_command = ver  vol
 stress_boot:
 alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network Connection
 
 variants:
 - Win2000:
@@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
 only Fedora.9 openSUSE-11 Ubuntu-8.10-server
 
 
+nic_hotplug.nic_virtio|block_hotplug:
+no Windows
+
+
 variants:
 - @qcow2:
 image_format = qcow2
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 2d11fed..21280b9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
 for se in sessions:
 se.close()
 logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise error.TestError(VM seems to be dead; Test requires a living VM)
+
+logging.info(Waiting for guest to be up...)
+
+session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+if not session:
+raise error.TestFail(Could not log into guest)
+
+logging.info(Logged in)
+
+# modprobe the module that enable hotplug
+if params.get(modprobe_acpiphp) == yes:
+if session.get_command_status(modprobe acpiphp):
+raise error.TestError(Modprobe module 'acpiphp' failed)
+
+# get reference output
+s, info_pci_ref = vm.send_monitor_cmd(info pci)
+
+# compare the output of `reference_cmd`
+ref_cmd = params.get(reference_cmd)
+reference = 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-06-30 Thread Dor Laor

On 06/30/2009 02:11 PM, Yolkfull Chow wrote:

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
  client/tests/kvm/kvm.py   |1 +
  client/tests/kvm/kvm_tests.cfg.sample |   56 
  client/tests/kvm/kvm_tests.py |   93 +
  client/tests/kvm/kvm_vm.py|2 +
  4 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 4c7bae4..4fbce5b 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
  kvm_install:  test_routine(kvm_install, 
run_kvm_install),
  linux_s3: test_routine(kvm_tests, run_linux_s3),
  stress_boot:  test_routine(kvm_tests, run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),


Cool! It's very good since it tends to break.



  }

  # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample
index 2f864de..50b5765 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,52 @@ variants:
  max_vms = 5
  alive_test_cmd = ps aux

+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+no Windows
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:


There is no need to test qcow2/raw here since it shouldn't matter.
You can test qcow2 only, it is enough.


+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
  # NICs
  variants:
  - @rtl8139:
@@ -306,6 +352,12 @@ variants:
  migration_test_command = ver  vol
  stress_boot:
  alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network Connection

  variants:
  - Win2000:
@@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
  only Fedora.9 openSUSE-11 Ubuntu-8.10-server


+nic_hotplug.nic_virtio|block_hotplug:
+no Windows
+
+
  variants:
  - @qcow2:
  image_format = qcow2
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 2d11fed..21280b9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
  for se in sessions:
  se.close()
  logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise error.TestError(VM seems to be dead; Test requires a living VM)
+
+logging.info(Waiting for guest to be up...)
+
+session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+if not session:
+raise error.TestFail(Could not log into guest)
+
+logging.info(Logged in)
+
+# modprobe the module that enable hotplug
+if params.get(modprobe_acpiphp) == yes:
+if session.get_command_status(modprobe acpiphp):
+raise 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-06-30 Thread Lucas Meneghel Rodrigues
On Tue, 2009-06-30 at 19:11 +0800, Yolkfull Chow wrote:
 Signed-off-by: Yolkfull Chow yz...@redhat.com
 ---
  client/tests/kvm/kvm.py   |1 +
  client/tests/kvm/kvm_tests.cfg.sample |   56 
  client/tests/kvm/kvm_tests.py |   93 
 +
  client/tests/kvm/kvm_vm.py|2 +
  4 files changed, 152 insertions(+), 0 deletions(-)

Thank you for your contribution Yolkfull, pci hotplug is an important
feature that we should test and stress.

 diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
 index 4c7bae4..4fbce5b 100644
 --- a/client/tests/kvm/kvm.py
 +++ b/client/tests/kvm/kvm.py
 @@ -55,6 +55,7 @@ class kvm(test.test):
  kvm_install:  test_routine(kvm_install, 
 run_kvm_install),
  linux_s3: test_routine(kvm_tests, run_linux_s3),
  stress_boot:  test_routine(kvm_tests, run_stress_boot),
 +pci_hotplug:  test_routine(kvm_tests, run_pci_hotplug),
  }
  
  # Make it possible to import modules from the test's bindir
 diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
 b/client/tests/kvm/kvm_tests.cfg.sample
 index 2f864de..50b5765 100644
 --- a/client/tests/kvm/kvm_tests.cfg.sample
 +++ b/client/tests/kvm/kvm_tests.cfg.sample
 @@ -94,6 +94,52 @@ variants:
  max_vms = 5
  alive_test_cmd = ps aux
  
 +
 +- nic_hotplug:
 +type = pci_hotplug
 +pci_type = nic
 +modprobe_acpiphp = yes
 +reference_cmd = lspci
 +find_pci_cmd = 'lspci | tail -n1'
 +pci_test_cmd = 'nslookup www.redhat.com'
 +variants:
 +- @nic_8139:
 +pci_model = rtl8139
 +match_string = 8139
 +- nic_virtio:
 +pci_model = virtio
 +match_string = Virtio network device
 +- nic_e1000:
 +pci_model = e1000
 +match_string = Gigabit Ethernet Controller
 +
 +- block_hotplug:
 +type = pci_hotplug
 +pci_type = block
 +modprobe_acpiphp = yes
 +reference_cmd = lspci
 +find_pci_cmd = 'lspci | tail -n1'
 +images +=  stg
 +boot_drive_stg = no
 +image_name_stg = storage
 +image_size = 1G
 +force_create_image_stg = yes
 +pci_test_cmd = 'dir'

Nice catch here, as dir would work on both command.com and *sh.

 +no Windows
 +variants:
 +- block_virtio:
 +pci_model = virtio
 +match_string = Virtio block device
 +- block_scsi:
 +pci_model = scsi
 +match_string = SCSI storage controller
 +variants:
 +- fmt_qcow2:
 +image_format_stg = qcow2
 +- fmt_raw:
 +image_format_stg = raw
 +
 +
  # NICs
  variants:
  - @rtl8139:
 @@ -306,6 +352,12 @@ variants:
  migration_test_command = ver  vol
  stress_boot:
  alive_test_cmd = systeminfo
 +nic_hotplug:
 +modprobe_acpiphp = no
 +reference_cmd = systeminfo
 +find_pci_cmd = ipconfig /all | find Description
 +nic_e1000:
 +match_string = Intel(R) PRO/1000 MT Network Connection
  
  variants:
  - Win2000:
 @@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
  only Fedora.9 openSUSE-11 Ubuntu-8.10-server
  
 
 +nic_hotplug.nic_virtio|block_hotplug:
 +no Windows
 +
 +
  variants:
  - @qcow2:
  image_format = qcow2
 diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
 index 2d11fed..21280b9 100644
 --- a/client/tests/kvm/kvm_tests.py
 +++ b/client/tests/kvm/kvm_tests.py
 @@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
  for se in sessions:
  se.close()
  logging.info(Total number booted: %d % (num -1))
 +
 +
 +def run_pci_hotplug(test, params, env):
 +
 +Test pci devices' hotplug
 +1) pci_add a deivce (nic or storage)
 +2) Compare 'info pci' output
 +3) Compare $reference_cmd output
 +4) Verify whether pci_model is shown in $pci_find_cmd
 +5) pci_del the device, verify whether could remove the pci device
 +
 +@param test:   kvm test object
 +@param params: Dictionary with the test parameters
 +@param env:Dictionary with test environment.
 +
 +vm = kvm_utils.env_get_vm(env, params.get(main_vm))
 +if not vm:
 +raise error.TestError(VM object not found in environment)
 +if not vm.is_alive():
 +raise error.TestError(VM seems to be dead; Test requires a living 
 VM)

The snippet above can be turned on a utility function, I am going to
cook up a patch doing it. When finished, I will replace it myself, no
need to worry about it.

 +logging.info(Waiting for guest to be up...)
 +
 +session = kvm_utils.wait_for(vm.ssh_login, 

Re: [PATCH] Add a subtest pci_hotplug in kvm test

2009-06-30 Thread Yolkfull Chow

On 06/30/2009 09:58 PM, Dor Laor wrote:

On 06/30/2009 02:11 PM, Yolkfull Chow wrote:

Signed-off-by: Yolkfull Chowyz...@redhat.com
---
  client/tests/kvm/kvm.py   |1 +
  client/tests/kvm/kvm_tests.cfg.sample |   56 
  client/tests/kvm/kvm_tests.py |   93 
+

  client/tests/kvm/kvm_vm.py|2 +
  4 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index 4c7bae4..4fbce5b 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -55,6 +55,7 @@ class kvm(test.test):
  kvm_install:  test_routine(kvm_install, 
run_kvm_install),
  linux_s3: test_routine(kvm_tests, 
run_linux_s3),
  stress_boot:  test_routine(kvm_tests, 
run_stress_boot),
+pci_hotplug:  test_routine(kvm_tests, 
run_pci_hotplug),


Cool! It's very good since it tends to break.



  }

  # Make it possible to import modules from the test's bindir
diff --git a/client/tests/kvm/kvm_tests.cfg.sample 
b/client/tests/kvm/kvm_tests.cfg.sample

index 2f864de..50b5765 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -94,6 +94,52 @@ variants:
  max_vms = 5
  alive_test_cmd = ps aux

+
+- nic_hotplug:
+type = pci_hotplug
+pci_type = nic
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+pci_test_cmd = 'nslookup www.redhat.com'
+variants:
+- @nic_8139:
+pci_model = rtl8139
+match_string = 8139
+- nic_virtio:
+pci_model = virtio
+match_string = Virtio network device
+- nic_e1000:
+pci_model = e1000
+match_string = Gigabit Ethernet Controller
+
+- block_hotplug:
+type = pci_hotplug
+pci_type = block
+modprobe_acpiphp = yes
+reference_cmd = lspci
+find_pci_cmd = 'lspci | tail -n1'
+images +=  stg
+boot_drive_stg = no
+image_name_stg = storage
+image_size = 1G
+force_create_image_stg = yes
+pci_test_cmd = 'dir'
+no Windows
+variants:
+- block_virtio:
+pci_model = virtio
+match_string = Virtio block device
+- block_scsi:
+pci_model = scsi
+match_string = SCSI storage controller
+variants:


There is no need to test qcow2/raw here since it shouldn't matter.
You can test qcow2 only, it is enough.


+- fmt_qcow2:
+image_format_stg = qcow2
+- fmt_raw:
+image_format_stg = raw
+
+
  # NICs
  variants:
  - @rtl8139:
@@ -306,6 +352,12 @@ variants:
  migration_test_command = ver  vol
  stress_boot:
  alive_test_cmd = systeminfo
+nic_hotplug:
+modprobe_acpiphp = no
+reference_cmd = systeminfo
+find_pci_cmd = ipconfig /all | find Description
+nic_e1000:
+match_string = Intel(R) PRO/1000 MT Network 
Connection


  variants:
  - Win2000:
@@ -530,6 +582,10 @@ virtio|virtio_blk|e1000:
  only Fedora.9 openSUSE-11 Ubuntu-8.10-server


+nic_hotplug.nic_virtio|block_hotplug:
+no Windows
+
+
  variants:
  - @qcow2:
  image_format = qcow2
diff --git a/client/tests/kvm/kvm_tests.py 
b/client/tests/kvm/kvm_tests.py

index 2d11fed..21280b9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -585,3 +585,96 @@ def run_stress_boot(tests, params, env):
  for se in sessions:
  se.close()
  logging.info(Total number booted: %d % (num -1))
+
+
+def run_pci_hotplug(test, params, env):
+
+Test pci devices' hotplug
+1) pci_add a deivce (nic or storage)
+2) Compare 'info pci' output
+3) Compare $reference_cmd output
+4) Verify whether pci_model is shown in $pci_find_cmd
+5) pci_del the device, verify whether could remove the pci device
+
+@param test:   kvm test object
+@param params: Dictionary with the test parameters
+@param env:Dictionary with test environment.
+
+vm = kvm_utils.env_get_vm(env, params.get(main_vm))
+if not vm:
+raise error.TestError(VM object not found in environment)
+if not vm.is_alive():
+raise error.TestError(VM seems to be dead; Test requires a 
living VM)

+
+logging.info(Waiting for guest to be up...)
+
+session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+if not session:
+raise error.TestFail(Could not log into guest)
+
+logging.info(Logged in)
+
+# modprobe the module that enable hotplug
+if params.get(modprobe_acpiphp) == yes:
+if