VMware {code} Community
derekbelrose
Contributor
Contributor

Confusion about the web services sdk and C#

I've seen answers all around the forums regarding how to create a virtual disk using C# and the Web Services sdk. In the Vim25Api.dll that I built using the SDK, I see a CreateVirtualDisk_Task(), which is, apparently what I need.

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualDiskManager.ht... shows that I need a VirtualDiskSpec, but I don't see this in the Vim25Api.dll at all. Has anyone experienced missing classes while working with C# and the Vim25Api?

Any help in this matter would be appreciated.

Thank you,

Derek Belorse

Reply
0 Kudos
9 Replies
derekbelrose
Contributor
Contributor

Also, I don't see any references to VirtualDiskManager in the Vim25Api.dll either.

Thanks!

Reply
0 Kudos
derekbelrose
Contributor
Contributor

Actually, I found VirtualDiskSpec, it's the VirtualDiskInfo class that I can't find.

I guess I'm wondering why there is mention of Managed Objects and Data objects in the SDK that aren't available in the DLLs generated from the WSDL.

Thanks.

Reply
0 Kudos
tos2k
Expert
Expert

Hi!

Looks like you are confused about:

1) object model of VimSdk

2) creating virtual disks with VimSdk

Maybe you find info over here:

1) http://communities.vmware.com/message/1331693

http://communities.vmware.com/message/1329703

2) http://communities.vmware.com/message/1066009

http://communities.vmware.com/message/1016432

HTH, Tos2k

Reply
0 Kudos
derekbelrose
Contributor
Contributor

Has it been confirmed that the VirtualCenter that was released with VI4 supports the VirtualDiskManager?

If so, then I'm going to accelerate our upgrade plan, if not, then I'm going to have to start connecting to our ESX servers, but there are 10 of them 😕 I assume that I can get the hosted server from the VirtualMachine mOR?

Thanks!

Derek

Reply
0 Kudos
tos2k
Expert
Expert

Hi!

I dont know exactly. Before VI4 the virtualDiskManager object was pretty much null, unset all the way on vCenter. It is valid and usable from VI4 (vSphere), yes.

It pretty much does what you want it todo. Even if it suffers from some rare behaviours that existed in VI3 before...

Anyway. When you want to use virtualDiskManager do copy any files, you may achieve better results when using the ESX directly.

Tos2k

Reply
0 Kudos
derekbelrose
Contributor
Contributor

My goal is to programmatically create and attach new drives to existing VMs. This would explain why I'm getting mysterious errors when I use the VirtualDiskManager in VC.

Reply
0 Kudos
derekbelrose
Contributor
Contributor

tos2k,

Do you know if it is possible to get the host of a VirtualMachine that is running on a cluster from VirtualCenter? I try using the "runtime.host" property, but it appears to be null. Surely there must be a way to get this information from the SDK.

Thanks!

Reply
0 Kudos
storm27
Enthusiast
Enthusiast

Hi,

Refer to managed object browser for vCenter and check if the runtime.host property of the Virtual Machine is null or not.

-Angela

Reply
0 Kudos
derekbelrose
Contributor
Contributor

Good afternoon,

I'm almost done this, I've managed to create a second hard disk but i'm getting the path screwed up. I know about summary.config.vmPathName, but is there a way to get the parent directory of the virtual machine? vmPathName is currently "[ESXSTORE_A] TCN - Web Server/TCN - Web Server.vmx". Before I break out my parsing, is there a way to get a Folder mOR for the TCN - Web Server directory?

Thanks!

Derek

Reply
0 Kudos