Fixes Hyper-V volume discovery exception message

On some editions of Windows / Hyper-V server the SAN policy is set
by default to "Online All", bringing online any disk, local or shared,
attached to the host.

Since only offline disks can be attached as passthrough disks to a Hyper-V
VM, this prevents Cinder volumes from being attached to instances,
resulting in an exception that can be particularly hard to troubleshoot
without a clear knowledge of the context.

This patch includes some details in the exception message for
troubleshooting purposes.

Change-Id: I6d0b49812f8ca965ca53be34ef009997c8e79728
Closes-Bug: #1361419
Fixes Hyper-V boot from volume live migration

Live migration fails on Hyper-V when boot from volume is used with
CoW, as the target host tries to cache the root disk image in
pre_live_migration, but in this case the image_ref is empty.

This patch adds a check to handle the empty image_ref case.

Co-Authored-By: Claudiu Belu <cbelu@cloudbasesolutions.com>

Change-Id: I60cb60ccaeb0cb8c536906d897249e31ae396923
Closes-Bug: #1362075
Fixes Hyper-V driver WMI issue on 2008 R2

Trying to assign properties on default Hyper-V resource setting data
WMI objects results in an exceptions before Hyper-V 2012.
Cloning the objects before assigning them solves the issue.

A similar approach was previous already implemented and has been
incorrectly removed during a refactoring.

Co-Authored-By: Robert Tingirica <rtingirica@cloudbasesolutions.com>
Change-Id: If119154f8b4756be9f98c8acd376003c52eff44f
Closes-Bug: #1356884
Fixes Hyper-V should log a clear error message

When failing to access a remote SMB UNC path, Python raises
   WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: '\\\\'
This issue happens during resize/cold migration.

This fix ensures that the Nova driver will report a clear error
message.

Change-Id: I735987f3c3f8c16759f6fbbb235a0156df832855
Closes-Bug: #1367786
Fixes differencing VHDX images issue on Hyper-V

When using differencing vhdx images, one will be created pointing
to the base image when a VM is spawned. This image will be created
having the according flavor size.

In this case, due to a Win32 API issue, the image is not generated
properly.

Simply creating the root image with no size specified and resizing
it afterwards fixes the issue.

Change-Id: I7bb46a63d4c2a06ed6f63c839461cbbc1abffa65
Closes-Bug: #1370531
Fixes Hyper-V dynamic memory issue with vNUMA

vNUMA and dynamic memory are mutually exclusive, so the former
needs to be disabled for instances where dynamic memory is enabled.

Change-Id: Ic730c294ffc89925076688a44adf2594c7f6712b
Closes-Bug: #1305897
Fixes spawn issue on Hyper-V

The current Hyper-V Technical Preview introduces slight changes
in the data returned by GetVirtualHardDiskSettingData in
Msvm_ImageManagementService.

Co-Authored-By: Adelina Tuvenie <atuvenie@cloudbasesolutions.com>
Change-Id: I830b07efb657acc1486f86a475310f5f4e584a37
Closes-Bug: #1376883
Hyper-V: Skip logging out in-use targets

As most of the Cinder volume drivers that use iSCSI export one LUN
per iSCSI target, the Hyper-V driver was logging out the according
target each time a volume was disconnected.

This causes issues with some volume drivers that use multiple LUNs
per iSCSI target and may disconnect in-use targets.

This patch fixes the issue by checking if there are other LUNs
being used, disconnecting the iSCSI targets otherwise.

Change-Id: Ida08e7129a7b7940ddea488488cccc7571a43b76
Closes-Bug: #1372815