virt: Add utils.safe_rmdir() function to make sure a directory can be removed

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>