Hello,
I'm porting in Python a powershell script.
This is the snippet:
$DSs = $VMHost | Get-Datastore
$esxcli = Get-EsxCli -VMhost $VMHost
foreach ($DS in $DSs){
$tempview = $DS | Get-View
$diskname = $tempview.Info.vmfs.Extent.Diskname
$accSup = $esxcli.storage.core.device.vaai.status.get() | Where-Object -Property Device -In ($diskname)
$ATSst = $accSup.ATSStatus
$Clonest = $accSup.CloneStatus
$Delst = $accSup.DeleteStatus
$Zerost = $accSup.ZeroStatus
$DSName = $tempview.Name
$FSType = $tempview.Info.vmfs.type
$FSver = $tempview.Info.vmfs.version
$Esxiname = $VMHost.Name
I don't know in pyvmomi how to code Get-EsxCli and get those esxi parameters.
I need help
Riccardo
However I solved in this way
Installed locally
https://code.vmware.com/web/tool/6.7u2/esxcli
And then used a system call to execute the call
from subprocess import check_output, CalledProcessError, STDOUT
full_command_array = ["env", "VI_USERNAME=" + decodeduser, "VI_PASSWORD=" + decodedpass,
"esxcli" + "-" + _vcenter_node["version"],
"--server=" + _vcenter_node["host"],
"--vihost=" + _vihost,
"--thumbprint="+ _vcenter_node["thumbprint"],
"--formatter=" + _formatter,
command ]
output = check_output(full_command_array, stderr=STDOUT).decode()
Moderator: Moved to PowerCLI Discussions, although this may need to go into one of the {code} forums
This belongs in the Phyton community
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Does the silence mean there's no `vSphere Web Services` coverage for `esxcli` ?
No, it means your Python question was located in the PowerCLI community.
Where there aren't many Python users present I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
However I solved in this way
Installed locally
https://code.vmware.com/web/tool/6.7u2/esxcli
And then used a system call to execute the call
from subprocess import check_output, CalledProcessError, STDOUT
full_command_array = ["env", "VI_USERNAME=" + decodeduser, "VI_PASSWORD=" + decodedpass,
"esxcli" + "-" + _vcenter_node["version"],
"--server=" + _vcenter_node["host"],
"--vihost=" + _vihost,
"--thumbprint="+ _vcenter_node["thumbprint"],
"--formatter=" + _formatter,
command ]
output = check_output(full_command_array, stderr=STDOUT).decode()