Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying to get Tasks, fails #13

Open
N3XT0R opened this issue Oct 7, 2014 · 1 comment
Open

trying to get Tasks, fails #13

N3XT0R opened this issue Oct 7, 2014 · 1 comment

Comments

@N3XT0R
Copy link

N3XT0R commented Oct 7, 2014

Dear Community,
i have a Problem with vmwarephp with version 5.5.
I am trying to get Tasks for a VM. Currently i am able to get all Tasks for a User, but not only for a VM.

My sourcecode looks like:

$oVM = $oVHost->findManagedObjectByName('VirtualMachine', "ib-webradio");
$oTaskVM = new TaskFilterSpecByEntity($oVM, 'self');
$oFilter = new TaskFilterSpec($oTaskVM);
$oTaskManager = $o->getServiceContent()->taskManager;

/* @var $oTasks TaskHistoryCollector */
$oTasks = $oTaskManager->CreateCollectorForTasks(array(
    "filter" => $oFilter,
));
print_r($oTasks);

when i am trying to execute the sourcecode above i get following exception:

Fatal error: Uncaught exception 'Vmwarephp\Exception\Soap' with message 'ServerFaultCode: . InvalidProperty: InvalidProperty Object ( [name] => _ ) ' in /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Service.php:75 Stack trace: #0 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Service.php(24): Vmwarephp\Service->makeSoapCall('RetrievePropert...', Array) #1 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/ManagedObject.php(42): Vmwarephp\Service->__call('RetrievePropert...', Array) #2 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/ManagedObject.php(42): Vmwarephp\Service->RetrieveProperties(Object(Vmwarephp\Extensions\PropertyCollector), Array) #3 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Extensions/PropertyCollector.php(28): Vmwarephp\ManagedObject->__call('RetrievePropert...', Array) #4 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Extensions/PropertyCollector.php(28): Vmwarephp\Extensions\PropertyCollector->RetrieveProperties(Array) #5 /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Ex in /Applications/MAMP/htdocs/vmware/library/Vmwarephp/Service.php on line 75

Maybe someone can help?

When i am leaving the Parameter "filter" blank, i get all tasks for a User unfiltered by Entity.

It seems, that the reference for the var "_this" is empty. I think, that i have the same problem, like another guy from here with "reconfigVM_Task".

@Harpreetsinghbedi
Copy link

Harpreetsinghbedi commented Aug 4, 2017

Try this one to get the recent vm task.

$this->connect();
$vm_info = $this->vsphere->findManagedObjectByName('VirtualMachine', $vm_name, array('recentTask'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants