Nova API收集AvailabilityZone的详细信息

时间:2017-09-26 07:33:33

标签: python python-2.7 openstack availability

我能够列出Nova AvailabilityZone。但是我无法看到它的细节。

RestPassword

此外,对象类型为>>> type(nova.availability_zones.list()) <class 'novaclient.base.ListWithMeta'> >>> >>> nova.availability_zones.list() [<AvailabilityZone: internal>, <AvailabilityZone: nova>] 。 我无法理解如何继续并获取详细信息。 任何帮助都会受到赞赏。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。

session_start();

// Load all the users and decode them to an array
$sajUsers = file_get_contents('webshop_mandatory_users.txt');
$ajUsers = json_decode($sajUsers);//turns the string into an array.

// Data comes from the browser
$sEmail = $_POST['txtEmail'];
$sPassword  = $_POST['txtPassword'];


// begin looping through the array.
for( $i = 0; $i < count($ajUsers) ; $i++ ) {

    //check if the data from the frontend matches any date in the backend - Check each one, one by one.
    if ($sEmail == $ajUsers[$i]->email && $sPassword == $ajUsers[$i]->password) {     //checks if the value of the username is equal to the value in the array.
        echo $sjResponse = '{"login":"ok"}';
        exit; //end the if statement and exit if it works.
    } else {
        echo $sjResponse = '{"login":"error"}'; // it didnt work.
        exit;
    }
}


?>

它在Dict中扔掉了所有东西。一切都比以前更早。我想知道为什么我只在迭代时获得>>> for i in nova.availability_zones.list(): ... print i ... <AvailabilityZone: internal> <AvailabilityZone: nova> <AvailabilityZone: test_zone> >>> dir(i) ['HUMAN_ID', 'NAME_ATTR', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattr__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_add_details', '_append_request_id', '_info', '_loaded', 'api_version', 'append_request_ids', 'get', 'hosts', 'human_id', 'is_loaded', 'manager', 'request_ids', 'request_ids_setup', 'set_loaded', 'to_dict', 'x_openstack_request_ids', 'zoneName', 'zoneState'] >>> >>> i.to_dict()