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

Multiple vlan for a port group

$
0
0

Is it possible to configure multiple vlan in a vswitch for a port group.


C# Using Single SignOn (SSPI) for Virtual Center 2.5.0.119598

$
0
0

I am trying to use passthru authentication using SSPI to work in my c# application. Here is a snippet of the code I am trying to get to work.

 

returns a reference for VMware.Vim.SessionManager

 

VMware.Vim.VimClient vimClient = new VMware.Vim.VimClient();

vimClient.Connect("10.x.x.x", CommunicationProtocol.Https, 443);

 

ManagedObjectReference serviceInstance = new ManagedObjectReference();

serviceInstance.Type = "ServiceInstance";

serviceInstance.Value = "ServiceInstance";

 

SessionManager sm = new SessionManager(vimClient, serviceInstance);

sm.LoginBySSPI(ct_b64, null);

 

I get an exception when I try to call this method LoginBySSPI

 

I am not sure that this is the correct approach, but I really would like to be able to login using single signon in my c# code but not having much success.

This works fine using PowerShell but I want to be able to do this directly using c# without using PS Pipelines.

 

 

Any suggesstions welcome.

 

 

Thanks

Use the method "addAuthorizationRole" to add the roles with same name successfully

$
0
0

I called the method  "addAuthorizationRole" to add a role named "testRole" twice. In the vCenter Server 6.0, "AlreadyExists" fault occured. but in the vCenter Server 5.1&5.5, I can add  the roles with same name successfully, is it a bug of vCenter Server 5.1&5.5?

Error in SSOConnect method - 'Vim25Api.VimService' does not contain a definition for 'SetPolicy'

$
0
0

Downloaded the latest build VMware-vSphere-SDK-5.5.0-1284541.zip from here

 

Made sure vCenter server version is 5.5 and local vSphere Client 5.5 is connecting to host with no issues.

 

Followed the instructions to create the following using Visual Studio 2008 command prompt

a. STSService.cs and dll

b. Vim25Service and VimService

 

The samples does not compile with the following error in the SSO Connect method in SvcConnection.cs in AppUtil project.

Error message:

'Vim25Api.VimService' does not contain a definition for 'SetPolicy' and no extension method 'SetPolicy' accepting a first argument of type 'Vim25Api.VimService' could be found (are you missing a using directive or an assembly reference?)   

File C:\Temp\VMware-vSphere-SDK-5.5.0-1284541\SDK\vsphere-ws\dotnet\cs\samples\AppUtil\SvcConnection.cs   

Line 263    Column 22    Project AppUtil

 

Here is method that

     public void SSOConnect(XmlElement token, string url)

        {

            if (_service != null)

            {

                Disconnect();

            }

 

            _service = new VimService();

            _service.Url = url;

            _service.Timeout = 600000; //The value can be set to some higher value also.

            _service.CookieContainer = new System.Net.CookieContainer();

          .

          .

          .

            //Setting up the security policy for the request

            Policy policySAML = new Policy();

            policySAML.Assertions.Add(customSecurityAssertion);

 

            // Setting policy of the service

           _service.SetPolicy(policySAML);

 

            _sic = _service.RetrieveServiceContent(_svcRef);

          .

          .

          .

     }


Appreciate any help in resolving this issue.

Is VMware-vSphere-SDK-6.0.0-2561048 supported on Jboss, getting the error at javax.xml.ws.Service.(Service.java:77) at com.vmware.vim25.VimService.(Unknown Source)

$
0
0

I am trying to use VMware-vSphere-SDK-6.0.0-2561048 to upgrade our existing Vmware SDK 4.x in our product. Our product is hosted on JBoss server. After using VMware SDK 6, I am getting the below error. Please suggest a solution to fix this problem.

 

 

 

Caused by: java.lang.AbstractMethodError

  at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.getDocument(WSDLDefinitionsFactory.java:175)

  at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:109)

  at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)

  at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:96)

  at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:75)

  at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:154)

  at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:125)

  at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:114)

  at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:128)

  at javax.xml.ws.Service.<init>(Service.java:77)

  at com.vmware.vim25.VimService.<init>(Unknown Source)

vSphere Management SDK url is just blank page

$
0
0

I'm trying to get started using the vSphere API, reading the document at the link below I should be able to browse to my vcenter using "sdk" in the URL but it's blank. Also I read that you have to download the root certificates, but that link is not where this document claims it is. I'm using 5.5

https://vdc-download.vmware.com/vmwb-repository/dcr-public/2d445149-7707-4c7d-98a7-9f00394b7df2/7322d611-ef3b-454a-ab63-ad3302d8b218/SDK/vsphere-ws/docs/SDK-README.html

Do I need to enable this SDK in vCenter?

Error ”Property is not user configurable” when importing OVF package

$
0
0

Hi,

 

I have a working functionality for importing OVF package in 5.1 and 5.5 but it fails for vCenter 6.0.

The functionality is similar to what mentioned here:

https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.wssdk.pg.doc/PG_VirtualApplications.14.6.html

 

The HttpNfcLease is returning following LocalizedMethodFault for one of the property(CustomeRole) in the OVF Descriptor:

 

Fault:        NonUserConfigurableProperty

Message:  Property CustomRole is not user configurable.

 

I checked the OVF Descriptor for this property and the value for userConfigurable is false.


But the OVF package gets imported successfully when I make userConfigurable true.

 

What has changed for 6.0 that’s making it fail and was working for 5.1 and 5.5?

 

Could somebody guide to possible cause and resolution for the issue?

How can I clone and customize a template using Java vSphere SDK?

$
0
0

I am running a vCenter 6.0 server with a few RedHat Linux 7.x templates.

I am writing a program which must be able to deploy VMs from these templates with customized hostnames and IP addresses.

Using the sample VMClone.java causes the vCenter to log the error:

"A specified parameter was not correct: spec.location.pool"

I am assuming this is because I have to explicitly define the resource pool to use, though the only code the sample has regarding VM specs is:

private VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
private VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

It appears that the VirtualMachineRelocateSpec object is what defines the resource pool and has methods to change it, though I cannot find any documentation on how exactly  to change the pool.

 

Any help on fixing this error and customizing the hostname and IP during cloning would be greatly appreciated.

private VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
    private VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

How to export efficiently the configuration of VM

$
0
0

Hello,

 

I need to export the hardware configuration (VirtualMachineConfigInfo) of a VM and create a VirtualMachineConfigSpec object by using the extracted infomation.

 

However, both objects are quite complicated, which contains lots of properties and objects of other types.

 

I'd like to know if there is an efficient way, a built-in method, which can export hardware configuration from a virtual machine easily,

or I really have to do it manually, which means, by traversing all the properties of the class VirtualMachineConfigInfo.

 

Thanks.

.NET Hok Sample : STSService returns incorrect TokenKey

$
0
0

Has anyone successfully got the .Net HoK sample working with the vSphere SDK and web services?  I have been struggling with Issuing tokens and like to bounce some ideas and code off of some folks.

Anyone out there with this type of experience?

GuestOSIds for different editions.

$
0
0

VMware mentioned different GuestOSids for different OSs with different Editions in below link. But in CreateVM task through vSphere client shows only basic OS names and with OS editions like 'Windows Server 2003, Enterprise Edition' so, how VMware manages GuestOSId for all OS names having editions?

http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html

 

EX:

CreateVm tasks select OS as 'Microsoft Windows Server 2003 (64 bit)'

Provide ISO of 'Windows Server 2003, Standard Edition (64 bit)'

 

will this VM work successfully?

GPU Utiliation statistics in vSphere API?

$
0
0

Hi,

I have an vsphere server 6.0 with nvidia grid cards. I want to take utilization statistics for GPU using vSphere java sdk. I have checked vsphere api and found HostGraphicsInfo object which will gives some basic informations but I need utilization statistics like volatile utilization and more. Where can i get this info from vsphere api.?

 

Thanks & Regards,

karthika

GPU Utilization statistics in vsphere api?

$
0
0

Hi,

I have an vsphere server 6.0 with nvidia grid cards. I want to take utilization statistics for GPU using vSphere java sdk. I have checked vsphere api and found HostGraphicsInfo object which will gives some basic information but I need utilization statistics like volatile utilization and more. Where can i get this info from vsphere api.?

 

Thanks & Regards,

karthika

QUeue depth utilization for storage adapter

Device Performance Monitor- can we get DQLEN, QUED, %USD and LOAD from Vmware vSphere Web Service SDK

$
0
0

Can we get device DQLEN, QUED, %USD and LOAD from Vmware Web Service SDK, similar to what we have through esxtop?


Cannot find the declaration of element RetrieveServiceContent.

$
0
0

Has anyone seen this error?  It occurs on this line of code:

_sic = _service.RetrieveServiceContent(_svcRef);

VimException Timeout, Session no longer exist

$
0
0

Hi Everyone,

      I am writing VIMAPI via vb.net and after the application launches and calls to connect to my VCenter server via Client.Connect and SSPIHelper. Approximately 60 minutes of runtime and a call to a VIMAPI function a VIMException occurs for Unauthorized use. This is due to the current session time for the VIMAPI. Is there a function I can call to check to see if the current session is alive and well and call to reauthorize if needed?

[code]

   Try

                sc = Client.Connect("https://virtualcenter/sdk")

            Catch ex As Exception

                MsgBox(ex.Message)

                Return False

            End Try

 

            SessMgr = Client.GetView(Client.ServiceContent.SessionManager, Nothing)

 

            If Not LoginToVirtualCenter(Username, Password) Then

                Return False

            End If

 

Private Function LoginToVirtualCenter(Optional ByVal Username As String = Nothing, Optional ByVal Password As String = Nothing) As Boolean

        If Username Is Nothing And Password Is Nothing Then

            Dim SSPIClient As SspiClients = New SspiClients("", SspiPackageType.NTLM)

            Dim SSPI As New VMware.Vim.SSPIAuthentication

 

            Try

                Dim SH As New SspiHelper("host/MyServer.MyDomain.Com@MyDomain.Com")

                Dim MyToken As Byte()

                Dim MyServerToken As Byte()

                Dim ContinueProcessing As Boolean = True

                SH.InitializeClient(MyToken, MyServerToken, ContinueProcessing)

                UserSess = SessMgr.LoginBySSPI(Convert.ToBase64String(MyToken), "en")

            Catch ex As VimException

                Debug.WriteLine("Exception")

                Dim MySSPIChallange As SSPIChallenge = ex.MethodFault

                Try

                    SSPIClient.Initialize(Convert.FromBase64String(MySSPIChallange.Base64Token))

                    Try

                        UserSess = SessMgr.LoginBySSPI(Convert.ToBase64String(SSPIClient.Token), "en")

                        Return True

                    Catch exab As VimException

                        Debug.WriteLine("NTLM AUTH FAILED TRYING WITH CREDS") ' Not sure why this happens on other machines?

                        Return LoadVirtualCenter(GVSphereUsername, GVSpherePassword)

                    Catch exabc As Exception

                        Console.WriteLine(exabc.Message)

                        Debug.WriteLine("exabc")

                    End Try

                    Return False

                Catch e As Exception

                    MsgBox(e.Message)

                    Return False

                End Try

            End Try

        Else

            UserSess = Client.Login("MyDomain\" & Username, Password)

        End If

 

        Return True

    End Function

[/code]

   Try
                sc = Client.Connect("https://virtualcenter/sdk")
            Catch ex As Exception
                MsgBox(ex.Message)
                Return False
            End Try
 
            SessMgr = Client.GetView(Client.ServiceContent.SessionManager, Nothing)
 
            If Not LoginToVirtualCenter(Username, Password) Then
                Return False
            End If
 
Private Function LoginToVirtualCenter(Optional ByVal Username As String = Nothing, Optional ByVal Password As String = Nothing) As Boolean
        If Username Is Nothing And Password Is Nothing Then
            Dim SSPIClient As SspiClients = New SspiClients("", SspiPackageType.NTLM)
            Dim SSPI As New VMware.Vim.SSPIAuthentication
 
            Try
                Dim SH As New SspiHelper("host/MyServer.MyDomain.Com@MyDomain.Com")
                Dim MyToken As Byte()
                Dim MyServerToken As Byte()
                Dim ContinueProcessing As Boolean = True
                SH.InitializeClient(MyToken, MyServerToken, ContinueProcessing)
                UserSess = SessMgr.LoginBySSPI(Convert.ToBase64String(MyToken), "en")
            Catch ex As VimException
                Debug.WriteLine("Exception")
                Dim MySSPIChallange As SSPIChallenge = ex.MethodFault
                Try
                    SSPIClient.Initialize(Convert.FromBase64String(MySSPIChallange.Base64Token))
                    Try
                        UserSess = SessMgr.LoginBySSPI(Convert.ToBase64String(SSPIClient.Token), "en")
                        Return True
                    Catch exab As VimException
                        Debug.WriteLine("NTLM AUTH FAILED TRYING WITH CREDS") ' Not sure why this happens on other machines?
                        Return LoadVirtualCenter(GVSphereUsername, GVSpherePassword)
                    Catch exabc As Exception
                        Console.WriteLine(exabc.Message)
                        Debug.WriteLine("exabc")
                    End Try
                    Return False
                Catch e As Exception
                    MsgBox(e.Message)
                    Return False
                End Try
            End Try
        Else
            UserSess = Client.Login("MyDomain\" & Username, Password)
        End If
 
        Return True
    End Function

Checking task status via SOAP

$
0
0

I'm using SOAP to launch a vMotion using the RelocateVM_Task or MigrateVM_Task methods successfully which returns a MORef like 'task-123'.

 

But what method is available to check the status of this task? There doesn't seem to be an obvious method available and everything I've tried so far fails.

 

Any suggestions appreciated.

 

Thanks.

C# CloneVM_Task Network Not Connected

$
0
0

Ok, so I would like to be able to clone a vm and have it's network come up already connected, and I feel I'm missing something incredibly simple.

 

https://github.com/jeffpatton1971/mod-vmware/blob/master/VMware/functions.cs#L402

 

That is where my clone code starts up, at line 539 I create my virtual network card. I loop through the devices in the source vm (one i'm cloning from) until I get to the network card that is attached to it. Yes, I know there could be multiple, in our environment we clone from specific machines and they only ever have one nic. I assign that device to my newly created network card. I create my devicespec and set it to edit and assing my network card to the device (I've recently updated this code a little, I now instantiate a virtualvmxnet3 object instead of virtualdevice object). I continue on my merry way assigning a new ip address, connecting it up to the proper vlan on the proper switch.

 

At line 600 I create a new connectinfo object, and set the device to be connected at startup, guest controlled and connected.

 

the clone happens just fine, I browse over to the vm and the network interface shows as not connected.

 

How can I programmatically connect this device to the network?

 

Thanks for checking this out!

Thumbprint mismatch

$
0
0

The Plugin does not work when we use VMCA to generate the certificate. I have used the certificate manager utility to generate the certificates and followed the link vSphere 6.0 Documentation Center. I have used the the 4th option "install the root certificates and replace all the certificates".

The root cause analysis suggests the following:

The plugin stores a list of valid thumbprints of all the servers present in the Vcenter using the Vcenter Api com.vmware.vise.usersession.ServerInfo.thumbprint. The list of thumbprints are not getting updated even after updating the certificates of the server using VMCA. So when the plugin tries to connect to the VCenter server it returns the updated thumbprint but it is not found in the list of valid thumbprints. The plugin throws the exception that the thumbprint does not match.

Steps tried:

  1. Used the latest Vcenter 6.0 WebClient  vsphere-client-lib.jar to build the java project and deploy in Vcenter.

  2. Restarted all the vmware services using service-control --start --all

  3. Restarted the Vcenter Server.

  4. Cleared the browser cache.

  5. Unregistered and registered the plugin.

  6. Used the certool CLI  to manually create the certificates and vecs-cli to add it to VECS.

 

Clarifications required:

  1. Need to know if there are any post-installation steps which needs to be performed.

  2. The folder C:\ProgramData\VMware\vCenterServer\cfg\sso\keys still contains the old certificates. Is there a way to update them?

  3. Any apis available to refresh the serverInfo?

Viewing all 1860 articles
Browse latest View live


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