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

VMRC连接ESXi的5.1错误

$
0
0

vmrc5.1 connect ESXi 5.1 error

As follows

123123jpg.jpg

An error occurred that affected the security of the connection

 

How to deal with?

Thank

 

 

            VirtualMachineMksTicket vmmt = _service.AcquireMksTicket(_virtualMachine);
            ticket = _service.AcquireCloneTicket(sic.sessionManager);

 

 

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

 

vmrc4.1 connect ESXi 5.1

Success  , is ok , No errors


Unexpected element tag "SOAP-ENV:Envelope" seen

$
0
0

Hi,

 

we get this error message on every request we are trying to send via gSOAP:

Unexpected element tag "SOAP-ENV:Envelope" seen

 

Could anyone explain me, why i get this error?

 

Here is the request:

 

POST /sdk HTTP/1.1
Host: vmware-test.boreus.de
User-Agent: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="urn:vim25/5.0"
Content-Length: 551
Connection: close
Accept-Encoding: gzip, deflate
SOAPAction: "urn:vim25/5.0"

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope

    xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:vim25"><SOAP-ENV:Body>

<ns1:RetrieveServiceContent xsi:type="ns1:RetrieveServiceContentRequestType">

<ns1:_this xsi:type="ns1:ManagedObjectReference" type="ServiceInstance">ServiceInstance</ns1:_this>

</ns1:RetrieveServiceContent>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

 

And here the answer:

HTTP/1.1 500 Internal Server Error
Date: Wed, 7 Sep 2011 16:51:10 GMT
Set-Cookie: vmware_soap_session="524dac01-d304-ac9d-c557-34839dde76ac"; Path=/; HttpOnly;
Cache-Control: no-cache
Connection: close
Content-Type: text/xml; charset=utf-8
Content-Length: 565

 

<?xml version="1.0" encoding="UTF-8"?>
<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>ClientFaultCode</faultcode>
  <faultstring>
Unexpected element tag &quot;SOAP-ENV:Envelope&quot; seen

 

while parsing HTTP request before method was determined
at line 1, column 0</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

VcTag scripting object

$
0
0

I am not sure if I missed the memo or what but it seems that in 5.1 custom fields are now read only and everything needs to be converted to tags.  I am trying to figure out how to programatically interact with the tagging as we use custom fields to sync some information to and fro from our machine database.  I see the property "tags" on most of the managed entities but I don't see where I can manipulate the tags (add/change/delete).  All I can do is get an array of the tags currently associated with the entity.

 

Do I need to tweak something in my vCenter configuration to keep the custom fields in place for now and useable as they were before?  The api docs all say "experimental" on that attribute and the vcTag object type.

 

This is a cross posting from the Orchestrator forums as I use orchestrator/javascript for everyting along with the vCenter plugin.

 

Paul

Unable to retrieving more than 100 VMs using PropertyCollector and WaitForUpdatesEx method

$
0
0

Using vSphere SDK for .NET. Sorry, couldn't find a .NET forum for the vSphere SDK but the Java forum should be close enough.

 

I am having problems retrieving a list of VMs from a Resource Pool. Specifically if there are more than 100 VMs (104 in my case) in the Folder or Resource Pool the returned UpdateSet will only ever have 100 items in it.

 

The offending code is as follows:

 

UpdateSet uSet = pc.WaitForUpdatesEx(string.Empty, new WaitOptions() { MaxWaitSeconds = 0 });
Console.Writeline(uSet.FilterSet[0].ObjectSet.Count); // will always contain no more than 100 items

 

There seems to be a hard cut off of 100 items.
WaitForUpdatesEx's WaitOptions contains a MaxObjectUpdates property, from the documentation

 

"The maximum number of ObjectUpdate entries that should be returned in a single result from WaitForUpdatesEx. See truncated

An unset value indicates that there is no maximum. In this case PropertyCollector policy may still limit the number of objects that appear in an UpdateSet."

 

But what is the "PropertyCollector Policy"  that it is referring to? I've been trawling the web and can find absolutely no reference to this at all other than in the documentation.

 

I also tried just putting in a a MaxObjectUpdates = 150 just to see what would happen. Again only 100 items returned.

 

For reference here is a more complete section of code:

 

EntityViewBase folderMngObj = GetVsphereVmFolderManagedObjectRefId(vClient, vSpherefolderName);

 

if (folderMngObj != null)
     {
          ManagedObjectReference svcRef = new ManagedObjectReference() { Type = "ServiceInstance", Value = "ServiceInstance" };
          ServiceInstance srvInst = new ServiceInstance(vClient, svcRef);

 

          ServiceContent sContent = srvInst.RetrieveServiceContent();
          ViewManager viewManager = new ViewManager(vClient, sContent.ViewManager);
          PropertyCollector pc = new PropertyCollector(vClient, sContent.PropertyCollector);

 

          ManagedObjectReference cvMngObjRef = viewManager.CreateContainerView(folderMngObj.MoRef, new string[] { "VirtualMachine" }, false);
          ContainerView cv = new ContainerView(vClient, cvMngObjRef);
          List<PropertySpec> propertySpecList = new List<PropertySpec>();

 

          foreach (string propertyPath in vmPropertyPaths)
          {
               PropertySpec propSpec = new PropertySpec();
               propSpec.PathSet = new string[] { propertyPath };
               propSpec.Type = "VirtualMachine";
               propertySpecList.Add(propSpec);
          }

 

          PropertySpec[] propertySpecs = propertySpecList.ToArray();
          PropertyFilterSpec pfs = new PropertyFilterSpec();
          pfs.ObjectSet = new ObjectSpec[] { CreateObjSpec(cv) };
          pfs.PropSet = propertySpecs;

 

          // Create a Property with partialUpdate is true
          PropertyFilter pf = new PropertyFilter(vClient, pc.CreateFilter(pfs, true));

 

          // Wait for initial udpate with empty version string
          UpdateSet uSet = pc.WaitForUpdatesEx(string.Empty, new WaitOptions() { MaxWaitSeconds = 0 });

 

          // Here uSet.FilterSet[0].ObjectSet will always contain no more than 100 items

 

          viewTable = OutputDataset(uSet);
          pf.DestroyPropertyFilter();
}

 

Any help would be appreciated.

vsphere management sdk write file (txt)

$
0
0
My virtual machine not have a network
How do I pass the information to the virtual machine
How do I write a Notepad (txt file)  

vsphere management sdk

 

 

thank

set ip

$
0
0
Hello
I passed the the cloning task to create a new virtual machine for (windeos or Linux)
May I ask how can I set a new virtual machine ip
Please provide ideas

 

 

Thank

How to add Vmxnet3 Ethernet adapter to VM

$
0
0

Hello everyone,

 

Can anyone show me a smple code or give me an example of how to add Vmxnet interface?
I managed to add ethernet card, but it added as "Flexible", any ideas?

 

Thanks,

 

Dan.

Hardware status and value differs in vCenter's MOB and Host MOB

$
0
0

Hi,

 

     The hardware status and sensor values differs in vCenter MOB and Host MOB for same host. Sensor values remains same (static) for all host if we traversed via vCenter, but the sensor values are fluctuating for each poll if we traversed via HOST MOB directly. Why the value difers? Can anybody noticed this issue previously? Awaiting for your reply.

 

Thanks and Regards

Raamesh Keerthi N.J


API to get VM CPU Cycles, Memory [RAM] Usage, Bandwidth Usage and Disk Space Usage

$
0
0

Hello,

 

Since I am pretty new to VM Ware, can anybody suggest me how to extract the following by a  C# application:

 

 

Any help on any of the above mentioned topics is appreciated.

 

Also, please let me know the appropriate community if this is not the appropriate community to post this query.

 

 

 

Thanks & regards

Vim::login(service_url =>)

$
0
0

Hi

 

I m trying to make a script for retrieving some informations about the esxi

 

here is my problem

 

I have two variables:

$opt_H and $url

$url = "https://".$opt_H."/sdk/webServer";

 

If I use $url with a variable the connexion doesn't work

Can't connect to XXXX.XXX.XXX.XX:443 (Connection refused)

 

LWP::Protocol::https::Socket: connect: Connection refused at /usr/lib/perl5/site_perl/5.8.8/LWP/Protocol/http.pm line 51.

 

If i change the variable and put the real ip address of the esxi it works

 

I don't understand, what I am doing wrong ?

 

I use these libraires:

 

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
use strict;
use warnings;
use Getopt::Long;
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use VMware::VIRuntime;
use VMware::VILib;

 

thanks in advance

How create virtual disk with specified geometry?

$
0
0

Hi everyone,

I need create virtual disk with 56 sectors per head. How can I do that?

Thank you very much for any help.

FLEX Component in Summary view

$
0
0

Is there a way to use SDK's flex component for the Summary view? What is the name of the package/class? I need an foldable grid like one on the screenshot:

http://i.imgur.com/Hws6y.png

Thanks!

PHP - vSphere WSDL Primer

$
0
0
I'm not sure if this is the "correct" place for this, but after spending HOURS of searching and many, many curse words, I wanted to share a quick little guide to using PHP to interface with the vSphere WSDL. I'm doing this because there is a lot of information spread out all over the Internet, however no one source ever really brought it all together. That is my goal here in this post. Note that I don't claim any of this to be really my own work, but rather my collection of other's work put together in one place. I would link to all the places I found this info, but honestly it came from so many places and was crosslinked to others that I can't even remember where I found most of this stuff. I've also interspersed this with my ramblings and thoughts on the whole process.

 

Please note I am NOT a developer. I'm just an admin trying to write a few scripts that I can use on some webpages to make my life (and some of my fellow admins lives) easiser. So I don't use a lot of functions and constants, I'll just write a new script if I need to do something else. (I think one of my major stumbling blocks was that the documentation was written for people creating large complicated applications, but that's just IMHO.)

 

Step 1 - What you'll need
-- You'll need PHP installed (Duh). I'm using version 5.3.3 but that shouldn't matter all that much. Newer versions may change some things slightly. I'm also using the built in soap client.
--You'll need vCenter (double Duh). I've tested this on 5.0 and 5.1. I'm sure there are differences, but I don't know what they are (and I don't care as long as my stuff works).
--You'll need your vcenter name or IP address. and you'll want to verify that the WSDL is at the correct location. You should be able to browse to your WSDL by going to "https://vcenter/sdk/vimService.wsdl". If you can't find it there, you'll need to figure out where it is.
--You'll also need to have a username and password to log into vCenter with. You should be able to use whatever credentials you log into the (Web or Destop) vSphere client. You should also probably know a little something about vSphere and stuff like "what a datastore is" vs "what a VM is".
--Finally you'll want to access your "MOB" at http://vcenter/mob. It will help navigating VMware's object structure.

 

Step 2 - Create SOAP client object
This probably shouldn't be your first ever PHP and SOAP script you attempt. So I assume you already know how to request a stock quote from webservicex.net or something. That being said, here's the setup:

 

$client = new SoapClient(https://vcenter/sdk/vimService.wsdl,     array (          "trace" => 1,          https://vcenter/sdk/,          )
);

 

Here we create a new soapclient and point it to our Vcenter WSDL. Note that you don't provide login information here (that stumped me for a good little while). Replace the "vcenter" with your Vcenter name or IP. The may be more "options" you want to play with for creating the soap client, you can add those to the array.

 


Step 3 - Let's start to do something that might seem productive
For whatever reason, the first thing you'll have to do is invoke the "ServiceInstance". I have no idea why, but you do. Here is how to do that:

 

$soapmessage["_this"] = new Soapvar ("ServiceInstance", XSD_STRING, "ServiceInstance");
$result = $client->RetrieveServiceContent($soapmessage);
$serviceContent = $result->returnval;

 

Here we create a "SoapVar" object, and give it some data. For some reason, I wasn't able to use a standard Object, not sure why. (Maybe I'm just not that smart? Standard objects always worked for me with other WSDLs, but w/e). We then invoke the "RetrieveServiceContent" method to create a ServiceInstance, which returns a bunch of data to the variable $result. We then load that information into a variable called "serviceContent". (You'll find that some of my variable names make no sense. That's because I was somewhat clueless as to what this was all doing when I wrote it. Feel free to change it to something else. Like I care what you call your own variables...)

 

Step 4 - Log in so it knows who we are
So if we want to do something productive, we're going to have to tell it who we are. The $result variable has some info we need, specifically the "sessionManager" object. SessionManager has a method called "Login", which sounds like what we're trying to do.

 

$soapmessage2["_this"] = $serviceContent->sessionManager;
$soapmessage2["userName"]='username';
$soapmessage2["password"]='password';
$result = $client->Login($soapmessage2);
$usersession = $result->returnval;

 

The "_this" refers to which object we're referencing (This is the session manager object that we got from the service instance above) Username and password are (TRIPLE DUH) your username and password. You'll probably want to change that to your actual username and password, unless your username and password really are "username" and "password". (If they are, please send me your IP address in a PM. Also, please include your ATM pin, mother's maiden name, and SSN.)

 

We then invoke the Login method, and get a result. I loaded that result into another variable, not sure why.

 

Step 5 - Um, can we actually do something now?
Here is where EVERY OTHER LINK I EVER SAW really failed epically. Most posts have you log out here. WHY WOULD I LOG OUT? WE DIDN'T DO ANYTHING YET!

 

Normally at this point you're probably going to need to get a "Managed Object ID", aka MOID. Think of the MOID as a name that never changes. You might have a VM called "Bob", but it's MOID is something like "vm-1234". If you rename your VM from "Bob" to "Weave", the MOID stays the same. They seem to follow a standard of some sort of identifier followed by a number. So your datacenter may be something like "datacenter-4893" and a datastore might be "datastore-6969". Folders are called "antifungalcream-123..." okay I'm kidding, they look something like "group-1231".

 

The reason you're going to need your MOID is because that's what you reference when you call your methods. So if you want to rename something, you'll need to tell it what you're renaming. The method for renaming a folder/host/VM is the same method, you just reference a different object.

 

I got my MOID by using the "FindByDNSName" method, under "SearchIndex". SearchIndex (and everything else???) is under the the "serviceContent".
Here is the code for that:

 

$soapmessage3["_this"] = $serviceContent->searchIndex;
$soapmessage3["dnsName"]='servername.domain.org';
$soapmessage3["vmSearch"]='true';
$result = $client->FindByDnsName($soapmessage3);
$vmentity = $result->returnval;

 

(Why did I have to tell it "Vmsearch = true". Did they think I was calling a search method but didn't want to search???)

 

The return is going to have your MOID

 

Step 6 Okay NOW we REALLY DO SOMETHING!
After you have your MOID, you just have to call a method that is valid for it. So if you're using a VM, your methods are "Rename_Task, PowerOnVM_Task, etc. For testing purposes, I was using "QueryFaultToleranceCompatibility" method. It just returns some data (no idea what this data really means), but it will tell you if your MOID is correct.

 

$soapmessage4["_this"] = $vmentity;
$result = $client->QueryFaultToleranceCompatibility($soapmessage4);

 

That's it! HOORAY WE DID SOMETHING! After four soap calls, we've actually done something that might be considered productive.

 

Step 7 NOW WE CAN LOG OUT

 

$soaplogout["_this"] = $serviceContent->sessionManager;
$result = $client->Logout($soaplogout);

 

Not much to figure out here.

 

Step 8 PROFIT!
The "ace trick" is finding your MOID. You'll need to figure out which search or method is best for you to use. This is where your "MOB" (referenced above in step 1) will be helpful, as you can browse and find methods and which MOIBs they can be called on. You might want to start in the "rootFolder". In the MOB click on "RetrieveServiceContent", then click "invoke method", then click "Group-d1" (apparently this is the default root folder, and it's always called that). From here you should see your data centers, you can click on them and browse folders/datastores/etc. The MOIDs are referenced as well as the properties and methods.

 

Final thoughts : This is by far the most complicated and obtuse WSDL I've ever had to work with. I thought I was getting good at it until I saw this one. Normally I can just read the WSDL and figure it out from there, but there's no way any human could do that with this one IMO. It also wasn't helpful to read people's responses like "You should use Java/Perl". Um, if I wanted to write Java, I'd write Java. Isn't the whole point of a WSDL to be language independant? Why should I go learn a whole new programming language?

 

Also, 4 soap calls to rename a VM? Does that seem reasonable? Usually I can do stuff like this in 1 or 2.

 

Message was edited by: Tyknee - Of course I had to go into the HTML and edit this to get it to look right. Board software was probably written by the same guy who wrote the WSDL...

The session is not authenticated

$
0
0

 

I am trying to communicate with vcenter server using webservices SDK.

 

 

 

 

 

I send Login XML and is successful.

 

 

I tried RetrieveServiceContent method and is successful and able to get all details.

 

 

I tried FetchDvPorts method and is resulting in error (The session is not authenticated).

 

 

 

 

 

&lt;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"&gt;

 

 

   &lt;soapenv:Body&gt;

 

 

      &lt;soapenv:Fault&gt;

 

 

         &lt;faultcode&gt;ServerFaultCode&lt;/faultcode&gt;

 

 

         &lt;faultstring&gt;The session is not authenticated.&lt;/faultstring&gt;

 

 

         &lt;detail&gt;

 

 

            &lt;NotAuthenticatedFault xsi:type="NotAuthenticated" xmlns="urn:vim25"&gt;

 

 

               &lt;object type="ManagedEntity"&gt;DistributedVirtualSwitch&lt;/object&gt;

 

 

               &lt;privilegeId&gt;System.View&lt;/privilegeId&gt;

 

 

            &lt;/NotAuthenticatedFault&gt;

 

 

         &lt;/detail&gt;

 

 

      &lt;/soapenv:Fault&gt;

 

 

   &lt;/soapenv:Body&gt;

 

 

&lt;/soapenv:Envelope&gt;

 

 

 

 

 

 

 

 

I guess this error is due to privilege difference.(RetrieveServiceContent  privilege is "System.Anonymous"

 

 

  and privilege for FetchDvPorts is "System.Read" System.Anonymous )

 

 

What should I do to get complete privilege to access all methods successfully.

 

 

Fail to create a data store in Version Vmfs3

$
0
0

Hi All

 

                  I have tried to create a vmfs3 datastore in ESX5.1 using vim25.jar

 

 

VmfsDatastoreOption[] dsOptions = VExecutor
.getInstance()
.getServiceInstance()
.queryVmfsDatastoreCreateOptions(datastoreSysMOR,
scsiDisk.get(0).getDevicePath(), null);
VmfsDatastoreCreateSpec vmfsSpec = (VmfsDatastoreCreateSpec) dsOptions[0]
.getSpec();
vmfsSpec.getVmfs().setVolumeName("DS");
vmfsSpec.getVmfs().setMajorVersion(3);

 

When I set MajorVersion value to 5 , then its working fine and datastore created. But Version3 not working.

 

 

xception in thread "main" AxisFault

faultCode: ServerFaultCode

faultSubcode:

faultString: An error occurred during host configuration.

faultActor:

faultNode:

faultDetail:

{urn:vim25}PlatformConfigFaultFault:<faultMessage><key>com.vmware.esx.hostctl.default</key><arg><key>reason</key><value xsi:type="xsd:string"> Unable to create Filesystem, please see VMkernel log for more details: VMFS3 file system creation is unsupported on a GPT partition on device 'eui.fd1a2bfb781b33786c9ce9009495adfd:1'</value></arg><message>Operation failed, diagnostics report:  Unable to create Filesystem, please see VMkernel log for more details: VMFS3 file system creation is unsupported on a GPT partition on device 'eui.fd1a2bfb781b33786c9ce9009495adfd:1'</message></faultMessage><text/>

Thanks

Siva


vSphere web service sdk: how to mount vmdk

$
0
0

Hello,

 

I am new to the vmware and its SDK in general.

 

Does the vsphere web service sdk provide functionality to mount the vmdk of a VM which is in OFF state ?

If so, what is the type/object model for this ?

For our case the vm is a windows vm, so the vmdk contains NTFS volume.

The mounting host can be:

A. Another windows host, in this case accessing the NTFS vol is no issue.

B. Linux host, in this case, I suppose we will need ntfs lib support.

 

Your help/comments are greatly appreciated.

Thanks

 

-antony

Retrieve hostFolder from Newly Created Datacenter

$
0
0

Hey everyone - I am trying to retrieve hostFolder (the ManagedObjectReference to the folder itself) from a newly created DataCenter so that I can add hosts to it.   However, when I try to use a simple PropertySpec (no traversal), there are no folders in the new datacenter to grab.  The Datacenter is being created on the server (I can see it in VI Client).

 

This is the code (C#):

ManagedObjectReference newDatacenter = vimService.CreateDatacenter(srvContent.rootFolder, "Datacenter");

 

PropertySpec pSpec = new PropertySpec();

pSpec.type = "Folder"; // Find folders

pSpec.all = false; // but not all of them

pSpec.pathSet = new string[] \{ "hostFolder" }; // just hostFolder

 

ObjectSpec oSpec = new ObjectSpec();

oSpec.obj = newDatacenter; // look in the new datacenter just created

 

// Setting up the PropertyFilter

PropertyFilterSpec pFilterSpec = new PropertyFilterSpec();

pFilterSpec.propSet = new PropertySpec[] \{ pSpec };

pFilterSpec.objectSet = new ObjectSpec[] \{ oSpec };

 

// Search

ObjectContent\[] objects = vimService.RetrieveProperties(srvContent.propertyCollector, new PropertyFilterSpec[] \{ pFilterSpec });

 

This terminates in a SoapException that seems to be an InvalidPropertyFault whose name property is hostFolder.  So when I tried to retrieve all folders from the data center, it did not cause an exception, but did not retrieve anything.  So I guess the question is how do I get the hostFolder in a newly created datacenter so I can use that hostFolder as an argument to AddStandaloneHost_Task?

 

I thought that the hostFolder would be created when the datacenter was created since a hostFolder is guaranteed to exist according to the Reference Guide.

 

Any help with this would be appreciated.  Thanks!

VMClone: The operation is not supported on the object.

$
0
0

I use Java in the sample VMclone class and submitted to the mistake, how to solve?

 

 

Cloning Virtual Machine [xp001] to clone name [copyxp001]


java.lang.RuntimeException: The operation is not supported on the object.
    at com.vmware.vm.VMClone.getTaskResultAfterDone(VMClone.java:256)
    at com.vmware.vm.VMClone.cloneVM(VMClone.java:406)
    at com.vmware.vm.VMClone.main(VMClone.java:642)

 

 

 

CloneVM_Task operation is not supported on ESX Server but it is available on VC, Virtual Center?

In order, to be able to run VMClone sample, i should connect to the VC Server?

How to connect to VC Server?

How to get datacentername?

$
0
0

How to get datacentername?

 

I want to call VMClone method

 

 VMClone
 This sample makes a template of an existing VM and
 deploy multiple instances of this template onto a datacenterParameters:
 url             [required] : url of the web service
 username        [required] : username for the authentication
 password        [required] : password for the authentication
 datacentername  [required] : name of Datacenter
 vmpath          [required] : inventory path of the VM
 clonename       [required] : name of the clone

 

 

datacentername  [required] : name of Datacenter
 vmpath          [required] : inventory path of the VM 

How to get the two parameters?

Attaching a RDM to VM. Can you please tell what am i missing here?

$
0
0

Hi,

 

I am using the below configuration spec to attach a RDM (raw disk - pass-throuh)

 

However attaching is failing:(

 

It says Invalid configuration for device '0'.

 

Any help is greatly appreciated as i am struck:(?

 

VirtualDisk virtualDisk = newVirtualDisk();

 

//disk info

virtualDisk.controllerKey = controllerKey;

virtualDisk.controllerKeySpecified = true;

virtualDisk.unitNumber = location;

virtualDisk.unitNumberSpecified = true;

 

//backing file info 

VirtualDiskRawDiskMappingVer1BackingInfo backing = newVirtualDiskRawDiskMappingVer1BackingInfo();

backing.lunUuid = uuid;

backing.compatibilityMode = "physicalMode";

backing.diskMode ="persistent";

backing.deviceName = "vml.0200030000600601607f412e003c84c498fc52e111565241494420"; //TODO

 

backing.datastore = datastoremor

backing.fileName = "[DS_193]";  //do i have to specify the file? is it the mapping vmdk file?

   //isnt the framework automaitcally create mapping file?

virtualDisk.backing = backing;

 

//config spec

 

VirtualDeviceConfigSpec vdConfigSpecEdit = newVirtualDeviceConfigSpec();

vdConfigSpecEdit.device = virtualDisk;

vdConfigSpecEdit.operation =VirtualDeviceConfigSpecOperation.add;

vdConfigSpecEdit.operationSpecified = true;

vdConfigSpecEdit.fileOperation =VirtualDeviceConfigSpecFileOperation.create;

vdConfigSpecEdit.fileOperationSpecified =false;

 

VirtualMachineConfigSpec vmConfigSpecEdit = newVirtualMachineConfigSpec();

vmConfigSpecEdit.deviceChange = newVirtualDeviceConfigSpec[1];

vmConfigSpecEdit.deviceChange[0] = vdConfigSpecEdit;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards,

Dreamer

 

 

Viewing all 1860 articles
Browse latest View live


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