Get list of storage volumes authorized to particul

2019-09-10 18:39发布

问题:

I'm using /etc/hosts to determine all IP's from my running cluseter. I can get the VM id's with

    for node_ip in ip_list:
    node_ip = ''.join(node_ip)
    id_mask = "mask[id]"
    vm_instance = SL.instance(sl_config).vm.list_instances(mask=id_mask,private_ip=node_ip)
    print vm_instance

Now, I'd like to use VM id's in order to get a list of the storage volumes attached to them. I am looking at using Virtual_Guest, but haven't had luck with

 vm_guest = SL.instance(sl_config).vm_guest.findByIpAddress(id=node_ip)

How can I access the storage volumes from this ID?

Thanks

回答1:

Add the following mask in your code allowedNetworkStorage

e.g:

id_mask = "mask[id, allowedNetworkStorage]"

It will display information for the storage objects that this Virtual Server has access to