virt: Run vm.pause/resume methond instead of call monitor cmd

Some cases call Monitor.cmd method directly, and they can't
work with qmp monitor, we need to make them call the wrapper
of monitor instead.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.kvm_monitor: Record all monitor message into a separated file

This patch record all monitor cmd/response in a seperated file,
so that we can analyse them easily.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt: Fix floppy image path for the old command line

The floppy image path in old format command line is not an abspath
which will cause some cases failed.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Fix the md5sum check issue

The "md5sum -c" will check the file which is md5sumed. in guest-os.cfg, it will hit a error,if we don't use the right
path
lyang0@lyang0-OptiPlex-755:~/community/autotest_upstream$ cd /bin && md5sum ls > /tmp/ls.md5 && cd /tmp && md5sum -c ls.md5
md5sum: ls: No such file or directory
ls: FAILED open or read
md5sum: WARNING: 1 of 1 listed file could not be read

Signed-off-by: Lei Yang <yanglei.fage@gmail.com>
virt: to test timer functionality of guest

This test implements the following github issue
https://github.com/autotest/autotest/issues/404

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
boottool: get rid of DeprecationWarning messages

Get rid of DeprecationWarning messages on newer Python version while still
making it run on properly on Python 2.4

Signed-off-by: Cleber Rosa <crosa@redhat.com>
boottool: support instalation of grubby build dependencies

Signed-off-by: Cleber Rosa <crosa@redhat.com>
kvm.tests.time_manage: stress parameters fixup

cpu and io stress has been added to the host load command.

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Use -device for virtio-blk

Create virtio-blk devices using '-drive if=none,...' and
'-device virtio-blk-pci'.  Has the advantage that we can
support bootindex this way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
bootindex support for ahci

pass on bootindex (if set) to ide drives hooked up via ahci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
add option to switch from boot=on to bootindex

This adds a global switch 'use_bootindex' which will make autotest
use bootindex instead of boot=on when it sees image_boot=yes.  Needed
when testing upstream qemu as boot=on isn't supported there.

Unfortunaly there is no easy way to figure whenever qemu supports
boot=on or not, thus we need the inconvinient manual switch here.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Catch KeyError in BaseVM.del_nic()

Base_VM.add_nic() doesn't add mac to address_cache,
so when we delete call BaseVM.del_nic(), it is like this:
    del self.address_cache[nic_mac]
This may lead to KeyError. But BaseVM.del_nic() only catch IndexError.
So we should catch KeyError too.

And also, we should do delete the nic in virtnet before we delete it
from address_cache, in case we occur the KeyError.

Signed-off-by: Tang Chen <tanchen@cn.fujitsu.com>
KVM-test: And check the cpu vendor_id in physical_resources_check

Since we do not have a simple way to identify the vendor_id
in the Windows guests, this test is limited to linux guests
for now.

Changes from v4:
 - Add a default cpu model in case qemu can't get cpu model
   from host's /proc/cpuinfo.
 - Add checking cpu vendor id cmd for win guest.
 - Rollback the cmd for checking vendor id in linux to
   'grep vendor_id /proc/cpuinfo', to make this case can also
   work on the guest without 'lscpu' cmd, eg, RHEL5.

Changes from v3:
 - Use 'lscpu' to check cpu vendor id.

Changes from v2:
 - The default vendor of cpu64-rhel6, qemu64 is AuthenticAMD,
   change vendor id to "AuthenticAMD", to make guest can get
   correct cores, threads, sockets

Changes from v1:
1. limit customized vendor_id to Linux guests.
2. test vendor_id in physical_resources_check, rather than in a
new testcase.

Signed-off-by: Chen Cao <kcao@redhat.com>
Signed-off-by: Suqin Huang <shuang@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-test: check if the MS Windows VirtIO driver is digital signed

Changes from v3:
 - Fix typo.
 - Convert 'chk_timeout' to integer type.

Changes from v2:
 - Update error log message, using a list to store error message.

Changes from v1:
 - The default 30s timeout sometimes is too short to get the result,
   change the timeout to 240

Signed-off-by: Chen Cao <kcao@redhat.com>
Signed-off-by: Suqin Huang <shuang@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-Test: physical_resouces_check: Add sockets/cores/threads check

Add sockets, cores, threads number checking test

Changes from v4:
 - Update the code for getting chk_cmd parameter in
   check_cpu_number() function
 - Give default value to chk_timeout.

Changes from v3:
 - Verify regex search result for cpu check, avoid list out of
   index error.

Changes from v2:
 - Putting actul checking steps into a sub-function called
   check_cpu_number
 - Update default values for sockets/cores/threads configuration,
   make them same as configs in kvm_vm file.

Changes from v1:
 - Change timeout to int(timeout)
 - Add timeout while checking cores, threads, sockets

Signed-off-by: Suqin Huang <shuang@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-Test: Add cores/threads/sockets checking cmd in cfg file

Add cores/threads/sockets check cmd in cfg file

Changes from v3:
 - Update cores/threads checking cmd for windows guest.

Changes from v2:
 - Move configs for linux guest into subtests.cfg file.
 - Use 'lscpu' cmd to check cpu info instead of /proc/cpuinfo

Changes from v1:
 - Update "check cpu cmds" for windows guest

Signed-off-by: Suqin Huang <shuang@redhat.com>
Signed-off-by: Golita Yue <gyue@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-test: Add punctuation to random string generate chars

Add punctuation to generate_random_string. Also add two parameters
to this function:
    - ignore_str: string that will not include in string that generated
    - convert_str: stirng that need to be covered with /
Make this function can cover more conditions.

changes from v1:
  - wrong docstring fix
  - use string.replace() to delete or substitute ignore_str and
    convert_str
changes from v2:
  - clean up code and make it simpler
changes from v3:
  - Check ignore_str and convert_str before using them.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Acked-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.unattended: Add hdparm package for Fedora 16/17 install file

The hdparm program can check disk info easily, and it's used by
hdparm test case, so install it by default.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-test: Add serial name check in physical_resources_check

Improve physical_resources_check in serial name part.
  - Add a random serial name to guest less than 20 characters
  - Add strict check for serial name

changes from v1:
  - format modify
changes from v2:
  - move randome generate string to virt_utils
changes from v3:
  - move this test only for virtio_blk and only for RHEL 6 guest
    as test plan
changes from v4:
  - clean up and make this test will not run in Windows guests
changes from v5:
  - Fix hard disk serial number check string problem.
changes from v6:
  - Update test config for fedora and new rhel guest
changes from v7:
  - Rename "catch_serial_cmd" to "disk_serial_num_chk_cmd"
  - Update the cmd of getting serial number for linux and win guest

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>