示例#1
0
                    nargs='+',
                    help="id in decimal of image to transfer")
parser.add_argument('-d',
                    '--dest',
                    dest='destination',
                    required=True,
                    help="address of destination Glance repository")
parser.add_argument('-p',
                    '--port',
                    dest='local_port',
                    default=9292,
                    help="local Glance port")

args = parser.parse_args()
dest = args.destination.split(':')
source_client = Client('localhost', args.local_port)
try:
    dest_client = Client(dest[0], dest[1])
except IndexError:
    dest_client = Client(dest[0])

images = {}

for image_id in args.images:
    images[image_id] = source_client.get_image_meta(image_id)

# Sort keys to that kernel/ramdisk images are transferred first, makes recreating
# associations easier later on
mapping = {'aki': 0, 'ari': 0, 'ami': 1}
sorted_ids = images.keys()
sorted_ids.sort(
示例#2
0
 def _get_glance_client(self):
     glance_host = self.conf.get('host', '127.0.0.1')
     glance_port = self.conf.get('port', '8080')
     c = Client(host=glance_host, port=glance_port)
     return c