virsh undefine(kvm xen)

I have made a few changes.Those changes can make autotest run normally in both XEN host and KVM host.
There's one point to notice. In XEN host, a runnig guest cannot be undefined,but in KVM host,  the runnig guest can be undefined.