Quantcast
Viewing all 1860 articles
Browse latest View live

OutOfMemoryException inside VIMService constructor

Hi,

 

We have a 32Bit .NET application that connects to a 4.0 vSphere Server via a compiled wsdl dll.

 

Inside the constructor of the VIMService Class we receive an OutOfMemoryException.

 

- for what is all that memory needed at this moment? – we don’t have requested any data at this time

- is it possible to decrease memory allocation by the VIMService Object at the moment of creation

- we also have recognized that the connect needs a lot of time (about 3 to 5 minutes)

- is it possible to speed it up

 

 

Stacktrace :

System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)

System.Text.StringBuilder.Append(String value)

System.IO.StringWriter.Write(String value)

System.Xml.Serialization.IndentedWriter.Write(String s)

System.Xml.Serialization.XmlSerializationReaderCodeGen.WriteQNameEqual(String source, String name, String ns)

System.Xml.Serialization.XmlSerializationReaderCodeGen.WriteLiteralStructMethod(StructMapping structMapping)

System.Xml.Serialization.XmlSerializationReaderCodeGen.WriteStructMethod(StructMapping structMapping)

System.Xml.Serialization.XmlSerializationReaderCodeGen.GenerateMethod(TypeMapping mapping)

System.Xml.Serialization.XmlSerializationCodeGen.GenerateReferencedMethods()

System.Xml.Serialization.XmlSerializationReaderCodeGen.GenerateEnd(String[] methods, XmlMapping[] xmlMappings, Type[] types)

System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)

System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)

System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)

System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

System.Web.Services.Protocols.SoapClientType..ctor(Type type)

System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

DSVmwareAll.VimService..ctor()

 

thanks in advance,

Peter


Searching for a Managed Entity

Using the VI Java API, I've seen two ways of searching for Managed Entities. For example, if I'm looking for a Virtual Machine, I could do either

ManagedObjectReference mor = new ManagedObjectReference();
mor.setType("VirtualMachine");
mor.set_value(vmname);
VirtualMachine vm = (VirtualMachine) MorUtil.createExactManagedEntity(si.getServerConnection(), mor);// which is the same as 'new VirtualMachine(si.getServerConnection(), mor)' if 'mor' is set up correctly

or

 

VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder()).searchManagedEntity("VirtualMachine", vmname);

 

 

Which one is faster (it would seem to be the first)? The second seems safer. What are the pros and cons to using each of these  (for example, is there a situation you would use one over the other)?

Composer View: List of Virtual Machines that are deleted after a logoff

Hi Community,

 

One of our custommers has the Composer View feature bought. He wants now a list of all permanent Virtual Machines (skiping the dynamic VMs that are destroyed within a log of).

 

I searched the sdk for this information, without success.

 

Maybe some had the same problem, but found a solution for it.

 

Kindly regards,

Peter

Using vCenter/vSphere API & SDK, get VM count using Java

I am trying to write administrative routines for a simple cloud management package. How do I get VM info, such as total VM count, powered VM count, etc using Java and the various vCenter/vSphere APIs and SDKs? I will be using vCenter/vSphere 5.1.

how to get all OID/TRAP from VMware MIB

Hello All,

 

I found the admin guide which mentioned SNMP for VMware,but did not find anything about OID and Trap information.

Does anyone have the snmp oid/trap list. If yes, could you please pass it on.

I download and saw few MIBs, but how can i get the OID/trap from MIBs

 

I was in a hurry to deploy SNMP monitoringImage may be NSFW.
Clik here to view.

 

Thanks

ESX Files - read only

Hi,

 

Is there a way to read any ESX file I want through any of the API provided. As far as my research I could not find any api to get read only access to any of the ESX file I want.

 

What I'm looking at is -

An ability to access the ESX files to read some of the configurations, specifically I'm looking to read pam settings and ssh configuration of a ESX host. This I want to achieve by connecting to Virtual Center Server managing the ESX host.

 

I looked at the vifs and web based access list for the ESX host, they dont seem to provide what I want to achieve. Please advice if there are any approaches to get access to esx files. I also checked the vCli, power cli and esxcli, let me if I had missed something.

 

Thanks for any pointers.

 

Regards,

Parash

How can I get the info about physical hosting device where a vCenter runs from web service SDK

Hi All,

    We'd like to get the info about the hosting device on which the vCenter is running, such as the its IP/hostname, CPU, memory, storage, etc. I searched through the vsphere web service SDK and cannot find it.  When a vCenter is installed on a physical device, it would know how much CPU, memory, storage, and network resources the vCenter can allocate to run a vCenter server smothly.

 

    Appreciate any helps.

Error: InvalidRequest when WaitForUpdatesEx is executing

Hi, all.

 

I'd like to get vm information when VM's events are occured.

I wrote a test code using WaitForUpdatesEx (vSphere 5.0) method.

 

When I ran this, I got the following error:

"com.vmware.vim25.InvalidRequest

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at java.lang.Class.newInstance0(Class.java:355)

at java.lang.Class.newInstance(Class.java:308)

at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:201)

at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:80)

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

at com.vmware.vim25.ws.VimStub.waitForUpdatesEx(VimStub.java:105)

at com.vmware.vim25.mo.PropertyCollector.waitForUpdatesEx(PropertyCollector.java:125)

at com.apexcns.test.AsyncPropsCollection.test(AsyncPropsCollection.java:170)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Below is my test code:
---------------------------------------------------------------------------------

 

EventFilterSpecByEntity entitySpec = new EventFilterSpecByEntity();
entitySpec.setEntity(serviceInstance.getRootFolder().getMOR());
entitySpec.setRecursion(EventFilterSpecRecursionOption.children);
// set the entity spec in the EventFilter
EventFilterSpec eventFilter = new EventFilterSpec();
eventFilter.setEntity(entitySpec);
eventFilter.setType( new String[] {"VmPoweredOffEvent", "VmPoweredOnEvent", "VmSuspendedEvent", "VmResettingEvent"} );
EventManager eventManager = serviceInstance.getEventManager();
EventHistoryCollector eventHistoryCollector = eventManager.createCollectorForEvents(eventFilter);
// PropertyFilterSpec Setting
PropertySpec propertySpec = new PropertySpec();
propertySpec.setAll(new Boolean(false));
propertySpec.setPathSet(new String[] { "latestPage" });
propertySpec.setType(eventHistoryCollector.getMOR().getType());
PropertySpec[] propertySpecAry = new PropertySpec[] {propertySpec};
ObjectSpec objSpec = new ObjectSpec();
objSpec.setObj(eventHistoryCollector.getMOR());
objSpec.setSkip(new Boolean(false));
objSpec.setSelectSet(new SelectionSpec[] { });
ObjectSpec[] objSpecAry = new ObjectSpec[] { objSpec };
   
PropertyFilterSpec spec = new PropertyFilterSpec();
spec.setPropSet(propertySpecAry);
spec.setObjectSet(objSpecAry);
                       
PropertyCollector propColl =  serviceInstance.getPropertyCollector();             
PropertyFilter propFilter = propColl.createFilter(spec, true);
                 
Integer MAX_WAIT_TIME = 60;
String version = "";
WaitOptions options = new WaitOptions();
options.setMaxWaitSeconds( MAX_WAIT_TIME );
options.setMaxObjectUpdates(0);
while (true) {
  
   logger.debug("Waiting for new Updates.");
   UpdateSet update =  propColl.waitForUpdatesEx(version, options);    // <= the error location was here.

 

  if ( update != null && update.getFilterSet() != null ) {

       .......

       version = update.getVersion();                         

  } else {

 

      logger.debug("No update is present!");                  

  }

}

.....

 

Please let me know if anyting is wrong in my code.

Thank you.

 

Yeonki.


Troubleshoot net boot failure using the API

Hi all,

 

We are using the API in a simple way to

 

  • Set boot device to net
  • Wait a few seconds
  • Reset VM
  • Wait appr. 10 seconds, set boot device to net.

 

This is done for many VMs as part of software testing and involves Vsphere 4 and Vsphere 5 clients.

Vsphere 4 VMs not managed through vCenter which the version 5 VMs are.

 

Appr. one network boot out of twenty constantly fails. The Events log look the same on the failing VM as it does

on a working VM. It's different VMs that fails.

 

We are pretty sure the boot requests doesn't reach the kickstart server.

 

Any seen this issue before?
Any clues how to procede the troubleshooting efforts?

 


Thanks in advance.

Guest Operations - The operation is not supported

Hi,

 

I'm using vmware.vim api in a C# project. When I try to get GuestAuthentication object with AcquireCredentialIsGuest I get the following error:

"A server fault of type NotSupported with message 'The operation is not supported on the object.' occured while performing requested operation."

 

Guest Commands aren't disabled, neither on virtualmachine or on host. I'm running out of ideas what could be wrong. Can anyone help me out ?

 

Code:

GuestOperationsManager t = (GuestOperationsManager)client.GetView(client.ServiceContent.GuestOperationsManager, null);

GuestAuthManager c = (GuestAuthManager) client.GetView(t.AuthManager, null);

NamePasswordAuthentication userCred = new NamePasswordAuthentication();

userCred.Username = "xxxx";
userCred.Password = "xxxx";
userCred.InteractiveSession = false;

GuestAuthentication a = c.AcquireCredentialsInGuest(vm.MoRef, userCred, null);

 

 

Thanks!

A general system error occurred: Invalid argument

Hi Everyone

     Right now I am trying to make a copy of a Virtual Machine  and to customize the settings on the unit for deployment. Right now my  code is as follows (Note: I cleaned some of the values before posting  public) The return result of this is Invalid Argument. Does anyone know  how I can dive deeper into the error and find out what is ultimatly the  reason for the issue?

Thanks,

-SysAdmin

 

Dim CloneSpec As VirtualMachineCloneSpec = New VirtualMachineCloneSpec()
        'cloneSpec.Config.CpuFeatureMas()
        Dim MyConfig As New VMware.Vim.VirtualMachineConfigSpec
        MyConfig.NumCoresPerSocket = 2
        MyConfig.NumCPUs = 4

 

        Dim MyLocation As New VMware.Vim.VirtualMachineRelocateSpec
        MyLocation.Host = HostMoRef
        MyLocation.Pool = PoolMoRef
        MyLocation.Datastore = DataStoreMoRef
        MyLocation.Transform = VirtualMachineRelocateTransformation.sparse 'Thin Provision
        MyLocation.DiskMoveType = VirtualMachineRelocateDiskMoveOptions.createNewChildDiskBacking

 


        Dim MyOptions = New CustomizationWinOptions
        MyOptions.ChangeSID = True
        MyOptions.DeleteAccounts = False

 

        Dim CustPassword As New CustomizationPassword
        CustPassword.Value = "MyPassword1!"
        CustPassword.PlainText = True

 

        Dim GUIUnattended As New CustomizationGuiUnattended
        GUIUnattended.TimeZone = 85
        GUIUnattended.AutoLogon = True
        GUIUnattended.AutoLogonCount = 1

 

        Dim CustUserData As New CustomizationUserData
        CustUserData.FullName = "Information Systems"
        CustUserData.OrgName = "Eisenhower Medical Center"
        'Need TimeZone
        Dim CustVirtualMachine As New CustomizationVirtualMachineName
        CustUserData.ProductId = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

 

        Dim GuiRunOnce As New CustomizationGuiRunOnce
        GuiRunOnce.CommandList = New String() {"cmd"}

 

        Dim Iden As New CustomizationIdentification
        Iden.JoinDomain = "CNN.COM"

 

        Dim GlobalIPInformation As New CustomizationGlobalIPSettings
        GlobalIPInformation.DnsSuffixList = {"CNN.COM"}

 

        '''Attach Classes

 

        CustUserData.ComputerName = CustVirtualMachine

 

        Dim SysPrep As New CustomizationSysprep
        SysPrep.UserData = CustUserData
        SysPrep.GuiRunOnce = GuiRunOnce
        SysPrep.GuiUnattended = GUIUnattended
        SysPrep.Identification = Iden

 

        Dim CustSpec As New CustomizationSpec
        CustSpec.GlobalIPSettings = GlobalIPInformation
        CustSpec.Options = MyOptions
        CustSpec.Identity = SysPrep

 

        CloneSpec.Config = MyConfig
        CloneSpec.Customization = CustSpec
        CloneSpec.Location = MyLocation

 

        'Dim DiskLocater = New VMware.Vim.VirtualMachineRelocateSpecDiskLocator
        'Dim DiskBacking = New VMware.Vim.VirtualDeviceBackingInfo
        'DiskLocater.DiskBackingInfo = DiskBacking
        'cloneSpec.Location.Disk = DiskLocater
        CloneSpec.PowerOn = True
        Dim MyView As EntityViewBase
        Try
            'WindowsServer2008r2.CustomizeVM(CloneSpec)
            Dim NewServer = WindowsServer2008r2.CloneVM(Folder, NameOfServer, CloneSpec)
            MyView = Client.GetView(NewServer, Nothing)
            VMS.Add(MyView)
            For i = 0 To 100
                Debug.WriteLine(i)

 

                Try
                    MyView.UpdateViewData(Nothing)
                Catch ex As Exception
                    Debug.WriteLine("ViewUpDate " & ex.Message)
                End Try

 

                Try
                    If GetServerStatus(MyView) Then
                        Exit For
                    End If
                Catch ex As Exception
                    Debug.WriteLine("GetServerStatus " & ex.Message)
                End Try

 

                Threading.Thread.Sleep(2000)
            Next
        Catch ex As VimException
            Select Case ex.Message
                Case "The task was canceled by a user."
                    MsgBox(ex.Message)
                Case Else
                    MsgBox(ex.Message & vbCrLf & ex.MethodFault.ToString)
            End Select
        End Try

 

        Return MyView

How to get the hardware's product number via web service SDK?

Hi All,

    I need to get the host's serial/product numbers. I can get the serial number through,

 

    HostSystem: hardware.systemInfo.otherIdentifyInfo[].otherIdentifyInfo.identifierValue

 

    But it seemed like the product number is not anywhere from hardware's systeminfo.

 

    My question is: can the web service SDK API for java return the host's product number?

 

    Thanks in advance,

 

    Mike J.

RecommendDatastores for Create machine fails with an Internal Server Error Occured: optional value not set

Hi,

I am trying to create a virtual machine in a cluster using a storage pod cluster.
I am getting an error when calling the RecommendDatastores.
The error looks like this:
Internal Server Error Occured: optional value not set
I have no idea what is the value that is missing.

I wonder if you can you give me some pointers or some troubleshooting tips?
Are there any logs that may help?
Should I try to configure the server to use HTTP and spy the SOAP messages?


Code transcript for creating the virtual machine using storage DRS


private void createVMDRS()
        {

            _service = cb.getServiceConnectionV25()._service;
            _sic = cb.getServiceConnectionV25().ServiceContent;
            ManagedObjectReference dcmor = null;
            ManagedObjectReference storagePodmor = null;
            ManagedObjectReference computeResourcemor = null;
            ManagedObjectReference resourcePoolmor = null;
            ManagedObjectReference vmFoldermor = null;

            // get the datacenter and the vm folder
            String dcName = cb.get_option("datacentername");
            if (!string.IsNullOrEmpty(dcName))
            {
                dcmor
                    = cb.getServiceUtilV25().GetDecendentMoRef(null, "Datacenter", dcName);

                if (dcmor == null)
                {
                    Console.WriteLine("Datacenter " + dcName + " not found.");
                    return;
                }
                else
                {
                    //get the vm folder
                    ObjectContent[] objArray = cb.getServiceUtilV25().GetObjectProperties(_sic.propertyCollector, dcmor, new string[] { "vmFolder" });
                    if (objArray.Length > 0)
                    {
                        vmFoldermor = (ManagedObjectReference)objArray[0].propSet[0].val;
                    }
                    else
                    {
                        Console.WriteLine("vmfolder not found.");
                        return;
                    }
                }
            }
            else
            {
                Console.WriteLine("datacentername user option is null or empty!");
                return;
            }

            // get the storage pod
            String storagePodName = cb.get_option("storagepodname");
            if (!string.IsNullOrEmpty(storagePodName))
            {
                storagePodmor = cb.getServiceUtilV25().GetDecendentMoRef(dcmor, "StoragePod", storagePodName);
                if (storagePodmor == null)
                {
                    Console.WriteLine("StoragePod " + storagePodName + " not found");
                    return;
                }
            }
            else
            {
                Console.WriteLine("storagepodname user option is null or empty!");
                return;
            }

            // get the computeresourcename (cluster)
            String computeResourceName = cb.get_option("computeresourcename");
            if (!string.IsNullOrEmpty(computeResourceName))
            {
                computeResourcemor = cb.getServiceUtilV25().GetDecendentMoRef(dcmor, "ClusterComputeResource", computeResourceName);
                if (computeResourcemor == null)
                {
                    Console.WriteLine("ComputeResourceName " + computeResourceName + " not found");
                    return;
                }
                //get the resource pool
                ObjectContent[] objArray = cb.getServiceUtilV25().GetObjectProperties(_sic.propertyCollector, computeResourcemor, new string[] {

"resourcePool" });
                if (objArray.Length > 0)
                {
                    resourcePoolmor = (ManagedObjectReference)objArray[0].propSet[0].val;
                }
                else
                {
                    Console.WriteLine("ResourcePool not found");
                    return;
                }
            }
            else
            {
                Console.WriteLine("computeresourcename user option is null or empty!");
                return;
            }


            // For create machine
            // the  Folder, ConfigSpec, ResourcePool and HostSystem parameters are expected
            // in the StoragePlacementSpec
            StoragePlacementSpec storageSpec = new StoragePlacementSpec();
            storageSpec.type = "create";
            storageSpec.resourcePool = resourcePoolmor;
            storageSpec.folder = vmFoldermor;
        
            // Storage DRS
            storageSpec.podSelectionSpec = new StorageDrsPodSelectionSpec();
            //user selected SDRS pod for the vm
            storageSpec.podSelectionSpec.storagePod = storagePodmor;

            // podSelectionSpec.initialVMConfig
            storageSpec.podSelectionSpec.initialVmConfig = new VmPodConfigForPlacement[1];
            storageSpec.podSelectionSpec.initialVmConfig[0] = new VmPodConfigForPlacement();
            storageSpec.podSelectionSpec.initialVmConfig[0].storagePod = storagePodmor;
            storageSpec.podSelectionSpec.initialVmConfig[0].storagePod.type = "StoragePod";
            storageSpec.podSelectionSpec.initialVmConfig[0].disk = new PodDiskLocator[1];
            storageSpec.podSelectionSpec.initialVmConfig[0].disk[0] = new PodDiskLocator();
            storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskId = -48;
            storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskBackingInfo = new VirtualDiskFlatVer2BackingInfo();
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskBackingInfo).fileName = "";
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskBackingInfo).diskMode = "persistent";
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskBackingInfo).thinProvisioned = true;
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.podSelectionSpec.initialVmConfig[0].disk[0].diskBackingInfo).eagerlyScrub = false;
        
            // configSpec
            storageSpec.configSpec = new VirtualMachineConfigSpec();
            storageSpec.configSpec.name = cb.get_option("vmname");
            storageSpec.configSpec.version = "vmx-08";
            storageSpec.configSpec.guestId = "windows7Server64Guest";
            storageSpec.configSpec.files = new VirtualMachineFileInfo();
            storageSpec.configSpec.files.vmPathName = "";
            storageSpec.configSpec.numCPUs = 1;
            storageSpec.configSpec.memoryMB = 1024;
            storageSpec.configSpec.firmware = "bios";

            // add devices to the machine
            storageSpec.configSpec.deviceChange = new VirtualDeviceConfigSpec[5];


            // add cd rom
            storageSpec.configSpec.deviceChange[0] = new VirtualDeviceConfigSpec();
            storageSpec.configSpec.deviceChange[0].operation = VirtualDeviceConfigSpecOperation.add;
            storageSpec.configSpec.deviceChange[0].device = new VirtualCdrom();
            storageSpec.configSpec.deviceChange[0].device.key = -44;
            storageSpec.configSpec.deviceChange[0].device.backing = new VirtualCdromRemotePassthroughBackingInfo();
            ((VirtualCdromRemotePassthroughBackingInfo)storageSpec.configSpec.deviceChange[0].device.backing).deviceName = "";
            ((VirtualCdromRemotePassthroughBackingInfo)storageSpec.configSpec.deviceChange[0].device.backing).exclusive = false;
            storageSpec.configSpec.deviceChange[0].device.connectable = new VirtualDeviceConnectInfo();
            storageSpec.configSpec.deviceChange[0].device.connectable.startConnected = false;
            storageSpec.configSpec.deviceChange[0].device.connectable.allowGuestControl = true;
            storageSpec.configSpec.deviceChange[0].device.connectable.connected = false;
            storageSpec.configSpec.deviceChange[0].device.controllerKey = 201;
            storageSpec.configSpec.deviceChange[0].device.unitNumber = 0;


            // add floppy
            storageSpec.configSpec.deviceChange[1] = new VirtualDeviceConfigSpec();
            storageSpec.configSpec.deviceChange[1].operation = VirtualDeviceConfigSpecOperation.add;
            storageSpec.configSpec.deviceChange[1].device = new VirtualFloppy();
            storageSpec.configSpec.deviceChange[1].device.key = -45;
            storageSpec.configSpec.deviceChange[1].device.backing = new VirtualFloppyRemoteDeviceBackingInfo();
            ((VirtualFloppyRemoteDeviceBackingInfo)storageSpec.configSpec.deviceChange[1].device.backing).deviceName = "";
            storageSpec.configSpec.deviceChange[1].device.connectable = new VirtualDeviceConnectInfo();
            storageSpec.configSpec.deviceChange[1].device.connectable.startConnected = false;
            storageSpec.configSpec.deviceChange[1].device.connectable.allowGuestControl = true;
            storageSpec.configSpec.deviceChange[1].device.connectable.connected = false;


            storageSpec.configSpec.deviceChange[2] = new VirtualDeviceConfigSpec();
            storageSpec.configSpec.deviceChange[2].operation = VirtualDeviceConfigSpecOperation.add;
            storageSpec.configSpec.deviceChange[2].device = new VirtualLsiLogicSASController();
            storageSpec.configSpec.deviceChange[2].device.key = -46;
            ((VirtualLsiLogicSASController)storageSpec.configSpec.deviceChange[2].device).busNumber = 0;
            ((VirtualLsiLogicSASController)storageSpec.configSpec.deviceChange[2].device).sharedBus = VirtualSCSISharing.noSharing;


            // add network
            storageSpec.configSpec.deviceChange[3] = new VirtualDeviceConfigSpec();
            storageSpec.configSpec.deviceChange[3].operation = VirtualDeviceConfigSpecOperation.add;
            storageSpec.configSpec.deviceChange[3].device = new VirtualE1000();
            storageSpec.configSpec.deviceChange[3].device.key = -47;
            storageSpec.configSpec.deviceChange[3].device.backing = new VirtualEthernetCardNetworkBackingInfo();
            ((VirtualEthernetCardNetworkBackingInfo)storageSpec.configSpec.deviceChange[3].device.backing).deviceName = "VM Network SQA";
            storageSpec.configSpec.deviceChange[3].device.connectable = new VirtualDeviceConnectInfo();
            storageSpec.configSpec.deviceChange[3].device.connectable.startConnected = true;
            storageSpec.configSpec.deviceChange[3].device.connectable.allowGuestControl = true;
            storageSpec.configSpec.deviceChange[3].device.connectable.connected = true;
            ((VirtualE1000)storageSpec.configSpec.deviceChange[3].device).addressType = "generated";
            ((VirtualE1000)storageSpec.configSpec.deviceChange[3].device).wakeOnLanEnabled = true;


            // add disk
            storageSpec.configSpec.deviceChange[4] = new VirtualDeviceConfigSpec();
            storageSpec.configSpec.deviceChange[4].operation = VirtualDeviceConfigSpecOperation.add;
            storageSpec.configSpec.deviceChange[4].fileOperation = VirtualDeviceConfigSpecFileOperation.create;
            storageSpec.configSpec.deviceChange[4].device = new VirtualDisk();
            ((VirtualDisk)storageSpec.configSpec.deviceChange[4].device).capacityInKB = 1048576;
            storageSpec.configSpec.deviceChange[4].device.key = -48;
            storageSpec.configSpec.deviceChange[4].device.controllerKey = -46;
            storageSpec.configSpec.deviceChange[4].device.unitNumber = 0;
            storageSpec.configSpec.deviceChange[4].device.backing = new VirtualDiskFlatVer2BackingInfo();
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.configSpec.deviceChange[4].device.backing).fileName = "";
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.configSpec.deviceChange[4].device.backing).diskMode = "persistent";
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.configSpec.deviceChange[4].device.backing).thinProvisioned = true;
            ((VirtualDiskFlatVer2BackingInfo)storageSpec.configSpec.deviceChange[4].device.backing).eagerlyScrub = false;


            // get recommened datastores call throws an error
           // The error looks like this:
          // Internal Server Error Occured: optional value not set
           StoragePlacementResult storagePlacementRes = _service.RecommendDatastores(_sic.storageResourceManager, storageSpec);
           if (storagePlacementRes.recommendations.Length > 0 )
           {
               string[] key = new String[1];
               key[0] =  storagePlacementRes.recommendations[0].key;
               _service.ApplyStorageDrsRecommendation_Task(_sic.storageResourceManager, key);
           }
           return;

}

 

I am attaching a zip file with a small example.
I created the example by modifying the vm create example in SDK samples C#.

I tried a few variations of the example above.
I read in the documentation that I should specify the HostSystem.

 

1- I tried to add the HostSystem and I set it to reference the compute cluster.
When I do that I get an error that looks like this:
A specified parameter was not correct.
Storage DRS placement: target host vim.ClusterComputeResource:domain-c26 not connected to pod TestDatastoreCluster

 

2- I tried to add the HostSystem and I set it to reference an host in the cluster instead of the cluster.
When I do that I still get the error:
Internal Server Error Occured: optional value not set

Other ideas?

I tried using the same API RecommendDatastores and ApplyStorageDrsRecommendation_Task
to clone an existing machine using storage DRS. That worked fine. That example is also included in
the zipfile.

 

 

Thanks,

 

Teresa.


Retrieve disk read/write statistics doesn't work

I'm busy retrieving VM statistics using the VMWare VSphere API (in Java). Retrieving memory or cpu statistics is no problem at all but I can't find the way to retrieve disk read/write statsitics (over the last half hour). Can somebody point me into the right direction?

How to retrieve virtual disk reads and writes?

Hi everybody,

 

I've been able to get all kind of information, but I haven't found how to retrieve the virtual disks I/O (reads and writes).

 

Does anybody know how I could retrieve the I/O information of the virtual disks from a given virtual machine using the VI API for Java? What class should I use to get that kind of info?

 

Thanks in advance,


how to get specific nic usage for a vm using vcenter api?

Hi,

 

 

 

 

how to get specific nic usage for a vm using vcenter api?

 

Kindly help me on that . I'm in need.

 

 

 

 

 

Thanks,

alex

Error connecting to SRM Server with API

OK, I have created the required stub file from the WSDL definition on the SRM server and can see all the classes within. But when I try to connect to the server using the code below, I keep getting an error. I have searched the forums and googled, but there doesn't seem to be too much information out there.

 

FYI, SRMAPI is the name space in the stub file.

FYI, A.B.C.D is specified as the IP address of the SRM server.

 

Imports srmapi
Imports System.Web.services
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sc As New srmAPI.SrmServiceInstanceContent
        Dim _service As New srmAPI.SrmBinding()
        _service.Url = "http://A.B.C.D:9007"
        _service.CookieContainer = New System.Net.CookieContainer
        _service.Timeout = 20000
        Dim MO As New ManagedObjectReference()
        MO.type = "SrmServiceInstance"
        MO.Value = "SrmServiceInstance"
        Try
            SC = _service.RetrieveContent(MO)
            _service.SrmLogin(MO, "administrator", "Xtrav1rt")
            MsgBox("done")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

 

 

The error I currently recieve is generated when trying to execute the following line:

SC = _service.RetrieveContent(MO)

 

The error is as follows:

 

"The underlying connection was closed: The connection was closed unexpectedly."

 

 

Can anyone help at all (and save some more of my hair)?

 

Thanks in advance.

How to get object name from metric instance ?

When i receive my performance information for disk latencies i have my PerfMetricId[] Array with all the available metrics.

 

If i pick out the disk metrics i want, the instance is something like this

 

 

Instance: eui.222100015507d2f3
or
Instance: t10.E4143500000000000000000020000000F4E2000000000100
In the vsphere GUI this values have correct device names
like this

 

 

How can i obtain these names programmaticly when i have the instance string?

 

I use c#, but any hint (no matter what language) would be helpful Image may be NSFW.
Clik here to view.

 

Thank you in advance

vmrc connect ESXi 5.1 error

vmrc5.1 connect ESXi 5.1 error

As follows

Image may be NSFW.
Clik here to view.
123123jpg.jpg

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

 

vmrc4.1 connect ESXi 5.1 error

Success   is ok , No errors

Download location for VASA SDK

Hi All


Kindly help me to find the VASA sdk download location

 

Thanks

Siva

Viewing all 1860 articles
Browse latest View live


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