Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all 1860 articles
Browse latest View live

how to create a VM using a Datacluster (aka Storage Pod) instead of a Datastore ?

$
0
0

Hi,

 

I inherited Java code that creates a VM using a specified Datastore.  I'm trying to modify it to use a Datacluster (aka StoragePod) instead of a Datastore.

 

(Creating a VM with a Datacluster instead of a Datastore appears to be valid when I'm using the vSphere Client UI.)

 

The code is pretty complex, but the following is snippets that show what I'm doing now.

 

I tried simply changing the datastoreName to be the name of the Datacluster (aka Storage Pod) but that didn't work.

 

Can anyone point me in the right direction?  Code sample or documentation or instructions for how this code should be modified would be greatly appreciated!

 

Thanks,

Rob

 

 

VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();

 

    VirtualMachineFileInfo vmfi = new VirtualMachineFileInfo();

    vmfi.setVmPathName(datastoreName);

 

configSpec.setFiles(vmfi);

 

    VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();

    diskSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.CREATE);

    diskSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);

 

        VirtualDisk disk = new VirtualDisk();

        disk.setKey(new Integer(0));

        disk.setControllerKey(new Integer(diskCtlrKey));

        disk.setUnitNumber(new Integer(0));

 

            VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();

            diskfileBacking.setFileName(datastoreName);

            diskfileBacking.setDiskMode("persistent");

 

        disk.setBacking(diskfileBacking);

        disk.setCapacityInKB(diskSizeKB);

 

    diskSpec.setDevice(disk);

           

           

    VirtualDeviceConfigSpec[] deviceConfigSpec = null;

    deviceConfigSpec[0] = diskSpec;

 

configSpec.getDeviceChange().addAll( Arrays.asList( deviceConfigSpec ));

 

 

_vimPortType.createVMTask(mor_folder, virtualMachineConfigSpec, mor_resourcePool, mor_hostCluster);


upload ovf via http to datastore

$
0
0

hello

I am trying to upload ovf tamplate to datasttore via c# api and could not figure out what this object dose
OvfNetworkMapping

Thx

VM Network setting using SDK Perl

$
0
0

Hi all!

 

I am trying to set the network of a VM with 2 vNIC; however I couldn't find any way yet. I am trying to apply using 'CustomizeVM_Task', but I am getting an error as:

 

SOAP Fault:

-----------

Fault string: The operation is not supported on the object.

Fault detail: NotSupported

 

PS: I am using vSphere 5.5

Changes in metric timestamps in 5.1 update 2a?

$
0
0

Hello,

 

I've noticed that when using latest version of vCenter - 5.1 update 2a timestamps of metrics are associated with START of the timestamp instead of the END.

In earlier versions and in vCenter 5.5 it was always the END of timestamp (e.g. vCenter 5.1. build 1064983 ). Does anybody is aware if it's made by purpose or maybe it is a bug in this build? (vCenter 5.1. build 1882349).

 

As we observed it affects answer, e.g. data from 00:00:00 - 00:01:00 are timestamped with values (00:00:00, 00:00:20,00:00:40) instead of (00:00:20,00:00:40, 00:01:00).

 

But if anybody knows if it affect also requests?

I mean does asking for data from 00:00:00 - 00:01:00 will give us data  00:00:00 - 00:01:00 or maybe  23:59:40 - 00:00:40?

 

Thanks in advance!

how to get past this error? "Cannot find 'vimService.wsdl' wsdl. Place the resource correctly in the classpath."

$
0
0

Hi,

 

I download the VMWare management SDK 5.1 with Java samples.

 

I ran the build.bat file to build everything (I had to tweak it to get it working because it didn't like the spaces in "Program Files", for example) -- it produced the vim25.jar and the samples.jar.

 

When I try to run a sample (CreateVM), I provide all the required params (url, username, password, and so on), but it gives me this error:

 

javax.xml.ws.WebServiceException: Cannot find 'vimService.wsdl' wsdl. Place the resource correctly in the classpath.

    at com.vmware.vim25.VimService.<clinit>(VimService.java:32)

    at com.vmware.vm.VMCreate.connect(VMCreate.java:253)

    at com.vmware.vm.VMCreate.main(VMCreate.java:919)

 

 

I tried putting the vimService.wsdl in the classpath, but it still doesn't work.

 

What am I doing wrong?  Stuck on this.

 

Thanks!

Rob

I have Getting started Tab for my Plugin Home , how can i add Basic Tasks to it which will call "configuration Wizard" for my plugin?

$
0
0

I have Getting started Tab for my Plugin Home , how can i add Basic Tasks to it which will call "configuration Wizard" for my plugin?

Windows registry gets corrupt when a quiesce snapshot is taken

$
0
0

Hello,

 

we're trying to do a backup using the vSphere SDK.  For this, we take a quiesce snapshot, and then one of the first things we do is look for the registry hives.  In this process, we find that the registry gets corrupt.  One other problem noticed, is that the SAM database also gets corrupt, as a result of which, VMs with a Domain Controller that are backed up can't be booted, because of a BSOD error.  Turning of the 'VSS Registry Writer' via C:\Program Files\VMware\VMware Tools\vmbackup.conf' does give positive results, although it isn't 100% of the time.  Is there some issue w/ the VSS Registry Writer when taking a Quiece Snapshot?

 

Regards,

Shiva

How to create Host?

$
0
0

How to create Host?

facing problem while creating Host.

In Vsphere SDK, SDK provide us one sample class called Create.java , which contains method Create. Create method takes parameter parent name folder.

And I don't what is it exact.

what should be exact parameter value?

can anybody give me example?


Using SDK to retrieve values available in the Guest OS drop down in the Create and Edit VM wizard in vSphere

$
0
0

Hi,

 

I am working on a web application that allows users to perform a subset of the functionality provided by vSphere web client. I have been using doublecloud proxy to identify the Java commands required to perform operations like creating VMs and retrieving VM details from vCentre.

 

I'm now trying to find out if there's an API call that will allow me to retrieve the values available in the Guest OS drop down in the Create and Edit VM wizard in vSphere - please see below.

 

OS-dropdown.PNG

I'll then use these values to populate the Operating System drop down in the web application. Doublecloud proxy didn't seem to show any API calls, so I'm wondering if it's possible at all.

 

Many thanks

Andrea

Getting Moref using VM Name

$
0
0

Is there is any fastest way to get the moref of a VM using its name?Instead of traversing each VM and comparing its name.

Can we specify propertyfilter in any manner to achieve this?

Reading vmx files from virtual machine

$
0
0

Hello

I want to add some varibales to vmx files and then be able to read them from the virtual machine can u pls help me to understand how to do it?

Thx

Problem while creating a VM in esxi 4.1

$
0
0

Hello,

 

I have encountered a very strange problem which is occurring only in esxi 4.1.

 

Basically I am creating a VM and the logic is working perfectly fome on esxi 5.0+

 

However, when trying this on an esxi 4.1, all the non default devices, i.e. VirtualCdrom, VirtualDisk add VirtualController are being ignored and hence not created on the server. The default devices; i.e. VirtualIDEController, VirtualPS2Controller, VirtualPCIController, VirtualSIOController, VirtualKeyboard, VirtualMachineVMCIDevice and VirtualPointingDevice are created correctly. screenshot1.png illustrates the devices which are being created while screenshot2.png illustrates what devices are supposed to be created.

 

I am following closely the documentation on how to create a VM and hence the code is supposed to be correct (basically translating the sample code from Java to C#). There is no reference on the docs that there might be some unsupported stuff on 4.1 when it comes to the objects being used in the VirtualMachineConfigSpec.

 

Also, it is good to note that when I tried to create the same VM with the same config on an esxi 5.0 and 5.5, the devices where successfully created.

 

Apart from this, the API is not returning with any errors or exceptions. The CreateVM_Task call is successful but these aforementioned devices are not created on the server. This was tested with API versions 5.1 and 5.5

 

This looks like a VMware issue. Can anybody confirm or help on this matter?

 

Many thanks in advance.

 

Chris

Java Client monitoring VM motion

$
0
0

Hello,

 

We have Java client using SDK that retrieves VM events from VCenter. To observe VM motions we retrieve two types of events VmMigratedEvent and DrsVmMigratedEvent from vSphere through web service. These events contain user name information but the problem is that sometimes user name is blank. Even if VM is moved manually by logged in user. We're not able to find any pattern why user name is sometimes blank. Is it known problem or is it matter of configuration or maybe there is a better way to monitor VM motions?

 

regards,

 

Piotr

How to determine if an ESX's device is local or not with vSphere API (Java)

$
0
0



Hi,


I've searched for "is local" property on ESX host's device but haven't found anything in the VMware API.


In esxcli there's a property "is local", How can this be retrieved or calculated from the API?


I found in API 5.5 a way to retrieve it for a VMFS datastore, but I need it in the device level (in case there is no datastore mapped to this device)


Thanks,


Lital

Anyone have the vSphere 5.5 SDK C# DLLs for download. I am having hard time building [ssoclient] the solution in Visual Studio 2013.

$
0
0

If anyone have the DLLs for .NET environment STSService and Vim25Api DLLs, can you share it. I am having difficulty building the batch file to create the STSService DLL.


Update Guest IP address without running Sysprep

$
0
0

Hi all,

 

I have a question which I will try and articular correctly.

 

After a machine has been deployed and sysprep has run and setup everything. What if I want to update the IP addresses on the network cards after the machine has been deployed. Do I have to run the entire sysprep CustomizationSysprep or is there a way to only update the specific network cards IP and subnet mask?

 

Your assistance is much appreciated.

 

Thank you.

Unable to get session - ConnectionRefused

$
0
0


May I know how to fix this? I've increased the timeout too but doesn't work. Please help 15:05:10:529 java.rmi.RemoteException: VI SDK invoke exception:java.net.ConnectException: Connection timed out: connect



at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:299)



at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:242)



at com.vmware.vim25.ws.VimStub.retrieveServiceContent(VimStub.java:1347)



at com.vmware.vim25.mo.ServiceInstance.<init>(ServiceInstance.java:100)



at com.vmware.vim25.mo.ServiceInstance.<init>(ServiceInstance.java:83)



Regards



Raamesh Keerthi N J


Need help with Copying nested Resource Pools

$
0
0

I have one cluster now that has a complex resource pool configuration with many sub-pools. I've been trying to use the Perl VI SDK to somehow copy the resourcepool structure and settings from one cluster to another. Or even export it and imports it to another cluster.

 

Soming like: copyResource.pl SourceClusterName DestinationClusterName

 

Any thoughts/ideas?

Trying to use UpdateVAppConfig to add vm's to a Vapp

$
0
0

I keep getting the error

"SOAP Fault:

--------

Fault string: A specified parameter is not correct.

entityConfig.key[vim.VirtualMachine:vm-54]

Fault detail: InvalidIndexArgumentFault

End Disconnect"

 

 

The 'key' parameter in the VAppEntityConfigInfo calls for a "ManagedObjectReference to a ManagedEntity Entity to power on or power off. This can be a virtual machine or a vApp.


I tried to get the managedobjectreference everyway i could.  Below was a very round about way to get a vm reference.  I'm really not sure how to set this parameter correctly.  I checked everywhere for ' InvalidIndexArgumentFault' but found it no where




Any assistance would be greatly appreciated




 

 

 

 

 

  my $DataCenterView = Vim::find_entity_view( view_type => 'Datacenter' , filter => { name => 'xxx-DC' } );

  #

  my $vmFolder_ref = $DataCenterView -> vmFolder;

#

  my $vmFolder = Vim::get_view( mo_ref => $vmFolder_ref );

  my $folderName = $vmFolder -> name;

 

  my $dataCenter = Vim::find_entity_view ( view_type => 'Datacenter' , filter => { name => 'xxx-DC' } );

  my $vmFolder2 = $dataCenter -> vmFolder;

  $vmFolder2 = Vim::get_view( mo_ref => $vmFolder2 );

 

  my $childEntities = $vmFolder -> childEntity;

  my $holdOne;

  foreach( @$childEntities ) {

  my $thisFolder = Vim::get_view( mo_ref => $_ );

  my $theVMs = $thisFolder -> childEntity;

 

  foreach( @$theVMs ) {

  $holdOne = $_;

  last;

  }

 

  print " get this far \n";

  last;

  }

 

  my $EC = VAppEntityConfigInfo -> new(

  key => $holdOne ,

  startAction => 'powerOn' ,

  startDelay => 5 ,

  startOrder => 0 ,

  stopAction => 'guestShutdown' ,

  stopDelay => 0 ,

  waitingForGuest => 'false' ,

  tag => 'noTag'

  );

 

  my @entityArray;

  push( @entityArray , $EC );

 

  my $vappEntity = Vim::find_entity_view ( view_type => 'VirtualApp' , filter => { name => 'testV' } );

  my $vappName = $vappEntity -> name;

  print " what is this $vappName \n";

  my $configSpec2 = VAppConfigSpec -> new( annotation => 'myVapp' , entityConfig => \@entityArray );

 

  $vappEntity -> UpdateVAppConfig( spec => $configSpec2 );

 

 

 

 

 

 

 

connected

get this far

what is this testV

 

 

SOAP Fault:

-----------

Fault string: A specified parameter is not correct.

entityConfig.key[vim.VirtualMachine:vm-54]

Fault detail: InvalidIndexArgumentFault

End Disconnect

Single sign on in vCenter environment

$
0
0



Hi,


I am writing a service to manage virtual machines storage through vSphere SDK. I have service running on one machine which connects to vCenter server and performs WS calls. 


I also have vSphere web client plugin. This plugin communicates with above service. 


How can I use samlTokenXml to pass it to the service so it can authenticate with vCenter environment?


As I can see it is a holder of key token and it has ProxyRestriction 0. Does this mean it cannot be passed as is to the service? If not how to issue another token from web client plugin and pass it to the service?


I checked SSO API and from samples I see that in order to issue HoK token I need original signing key and certificate. Is that also true?


Thanks


Alex

Viewing all 1860 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>