Carmageddon's Posts

Is that answer still holding true today? We also need to implement similar functionality.. any way to do a form.submit perhaps to vlcoud, to imitate the login process? or maybe a way to modify t... See more...
Is that answer still holding true today? We also need to implement similar functionality.. any way to do a form.submit perhaps to vlcoud, to imitate the login process? or maybe a way to modify the vCloud web server, to send Access-Control-Allow-Origin header? this would SOLVE all my problems!
The admin says that yes, otherwise we would be working on fixing that before doing it via API. EDIT: by the "same location", I suppose you mean clone to a DataStoreCluster? if so yes.
Thank you for the hints. Yes, I am calling against the vCenter API and not separate ESXi hosts. The property looks interesting, especially seeing the script uses it: my $location = VirtualMac... See more...
Thank you for the hints. Yes, I am calling against the vCenter API and not separate ESXi hosts. The property looks interesting, especially seeing the script uses it: my $location = VirtualMachineRelocateSpec->new(); I am not sure however what to specify there for the host, it seems to take an object reference, and I am not certain I even need one, and what the different options for it mean: The target host for the virtual machine. If not specified, if resource pool is not specified, current host is used. if resource pool is specified, and the target pool represents a stand-alone host, the host is used. if resource pool is specified, and the target pool represents a DRS-enabled cluster, a host selected by DRS is used. if resource pool is specified and the target pool represents a cluster without DRS enabled, an InvalidArgument exception be thrown. Keep in mind please, I am not a VMware certified admin, I am the programmer trying to automate what the admin can do in GUI I will ask tomorrow at work, if any of those things make sense to him as required for DataStoreCluster cloning. But if it is not? how is the scripts supposed to work? if by default it takes an empty VirtualMachineRelocateSpec object? Does it work for you?
well, for me the problem was 100% with the module version under Centos 5.8. And as the guy at the CPAN bug report said, FreeBSD installations are also affected by this. I guess MAC fanboys are ... See more...
well, for me the problem was 100% with the module version under Centos 5.8. And as the guy at the CPAN bug report said, FreeBSD installations are also affected by this. I guess MAC fanboys are lucky this time around :smileysilly:
Hey guys, We are trying to utilize William's script, to clone to the datastorecluster (from here: vGhetto / Code / [r251] /scripts/datastoreClusterVMProvisioning.pl) However we have an error... See more...
Hey guys, We are trying to utilize William's script, to clone to the datastorecluster (from here: vGhetto / Code / [r251] /scripts/datastoreClusterVMProvisioning.pl) However we have an error we cant figure out what causes it: Cloning "sdktemp1" to "del1000" onto "cl_ds1" Error: SOAP Fault: ----------- Fault string: The operation is not supported on the object. Fault detail: NotSupported This is on vSphere 5.5 and SDK 5.5 as well. One theory the System guy who deals with the VMware infrastructure has, is that it is related to not having the FullyAutomated setting, anywhere in the configuration specifications for the clone. I have been looking hard into the objects related to the calls in your script, and their API reference, and I cant find any way this setting could be set in the relevant object (it doesnt exist in those objects). Any ideas what could this be? Thanks!
To anyone interested, we have isolated the source of the problem: Package LWP::UserAgent in version 6.05 is bugged and causing the issue. Upgrade to 6.06 is not helping, because VMware SDK uses... See more...
To anyone interested, we have isolated the source of the problem: Package LWP::UserAgent in version 6.05 is bugged and causing the issue. Upgrade to 6.06 is not helping, because VMware SDK uses Net::SSL instead of Crypt::SSLeay (or something like that, more details here: https://rt.cpan.org/Public/Bug/Display.html?id=81684) Our solution was to downgrade the LWP::UserAgent package to 5.85 I think, and then everything works again If anyone manages to get it working on newer version, allowing to upgrade packages without fear - I'd like to hear. I hope this information helps someone.
I have a very similar problem! We have an older server, running the VMware VI SDK for Perl in older version (about 3 years old). That server is currently in production and works, it has the f... See more...
I have a very similar problem! We have an older server, running the VMware VI SDK for Perl in older version (about 3 years old). That server is currently in production and works, it has the following modules: [root@vmgw02 ~]# rpm -qa | grep perl | sort perl-5.8.8-32.el5_5.1 perl-Compress-Zlib-1.42-1.fc6 perl-Crypt-SSLeay-0.51-11.el5 perl-DBD-MySQL-3.0007-2.el5 perl-DBD-Pg-1.49-2.el5_3.1 perl-DBI-1.52-2.el5 perl-Digest-HMAC-1.01-15 perl-Digest-SHA1-2.11-1.2.1 perl-File-Type-0.22-3.el5 perl-HTML-Parser-3.55-1.fc6 perl-HTML-Tagset-3.10-2.1.1 perl-IO-Socket-INET6-2.51-2.fc6 perl-IO-Socket-SSL-1.01-1.fc6 perl-libwww-perl-5.805-1.1.1 perl-libxml-perl-0.08-1.2.1 perl-MailTools-1.77-1.el5.centos perl-MIME-Lite-3.01-5.el5 perl-Net-SSLeay-1.30-4.fc6 perl-Socket6-0.19-3.fc6 perl-String-CRC32-1.4-2.fc6 perl-TermReadKey-2.30-4.el5 perl-TimeDate-1.16-5.el5 perl-URI-1.35-3 perl-XML-Parser-2.34-6.1.2.2.1 The new server, with the updated SDK: [root@tcc1-dns ~]# rpm -qa | grep perl | sort perl-5.8.8-27.el5 perl-DBD-MySQL-3.0007-2.el5 perl-DBI-1.52-2.el5 perl-String-CRC32-1.4-2.fc6 I isolated our problem to be reproducible using the /usr/lib/vmware-vcli/apps/vm/vmcontrol.pl using a  --operation reset In Perl debugging, I can see that It does a SOAP request (which looks complete), and then gets a very long response, but malformed - the XML body is cut off, and the following header is added to the response object, when I do x $response in debugger (Please note RetrievePropertiesResponse  has a really loooong output, I cut it off to protect the data - but I left the structure showing how XML is cut in the end In: SoapClient::request(/usr/lib/perl5/5.8.8/VMware/VICommon.pm:2207):   DB<2> x $response 0  HTTP::Response=HASH(0x14d133e0)    '_content' => '<?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> <RetrievePropertiesResponse xmlns="urn:vim25"><returnval><obj type="VirtualMachine">vm-212827</obj><propSet><name>name</name><val xsi:type="xsd:string">PPA (87030acc-1eee-483e-8952-7bc1ba23515f)</val></propSet></returnval><returnval><obj type="VirtualMachine">vm-246541</obj><propSet><name>name</name><val xsi:type="xsd:string">SAP-VM2 (2264bf74-ff16-4788-b822-7e248f42d540)</val></propSet></returnval><re'    '_headers' => HTTP::Headers=HASH(0x14d131f0)       '::std_case' => HASH(0x14d13180)          'client-aborted' => 'Client-Aborted'          'client-date' => 'Client-Date'          'client-peer' => 'Client-Peer'          'client-response-num' => 'Client-Response-Num'          'client-ssl-cert-issuer' => 'Client-SSL-Cert-Issuer'          'client-ssl-cert-subject' => 'Client-SSL-Cert-Subject'          'client-ssl-cipher' => 'Client-SSL-Cipher'          'client-ssl-socket-class' => 'Client-SSL-Socket-Class'          'client-ssl-warning' => 'Client-SSL-Warning'          'client-transfer-encoding' => 'Client-Transfer-Encoding'          'set-cookie' => 'Set-Cookie'          'set-cookie2' => 'Set-Cookie2'         'x-died' => 'X-Died'       'cache-control' => 'no-cache'       'client-aborted' => 'die'       'client-date' => 'Tue, 31 Dec 2013 15:16:59 GMT'       'client-peer' => '1.1.1.4:443'       'client-response-num' => 2       'client-ssl-cert-issuer' => '/O=VMware Installer'       'client-ssl-cert-subject' => '/O=VMware, Inc./OU=VMware, Inc./CN=VMware default certificate/emailAddress=support@vmware.com'       'client-ssl-cipher' => 'AES256-SHA'       'client-ssl-socket-class' => 'Net::SSL'       'client-ssl-warning' => 'Peer certificate not verified'       'client-transfer-encoding' => ARRAY(0x12d47140)          0  'chunked'       'connection' => 'Keep-Alive'       'content-type' => 'text/xml; charset=utf-8'       'date' => 'Tue, 31 Dec 2013 15:16:38 GMT'       'x-died' => 'read timeout at /usr/lib/perl5/site_perl/5.8.8/Net/HTTP/Methods.pm line 236.'    '_msg' => 'OK'    '_protocol' => 'HTTP/1.1'    '_rc' => 200    '_request' => HTTP::Request=HASH(0x14d4fb90)       '_content' => '<?xml version="1.0" encoding="UTF-8"?>    <soapenv:Envelope 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> <RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this> <specSet><propSet><type>VirtualMachine</type><all>0</all><pathSet>name</pathSet></propSet><objectSet><obj type="Folder">group-d1</obj> <skip>0</skip><selectSet xsi:type="TraversalSpec"><name>folderTraversalSpec</name><type>Folder</type><path>childEntity</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet><selectSet><name>datacenterHostTraversalSpec</name></selectSet><selectSet><name>datacenterVmTraversalSpec</name></selectSet><selectSet><name>datacenterDatastoreTraversalSpec</name></selectSet><selectSet><name>datacenterNetworkTraversalSpec</name></selectSet><selectSet><name>computeResourceRpTraversalSpec</name></selectSet><selectSet><name>computeResourceHostTraversalSpec</name></selectSet><selectSet><name>hostVmTraversalSpec</name></selectSet><selectSet><name>resourcePoolVmTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>datacenterDatastoreTraversalSpec</name><type>Datacenter</type><path>datastoreFolder</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>datacenterNetworkTraversalSpec</name><type>Datacenter</type><path>networkFolder</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>datacenterVmTraversalSpec</name><type>Datacenter</type><path>vmFolder</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>datacenterHostTraversalSpec</name><type>Datacenter</type><path>hostFolder</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>computeResourceHostTraversalSpec</name><type>ComputeResource</type><path>host</path><skip>0</skip></selectSet><selectSet xsi:type="TraversalSpec"><name>computeResourceRpTraversalSpec</name><type>ComputeResource</type><path>resourcePool</path><skip>0</skip><selectSet><name>resourcePoolTraversalSpec</name></selectSet><selectSet><name>resourcePoolVmTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>resourcePoolTraversalSpec</name><type>ResourcePool</type><path>resourcePool</path><skip>0</skip><selectSet><name>resourcePoolTraversalSpec</name></selectSet><selectSet><name>resourcePoolVmTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>hostVmTraversalSpec</name><type>HostSystem</type><path>vm</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet></selectSet><selectSet xsi:type="TraversalSpec"><name>resourcePoolVmTraversalSpec</name><type>ResourcePool</type><path>vm</path><skip>0</skip></selectSet></objectSet></specSet></RetrieveProperties></soapenv:Body></soapenv:Envelope> '       '_headers' => HTTP::Headers=HASH(0x14d4fa60)          '::std_case' => HASH(0x14d4fbb0)             'cookie' => 'Cookie'             'cookie2' => 'Cookie2'             'if-ssl-cert-subject' => 'If-SSL-Cert-Subject'             'soapaction' => 'SOAPAction'          'content-length' => 3164          'content-type' => 'text/xml'          'cookie' => 'vmware_soap_session="52981bc0-8697-558d-4f6e-9588b76021c6"'          'cookie2' => '$Version="1"'          'soapaction' => '"urn:vim25/test"'          'user-agent' => 'VI Perl'       '_method' => 'POST'       '_uri' => URI::https=SCALAR(0x14cc0560)          -> 'https://1.1.1.4:443/sdk/webService'       '_uri_canonical' => URI::https=SCALAR(0x14cc5320)          -> 'https://1.1.1.4/sdk/webService' I did further tests: When I clone the old (production) machine, and boot the clone with the IP of the new machine - the scripts work (meaning its not firewall or network issue). From my check with Perl, the timeout on HTTP::Request module's underlying modules, is 0 by default (no timeout), and anyway I have ruled out network issue as the cause. EDIT: The trigger is my $vm_views = VMUtils::get_vms ('VirtualMachine', $vm_name,                       $datacenter, $folder, $pool, $host, %filterHash); line 95 in /usr/lib/vmware-vcli/apps/vm/vmcontrol.pl, all calls including connect pass successfully before hand. Please, can anyone give me some hints into the possible cause? Thanks!
Come on guys, anyone? How do you create/clone VMs from template without hardcoded reliance on a single (or a pre-defined list) of host(s)?
Hello! I've been using the vSphere SDK for Perl to do automation. I have used until now, something like this to clone from templates: my @args = ("/root/vmware-vsphere-cli-distrib/apps/vm/... See more...
Hello! I've been using the vSphere SDK for Perl to do automation. I have used until now, something like this to clone from templates: my @args = ("/root/vmware-vsphere-cli-distrib/apps/vm/vmclone.pl --vmhost esx12.infra.local --vmname $templateName --vmname_destination $finalVMName --datastore $dataStore  --username $User --password $Pass --url $serverIP"); Which is working. However now they want to do some changes in infrastructure, and asking me whether I can make it dynamic. I have not found any examples or documentation stating how to do that, but logic dictates it must be possible somehow - the whole point of vCenter is that it chooses automatically on which host to provision the new VM. However as I said, no sample shows this is possible (and how). Any ideas please?
I solved it! your information is misleading (as well as the documentation). The string should look as follows: #{#string#xxx.xxx.37.202-xxx.xxx.37.206#}#
Thank you so much mcssschaefer! Your hints and samples helped me, I think I am too on the right way (using PHP). Here is the method I created for arrays (similar to normal items): /**... See more...
Thank you so much mcssschaefer! Your hints and samples helped me, I think I am too on the right way (using PHP). Here is the method I created for arrays (similar to normal items): /** * Method to deal with adding arrays of elements like strings, numbers etc - only deals with homogenous array! * @param array $objects Array of the values to add. * @param String $name Name of the attribute, default value is 'name'. * @param string $type Should be either string or "number". */ public function AddArrayInput(array $objects, $name="name", $type="string") { if (empty($objects)) throw new Exception("Array of objects should not be empty!", 1); $finalString = '#{'; foreach ($objects as $value) $finalString = $finalString."#<$type>#<$value>#;"; $finalString = trim($finalString, ";"); $finalString = $finalString."}#"; $attr = new stdClass(); $attr->name = $name; $attr->type = "Array/$type"; $attr->value = $finalString; $this->workflowInputs[] = $attr; } When I call the workflow, I get no exceptions thrown, however, vCO still fails to validate the array parameters In the execution Events log (in GUI), I see this: Workflow has failed: Invalid parameter(s) Validation error for parameter 'alertEmailTo': OGNL error : null And in the variables list, the Array type parameters remain "Not set" I must be very very close! what am I doing wrong? Here is a sample piece of the print_r of getWorkflowTokenStatus output which indicates how the parameter was constructed and passed to vCO:     stdClass::__set_state(array(        'name' => 'OrgAlertEmailTo',        'type' => 'Array/string',        'value' => '#{#<string>#<maxim@domain.com>#}#',     )), Please, any help? EDIT: Additional information: It seems that the validation error comes from the workflows INSIDE the workflow I am executing - for some reason either the array is not properly parsed, or not passed to the workflows inside. for example, the OrgAlertEmailTo is an input parameter for a local parameter called alertEmailTo (in Add an Organization workflow). I am not sure what this clue means... Message was edited by: Carmageddon
Thanks William, I posted: http://communities.vmware.com/thread/342817 However I should rephrase my question regarding the forum use: indeed creating thread is easy with the big green button. ... See more...
Thanks William, I posted: http://communities.vmware.com/thread/342817 However I should rephrase my question regarding the forum use: indeed creating thread is easy with the big green button. But I meant, that I wanted to BROWSE that forum, see what other questions were asked and see if any of them would shed any light on my issues and give me better undestanding. However, I only found there the "Recent Content" under the above link, and no link leading to a forum in its classic sense. Only after posting the new thread, I saw the link in the forum categories "bread crumbs" called "Discussions" leading to this: http://communities.vmware.com/community/vmtn/developer/forums/vcloudsdkphp?view=discussions Otherwise I could not find any other way to reach that forum. I hope this is something which can be fixed
William - the page you linked to only has the SDK on it and some (quite useless) "documentation". There is no sub-forum there for VCloud SDK for PHP - perhaps it has been removed/merged since ... See more...
William - the page you linked to only has the SDK on it and some (quite useless) "documentation". There is no sub-forum there for VCloud SDK for PHP - perhaps it has been removed/merged since you posted, or perhaps I am too stupid to use the intuitive GUI of vmWare's website. Either way, I too am having a lot of fundamental problems with understanding the SDK and how to work with it. The only available documentation is the one generated from PHP comments which pretty much sums the methods, variables, classes and groups them together. This is a reference which helps  a little bit on the technical aspect of classes and how they relate to each other, but it DOES NOT tell me, for example from one of the sample files: echo "     -c|--netmoref <netmoref>  [opt] Vim portgroup MoRef. Required for creating.\n"; Thats from the sample script which creates an External Network, which I need to do in order to provision a new customer Organization. Another unknown thing, is what is a "fence Mode" in this:  $config->setFenceMode($fenceMode); Another basic concept of the SDK I could not really grasp yet - is why some of the classes begin as VMware_VCloud_API* while others are VMware_VCloud_SDK* Another example? in the GUI's New Organization scree, under Policies section, there is a "Limits" section - I searched thoroughly, and did not find any corresponding SDK/API methods in the documentation! Also, I did not find a way to Delete organization (when a customer cancels subscription for example). I apologize if my attitude comes over a bit on the irritated side, but I've been at it for some time now, and each time I get more and more irritated looking at the "documentation" trying to figure out something Regardless, Kimberly Wang's code is simply outstanding and well written, I just wish for some help figuring out how to put this huge puzzel together (even in the sample code I dont understand for example, how to come up with the right order of objects within objects nesting in order to get something done such as VMware_VCloud_API_OrgSettingsType class object for the settings, then feed it into a VMware_VCloud_API_AdminOrgType (along with other settings - why are they not in the $settings object? And finally another VMware_VCloud_SDK_Admin object is the one to actually create the organization! why the VMware_VCloud_API_AdminOrgType couldnt be the class doing the organization creation?) This is a brief summary of the things I am trying to figure out. Perhaps I missed some kind of guide for this? and if not, I would be very grateful if someone could explain in a few words to help me understand this puzzel so I could start doing my job and build something out of these awesome (even if cryptic) building blocks! Thanks
Hi, I have noticed you've got the guest Customization options figured out (as I see below). I would like to do something similar - basically all I need is to change the password of the adminis... See more...
Hi, I have noticed you've got the guest Customization options figured out (as I see below). I would like to do something similar - basically all I need is to change the password of the administrator when I call vmclone.pl (vmware's application). For that, I need to feed it XML file with the specification for that (and probably XSD file as well). However my problem is, I have not found a complete documentation for all the customization options - how exactly to define them in XML and XSD files? Inferring from your example, I would think its something like: <identity> <password>abc</password> <plainText>true</plainText> </identity> Would this be correct? if so who would be the parent of identity in the XML? Also what is the guiUnattended[password] attribute for? Thanks! Code to generate spec for anyone else's reference. > function generateSpec($key) { > /* > * Windows Customization Options > */ > $winOptions[changeSID] = true; > $winOptions[deleteAccounts] = false; > $spec[options] = new soapval('options', false, $winOptions, false, false, array("xsi:type" => "CustomizationWinOptions")); > > /* > * Identity > */ > $password[value] = "**encryptedPassword**"; > $password[plainText] = false; > $guiUnattended[password] = $password; > $guiUnattended[timeZone] = 20; > $guiUnattended[autoLogon] = true; > $guiUnattended[autoLogonCount] = 1; > $identity[guiUnattended] = new soapval('guiUnattended', false, $guiUnattended, false, false, array("xsi:type" => "CustomizationGuiUnattended")); > > >
Glad you got it working, but I seriously no clue what you're trying to say. Hope you update your published one to be universal.I'm not sure I follow this as well, what do you mean "unive... See more...
Glad you got it working, but I seriously no clue what you're trying to say. Hope you update your published one to be universal.I'm not sure I follow this as well, what do you mean "universal". It supports all 4 types of vNIC (e1000,pcnet32,vmxnet2 and vmxnet3) In any case, the script is provide as an example and has been tested against all 4 types of vNIC. I encourage users to modify and tweak these scripts to fit their operating environment. Regarding the limited sub-properties, if you look at the API docs, not all of them are required ... this really depends on what you need configured and again, it may vary based on your requirements. Thanks ok I will try explaining again: What I meant is, your script currently tries to retrieve information from sub-objects in the VM tree such as "Backing" and then some sub-object in it etc (which doesnt always exist for everyone who uses the script), and is are not neccesary information for the changing MAC procedure - hence why your original script failed for me. Instead, I just modified your call to the New constructor, and inside simply copied all the attributes inside my NIC. What I am saying, perhaps we should simply write a script that would automatically check first if certain attribute exists, if it does, copy it to the new object as well (eventually ending up with perfect copy, and only changing macAddress and the "Static" thing. And then issuing the Reconfigure task. The point is, such script would work "universally" for all people, regardless if they have Distributed NIC, normal nic, 100 attributes to their NIC, or only 5.
Peter, Just found your post and been reading information last 3 hours on the topic of changing password while cloning a VM (either linux or windows based) Seems still poorly (not at all) docum... See more...
Peter, Just found your post and been reading information last 3 hours on the topic of changing password while cloning a VM (either linux or windows based) Seems still poorly (not at all) documented even now 3 years later I would still like to see your script, my guess is that it should at least work for the Server 2003 and (hopefully) 2008, leaving me with only linux root password change issue, so would be there half way. I cant find your script in the sample Perl scripts folder. Can you (or anyone) link or upload please? Thanks!
William I got it working, took a while but I changed your script a bit. I dont know why did you do stuff such as: my $network = Vim::get_view(mo_ref => $vnic_device->backing->network, properties... See more...
William I got it working, took a while but I changed your script a bit. I dont know why did you do stuff such as: my $network = Vim::get_view(mo_ref => $vnic_device->backing->network, properties => ); Its not needed I disabled ALL of that stuff, and changed all 4 devices in the following fashion (your old setting commented out): if($nictype eq 'VirtualE1000') { #$newNetworkDevice = VirtualE1000->new(key => $vnic_device->key, unitNumber => $vnic_device->unitNumber, controllerKey => $vnic_device->controllerKey, backing => $backing_info, addressType => 'Manual', macAddress => $mac); $newNetworkDevice = VirtualE1000->new(key => $vnic_device->key, unitNumber => $vnic_device->unitNumber, controllerKey => $vnic_device->controllerKey, backing => $vnic_device->backing, addressType => 'Manual', macAddress => $mac, deviceInfo => $vnic_device->deviceInfo, wakeOnLanEnabled => $vnic_device->wakeOnLanEnabled, connectable => $vnic_device->connectable); As you can see, your old objects contained too few sub-objects, and I have no idea why did you read them to separate variables earlier, just to give them again here - doing backing => $vnic_device->backing is UNIVERSAL, and should work for any nic - why did you go to backing->network? you didn't need anything there in order to complete the script's task. In any case, thanks again! although not a direct help, you did send me time and time again to look at your script Hope you update your published one to be universal.
Ok.. after thinking, perhaps it would be much easier to customize the MAC address, when I create the machine instead? using vmware-vsphere-cli-distrib/apps/vm/vmclone.pl , I can ask it to clon... See more...
Ok.. after thinking, perhaps it would be much easier to customize the MAC address, when I create the machine instead? using vmware-vsphere-cli-distrib/apps/vm/vmclone.pl , I can ask it to clone the machine while customizing the VM using an XMLll file. They give some examples in the documentation for things such as: However, I cant find the corresponding settings in the VMX file. What I want to do, is esentially clone from template (which works) BUT, I want to do it with customizing the VM using the XML file, which would contain configspecs equal to these from the VMX file: ethernet0.present = "TRUE" ethernet0.virtualDev = "e1000" ethernet0.dvs.switchId = "long HEX address" ethernet0.dvs.portId = "510" ethernet0.dvs.portgroupId = "dvportgroup-712" ethernet0.dvs.connectionId = "1946534217" ethernet0.addressType = "static" ethernet0.address = "00:50:56:30:00:13" Now, how do I find the equivalents of these for XML file? From all my searches and readings, the documentation is spread all over and in my cases not complete, I would love if you could point me to specifics - maybe I missed something? Anyhow, of the above VMX settings, I think I only need to do ethernet0.present, ethernet0.virtualDev, ethernet0.dvs.switchId = "some HEX address", ethernet0.addressType and ethernet0.address, and everything else would be adjusted by VMware (as the port is unique per each VM). Am I right? if not, how would you suggest I do it? and by the way, you were right William, we do indeed use Distributed Ports, but since I cant find such setting in the VMX file, I must assume it comes from the switch? I not, how would you suggest I clone the template, using a custom MAC? (I can specify the template - it could be without a NIC, or with it, but seems much more difficult to change it).
Thank you. I've followed your links and started digging deeper, although a lot of the PDF documents seem very outdated using very old (2006-2007) versions of the Perl API. About the Reference... See more...
Thank you. I've followed your links and started digging deeper, although a lot of the PDF documents seem very outdated using very old (2006-2007) versions of the Perl API. About the ReferenceGuide - is there any way to present it in a UML like way, or some way I could comfortably print it out? I find it hard to link all the bits and pieces in my head, and it helps seeing who inherits what etc, when its printed and easy to follow from one page to the next. Or better yet, a nice printout of the entire VM object, the way debugger shows - I think this would help. I have another idea for approaching this problem: Will creating a VM with custom MAC pre-defined, be easier than modifying? (I will need to do it anyway on the next step of the project..) Yes you understood correctly I think - I will put it in my words: I need to change the VM's ethernet adapter's MAC, because this is how DHCP server handles out IPs etc. (Or alternatively and even better, create the VM with the right MAC from the start). I am not sure what is standard portgroup, and distributed portgroup - is this part of the API? if not where do I check, which kind of ethernet adapter our VMs use? I will try your suggestion and create a VM with standard default NIC tomorrow at work, and see if the change MAc works then, and take it from there. Although I am beginning to think creating VM with the right mac from the start, should be easier? If I specify it in the config XML file I pass to create_VM method, how would I define this? can I simply take the elements names from a sample VMX file, add it to the XML file and it will understand what to do with the special elements? beside the trivial ones such as Disksize etc?
William, my issue with analyzing how your script works, it two-folded: 1) Due to the error I get on line 123, I cant reach the actual creation and watch it via debugger like I want 2) I found n... See more...
William, my issue with analyzing how your script works, it two-folded: 1) Due to the error I get on line 123, I cant reach the actual creation and watch it via debugger like I want 2) I found no documentation for a lot of things you use in your script, such as mo_ref => $vnic_device->backing->network There is no documentation on mo_ref for vSphere 4 anywhere, also the whole section of: if($nictype eq 'VirtualE1000') {.....} Uses things I am not sure where are they documented. If you look at page 29 of the SDK for Perl Programming Guide documentation, it's instructions on how to modify a property, are very different from how you do it. - thats why I am having troubles understanding that. I will also point out, that your other script (which finds a machine name by its MAC), actually works exactly as per the documentation, eg it goes to $vm->config->hardware->device->VirtualEthernetCard and then accesses the macAddress property - simple, identical to what the API says about that object. Now from here when I get back to 1 and 2, I cant understand why suddenly everything changes, the moment I want to modify the value of the field?