Cannot resize VM to a different compute node when using hyperv_utils_v2

Bug #1248463 reported by Feng Ju on 2013-11-06
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
High
Feng Ju
Havana
Undecided
Unassigned

Bug Description

The bug is when you resize a VM to another compute node using Hyper-V VMUtilsV2, there will be an exception in the compute node which the VM located before resizing.
The exception is "Cannot find boot VHD file for instance: instance-0000000e".

After debuged, the issue maybe in funtion get_vm_storage_paths of vmutils.py.

If using Hyper-V v1, the get_vm_storage_paths function in vmutils.py can find the Virtual Hard Disk, all the ResourceSubType of Msvm_ResourceAllocationSettingData are
[u'Microsoft Virtual Keyboard',
u'Microsoft Virtual PS2 Mouse',
u'Microsoft S3 Display Controller',
u'Microsoft Synthetic Diskette Drive',
None,
u'Microsoft Serial Controller',
u'Microsoft Serial Port',
u'Microsoft Serial Port',
u'Microsoft Synthetic Disk Drive',
u'Microsoft Virtual Hard Disk',
u'Microsoft Synthetic DVD Drive',
u'Microsoft Virtual CD/DVD Disk',
u'Microsoft Emulated IDE Controller',
u'Microsoft Emulated IDE Controller',
u'Microsoft Synthetic Mouse',
u'Microsoft Synthetic Display Controller',
u'Microsoft Synthetic SCSI Controller']

If using Hyper-V v2, the get_vm_storage_paths function in vmutils.py can not find the Virtual Hard Disk, all the ResourceSubType of Msvm_ResourceAllocationSettingData are
Microsoft:Hyper-V:Virtual Keyboard
Microsoft:Hyper-V:Virtual PS2 Mouse
Microsoft:Hyper-V:S3 Display Controller
Microsoft:Hyper-V:Synthetic Diskette Drive
None
Microsoft:Hyper-V:Serial Controller
Microsoft:Hyper-V:Serial Port
Microsoft:Hyper-V:Serial Port
Microsoft:Hyper-V:Synthetic Disk Drive
Microsoft:Hyper-V:Synthetic DVD Drive
Microsoft:Hyper-V:Emulated IDE Controller
Microsoft:Hyper-V:Emulated IDE Controller
Microsoft:Hyper-V:Synthetic Mouse
Microsoft:Hyper-V:Synthetic Display Controller
Microsoft:Hyper-V:Synthetic SCSI Controller

I also find in Hyper-V v2 I can find Microsoft Virtual Hard Disk from class Msvm_StorageAllocationSettingData.

Maybe the Hyper-V v2 api changed, but the codes in nova didn't change.

Feng Ju (jufeng) wrote :

If I change Msvm_ResourceAllocationSettingData in get_vm_storage_paths function in vmutils.py to Msvm_StorageAllocationSettingData, the disk_resource.Connection at line 398 will be null in get_vm_storage_paths function in vmutils.py.
In Hyper-V v1 the disk_resource.Connection will be something like this (u'd:\\hyper-v\\instances\\instance-0000001d\\root.vhd',)

Feng Ju (jufeng) wrote :
Download full text (3.6 KiB)

I debuged Hyper-V V1 API and Hyper-V V2 API for function get_vm_storage_paths.
I set breakpoint at function get_vm_storage_paths in vmutils.py, the debug output is as follows.

When using Hyper-V v1 API:

(Pdb) pp [r.ResourceSubType for r in rasds]
[u'Microsoft Virtual Keyboard',
 u'Microsoft Virtual PS2 Mouse',
 u'Microsoft S3 Display Controller',
 u'Microsoft Synthetic Diskette Drive',
 None,
 u'Microsoft Serial Controller',
 u'Microsoft Serial Port',
 u'Microsoft Serial Port',
 u'Microsoft Synthetic Disk Drive',
 u'Microsoft Virtual Hard Disk',
 u'Microsoft Synthetic DVD Drive',
 u'Microsoft Virtual CD/DVD Disk',
 u'Microsoft Emulated IDE Controller',
 u'Microsoft Emulated IDE Controller',
 u'Microsoft Synthetic Mouse',
 u'Microsoft Synthetic Display Controller',
 u'Microsoft Synthetic SCSI Controller']
(Pdb) jf = vmsettings[0].associators(wmi_result_class='Msvm_StorageAllocationSettingData')
(Pdb) pp [r.ResourceSubType for r in jf]
[]

There is 'Microsoft Virtual Hard Disk' in rasds' ResourceSubType and not i jf.

When using Hyper-V v2 API:

(Pdb) pp [r.ResourceSubType for r in rasds]
[u'Microsoft:Hyper-V:Virtual Keyboard',
 u'Microsoft:Hyper-V:Virtual PS2 Mouse',
 u'Microsoft:Hyper-V:S3 Display Controller',
 u'Microsoft:Hyper-V:Synthetic Diskette Drive',
 None,
 u'Microsoft:Hyper-V:Serial Controller',
 u'Microsoft:Hyper-V:Serial Port',
 u'Microsoft:Hyper-V:Serial Port',
 u'Microsoft:Hyper-V:Synthetic Disk Drive',
 u'Microsoft:Hyper-V:Synthetic DVD Drive',
 u'Microsoft:Hyper-V:Emulated IDE Controller',
 u'Microsoft:Hyper-V:Emulated IDE Controller',
 u'Microsoft:Hyper-V:Synthetic Mouse',
 u'Microsoft:Hyper-V:Synthetic Display Controller',
 u'Microsoft:Hyper-V:Synthetic SCSI Controller']
(Pdb) jf = vmsettings[0].associators(wmi_result_class='Msvm_StorageAllocationSettingData')
(Pdb) pp [r.ResourceSubType for r in jf]
[u'Microsoft:Hyper-V:Virtual Hard Disk',
 u'Microsoft:Hyper-V:Virtual CD/DVD Disk']
(Pdb) pp ["obj.%s = %s" % (p, getattr(jf[0], p)) for p in jf[0]._properties]
[u'obj.HostExtentName = None',
 u'obj.AutomaticDeallocation = True',
 u'obj.InstanceID = Microsoft:2CD8141B-6228-49AC-8FF7-AE5CB2A1BB52\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\0\\0\\L',
 u'obj.VirtualResourceBlockSize = None',
 u'obj.ResourceSubType = Microsoft:Hyper-V:Virtual Hard Disk',
 u'obj.Access = None',
 u"obj.HostResource = (u'd:\\\\hyper-v\\\\instances\\\\instance-0000001e\\\\root.vhd',)",
 u'obj.OtherHostExtentNameNamespace = None',
 u'obj.OtherHostExtentNameFormat = None',
 u'obj.ElementName = Hard Disk Image',
 u'obj.Description = Settings for the Microsoft Hard Disk Image.',
 u'obj.Parent = \\\\ABBA-N06-HV01\\root\\virtualization\\v2:Msvm_ResourceAllocationSettingData.InstanceID="Microsoft:2CD
8141B-6228-49AC-8FF7-AE5CB2A1BB52\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\D"',
 u'obj.VirtualQuantity = 1',
 u'obj.HostResourceBlockSize = None',
 u'obj.AutomaticAllocation = True',
 u'obj.PoolID = ',
 u'obj.HostExtentStartingAddress = None',
 u'obj.Reservation = 1',
 u'obj.VirtualQuantityUnits = count(fixed size block)',
 u'obj.AllocationUnits = count',
 u'obj.MappingBehavior = None',
 u'obj.Address = None',
 u'obj.AddressOnParent = None',
 u'obj.OtherRe...

Read more...

Feng Ju (jufeng) wrote :

code review is here https://review.openstack.org/#/c/55501/ for the bug didn't related to reivew automatically.

Matt Riedemann (mriedem) on 2013-11-12
Changed in nova:
status: New → In Progress
assignee: nobody → Feng Ju (jufeng)
Changed in nova:
importance: Undecided → High

Reviewed: https://review.openstack.org/55501
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6847a0ef927929e631e9c6db2e2812528ca93151
Submitter: Jenkins
Branch: master

commit 6847a0ef927929e631e9c6db2e2812528ca93151
Author: jufeng <email address hidden>
Date: Thu Nov 7 14:12:36 2013 +0800

    Fixes get_vm_storage_paths issue for Hyper-V V2 API

    Add get_vm_storage_paths function to vmutilsv2.py

    get_vm_storage_paths implementation on Hyper-V V2 API changed
    compared to previous V1 API. In previous V1 APIs, using
    Msvm_ResourceAllocationSettingData class can get storage
    paths, but in V2 API, only using Msvm_StorageAllocationSettingData
    class can get the storage paths.

    Closes-Bug: #1248463

    Change-Id: Ica73221524f162a6ffcd9dc64ee33c85fb5ad31d

Changed in nova:
status: In Progress → Fix Committed

Feng Ju, this one needs to be backported to Havana.
Would you like to commit the Havana patch? If not I can do it of course.

Thanks!

Alessandro

tags: added: havana-backport-potential
Changed in nova:
milestone: none → icehouse-2
Thierry Carrez (ttx) on 2014-01-22
Changed in nova:
status: Fix Committed → Fix Released

The Havana branch proposed patch is here:
https://review.openstack.org/#/c/57836/

The bug page didn't get updated.

Thierry Carrez (ttx) on 2014-04-17
Changed in nova:
milestone: icehouse-2 → 2014.1

Reviewed: https://review.openstack.org/57836
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=65fedbdd9a250d36622c048c2e5bc6a10d6e04ef
Submitter: Jenkins
Branch: stable/havana

commit 65fedbdd9a250d36622c048c2e5bc6a10d6e04ef
Author: Feng Ju <email address hidden>
Date: Thu Jan 30 15:59:13 2014 +0800

    Fixes get_vm_storage_paths issue for Hyper-V V2 API

    Add get_vm_storage_paths function to vmutilsv2.py

    get_vm_storage_paths implementation on Hyper-V V2 API changed
    compared to previous V1 API. In previous V1 APIs, using
    Msvm_ResourceAllocationSettingData class can get storage
    paths, but in V2 API, only using Msvm_StorageAllocationSettingData
    class can get the storage paths.

    Closes-Bug: #1248463

    Change-Id: Ica73221524f162a6ffcd9dc64ee33c85fb5ad31d
    (cherry picked from commit 6847a0ef927929e631e9c6db2e2812528ca93151)

tags: added: in-stable-havana
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers