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

How can I bypath the Root CA when using HTML Console?

$
0
0

I want users to see their HTML console directly without installing root CA on their computers.

I have been using vim25(JAVA) for developing.

Is there a way to bypath the Root CA when using HTML Console?

Thank you for reading!


SOAP 'Login': Cannot complete login due to an incorrect user name or password

$
0
0

Hello all --

 

I'm attempting to perform a 'Login' SOAP method, but am receiving a ServerFaultCode with the string of "Cannot complete login due to an incorrect user name or password." The username and password are correct (I can login via HTML or Flash management or via the REST API with the same credentials).

 

My flow is as follows:

>> Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:RetrieveServiceContent>

         <urn:_this>ServiceInstance</urn:_this>

      </urn:RetrieveServiceContent>

   </soapenv:Body>

</soapenv:Envelope>

 

<< Response

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <RetrieveServiceContentResponse xmlns="urn:vim25">

         <returnval>

            <rootFolder type="Folder">ha-folder-root</rootFolder>

            <propertyCollector type="PropertyCollector">ha-property-collector</propertyCollector>

            <viewManager type="ViewManager">ViewManager</viewManager>

            <about>

               <name>VMware Workstation</name>

               <fullName>VMware Workstation 14.0.0 build-6661328</fullName>

               <vendor>VMware, Inc.</vendor>

               <version>14.0.0</version>

               <build>6661328</build>

               <localeVersion>INTL</localeVersion>

               <localeBuild></localeBuild>

               <osType>linux-x64</osType>

               <productLineId>ws</productLineId>

               <apiType>HostAgent</apiType>

               <apiVersion>r30428</apiVersion>

               <licenseProductName>VMware Workstation</licenseProductName>

               <licenseProductVersion>14.0</licenseProductVersion>

            </about>

            <setting type="OptionManager">HostAgentSettings</setting>

            <userDirectory type="UserDirectory">ha-user-directory</userDirectory>

            <sessionManager type="SessionManager">ha-sessionmgr</sessionManager>

            <authorizationManager type="AuthorizationManager">ha-authmgr</authorizationManager>

            <eventManager type="EventManager">ha-eventmgr</eventManager>

            <taskManager type="TaskManager">ha-taskmgr</taskManager>

            <diagnosticManager type="DiagnosticManager">ha-diagnosticmgr</diagnosticManager>

            <licenseManager type="LicenseManager">ha-license-manager</licenseManager>

            <searchIndex type="SearchIndex">ha-searchindex</searchIndex>

            <fileManager type="FileManager">ha-nfc-file-manager</fileManager>

            <ovfManager type="OvfManager">ha-ovf-manager</ovfManager>

            <localizationManager type="LocalizationManager">ha-l10n-manager</localizationManager>

            <storageResourceManager type="StorageResourceManager">ha-storage-resource-manager</storageResourceManager>

         </returnval>

      </RetrieveServiceContentResponse>

   </soapenv:Body>

</soapenv:Envelope>

 

>> Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:Login>

         <urn:_this type="SessionManager">ha-sessionmgr</urn:_this>

         <urn:userName>administrator@myhost.com</urn:userName>

         <urn:password>supersecretpassword</urn:password>

      </urn:Login>

   </soapenv:Body>

</soapenv:Envelope>

 

<< Response

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <soapenv:Fault>

         <faultcode>ServerFaultCode</faultcode>

         <faultstring>Cannot complete login due to an incorrect user name or password.</faultstring>

         <detail>

            <InvalidLoginFault xsi:type="InvalidLogin" xmlns="urn:vim25"/>

         </detail>

      </soapenv:Fault>

   </soapenv:Body>

</soapenv:Envelope>

 

Can someone point out what's wrong here? Everything seems OK according to docs.

 

Thanks for any help!

vSphere SDK / API wmks.min.js Idle Timeout

$
0
0

Hi there,

 

We have developed our own client portal for various reason beyond the scope of this discussion, however we have hit a snag and I would greatly appreciate any input or assistance in this regard:

 

The problem we are experiencing is that when a customer opens a console screen to his VM but is not active on it that it automatically closes the session after about 30 seconds. I have tested this where I opened a session just Desktop with explorer window open on a VM then it disconnects after 30 seconds. If however I open a command prompt and do a simple localhost ping then the console screen stays open for 2 hours with zero other interaction with the console.

 

We are using WMKS.buildNumber = "4504321", WMKS.version = "2.1.0"

 

We are not able to find anything that is forcing this disconnect nor any parameter to send when connecting to the console to keep it open for N minutes. I.e. unable to set an Idle Timeout.

 

Any help or pointers in this regard would be massively appreciated.

 

Regards,

Riaan

 

EDIT: We are not using vCloud director at all, this is a vanilla portal using vCenter v6 APIs only.

 

Thanks much for any assistance.

Rest Java - VM creation

$
0
0

1. Is it possible to create VM with template configuration using REST Java?

2. Is it possible to apply OS customization on VM using REST Java ?

vSphere SDK windows authentication

$
0
0

Hi,

 

I'm using .NET c# and so far I'm connection to the vCenter in next way:

 

VimClient client1 = new VimClient();

client1.Connect("https://<hostname>/sdk");

client1.Login("user", "pass");

 

However, since from vShpere client is possible to use windows authentication I suppose that somehow I can manage to do it from my implementation as well, but I couldn't find how to do it.

 

 

Is somebody know how I can do it from the code?

 

Thank you,

dragon

how can i use Python script to login to config network information?

$
0
0

guys,i got a question here: when i finished building a esxi vm through vCenter and installed an OS,can i or how to use Python code to login to config network service? any help?much thanks  

Attach vmware tools image to PXE booted host

$
0
0

I am trying to boot my host using PXE, as I need to change the image frequently.

But the problem is, I don't see any vmware-tools image attached to the host.

Which in turn, gives me error whenever I try to install or upgrade the tools on vm.

 

so is there a way I can do it programmatically, so once host are booted, vmware tools image can be attached to the host.

CloneVM_Task throws error "The request refers to an unexpected or unknown type."

$
0
0

Hi,

 

I trying to Clone a VM, It works perfect when i specify host managed object Reference(MOR) in VirtualMachineRelocateSpec.

 

http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.vm.RelocateSpec.html

 

When i try with Cluster managed object Reference (MOR) I'm getting this error "The request refers to an unexpected or unknown type."

 

   // Get clone specifications

  VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

     relocSpec.datastore = targetDataStore;

 

     relocSpec.pool = resourcePoolRootRef;

 

// assgining cluster compute resource pool...

 

relocSpec.host = hostParentCompResRef;

 

If i change it to Host it works fine...

relocSpec.host = hostRef;

 

I don't want to specify particular host, the Cluster is DRS enabled ....

 

Still I get this error can anyone help...

 

Anand.

 

 

 

 

 


Get ESXi local filesystem details like capacity and freespace

PowerCLI 6.3 changes with VimClient.Connect() for C# - SSL/TLS Error

$
0
0

I have been developing a c# app and was using the VMWare.Vim DLL from PowerCLI 6.0. I updated my PowerCLI and now i am unable to connect to the vCenter. The connection now throws an error of "The underlying connection was closed: could not establish trust relationship for the SSL/TLS secure channel". I never had this problem before i upgraded PowerCLI. Is there a way to disable checking the certificate?

 

Thanks

can not find HostSystem mob on vpshere mob webpage.

$
0
0

Hello,

 

     I am trying to check some iscsi infomation, I followed this discussion How to get the iscsi initiator name(iqn) of esx using vsphere sdk , I login into the (version 6.0) vcenter's mob webpage and entered ServiceContent entity, but I can not find HostSystem entity.

    anyone knows where is the HostSystem entity is ? please help , thanks in advance.

 

     this is what my ServiceContent shown.

72CE4C86-6730-4585-9105-F4CA0B8C86BC.jpg

Get cluster name from VM with API via python script

$
0
0

I have a script to get a few details from VMware VSphere 6.0 on my VMs using a python script, but can't seem to find the cluster name anywhere with regards to a VM. My python script looks like this

 

from __future__ import print_function

import atexit

import creds

from pyVim.connect import SmartConnectNoSSL, Disconnect

from pyVmomi import vim

from tools import cli

 

 

 

 

MAX_DEPTH = 10

 

 

vm_info = []

 

def printvminfo(vm, depth=1):

 

 

    if hasattr(vm, 'childEntity'):

        if depth > MAX_DEPTH:

            return

        vmlist = vm.childEntity

        for child in vmlist:

            printvminfo(child, depth+1)

        return

   

    network = vm.network

    summary = vm.summary

    hardware = vm.config.hardware.device

  

    test = {}

    mac_addresses = []

 

 

    test['name'] = summary.config.name

    test['vCPU'] = summary.config.numCpu

    test['memory'] = summary.config.memorySizeMB

    test['IP'] = summary.guest.ipAddress

    for d in hardware:

        if hasattr(d, 'macAddress'):

            mac_addresses.append(d.macAddress)

        test['mac'] = mac_addresses

        if isinstance(d, vim.vm.device.VirtualDisk):

    #disk_gb = d.capacityInKB / 1024 / 1024

            test['disksizeGB'] = int((d.capacityInKB / 1024 / 1024))

 

    vm_info.append(test)

 

 

def get_vm_stuff():

    print(vm_info)

 

 

def main():

    si = None

 

    host = creds.host

    user = creds.user

    password = creds.password

 

 

    try:

        si = SmartConnectNoSSL(host=host,

                               user=user,

                               pwd=password)

        atexit.register(Disconnect, si)

    except vim.fault.InvalidLogin:

        raise SystemExit("Unable to connect to host "

                         "with supplied credentials.")

    content = si.RetrieveContent()

 

    for child in content.rootFolder.childEntity:

        if hasattr(child, 'vmFolder'):

            datacenter = child

            vmfolder = datacenter.vmFolder

            vmlist = vmfolder.childEntity

 

 

            for vm in vmlist:

                printvminfo(vm)

 

 

    get_vm_stuff()

 

 

 

 

if __name__ == "__main__":

    main()

 

Is there anyway I can return the cluster name for a VM from the vmFolder directory?

Noob trying to create simple C# exe from SDK, can't find apputil.dll

$
0
0

I'm a fairly proficient C# and C++ Windows developer, and I'm getting started with this whole SDK.

 

Not being sure which one I need, so I downloaded VMware-vSphereSDK-6.5.0-4571253. The samples, even the main sample, in the "SDK\VMware-vSphereSDK-6.5.0-4571253\SDK\vsphere-ws\dotnet\cs" folder, won't build.

 

I ran the VMware PowerCLI powershell installation and was able to get VimService65.dll.

 

However, there is no apputil.dll. There is a vmapputil.dll, but that cannot be loaded as a Reference in Visual Studio 2017 b/c it complains it's not a COM component.

 

Any help to help me get started is much appreciated.

How to set properties OVF properties?

$
0
0

I'm trying to use vSphere Management SDK using Java to install NSX Manager.

Normally when we manually install NSX Manager, we set the Admin and Privilaged Mode password. I was wondering how to do this using vSphere Management SDK. Can someone help me with this?

Expanding VMDK in 6.5 with c#

$
0
0

I would like to expand a VMDK on a VM in our 6.5 environment via the c# Management SDK, and if I understand the documentation correctly the best way to do this would be to leverage HostExtendDisk_Task from HostVStorageObjectManager. The problem i'm having is how do I get the HostVStorageObjectManager object?  I have a feeling my method is close but I just can't figure it out Here is what i'm trying, but it is failing on a type conversion so it's definitely not correct. Do I need to get it from the VM host somehow?

HostVStorageObjectManager vDiskMan = (HostVStorageObjectManager)vimClient.GetView(vimClient.ServiceContent.VStorageObjectManager, null);

Any help is appreciated


Custom events not formatting correctly with WSSDK 5.1

$
0
0

Hello,

 

I'm registering an extension using the VMware vSphere Web Services SDK. The custom tasks and faults I've defined are displayed correctly on the VMware vSphere Client, as well as the vSphere Web Client. The events I defined used to be displayed correctly in both, but when I converted my code from the 5.0 release to 5.1, they are no longer being shown correctly.

 

Instead of seeing something like, "Type: info" and "Description: This is the full format message", the event now looks something like, "Type: XXX Company.Product.CustomEvent.category not found XXX" and "Description: event.Company.Product.CustomEvent.fullFormat (Company.Product.CustomEvent)".

 

The code to register the extension is similar to the following, with some parts omitted, since the tasks and faults are working OK:

 

import com.vmware.vim25.*;

 

public static final String EXTENSION_KEY = "Company.Product";
public static final String CUSTOM_EVENT = EXTENSION_KEY + ".CustomEvent";

 

Extension extension = new Extension();

 

ExtensionEventTypeInfo customEventInfo = new ExtensionEventTypeInfo();
customEventInfo.setEventID(CUSTOM_EVENT);
extension.getEventList().add(customEventInfo);

 

ExtensionResourceInfo customEventResourceInfo = new ExtensionResourceInfo();
customEventResourceInfo.setLocale("en");
customEventResourceInfo.setModule("event");

 

KeyValue customEventCategory = new KeyValue();
customEventCategory.setKey(CUSTOM_EVENT + ".category");
customEventCategory.setValue("info");
customEventResourceInfo.getData().add(customEventCategory);

 

KeyValue customEventLabel = new KeyValue();
customEventLabel.setKey(CUSTOM_EVENT + ".label");
customEventLabel.setValue("This is the label");
customEventResourceInfo.getData().add(customEventLabel);

 

KeyValue customEventSummary = new KeyValue();
customEventSummary.setKey(CUSTOM_EVENT + ".summary");
customEventSummary.setValue("This is the summary");
customEventResourceInfo.getData().add(customEventSummary);

 

KeyValue customEventFormat = new KeyValue();
customEventFormat.setKey(CUSTOM_EVENT + ".fullFormat");
customEventFormat.setValue("This is the full format message");
customEventResourceInfo.getData().add(customEventFormat);

 


The main difference between this and my previous version of the extension is the change to Lists that I need to retrieve before adding objects, instead of adding array of objects.

 

The code I use to create the events looks similar to:

 

ExtendedEvent event = new ExtendedEvent();
event.setEventTypeId(CUSTOM_EVENT);
event.setManagedObject(moRef);
event.setUserName(user);
event.setChainId(taskInfo.getEventChainId());
event.setKey(0);
event.setMessage("This is a non-localized message");
event.setCreatedTime(xmlGregCal);

 

vimPort.postEvent(eventManagerMOR, event, taskInfo);

 


This part of the code has also changed a little from the 5.0 version of the SDK to the 5.1 version, such as the use of XMLGregorianCalendar for the created time.

 

I've tried prefixing the keys for the resource information with "event." but this didn't fix the problem. I didn't have to change much to get the custom tasks and faults to work with 5.1, but that doesn't seem to be the case with events. Does anyone know what other changes need to be made for events to be displayed correctly?

 

Thanks,

Need help with SOAP request for guest operations

$
0
0

I'm working on a php script to do some automation. This is using the standard SOAP/WSDL and PHP. Mostly things are going well, but I have ran into an issue with guest operations. Can anyone either post the XML request/response or give an example using the MOB. I've been working with listFilesInGuest, but anything will do. I just need to understand how the guest authorization works. I've been able to use pyvmomi to get this, but I can't seem to figure out how to output the request/response in python. My requirement is for PHP so I can't move to python either.

 

Any help is greatly appreciated.

Vcenter SOAP API call HELP

$
0
0

Hi Guys

Could you guide or provide sample SOAP xml to create datastore cluster or Create cluster using SOAP API call. I am able to create datacenter using SOAP API call, but i am unable to perform any other additional operation using SOAP API Call..

 

Could you please let me know any documentation available to create SOAP call for the vcenter basic operation . Thanks

vCenter API description about instance for virtual disk performance counter "totalReadLatency"

$
0
0

We are invoking queryPerf method (vCenter API) and trying to get virtual disk performance parameter "totalReadLatency". In queryPerf output, we are getting "scsi0:0" and "scsi0:1" as instance for totalReadLatency performance counter. Can you please add more information about instance for virtual disk counters?

By instance I am referring to - https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.PerformanceManager.MetricId.html#instance

 

We are not able to identify "scsi0:0" is referring to which virtual disk. From DataObject - VirtualHardware, we are getting virtual disk key as 2000 and 2001. Is there any relation between scsi0:0 and 2000?

We are also getting unitNumber on VirtualHardware as 0 and 1. Does it resemble anything out of scsci0:0 and scsi0:1?

 

Please provide more information about instance or let us know if we are looking at wrong parameters

vvol datastore became inactive

$
0
0

 

Hello there

 

After we registered our VASA Provider to the webclient(Version 6.5.0 Build 4240420),we successfully created datastores.

But after we refreshing the datastores,their status came into "inactive" and the capacity was "0.00B"

 

We searched the vvold logs and found something below:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap: https://100.115.195.31:18543/XXXXXX/vasaService session state (TransportError) - recreating soap

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap: Soap client deleted successfully

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap: Master soap client created successfully

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap: _masterSoap=02c70940, iomode=33558544

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap VVold using 15 secs for soap connect timeout

2016-10-18T03:39:45.704Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::InitSoap VVold using 75 secs for soap receive timeout

2016-10-18T03:39:46.270Z warning vvold[6039B70] [Originator@6876 sub=Default] vvol_ssl_auth_init: Will skip CRL check as env variable VVOLD_DO_CRL_CHECK is not set!

2016-10-18T03:39:46.270Z info vvold[6039B70] [Originator@6876 sub=Default] VasaSession::KillAllConnections VP (vvol), purged 0 connections, 0 currently active, new genId (2978) (broadcast wakeup to all threads waiting for free connection)

2016-10-18T03:39:46.287Z error vvold[6039B70] [Originator@6876 sub=Default] VasaSession::DoSetContext: setContext for VP vvol (url: https://100.115.195.31:18543/XXXXXXX/vasaService) failed [connectionState: AuthorizationError]: INVALID_LOGIN (SSL_ERROR_SSL

--> error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small / SSL_connect error in tcp_connect())

2016-10-18T03:39:46.287Z error vvold[6039B70] [Originator@6876 sub=Default]

--> VasaOp::ThrowFromSessionError [#21779]: ===> FINAL FAILURE getEvents, error (INVALID_SESSION / Bad session state (TransportError)) VP (vvol) Container (vvol) timeElapsed=583 msecs (#outstanding 0)

2016-10-18T03:39:46.287Z error vvold[6039B70] [Originator@6876 sub=Default] VasaSession::EventPollerCB VP vvol: getEvents failed (INVALID_SESSION, Bad session state (TransportError)) [session state: TransportError]

2016-10-18T03:40:15.540Z info vvold[5FF8B70] [Originator@6876 sub=Default] VVolUnbindManager::UnbindIdleVVols called

2016-10-18T03:40:15.540Z info vvold[5FF8B70] [Originator@6876 sub=Default] VVolUnbindManager::UnbindIdleVVols done for 0 VVols

2016-10-18T03:40:16.297Z info vvold[5B97B70] [Originator@6876 sub=Default]

--> VasaOp::EventPollerCB [#21781]: ===> Issuing 'getEvents' to VP vvol (#outstanding 0/4) [session state: TransportError]

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

While we executed the ESXcli command of "esxcli storage vvol vasaprovider list "on the ESXi host,we found that the "Status" of the VP was "syncError".

Otherwise,if we run the command of "esxcli storage vvol storagecontainer list",we could see the status of the VVOL datastore was "inaccessible"

 

We didnot quite sure if there was something wrong with the SSL protocol and where need we modify.

Does anybody have any suggestions to this issue please?

Thank you very much!

 

Viewing all 1860 articles
Browse latest View live


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