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

503 Service Unavailable (Error connecting tunnel on named pipe: (null)) (ticket wmks)

$
0
0

Hello, I'm trying to use the html5 sdk console from vmware to externally manage the machines, I have used the sample code and fulfilled the necessary requirements, but I am not getting success in running, it gives the following error 503.

Does anyone know how I can solve it?

 

503 Service Unavailable (Error connecting tunnel on named pipe: (null))

 

Code:

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Console</title>

</head>

<body>

<link rel="stylesheet" type="text/css" href="css/wmks-all.css" />

<script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.min.js"></script>

<script type="text/javascript" src="https://code.jquery.com/ui/1.8.16/jquery-ui.min.js"></script>

<script type="text/javascript" src="wmks.min.js"></script>

<div id="wmksContainer" style="position:absolute;width:100%;height:100%"></div>

<script>

var wmks = WMKS.createWMKS("wmksContainer",{})

.register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, function(event,data){

if(data.state == WMKS.CONST.ConnectionState.CONNECTED){

  console.log("connection state change : connected");}

});

wmks.connect("wss://ip:443/ticket/ticketnumber");

</script>

</body>

</html>

 

Remember that the version of my vmware is 6.0

If someone knows how to solve thank you right away.


Why VMware.Vim dll is not strong name enabled from Power CLI 6.5

$
0
0

Hi,

 

Till 6.5.0 Power CLI, VMware.Vim.dll was strong name enabled dlls. But from 6.5.1, those dll's are not strongly named dll's.

 

In PowerShell gallery based installation also, dll's were not strongly named.

 

Unable to load those dll's into strongly named execution binary.

Hostdiag vCenter extension - severity

$
0
0

Hello,

There is a vCenter extension - hostdiag which sends events of type EventEx. For instance, eventTypeId – “esx.problem.scsi.device.io.latency.high” and severity field is empty string. There is no severity info in ExtensionEventTypeInfo either.

Hovewer vCenter marks those events as warnings somehow (see the attached screenshot). So how does vCenter get this information?

VimService65.dll not found

$
0
0

Hello

I just updated to PowerCLI 6.5.2 as I need access to the VMware.Vim.dll.  After upgrading when I run my code it complains that VimService65.dll is not found.  Before when I used version 6.5.0 there were no issues.  To get this to work I needed to manually add the VimService65.dll to my project.  Is this normal for this version?

vix api to vSphere API

$
0
0

Hi,

 

I have a project which uses vix APIs to manage VMs in Workstation and esxi.

 

After the release of vix1.15, these vix APIs are deprecated and no longer be used to manage VMs present in ESXi.

 

The code was written in c++. Can any one please suggest me on below queries...

 

-     Can any one give suggestion on how to move to vSphere APIs from vix APIs?

-     What are all the additional tools required ? (Like openssl)

-     Is vCenter must for managing VMs in ESXI ? (If we use vix1.15)

 

Since I am new to these things, please correct me if my question is not understandable.

 

Thanks and Regards,

Bhargava

Total bandwidth usage tracking

$
0
0

In VMWare vSphere, how can I set and track the monthly bandwidth usage of each guest? I need to reduce the network speed when bandwidth usage exceeds 90% or so.

 

What are my options?

Knowing datastore name/url pair, how to get the actual datastore?

$
0
0

Hi, 

I collected a list of VirtualMachineConfigInfoDatastoreUrlPair from querying the target vm, is there easy way for me to get to the actual datastore without iterating/searching through the whole inventory?   Thanks in advance.

Help with TraversalSpec

$
0
0

Hello
I trying to retrieve data from a standlone esxi host using c# and the vmware.vim.dll. 
I am trying to do this using the Property Controller along with the TraversalSpec.  The following code is what I have but when I run it I get the following:

"Additional information: A specified parameter was not correct: undefined TraversalSpec name" at the 
ObjectContent[] objs =pCollector.RetrieveProperties(pFss);


Without the TraversalSpec section I can get the maxCollector value if I change the "ipAddress" to "maxCollector" but I'm trying to get the ipAddress that is within the latestEvent property.
This is just a test to see that it works.  So far I cant get the TraversalSpec part to work.

Any help would be appreciated.

public void listTasks(VimClientImpl client)
 
        {
    ManagedObjectReference objRef = new ManagedObjectReference();
 
            objRef.Type = "ServiceInstance";
 
            objRef.Value = "ServiceInstance";
 
 
 
            ServiceContent sc = client.ServiceContent;
 
            
 
            ManagedObjectReference pcMOR = sc.PropertyCollector;
 
            
 
            ManagedObjectReference rootFolderMOR = sc.EventManager;
 
            PropertySpec pSpec = new PropertySpec();
 
            pSpec.All = false;
 
            pSpec.Type = rootFolderMOR.Type;
 
            pSpec.PathSet = (new String[] { "ipAddress" });
 
 
 
            ObjectSpec oSpec = new ObjectSpec();
 
            oSpec.Obj = rootFolderMOR;
 
 
 
            TraversalSpec folderToChild = new TraversalSpec();
 
            folderToChild.Name = "folderToChild";
 
            folderToChild.Type = rootFolderMOR.Type;
 
            folderToChild.Path = "latestEvent";
 
            folderToChild.Skip = false;
 
 
 
            SelectionSpec foldersSSpec = new SelectionSpec();
 
            foldersSSpec.Name = "folderToChild";
 
            SelectionSpec[] ftcArr = new SelectionSpec[] { foldersSSpec };
 
            oSpec.SelectSet = ftcArr;
 
 
 
 
 
            PropertyFilterSpec[] pFss = new PropertyFilterSpec[1];
 
            pFss[0] = new PropertyFilterSpec();
 
            pFss[0].ObjectSet = (new ObjectSpec[] { oSpec });
 
            pFss[0].PropSet = (new PropertySpec[] { pSpec });
 
 
 
            PropertyCollector pCollector = new PropertyCollector(client, pcMOR);
 
 

            //fails at this point

            ObjectContent[] objs =pCollector.RetrieveProperties(pFss);
 
 
 
            if (objs!=null&&objs[0]!=null)
 
            {
 
                for (int i =0; i<objs.Length;i++)
 
                {
 
                    DynamicProperty[] dps = objs[i].PropSet;
 
                    foreach (DynamicProperty d in dps)
 
                    {
 
                        listview1.Items.Add(d.Val);
                    }
 
                }    
 
            }
 
         }
 

Thanks

public void listTasks(VimClientImpl client)
 
        {
    ManagedObjectReference objRef = new ManagedObjectReference();
 
            objRef.Type = "ServiceInstance";
 
            objRef.Value = "ServiceInstance";
 
 
 
            ServiceContent sc = client.ServiceContent;
 
            
 
            ManagedObjectReference pcMOR = sc.PropertyCollector;
 
            
 
            ManagedObjectReference rootFolderMOR = sc.EventManager;
 
 
 
            
 
            
 
            PropertySpec pSpec = new PropertySpec();
 
            pSpec.All = false;
 
            pSpec.Type = rootFolderMOR.Type;
 
            pSpec.PathSet = (new String[] { "ipAddress" });
 
 
 
            ObjectSpec oSpec = new ObjectSpec();
 
            oSpec.Obj = rootFolderMOR;
 
 
 
            TraversalSpec folderToChild = new TraversalSpec();
 
            folderToChild.Name = "folderToChild";
 
            folderToChild.Type = rootFolderMOR.Type;
 
            folderToChild.Path = "latestEvent";
 
            folderToChild.Skip = false;
 
 
 
            SelectionSpec foldersSSpec = new SelectionSpec();
 
            foldersSSpec.Name = "folderToChild";
 
            SelectionSpec[] ftcArr = new SelectionSpec[] { foldersSSpec };
 
            oSpec.SelectSet = ftcArr;
 
 
 
 
 
            PropertyFilterSpec[] pFss = new PropertyFilterSpec[1];
 
            pFss[0] = new PropertyFilterSpec();
 
            pFss[0].ObjectSet = (new ObjectSpec[] { oSpec });
 
            pFss[0].PropSet = (new PropertySpec[] { pSpec });
 
 
 
            PropertyCollector pCollector = new PropertyCollector(client, pcMOR);
 
 
 
            ObjectContent[] objs =pCollector.RetrieveProperties(pFss);
 
 
 
            if (objs!=null&&objs[0]!=null)
 
            {
 
                for (int i =0; i<objs.Length;i++)
 
                {
 
                    DynamicProperty[] dps = objs[i].PropSet;
 
                    foreach (DynamicProperty d in dps)
 
                    {
 
                        
 
                             
 
                        listview1.Items.Add(d.Val);
 
                            
 
                    }
 
                }    
 
            }
 
         }

posting custom events and creating alarms on custom events

$
0
0

I m creating custom event on a VM in the following code.

 

            ExtendedEvent myEvent = newExtendedEvent();

 

            myEvent.chainId = 0;

            myEvent.key = 0;

            myEvent.createdTime = DateTime.Now;

            myEvent.fullFormattedMessage = "This is my first event message";

            myEvent.userName = "Administrator";

            myEvent.message = "This is my first event message";

            myEvent.eventTypeId = "com.my.trial.event1";

            myEvent.managedObject = vmor;// VM

 

            pg.service.PostEvent(pg.sic.eventManager, myEvent, null);

 

 

I can see com.my.trial.event1 displayed in the task and event tab in vSphere client. I have following queries-

1.       Is this correct and all that I need to post an event?

2.       Can somebody elaborate on eventTypeID? Significance of it?

3.    How can I create an alarm for this event? I tried it with  providing com.my.trial.event1 as event in the Triggers tab of Alarm settings dialog while creating new alarm. I tried selecting Suspend VM and Power off Vm actions. But the actions are not executed after this event is posted. L

Traffic shaping per VM, rather than vlan

$
0
0

As per VirtualMachineNetworkShaperInfo I tried to set bandwidth restrictions using Traffic shaping policy on VM using vmware API and it didn't work as expected.

 

Followed the below link,

https://www.vmware.com/support/developer/converter-sdk/conv50_apireference/vim.vm.NetworkShaperInfo.html

I tried to specify VirtualMachineNetworkShaperInfo  on VirtualMachineConfigSpec of CloneVM_Task API to create VM. API worked without any errors but the bandwidth limiting is not working as expected. The traffic shaping is working on vlan, but I want to implement on this per VM.

 

Any thoughts?

I want to use code to implement the function of console in VSphere Client to find that file

$
0
0
I want to use code to implement the function of console in VSphere Client to find that file

c# API getting VM name from MOR

$
0
0

Hello

I am able to get a list of VM's MOR but is there a way to translate that to the actual VM names?

I used the PropertySpec with Traversalspec to get the MOR of the VM's but how do I convert that to the actual names.

I have for example 'VirtualMachine-15'.  I cannot find a way to get the name.

 

I'm using the vmware.vim.dll.

 

Thanks

vSphere Server error: 0x803d0000 : The input data was not in the expected format or did not have the expected value.

$
0
0

Hi,

 

I am trying to connect esxi server using WWSAPI.

 

Generated the client side proxy stubs using WsUtil.exe comes with Microsoft SDK.

 

After setting all the things, when I call proxy stub for CurrentTime/Login (Tried with these two), it returns me with the below error:

0x803d0000 : The input data was not in the expected format or did not have the expected value.

 

Could any one please let me know how to resolve this issue?

 

also any one please suggest me on how to specify the managed object reference type and value attributes for vSphere APIs?

 

Below is the code which I tried:

 

HRESULT             hr  = NOERROR;
WS_ERROR        *   error   = NULL;
WS_HEAP         *   heap= NULL;
WS_SERVICE_PROXY*   proxy   = NULL;

 

// declare and initialize a Windows credential
WS_STRING_WINDOWS_INTEGRATED_AUTH_CREDENTIAL windowsCredential = {}; // zero out the struct

 

windowsCredential.credential.credentialType = WS_STRING_WINDOWS_INTEGRATED_AUTH_CREDENTIAL_TYPE; // set the credential type

 

// for illustration only; usernames and passwords should never be included in source files
windowsCredential.username.chars    = L"root";
windowsCredential.username.length   = (ULONG)wcslen(windowsCredential.username.chars);
windowsCredential.password.chars    = L"hvecu_12";
windowsCredential.password.length   = (ULONG)wcslen(windowsCredential.password.chars);

 

// declare and initialize properties to set the authentication scheme to Basic
ULONG scheme = WS_HTTP_HEADER_AUTH_SCHEME_BASIC;

 

WS_SECURITY_BINDING_PROPERTY httpAuthBindingProperties[1] =
{
    { WS_SECURITY_BINDING_PROPERTY_HTTP_HEADER_AUTH_SCHEME, &scheme, sizeof(scheme) }
};

 

/*WS_SECURITY_BINDING_PROPERTY_HTTP_HEADER_AUTH_SCHEME*/
// declare and initialize an HTTP header authentication security binding
WS_HTTP_HEADER_AUTH_SECURITY_BINDING httpAuthBinding = {}; // zero out the struct

 

httpAuthBinding.binding.bindingType = WS_HTTP_HEADER_AUTH_SECURITY_BINDING_TYPE; // set the binding type
httpAuthBinding.binding.properties  = httpAuthBindingProperties;
httpAuthBinding.binding.propertyCount   = WsCountOf(httpAuthBindingProperties);
httpAuthBinding.clientCredential    = &windowsCredential.credential;

 

DWORD dwIgnoreCnCertValue = WS_CERT_FAILURE_CN_MISMATCH | WS_CERT_FAILURE_UNTRUSTED_ROOT | WS_CERT_FAILURE_WRONG_USAGE | WS_CERT_FAILURE_REVOCATION_OFFLINE;

   

WS_SECURITY_BINDING_PROPERTY securityBindingPropertiesArray[1];

 

securityBindingPropertiesArray[0].id    = WS_SECURITY_BINDING_PROPERTY_CERT_FAILURES_TO_IGNORE;
securityBindingPropertiesArray[0].valueSize = sizeof(dwIgnoreCnCertValue);
securityBindingPropertiesArray[0].value = &dwIgnoreCnCertValue;

 

// declare and initialize an SSL transport security binding
WS_SSL_TRANSPORT_SECURITY_BINDING sslBinding = {}; // zero out the struct

 

sslBinding.binding.bindingType  = WS_SSL_TRANSPORT_SECURITY_BINDING_TYPE; // set the binding type
sslBinding.binding.properties   = securityBindingPropertiesArray;
sslBinding.binding.propertyCount= 1;

 

// declare and initialize the array of all security bindings
WS_SECURITY_BINDING* securityBindings[2] = { &sslBinding.binding, &httpAuthBinding.binding };

 

//- We also have to use SOAP 1.1

   /* WS_ENVELOPE_VERSION soapVersion = WS_ENVELOPE_VERSION_SOAP_1_1;

WS_ADDRESSING_VERSION addressingVersion = WS_ADDRESSING_VERSION_TRANSPORT;*/

 

WS_CHANNEL_PROPERTY channelProperties[2];
ULONG           channelPropertyCount        = 0;
WS_ADDRESSING_VERSION addressingVersion         = WS_ADDRESSING_VERSION_TRANSPORT;

 

WS_ENVELOPE_VERSION soapVersion                 = WS_ENVELOPE_VERSION_SOAP_1_1;
channelProperties[channelPropertyCount].id      = WS_CHANNEL_PROPERTY_ENVELOPE_VERSION;
channelProperties[channelPropertyCount].value   = &soapVersion;
channelProperties[channelPropertyCount].valueSize   = sizeof(soapVersion);
channelPropertyCount++;

 

channelProperties[channelPropertyCount].id      = WS_CHANNEL_PROPERTY_ADDRESSING_VERSION;
channelProperties[channelPropertyCount].value   = &addressingVersion;
channelProperties[channelPropertyCount].valueSize   = sizeof(addressingVersion);
channelPropertyCount++;

 

/*WS_CHANNEL_PROPERTY channelProperties[] = {
    { WS_CHANNEL_PROPERTY_ENVELOPE_VERSION, &soapVersion, sizeof(soapVersion) },
    { WS_CHANNEL_PROPERTY_ADDRESSING_VERSION, &addressingVersion, sizeof(addressingVersion) } };*/

 

// declare and initialize the security description
WS_SECURITY_DESCRIPTION securityDescription = {}; // zero out the struct
securityDescription.securityBindings    = securityBindings;
securityDescription.securityBindingCount= WsCountOf(securityBindings);

 

int                 result      = 0;
WS_ENDPOINT_ADDRESS address     = {};
WS_STRING           url         = WS_STRING_VALUE(_T("https://10.165.7.196/sdk/vimService"));
                        address.url = url;

 

// Create an error object for storing rich error information
hr = WsCreateError(
                    NULL,
                    0,
                    &error
                  );
if (FAILED(hr))
{
    goto Exit;
}

 

// Create a heap to store deserialized data
hr = WsCreateHeap(
                    /*maxSize*/ 2048,
                    /*trimSize*/ 512,
                    NULL,
                    0,
                    &heap,
                    error
                 );
if (FAILED(hr))
{
    goto Exit;
}

 

// Create the proxy
hr = WsCreateServiceProxy(
                            WS_CHANNEL_TYPE_REQUEST,
                            WS_HTTP_CHANNEL_BINDING,
                            &securityDescription,
                            NULL,
                            0,
                            channelProperties,
                            channelPropertyCount,
                            &proxy,
                            error
                         );
if (FAILED(hr))
{
    goto Exit;
}

 

hr = WsOpenServiceProxy(
                        proxy,
                        &address,
                        NULL,
                        error
                       );
if (FAILED(hr))
{
    goto Exit;
}

 

 

 

mor.type   = _T("SessionManager");
mor._value = _T("SessionManager");

 

UserSession * userSession;

   

hr = VimBinding_Login(
                        proxy,
                        &mor,
                        L"root",
                        L"hvecu_12",
                        NULL,
                        &userSession,
                        heap,
                        NULL,
                        NULL,
                        NULL,
                        error
                     );

   

WS_DATETIME serverDate;

 

hr = VimBinding_CurrentTime(
                            proxy,
                            &mor,
                            &serverDate,
                            heap,
                            NULL,
                            NULL,
                            NULL,
                            error
                          );

 

Thanks,

Bhargava

In the Java program of vSphere Management SDK, how do I call the vmRc SDK function?

$
0
0
In the Java program of vSphere Management SDK, how do I call the vmRc SDK function?

How to use SDK API to assign static IP address to VM

$
0
0

 

Hi All,

 

 

Can I use SDK API to assign static IP address to VM when cloning a new VM? I used VI Client to do it but it failed. Therefore, I am wondering if SDK API can do this. Can anyone give me a sample code?

 

 

Thank you very much.

 

 

Jeff

 

 


How to assign static IP to the VM while cloning the VM from template using java

$
0
0

Hello,

I am getting InvalidRequest exception while assigning static ip to the VM while cloning using java. Attached is the code and exception. Is there any mistake in my code?

Thanks

How to update IP and Network adapter using Java

$
0
0

 

Greetings,

 

 

would anybody have a working example on how to update the IP address and network adapter of an existing VM?  We are using ESX Server 3.5, and the VI SDK 2.5.0.  Similar to the code provided in the samples for VMpowerOps.java, where I provide the datacenter and name of the VM, along with the desired IP and network adapter name.  Context: I am setting up a fully automated test automation environment, where VMs get deployed on-demand, as requests for test execution are submitted.  As the VMs get deployed from previously built templates, I need to set the IP and network adapter (using the value displayed for the 'Network label' in VM Properties) programmatically.

 

 

Thanks in advance!

 

 

- Stephan

 

 

Using vCloud Suite SDK for tag management on vsphere 5.5 or earlier

$
0
0

Hello,

I researched alot about this topic and found out that  5.5 and earlier versions of vSphere have tagging capability but they do not provide public API for tag management so we won’t be able to access those tags using  SDK versions  5.5 and earlier. But now since vCloud suite SDK provides this capability, can we use this SDK to target it for vcenter 5.5 and earlier? I know PowerCLI is another option, but I do not want to use automation SDK and want to stick to Java management SDK.  

How to maintain session across VCP client and backend integration server?

$
0
0

Hi,

 

We are building a vSphere client plugin with workflows offloaded to a backend server.

Is there way using which I can use the logged in user session to run these flows in the backend server?

 

I am looking for a possibility to either using the logged on session on client to run server flows, or a possibility to impersonate based on logged on user.

 

Can someone point me to a best practices in case of VCP plugin in this respect.

 

Thanks

Imroz

Distributed Port Group assignment

$
0
0

How can we assign existing Distibuted port group to the VM using java?
I tried with below code but it shows disconnected...

VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec();
nicSpec.setOperation(VirtualDeviceConfigSpecOperation.edit);
for (int i = 0; i < vds.length; i++) {
if ((vds[i] instanceof VirtualEthernetCard)
&& (vds[i].getDeviceInfo().getLabel().equalsIgnoreCase("Network Adapter 1"))) {
VirtualEthernetCard nic = (VirtualEthernetCard) vds[i];
VirtualDeviceBackingInfo properties = nic.getBacking();
VirtualEthernetCardNetworkBackingInfo nicBaking = (VirtualEthernetCardNetworkBackingInfo) properties;
nicBaking.setDeviceName(network);
nic.setBacking(nicBaking);
nicSpec.setDevice(nic);
}
}
return nicSpec;

Viewing all 1860 articles
Browse latest View live


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