To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!More about adding a collaborator
List server flavors (python)
The following code example shows how to list flavors for the python SDK.
See also Listing Flavors in the OpenStack documentation.
- List flavors (python)
- I am setup to run example code for python
I execute the following code:
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2012 Rackspace # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import pyrax pyrax.set_setting("identity_type", "rackspace") pyrax.set_credentials(os.environ['OS_USERNAME'], os.environ['OS_PASSWORD']) cs = pyrax.cloudservers flvs = cs.flavors.list() for flv in flvs: print "Name:", flv.name print " ID:", flv.id print " RAM:", flv.ram print " Disk:", flv.disk print " VCPUs:", flv.vcpus print
the output should match
Name: 512MB Standard Instance ID: 2 RAM: 512 Disk: 20 VCPUs: 1 Name: 1GB Standard Instance ID: 3 RAM: 1024 Disk: 40 VCPUs: 1 Name: 2GB Standard Instance ID: 4 RAM: 2048 Disk: 80 VCPUs: 2 Name: 4GB Standard Instance ID: 5 RAM: 4096 Disk: 160 VCPUs: 2 Name: 8GB Standard Instance ID: 6 RAM: 8192 Disk: 320 VCPUs: 4 Name: 15GB Standard Instance ID: 7 RAM: 15360 Disk: 620 VCPUs: 6 Name: 30GB Standard Instance ID: 8 RAM: 30720 Disk: 1200 VCPUs: 8
Last published over 7 years ago by Max Lincoln.