1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
# Copyright [2010] [Anso Labs, LLC]
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
17
Proxy AMI-related calls from the cloud controller, to the running
25
from nova import vendor
29
from nova import flags
30
from nova import utils
35
def modify(user, image_id, operation):
36
conn(user).make_request(
39
query_args=qs({'image_id': image_id, 'operation': operation}))
44
def register(user, image_location):
45
""" rpc call to register a new image based from a manifest """
47
image_id = utils.generate_uid('ami')
48
conn(user).make_request(
51
query_args=qs({'image_location': image_location,
52
'image_id': image_id}))
57
def list(user, filter_list=[]):
58
""" return a list of all images that a user can see
60
optionally filtered by a list of image_id """
62
# FIXME: send along the list of only_images to check for
63
response = conn(user).make_request(
67
return json.loads(response.read())
70
def deregister(user, image_id):
71
""" unregister an image """
72
conn(user).make_request(
75
query_args=qs({'image_id': image_id}))
79
return boto.s3.connection.S3Connection (
80
aws_access_key_id=user.access,
81
aws_secret_access_key=user.secret,
83
calling_format=boto.s3.connection.OrdinaryCallingFormat(),
90
for key in params.keys():
91
pairs.append(key + '=' + urllib.quote(params[key]))
92
return '&'.join(pairs)