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>
virt.virt_vm: Create CpuInfo struct for virt_vm class

This patch creates a CpuInfo class for virt_vm, this class
stores VM's cpu information, we can access cpu info in test
cases easily with it.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.kvm_vm: Generate cpu topology info as qemu's way

The existed code for generate cpu topology info (sockets/
cores/threads) may generate a invalid config. This patch
Update this part of code with qemu's way.

This patch also add the support for 'maxcpus' option.

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 v5:
 - Get cpu topology info from vm.cpuinfo class directly.

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.
chanages from v4:
  - Update docstring.

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