virttest: Update the code to get the command status

The original code can not handle negative number.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Merge pull request #1818 from ypu/cmd_status

virttest: Update the code to get the command status