Discussion:
[libvirt-users] Libvirt api for esx
ROHIT SINGH
2018-11-26 10:41:20 UTC
Permalink
Hi,

I am doing poc for using libvirt api for implementation of esx in python.

I tried researching through module but did not find a way how it works for
esx.
Any help on how to proceed specifically for esx would be of great help.

Please let me know as soon as possible, lagging on deliverables.

Thanks for help!!

Regards
Rohit Singh
Martin Kletzander
2018-11-28 16:00:48 UTC
Permalink
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in python.
I tried researching through module but did not find a way how it works for
esx.
Any help on how to proceed specifically for esx would be of great help.
See https://libvirt.org/drvesx.html for ESX-related stuff. But mainly it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
ROHIT SINGH
2018-11-28 16:24:36 UTC
Permalink
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in python.
I tried researching through module but did not find a way how it works for
esx.
Any help on how to proceed specifically for esx would be of great help.
See https://libvirt.org/drvesx.html for ESX-related stuff. But mainly it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
ROHIT SINGH
2018-11-28 16:54:55 UTC
Permalink
Hi Martin,

Could you please point me to any example codes in python present for esx?
Suppose, I have to power off and power on esx virtual machine, can i get
this code somewhere on python to develop some understanding.

Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.

Appreciate your help !!

Thanks.

Regards
Rohit Singh
Post by ROHIT SINGH
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in python.
I tried researching through module but did not find a way how it works
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great help.
See https://libvirt.org/drvesx.html for ESX-related stuff. But mainly it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
Martin Kletzander
2018-11-29 09:04:55 UTC
Permalink
Post by ROHIT SINGH
Hi Martin,
Could you please point me to any example codes in python present for esx?
Suppose, I have to power off and power on esx virtual machine, can i get
this code somewhere on python to develop some understanding.
Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.
https://github.com/libvirt/libvirt-python/blob/master/examples/esxlist.py

and all other examples:

https://github.com/libvirt/libvirt-python/tree/master/examples

The point of libvirt is that the code doesn't have to be (way) different
depending on the hypervisor.
Post by ROHIT SINGH
Appreciate your help !!
Thanks.
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in python.
I tried researching through module but did not find a way how it works
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great help.
See https://libvirt.org/drvesx.html for ESX-related stuff. But mainly it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
ROHIT SINGH
2018-11-29 17:43:23 UTC
Permalink
Thanks a lot Martin for help.
Really appreciate it. You’re life saver.

I will go through these links and will get back to you in case I need
anymore information.

Once again, thanks for help.

Regards
Rohit Singh
Post by Martin Kletzander
Post by ROHIT SINGH
Hi Martin,
Could you please point me to any example codes in python present for esx?
Suppose, I have to power off and power on esx virtual machine, can i get
this code somewhere on python to develop some understanding.
Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.
https://github.com/libvirt/libvirt-python/blob/master/examples/esxlist.py
https://github.com/libvirt/libvirt-python/tree/master/examples
The point of libvirt is that the code doesn't have to be (way) different
depending on the hypervisor.
Post by ROHIT SINGH
Appreciate your help !!
Thanks.
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in
python.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
I tried researching through module but did not find a way how it works
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great
help.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
See https://libvirt.org/drvesx.html for ESX-related stuff. But mainly it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
ROHIT SINGH
2018-12-05 16:14:17 UTC
Permalink
Hi Martin,

Could you please help me with below issue, I am not sure what’s wrong here.
Please find below code and error snippet.

Thanks for help.

Code Snippet: -

from __future__ import print_function
import sys
import libvirt
SASL_USER = <username>
SASL_PASS = <password>
def request_cred(credentials, user_data):
for credential in credentials:
if credential[0] == libvirt.VIR_CRED_AUTHNAME:
credential[4] = SASL_USER
elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
credential[4] = SASL_PASS
return 0
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
request_cred, None]
conn = libvirt.openAuth("esx://<vm name>?no_verify=1", auth, 0)
if conn == None:
print('Failed to open connection to qemu+tcp://localhost/system',
file=sys.stderr)
exit(1)
conn.close()


Error Snippet: -
File
"/usr/software/pkgs/Python-3.4.3/lib/python3.4/site-packages/libvirt.py",
line 105, in openAuth
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: internal error: HTTP response code 404 for call to
'RetrieveServiceContent'


Regards
Rohit Singh
Post by ROHIT SINGH
Thanks a lot Martin for help.
Really appreciate it. You’re life saver.
I will go through these links and will get back to you in case I need
anymore information.
Once again, thanks for help.
Regards
Rohit Singh
Post by Martin Kletzander
Post by ROHIT SINGH
Hi Martin,
Could you please point me to any example codes in python present for esx?
Suppose, I have to power off and power on esx virtual machine, can i get
this code somewhere on python to develop some understanding.
Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.
https://github.com/libvirt/libvirt-python/blob/master/examples/esxlist.py
https://github.com/libvirt/libvirt-python/tree/master/examples
The point of libvirt is that the code doesn't have to be (way) different
depending on the hypervisor.
Post by ROHIT SINGH
Appreciate your help !!
Thanks.
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in
python.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
I tried researching through module but did not find a way how it
works
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great
help.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
See https://libvirt.org/drvesx.html for ESX-related stuff. But
mainly
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
Martin Kletzander
2018-12-06 09:25:48 UTC
Permalink
Post by ROHIT SINGH
Hi Martin,
Could you please help me with below issue, I am not sure what’s wrong here.
Please find below code and error snippet.
Thanks for help.
Code Snippet: -
from __future__ import print_function
import sys
import libvirt
SASL_USER = <username>
SASL_PASS = <password>
credential[4] = SASL_USER
credential[4] = SASL_PASS
return 0
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
request_cred, None]
conn = libvirt.openAuth("esx://<vm name>?no_verify=1", auth, 0)
I don't know. I don't have any ESX machine handy. Try to do some debugging.
Maybe the fact that you have the VM name here instead of the ESX server.

Does the esxlist.py from python examples work? Maybe you can differentiate with
that. Maybe you're not handling some of the credentials right.
Post by ROHIT SINGH
print('Failed to open connection to qemu+tcp://localhost/system',
file=sys.stderr)
exit(1)
conn.close()
Error Snippet: -
File
"/usr/software/pkgs/Python-3.4.3/lib/python3.4/site-packages/libvirt.py",
line 105, in openAuth
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: internal error: HTTP response code 404 for call to
'RetrieveServiceContent'
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks a lot Martin for help.
Really appreciate it. You’re life saver.
I will go through these links and will get back to you in case I need
anymore information.
Once again, thanks for help.
Regards
Rohit Singh
Post by Martin Kletzander
Post by ROHIT SINGH
Hi Martin,
Could you please point me to any example codes in python present for esx?
Suppose, I have to power off and power on esx virtual machine, can i get
this code somewhere on python to develop some understanding.
Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.
https://github.com/libvirt/libvirt-python/blob/master/examples/esxlist.py
https://github.com/libvirt/libvirt-python/tree/master/examples
The point of libvirt is that the code doesn't have to be (way) different
depending on the hypervisor.
Post by ROHIT SINGH
Appreciate your help !!
Thanks.
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks, I'll check it out.
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in
python.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
I tried researching through module but did not find a way how it
works
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great
help.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
See https://libvirt.org/drvesx.html for ESX-related stuff. But
mainly
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
it is the
URI you need to use. Then look at https://libvirt.org/hvsupport.html where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
ROHIT SINGH
2018-12-06 17:54:30 UTC
Permalink
Thanks Martin for help. I will give it a shot.

Regards
Rohit Singh
Post by Martin Kletzander
Post by ROHIT SINGH
Hi Martin,
Could you please help me with below issue, I am not sure what’s wrong
here.
Post by ROHIT SINGH
Please find below code and error snippet.
Thanks for help.
Code Snippet: -
from __future__ import print_function
import sys
import libvirt
SASL_USER = <username>
SASL_PASS = <password>
credential[4] = SASL_USER
credential[4] = SASL_PASS
return 0
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
request_cred, None]
conn = libvirt.openAuth("esx://<vm name>?no_verify=1", auth, 0)
I don't know. I don't have any ESX machine handy. Try to do some debugging.
Maybe the fact that you have the VM name here instead of the ESX server.
Does the esxlist.py from python examples work? Maybe you can
differentiate with
that. Maybe you're not handling some of the credentials right.
Post by ROHIT SINGH
print('Failed to open connection to qemu+tcp://localhost/system',
file=sys.stderr)
exit(1)
conn.close()
Error Snippet: -
File
"/usr/software/pkgs/Python-3.4.3/lib/python3.4/site-packages/libvirt.py",
line 105, in openAuth
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: internal error: HTTP response code 404 for call to
'RetrieveServiceContent'
Regards
Rohit Singh
Post by ROHIT SINGH
Thanks a lot Martin for help.
Really appreciate it. You’re life saver.
I will go through these links and will get back to you in case I need
anymore information.
Once again, thanks for help.
Regards
Rohit Singh
Post by Martin Kletzander
Post by ROHIT SINGH
Hi Martin,
Could you please point me to any example codes in python present for
esx?
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
Suppose, I have to power off and power on esx virtual machine, can i
get
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
this code somewhere on python to develop some understanding.
Actually, I am not able to find sample code related to esx in python,
please point me if any such link available.
https://github.com/libvirt/libvirt-python/blob/master/examples/esxlist.py
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
https://github.com/libvirt/libvirt-python/tree/master/examples
The point of libvirt is that the code doesn't have to be (way)
different
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
depending on the hypervisor.
Post by ROHIT SINGH
Appreciate your help !!
Thanks.
Regards
Rohit Singh
On Wed, 28 Nov 2018 at 9:54 PM, ROHIT SINGH <
Post by ROHIT SINGH
Thanks, I'll check it out.
On Wed, 28 Nov 2018 at 9:31 PM, Martin Kletzander <
Post by Martin Kletzander
Post by ROHIT SINGH
Hi,
I am doing poc for using libvirt api for implementation of esx in
python.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
I tried researching through module but did not find a way how it
works
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
for
Post by ROHIT SINGH
esx.
Any help on how to proceed specifically for esx would be of great
help.
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
See https://libvirt.org/drvesx.html for ESX-related stuff. But
mainly
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
it is the
URI you need to use. Then look at
https://libvirt.org/hvsupport.html
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
Post by ROHIT SINGH
Post by ROHIT SINGH
Post by Martin Kletzander
where you
can see what APIs are available for that HV driver.
Post by ROHIT SINGH
Please let me know as soon as possible, lagging on deliverables.
Thanks for help!!
Regards
Rohit Singh
_______________________________________________
libvirt-users mailing list
https://www.redhat.com/mailman/listinfo/libvirt-users
Loading...