virsh.attach_device: Skip login if vm is not alive

For the case where the vm is not alive, then skip doing the login() call
since there are multiple timeouts in play. One in particular - the call
to wait_for_get_address() has a 300 second timeout. If we fall into that
timeout, we can wait for up to 6 minutes per test run. When there's 16
devices that adds up to 96 minutes of waiting for no good reason.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Merge pull request #107 from jferlan/attach_device

virsh.attach_device: Skip login if vm is not alive
Add file_dir APIs: chmod, chown, lchown, du, file
Optimize checking logic for API:file
Adjust coding formats