autotest/virt-test — pull request #1325 by will-Do (2014-01-07 07:50:57+00:00)
Title: catch TypeError if index variable is None

In very few case, parameter ```serial_ports``` may equal to None, then test will fail as:
```
14:23:44 DEBUG| Destroying VM
14:23:44 DEBUG| Releasing MAC addresses for vm virt-tests-vm1.
14:23:45 ERROR|
14:23:45 ERROR| Traceback (most recent call last):
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/standalone_test.py", line 187, in run_once
14:23:45 ERROR| params = env_process.preprocess(self, params, env)
14:23:45 ERROR| File "/home/ydu/Work/autotest/client/shared/error.py", line 141, in new_fn
14:23:45 ERROR| return fn(*args, **kwargs)
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/env_process.py", line 652, in preprocess
14:23:45 ERROR| process(test, params, env, preprocess_image, preprocess_vm)
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/env_process.py", line 414, in process
14:23:45 ERROR| _call_vm_func()
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/env_process.py", line 389, in _call_vm_func
14:23:45 ERROR| vm_func(test, vm_params, env, vm_name)
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/env_process.py", line 156, in preprocess_vm
14:23:45 ERROR| vm.create_serial_console()
14:23:45 ERROR| File "/home/ydu/Work/run/virt-test/virttest/libvirt_vm.py", line 873, in create_serial_console
14:23:45 ERROR| cmd += (" console %s %s" % (self.name, self.serial_ports[0]))
14:23:45 ERROR| TypeError: 'NoneType' object has no attribute '__getitem__'
14:23:45 ERROR|
14:23:45 ERROR| FAIL type_specific.virsh.blockcopy.positive_test.no_option -> TypeError: 'NoneType' object has no attribute '__getitem__'
```

This is a TypeError instead of IndexError.