
On Tue, Sep 4, 2018 at 3:10 PM David David <dd432690@gmail.com> wrote:
hi
need to lookup storage name by vm disk id. how to do it in python or in java?
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import ovirtsdk4 as sdk logging.basicConfig(level=logging.DEBUG, filename='example.log') # set variables fqdn = 'engine.example.com' password = 'yourpwd' disk_id = '3810cf0f-f559-4fa8-a441-935e4ecbc794' # Create the connection to the server: connection = sdk.Connection( url='https://{fqdn}/ovirt-engine/api'.format(fqdn=fqdn), username='admin@internal', password=password, insecure=True, debug=True, log=logging.getLogger(), ) disk = connection.system_service().disks_service().disk_service(disk_id).get() sd_id = disk.storage_domains[0].id sd = connection.system_service( ).storage_domains_service().storage_domain_service(sd_id).get() print("storage_domain: {sdname}".format(sdname=sd.name)) # Close the connection to the server: connection.close()
thanks _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/YC5UZA6TYQQFC2...