Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all 2039 articles
Browse latest View live

Can we use VIX to add/remove disks from a VM?

$
0
0

Hi All,

 

I'm having a problem, I have a ESX server which as several VMs: A,B,C,D,E etc.

On A, I want to add/remove disks to B,C,D,E with VIX APIs (or vmrun commands).

Is this possible? Or I have to give up VIX and use another vmware API to do this?

Thanks for the reading my question! :-)


How to ignore quotes in vmrun commands

$
0
0

Hi,

 

I am trying to execute a vmrun command like below which is working fine.

 

vmrun -T esx -h https://test.eng.vmware.com/sdk -u root -p password -gu root -gp password runProgramInGuest "[datastore] test/test.vmx" /bin/rpm -i /root/expect-5.43.0-5.1.x86_64.rpm

 

But if I execute it like below (please note I've mentioned the programName in quotes)

 

vmrun -T esx -h https://test.eng.vmware.com/sdk -u root -p password -gu root -gp password runProgramInGuest "[datastore] test/test.vmx" "/bin/rpm -i /root/expect-5.43.0-5.1.x86_64.rpm"

 

then I am getting an error "Error: A file was not found"

 

Why is this difference..?

I need that command to be worked in the second format also. Because I am trying to execute it from java where I am passing all the details as strings. So it is getting executed with quotes and I am getting the same error "Error: A file was not found".

 

Any solution..?

 

Regards,

Badri.

Programmatically Connecting/Disconnecting Removable Devices using VIX API?

$
0
0

 

Is it somehow possible to connect/disconnect removable devices using the VIX API?

 

 

Or is there another mechanism how I might archieve that using my own tool/script?

 

 

 

 

 

Thanks

 

 

Can removable devices connect or disconnect with VIX API?

$
0
0

Hi,

 

I want to be able to connect a USB device (currently being connected to the host) to the guest with command-line or program.

 

Is this possible in some way?

 

Menu -> VM -> Removable Devices -> Connect USB Device or Disconnect USB Device

 

 

I want to be albe to execute this command in some way.

 

 

if it is impossible, I want to answer that is word "It's impossible"

 

 

help me, please.

vix API C# not able read the CPU utilization and memory usage

$
0
0

iam automating the report of the VI server utlilization. Need help to get the CPU ustilization of the server, IP host of the server list and memeory usage of the VI server. I gone through all the documents i not able get proper help for this. Would someone please provide sample code C# function to do these thing.

 

Thanks in advance

VixVM_Open() returns error "The datastore corresponding to the given datastore path is not found"

$
0
0

In one of our setup, VixVM_Open() API call returns error "The datastore corresponding to the given datastore path is not found."

The returned error code is 38.

 

The specified vmx path as input to VixVM_Open() is of the fornmat "[MyDatastore] MyVM/MyVM.vmx".

We have verified that the datastore "MyDatastore" and the vmx path "[MyDatastore] MyVM/MyVM.vmx" exists and a VM is using this path.

 

We don't suspect any problem with the code, as the same code works in other setups.

 

What can be the possible reasons of VixVM_Open() returning this error?

And where to look for to drill down the root cause?

 

PS: We called VixHost_Connect() API to connect to a vCenter server (5.1) and then used VixVM_Open() API to try to connect to a VM. But the later is returning error.

 

 

Thanks in advance.

Problems using vmrun on ESX3.5

$
0
0

Hopefully a quick question because I'm missing something obvious.

 

I am running vmrun version 1.12.1 against an ESX 3.5 Server and am getting partial sucess.

 

If I run:

 

vmrun -T ESX -h http://{ip Address}/sdk -u root list

 

I am prompted for the password then it lists the VM's running as follows.

 

Total running VMs: 3

[ha-datacenter/server:storage2] Client/Client.vmx

""                          ""                     ""

""                          ""                     ""

 

But when I try to list the snapshots using:

 

vmrun -T ESX http://{ip Address}/sdk -u root listSnapshots "[ha-datacenter/server:storage2] Client/Client.vmx"

or

vmrun -T ESX http://{ip Address}/sdk -u root listSnapshots "[server:storage2] Client/Client.vmx"

 

I get the following error.

 

Error: Cannot open VM: [server:storage2] Client/Client.vmx, There was an error in communication.

 

Thanks,

For snapshot

$
0
0

I want to get a virtual machine all snapshot,

But by  VixVM_GetNumRootSnapshots ()  does not get to all。

What should I do to get it?


Getting "VMware Tools are not running in the guest" from VIX, but tools are running

$
0
0

I'm having an issue with a Perl VIX script that I am writing. I am connecting to a VM, I wait for the VMWare tools using VMWaitForToolsInGuest, and then I execute a VBScript. After about 15 minutes, I get an 3016 error code "VMWare Tools are not running in the guest", but if I check the VM manually, the tools are running. Does anyone have any clue as to why I might get this error if the tools are running?

 

Below is the code that I am using. I am able to connect to the VM before this in the same script without error. The error occurs during the last VMRunProgramInGuest.

 

Any help would be greatly appreciated.

 

Thanks,

 

Andy


print Time(), "Connecting to host...";
$err, $hostHandle) = HostConnect(      VIX_API_VERSION,      VIX_SERVICEPROVIDER_VMWARE_WORKSTATION,      $hostName, # hostName      0, # hostPort      $userName, # userName      $password, # password      0, # options      VIX_INVALID_HANDLE); # propertyListHandle
CheckError("HostConnect() failed");
print "Connected\n";
print Time(), "Opening VM...";
($err, $vmHandle) = VMOpen(      $hostHandle,      "$vmName");
CheckError("VMOpen() failed");
print "Opened\n";

print Time(), "Powering on VM...";
$err = VMPowerOn(
      $vmHandle,      VIX_VMPOWEROP_LAUNCH_GUI, # powerOnOptions      VIX_INVALID_HANDLE);  # propertyListHandle
CheckError("VMPowerOn() failed");
print "Powered on\n";

print Time(), "Waiting for tools...";
$err = VMWaitForToolsInGuest(
      $vmHandle,      3600); # timeoutInSeconds
CheckError("VMWaitForToolsInGuest() failed");
print "Ready\n";  

print Time(), "Logging in as $userName...";
$err = VMLoginInGuest(
      $vmHandle,      $userName, # userName      $password, # password      0); # options
CheckError("VMLoginInGuest() failed");
print "Logged in\n";  

$err =  VMRunProgramInGuest(      $vmHandle,      $cscript, #executable      "$vmTestsDir\\runAnt.vbs $vmTestsDir\\build.xml $buildTarget", #arguments      0, # options      VIX_INVALID_HANDLE);
CheckError("VMRunProgramInGuest(JUnit tests) failed");
print "Finished\n";

VIX Perl, VMRunProgramInGuest and reading exitcode

$
0
0

Hello all,

is there posibility to read exitcode that program executed via VMRunProgramInGuest returns?  I mean in Perl.

I found that there is a VIX_PROPERTY_JOB_RESULT_GUEST_PROGRAM_EXIT_CODE but this is property of Job and job are not available in VIX Perl.

Have i chance to get exitcode in Perl?

vim-cmd vmsvc/snapshot.removeall command took about 20 mins to finish

$
0
0

Experts,

 

I am using command line tool vim-cmd to control my Vsphere clients' snapshots.

Because I can not use vim-cmd to identify one snapshot by name, need to provide Index and Level, which I dont have. But I can always use 0 0 pair for the root snapshot.

So, I am using only one snapshot and using snapshot.removeall to remove the root snapshot.

But sometimes vmsvc/snapshot.removeall command took too much time to execute, I dont know why, anyone who can direct me? Or I should choose remove but not remove all?

 

 

 

 

Thanks!

Tyler

issues getting the VM to "notice" runtime changes I've made via the VIX API?

$
0
0

Hello there!  I appear to have run into an interesting quirk in some automated testing I'm setting up using the VIX VM Perl API, and was wondering if anyone had seen anything similar and/or could offer any advice.

 

So I'm trying to see how various network problems - throttled bandwidth, dropped packets, etc. - adversely affect a client I'm building.  I have a VM created, running in VMWare Workstation 8, where I have a copy of the client installed.  When I try to throttle my bandwidth using the Workstation UI - [right click on VM] > Settings > Network Adapter > Advanced > [change numbers] > OK > OK - everything works beautifully.  The log files show reduced bandwidth, I can visually see video streaming quality degrade, and everything else is precisely as one would expect.

 

But I'd love to automate this task to get better test coverage, so I've tried to emulate the same experience with the VIX API in Perl.  The VMWriteVariable calls return successfully when I try to modify the "ethernet0.rxbw.limit" and "ethernet0.txbw.limit" values in the runtime.  The VMReadVariable calls confirm that the changes to those variables have been made.  But the network performance is not actually affected; everything continues operating as if the network bandwith options had not been touched. (Although interestingly, if I *then* go into the VM via the VMWare Workstation UI and inspect those values?  Clicking "OK" and "OK" in the above sequence will make the runtime "notice" my changes, which suddenly go into effect.)

 

Does anyone have any insight on what might be causing this or how I might get around it?  I've pored over the documentation and didn't see anything obvious, like a "send this message to force runtime changes to be uptaken" or anything.  Wasn't sure if this was a bug, or operator error on my end, or something else entirely.  If anyone can float some advice my way, I'd be ever so thankful!

VIX function to find guest OS volumes

$
0
0

hello

I am trying to find volumes of guest OS is there any function or method in VIX.

Thanks in advance

Simulate a device status of disconnected in Workstation v.9?

$
0
0

I am trying to find a way to simulate a device status of disconnected in Workstation v.9.  I could probably stop/start the network service inside a guest but I'm looking for something more disruptive.

 

 

Any suggestions how to do that via the VIX API?

 

 

 

Gary

vifs --get internal error

$
0
0

Hi,

 

I'm getting an internal error 500 from

 

# vifs --server srv2 --username root --password *** -g "[SATA-RAID5] ISO/CentOS-6.2-x86_64-minimal.iso" ./x

GET https://srv2/folder/ISO/CentOS-6.2-x86_64-minimal.iso?dsName=SATA-RAID5 unsuccessful : 500 Internal Server Error

 

It worked at first, but stopped working some time after I deleted the VM that was using the image. I have rebooted the host

to no avail. I can retrieve the file from another host in the cluster.

 

Does anyone have a clue to what is going on here? The host is using vSpere 5.0. Logs below. It says "Error creating Reader: FileIO error : Failed to lock file",

but I don't know how to unlock.

 

-- robin

 

2013-06-07T22:14:34.563Z [69DDBB90 verbose 'Locale' opID=HB-host-413@75-f3d8feaa-a5] Default resource used for 'counter.virtualDisk.busResets.summary' expected in module 'perf'.

2013-06-07T22:14:41.990Z [69E5DB90 verbose 'SoapAdapter'] Responded to service state request

2013-06-07T22:14:43.236Z [69E1CB90 verbose 'Proxysvc Req00019'] New proxy client SSL(TCP(local=10.1.2.75:443, peer=10.1.2.76:57162))

2013-06-07T22:14:43.262Z [69681B90 verbose 'Locale' opID=HB-host-413@77-b8d3397a-5c] Default resource used for 'counter.virtualDisk.commandsAborted.label' expected in module 'perf'.

2013-06-07T22:14:43.262Z [69681B90 verbose 'Locale' opID=HB-host-413@77-b8d3397a-5c] Default resource used for 'counter.virtualDisk.commandsAborted.summary' expected in module 'perf'.

2013-06-07T22:14:43.262Z [69681B90 verbose 'Locale' opID=HB-host-413@77-b8d3397a-5c] Default resource used for 'counter.virtualDisk.busResets.label' expected in module 'perf'.

2013-06-07T22:14:43.262Z [69681B90 verbose 'Locale' opID=HB-host-413@77-b8d3397a-5c] Default resource used for 'counter.virtualDisk.busResets.summary' expected in module 'perf'.

2013-06-07T22:14:43.288Z [69E1CB90 verbose 'ha-license-manager' opID=HB-host-413@77-b8d3397a-5c] Load: Loading existing file: /etc/vmware/license.cfg

2013-06-07T22:14:43.303Z [69E1CB90 verbose 'Default' opID=HB-host-413@77-b8d3397a-5c] ha-license-manager:Validate -> Valid license detected for "VMware ESX Server 5.0" (lastError=0, desc.IsValid:Yes)

2013-06-07T22:14:52.466Z [FFE9FAD0 verbose 'Proxysvc Req00020'] New proxy client SSL(TCP(local=10.1.2.75:443, peer=10.1.2.196:50316))

2013-06-07T22:14:52.667Z [696C2B90 verbose 'Proxysvc Req00021'] New proxy client SSL(TCP(local=10.1.2.75:443, peer=10.1.2.196:50321))

pam_per_user: create_subrequest_handle(): doing map lookup for user "root"

pam_per_user: create_subrequest_handle(): creating new subrequest (user="root", service="system-auth-generic")

Accepted password for user root from 10.1.2.196

2013-06-07T22:14:52.785Z [69AC2B90 info 'Vimsvc'] [Auth]: User root

2013-06-07T22:14:52.785Z [69AC2B90 info 'ha-eventmgr'] Event 120 : User root@10.1.2.196 logged in

2013-06-07T22:14:52.884Z [FFE9FAD0 info 'TaskManager'] Task Created : haTask--vim.SearchIndex.findByInventoryPath-91916343

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] FindByInventoryPath: inventoryPath = ha-datacenter

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] GetMatchingChild: node = <null>, childName = ha-datacenter

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] RefToNamedManagedEntity: ref = vim.Datacenter:ha-datacenter, name = ha-datacenter

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] RefNamedManagedEntity: result = vim.Datacenter:ha-datacenter

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] GetMatchingChild: returning child = [N4Solo17HaFixedDatacenterE:0x57098f4]

2013-06-07T22:14:52.884Z [69DDBB90 verbose 'SearchIndex'] FindByInventoryPath returning vim.Datacenter:ha-datacenter

2013-06-07T22:14:52.884Z [69DDBB90 info 'TaskManager'] Task Completed : haTask--vim.SearchIndex.findByInventoryPath-91916343 Status success

2013-06-07T22:14:52.886Z [69A81B90 verbose 'DatastoreBrowser'] 4f702519-ed59a094-6804-d4bed9ed50ab-datastorebrowser::Search Path = [SATA-RAID5]ISO Spec = (vim.host.DatastoreBrowser.SearchSpec) {

-->    dynamicType = <unset>,

-->    query = (vim.host.DatastoreBrowser.Query) [

-->       (vim.host.DatastoreBrowser.FolderQuery) {

-->          dynamicType = <unset>,

-->       },

-->       (vim.host.DatastoreBrowser.Query) {

-->          dynamicType = <unset>,

-->       }

-->    ],

-->    details = (vim.host.DatastoreBrowser.FileInfo.Details) {

-->       dynamicType = <unset>,

-->       fileType = true,

-->       fileSize = false,

-->       modification = false,

-->       fileOwner = false,

-->    },

-->    searchCaseInsensitive = <unset>,

-->    matchPattern = (string) [

-->       "CentOS-6\.2-x86_64-minimal\.iso"

-->    ],

-->    sortFoldersFirst = <unset>,

--> }

2013-06-07T22:14:52.887Z [69A81B90 verbose 'DatastoreBrowser'] 4f702519-ed59a094-6804-d4bed9ed50ab-datastorebrowser::SearchInt

2013-06-07T22:14:52.887Z [69A81B90 verbose 'DatastoreBrowser'] 4f702519-ed59a094-6804-d4bed9ed50ab-datastorebrowser::GetLocalpathFromDatastorepath

2013-06-07T22:14:52.889Z [69A81B90 verbose 'DatastoreBrowser'] 4f702519-ed59a094-6804-d4bed9ed50ab-datastorebrowser::Verify

2013-06-07T22:14:56.899Z [FFE9FAD0 warning 'HTTP server /folder'] Error creating Reader: FileIO error : Failed to lock file  : /vmfs/volumes/4f702519-ed59a094-6804-d4bed9ed50ab/ISO/CentOS-6.2-x86_64-mini

mal.iso

2013-06-07T22:14:56.899Z [FFE9FAD0 verbose 'HttpSvc.HTTPService'] HTTP Response: Complete (processed 0 bytes)

2013-06-07T22:14:56.899Z [FFE9FAD0 verbose 'HttpSvc.HTTPService'] User agent is 'VI Perl'

2013-06-07T22:14:56.899Z [FFE9FAD0 verbose 'HTTP server /folder'] Sent InternalServerError response for GET /folder/ISO/CentOS-6.2-x86_64-minimal.iso?dsName=SATA-RAID5


Run Program in Guest as an Administrator

$
0
0

I'm attempting to automate some machine set-up tasks using the VIX API with VMware Workstation v9 using VBS. I have hit a blocker when attempting to use the "RunProgramInGuest" option on Windows 8, the program is failing as it is not being run as an administrator.

 

Set job = vm.RunProgramInGuest("C:\windows\system32\cmd.exe", "/c C:\test\test.bat", 0, Nothing, Nothing)

 

Any ideas how I can force this to run as an administrator? UAC is currently turned off.

 

Thanks

vmrun insufficient permissions

$
0
0

hello everyone

when i try to start a vm using the following command

vmrun -t esx -h https://myserver.com/sdk -u domain\user -p ******* start "[datastore1-mydata] vmname/vmname.vmx"

i get an error  message "Cannot open VM: [datastore1-mydata] vmname/vmname.vmx, Insufficient permissions in the host operating system"

 

however when i type vmrun -t esx -h https://myserver.com/sdk -u domain\user -p ******* list

i do get a list of all the vms

 

I have administrator permissions on the said vm and on it's datastore

also, when i try to do the same thing using powercli, it works perfectly, and the VM root user also manages to do this with no problem

i'm guessing it's a permissions thing but what other permissions could i need?

 

thanks

How to get performance data of average CPU, MEM and NET.

$
0
0

Hi all,

 

I am trying to get the details of performance data CPU, MEM and NET, my code output is as below

 

Thu Jul 18 15:00:00 IST 2013 cpu.usage.average  :: 3080

Thu Jul 18 15:05:00 IST 2013 cpu.usage.average  :: 675

Thu Jul 18 15:10:00 IST 2013 cpu.usage.average  :: 849

Thu Jul 18 15:15:00 IST 2013 cpu.usage.average  :: 1453

Thu Jul 18 15:20:00 IST 2013 cpu.usage.average  :: 5924

Thu Jul 18 15:25:00 IST 2013 cpu.usage.average  :: 1881

Thu Jul 18 15:30:00 IST 2013 cpu.usage.average  :: 1514

Thu Jul 18 15:35:00 IST 2013 cpu.usage.average  :: 595

Thu Jul 18 15:40:00 IST 2013 cpu.usage.average  :: 644

Thu Jul 18 15:45:00 IST 2013 cpu.usage.average  :: 603

Thu Jul 18 15:50:00 IST 2013 cpu.usage.average  :: 1032

Thu Jul 18 15:55:00 IST 2013 cpu.usage.average  :: 1756

 

Here output of CounterID "cpu.usage.average" and data is showing like above data. If anyone know about that output, please let me know.

How can we calculate the Percentage from that data.

 

Thanks in advance.

Will VIX API continue to be supported in vSphere 5.5 ?

$
0
0

Hi,

 

Will the current VIX API's continue to be supported for the upcoming vSphere version - 5.5?

I know that, now similar functionality are exposed by Web Services APIs. Still wanted to check whether the immediate next version of vSphere (i.e. 5.5) will continue to be supported by VIX.

 

Thanks!

copy file from vco to guest failure?

$
0
0

Hi

 

I am running VCO 5.1 appliance in a vsphere 5.1 environment.

 

I am attempting to write a file to a guest machine. I have tried using both Local Administrator and Domain Administrator credentials but in both instances I receive the following:

 

No permissions on the file for the attempted operation (Workflow:test workflow / Scriptable task (item1)#15)

 

I have tested that I can indeed logon.

I have tested that I can check for a directory.

I have tested that I can create a directory.

 

All work fine. I just can't appear to create the file.

 

I ran proccess mon on the guest when I ran the workflow (outputprocmon.txt)

 

So I can see it is trying look at the directory and the file but for some reason is getting a permission denied??

 

I can log onto the guest as either a domain admin or local admin and create a file in this directory.

 

Is the file being created as the user passed through or as the account running the vmtools?

 

Test script is:

 

parameters [string]userName, [secureString]password, [VC:VirtualMachine]vm

 

var host = vm.sdkConnection;
var guestOperationsManager = host.guestOperationsManager;
var guestAuth = new VcNamePasswordAuthentication();
guestAuth.username = userName;
guestAuth.password = password;
var fileManager = guestOperationsManager.fileManager;
myResult = false;
overwrite = false;
var attr = new VcGuestFileAttributes();
//var srcFile = new File(vcoPath);
var srcFile = "/scripts/blah.txt";
var guestFilePath = "C:/bin/blah.txt";
var uri = fileManager.initiateFileTransferToGuest(vm , guestAuth ,guestFilePath, attr, srcFile.length, overwrite);
myResult = fileManager.putFile(srcFile, uri);
System.log("Result is: " + myResult);

 

 

Oh and the path /scripts on the vco appliance is a ntfs mount rw,hard,intr

 

Any assistance greatly appreciated.

 

Sam

Viewing all 2039 articles
Browse latest View live


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