> [... snip horrendous Powershell stuff ...]
>
> I never can understand why people like Powershell syntax so much <grin>

Indeed, it is syntactically horrendous. I wrote that after I hit problem in 
Python to test the concept, honest...

> I'm not going to be much help here, I'm afraid: I don't have access
> to a Hyper-V installation

I can give you access to one ;)

> What might just help is a full traceback which would show exactly
> where the error is arising. Frankly, I'm not too hopeful, although
> I'm happy to try.

python scsi_add_short.py
Traceback (most recent call last):
  File "scsi_add_short.py", line 15, in <module>
    HD.Address = "100"
  File "c:\python27\lib\site-packages\wmi.py", line 571, in __setattr__
    handle_com_error ()
  File "c:\python27\lib\site-packages\wmi.py", line 241, in handle_com_error
    raise klass (com_error=err)
wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0,
 u'SWbemObjectEx', u'Provider is not capable of the attempted operation ', None,
 0, -2147217372), None)>

The traceback, for the following code;

import wmi
c = wmi.WMI("hostname", namespace="virtualization", find_classes=False)
VM = c.Msvm_ComputerSystem(ElementName="vmname")[-1]
DiskPool = c.Msvm_ResourcePool(ResourceType=22,ResourceSubtype="Microsoft 
Physical Disk Drive")[-1]
Disks = DiskPool.associators(wmi_result_class="Msvm_DiskDrive")
Disk = [d for d in Disks if d.DriveNumber==10][0]
VSSDs = VM.associators(wmi_result_class="Msvm_VirtualSystemSettingData")
VSSD = [v for v in VSSDs if v.SettingType==3][0]
SCSIs = VSSD.associators(wmi_result_class="Msvm_ResourceAllocationSettingData")
SCSI = [s for s in SCSIs if s.ResourceType==6][0]
AC = c.Msvm_AllocationCapabilities(ResourceType=22,ResourceSubtype="Microsoft 
Physical Disk Drive")[-1]
Default = 
c.Msvm_SettingsDefineCapabilities(ValueRange=0,GroupComponent=AC.Path_.Path)[-1]
# Problematic section
HD = Default.PartComponent
HD.Address = "100"
HD.Parent = SCSI.Path_.Path
HD.HostResource= DISK.Path_.Path
VMMS.AddVirtualSystemResources(VM, [HD.gettext_(1),])

> In the Python call to AddVirtualSystemResources() you've reversed the order 
> of the parameters.
I'm sure in testing there was a reason why i'd switched them around, but I 
cannot remember right now. As you can see in this example they are the correct 
way around (but the code doesn't get that far anyway).

Thanks again for looking.

Matt

Warwickshire Schools Email System

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
you have received this email in error please forward to: 
postmas...@we-learn.com.

If the content of this email is considered to be inappropriate or offensive 
please report by forwarding to: reportab...@we-learn.com
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to