Raise correct exception for duplicate networks

When using Quantum, if duplicate network ids are passed in on a
nova boot, nova-api raises a NetworkNotFound exception, which is
not correct.  This change causes it to raise a NetworkDuplicated
exception instead.

Fixes bug 1165088

Change-Id: I4f1f9aa5e1fa0e740b78e67760d924e2dd1d4d98
baremetal: Change input for sfdisk

To prevent sfdisk stopping with "bad input", use a empty string
instead of "-" (and doing so requires using "," as a separator).

Fixes bug 1166112

Change-Id: I5e4cffaa326fbafd1583d55744f921a40b3ae76f
Cleanup and test volume usage on volume detach

* Refactor _poll_volume_usage to be more readable

* Test that detaching a volume updates the totals on the volume usage
  cache correctly. This works but adding test to make sure that it always
  works.

Change-Id: I82da44137bc65d5f04bca0820eb327438d6e1f35
Delete extra space to api/volumes message

Change-Id: I04efa9c8ddb5790f99d66c302198bf92000f6e66
Signed-off-by: You Ji <jiyou09@gmail.com>
Fix hyperv copy file error logged incorrect

This patch just fix hyperv copy file error message
incorrect, missing src and dest value.

Fixes bug #1170580

Change-Id: I309fd67b3f491c9be872ff9cdd58f6364a26a96b
Stop vm_state reset on reboot of rescued vm

When a VM is in rescue mode, giving it a reboot will reset its state in
the DB back to ACTIVE.

This patch stops that happening.

Work towards bug: 1170237
Change-Id: Ie442bcc85ed7ad5d897b88ffd0dbcf6eeee7b990
Adds tests to xenapi.vm_utils's 'lookup' method

Change-Id: I140f091b50c3e4076d3f4812cae00e37f120a277
Allows xenapi 'lookup' to look for rescue mode VMs

When you lookup a VM by name, you can specify if you want it to check if
it has a rescue mode instance running.

If it finds the rescue mode instance, it'll return that one instead
of the original name.

This is useful for operations that should work on the rescue mode vm if
it's there, or the normal one, if it's not.

Work towards bug: 1170237
Change-Id: I41b31e59631b78a62faadb9970b6b824929e7061
Can now reboot rescued instances in xenapi

This patch makes it possible to reboot an instance that is in rescue mode.

It causes the reboot action to search first for rescue mode VM (the
normal VMs name plus '-rescue') .. if it can't find it, it does a reboot
of the normal VM. If it finds the rescue one first, it'll reboot the
rescue instance.

If there is more than one VM named 'myvm-rescue', it'll raise an
exception just like it did if there were more than one VM named 'myvm'.

Helps with bug: 1170237

Change-Id: I1858d86bf93546618eeaaec92d856f5236f3f090
Merge "Raise correct exception for duplicate networks"
Merge "baremetal: Change input for sfdisk"
Merge "Delete extra space to api/volumes message"
Merge "Cleanup and test volume usage on volume detach"
Merge "Stop vm_state reset on reboot of rescued vm"
Merge "Adds tests to xenapi.vm_utils's 'lookup' method"
Merge "Allows xenapi 'lookup' to look for rescue mode VMs"
Merge "Can now reboot rescued instances in xenapi"
Merge "Fix hyperv copy file error logged incorrect"