1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2012 IBM Corp.
5
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6
# not use this file except in compliance with the License. You may obtain
7
# a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
# License for the specific language governing permissions and limitations
18
class VirtAPI(object):
19
def instance_update(self, context, instance_uuid, updates):
20
"""Perform an instance update operation on behalf of a virt driver
21
:param context: security context
22
:param instance_uuid: uuid of the instance to be updated
23
:param updates: dict of attribute=value pairs to change
25
Returns: orig_instance, new_instance
27
raise NotImplementedError()
29
def instance_get_by_uuid(self, context, instance_uuid):
30
"""Look up an instance by uuid
31
:param context: security context
32
:param instance_uuid: uuid of the instance to be fetched
34
raise NotImplementedError()
36
def instance_get_all_by_host(self, context, host):
37
"""Find all instances on a given host
38
:param context: security context
39
:param host: host running instances to be returned
41
raise NotImplementedError()
43
def aggregate_get_by_host(self, context, host, key=None):
44
"""Get a list of aggregates to which the specified host belongs
45
:param context: security context
46
:param host: the host for which aggregates should be returned
47
:param key: optionally filter by hosts with the given metadata key
49
raise NotImplementedError()
51
def aggregate_metadata_get(self, context, aggregate_id):
52
"""Get metadata for the specified aggregate
53
:param context: security context
54
:param aggregate_id: id of aggregate for which metadata is to
57
raise NotImplementedError()
59
def aggregate_metadata_add(self, context, aggregate_id, metadata,
61
"""Add/update metadata for specified aggregate
62
:param context: security context
63
:param aggregate_id: id of aggregate on which to update metadata
64
:param metadata: dict of metadata to add/update
65
:param set_delete: if True, only add
67
raise NotImplementedError()
69
def aggregate_metadata_delete(self, context, aggregate_id, key):
70
"""Delete the given metadata key from specified aggregate
71
:param context: security context
72
:param aggregate_id: id of aggregate from which to delete metadata
73
:param key: metadata key to delete
75
raise NotImplementedError()
77
def security_group_get_by_instance(self, context, instance_uuid):
78
"""Get the security group for a specified instance
79
:param context: security context
80
:param instance_uuid: instance defining the security group we want
82
raise NotImplementedError()
84
def security_group_rule_get_by_security_group(self, context,
86
"""Get the rules associated with a specified security group
87
:param context: security context
88
:param security_group_id: the security group for which the rules
91
raise NotImplementedError()
93
def provider_fw_rule_get_all(self, context):
94
"""Get the provider firewall rules
95
:param context: security context
97
raise NotImplementedError()
99
def agent_build_get_by_triple(self, context, hypervisor, os, architecture):
100
"""Get information about the available agent builds for a given
101
hypervisor, os, and architecture
102
:param context: security context
103
:param hypervisor: agent hypervisor type
104
:param os: agent operating system type
105
:param architecture: agent architecture
107
raise NotImplementedError()