Merge lp:~ewanmellor/nova/xenapi into lp:~hudson-openstack/nova/trunk

Proposed by Ewan Mellor
Status: Merged
Approved by: Jay Pipes
Approved revision: 176
Merged at revision: 240
Proposed branch: lp:~ewanmellor/nova/xenapi
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 274 lines (+142/-21)
5 files modified
doc/source/getting.started.rst (+1/-0)
nova/virt/connection.py (+9/-0)
nova/virt/fake.py (+128/-1)
nova/virt/libvirt_conn.py (+0/-20)
plugins/xenapi/README (+4/-0)
To merge this branch: bzr merge lp:~ewanmellor/nova/xenapi
Reviewer Review Type Date Requested Status
Soren Hansen (community) Approve
Jay Pipes (community) Approve
Review via email: mp+32582@code.launchpad.net

Commit message

Added documentation for the nova.virt connection interface, a note about the need to chmod the objectstore script, and a reference for the XenAPI module.

Description of the change

Added documentation for the nova.virt connection interface, a note about the need to chmod the objectstore script, and a reference for the XenAPI module.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

Documentation++

review: Approve
Revision history for this message
Soren Hansen (soren) wrote :

Yay for more documentation.

Revision history for this message
Soren Hansen (soren) :
review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (10.6 KiB)

The attempt to merge lp:~ewanmellor/nova/xenapi into lp:nova failed.Below is the output from the failed tests.

nova.tests.access_unittest
  AccessTestCase
    test_001_allow_all ... [OK]
    test_002_allow_none ... [OK]
    test_003_allow_project_manager ... [OK]
    test_004_allow_sys_and_net ... [OK]
    test_005_allow_sys_no_pm ... [OK]
nova.tests.api_unittest
  ApiEc2TestCase
    test_describe_instances ... [OK]
    test_get_all_key_pairs ... [OK]
nova.tests.auth_unittest
  AuthTestCase
    test_001_can_create_users ... [OK]
    test_002_can_get_user ... [OK]
    test_003_can_retreive_properties ... [OK]
    test_004_signature_is_valid ... [OK]
    test_005_can_get_credentials ... [OK]
    test_006_test_key_storage ... [OK]
    test_007_test_key_generation ... [OK]
    test_008_can_list_key_pairs ... [OK]
    test_009_can_delete_key_pair ... [OK]
    test_010_can_list_users ... [OK]
    test_101_can_add_user_role ... [OK]
    test_199_can_remove_user_role ... [OK]
    test_201_can_create_project ... [OK]
    test_202_user1_is_project_member ... [OK]
    test_203_user2_is_not_project_member ... [OK]
    test_204_user1_is_project_manager ... [OK]
    test_205_user2_is_not_project_manager ... [OK]
    test_206_can_add_user_to_project ... [OK]
    test_207_can_remove_user_from_project ... [OK]
    test_208_can_remove_add_user_with_role ... [OK]
    test_209_can_generate_x509 ... [OK]
    test_210_can_add_project_role ... [OK]
    test_211_can_list_project_roles ... [OK]
    test_212_can_remove_project_role ... [OK]
    test_214_can_retrieve_project_by_user ... [OK]
    test_299_can_delete_project ... [OK]
    test_999_can_delete_users ... [OK]
nova.tests.cloud_unittest
  CloudTestCase
    test_console_output ... [OK]
    test_instance_update_state ... [OK]
    test_run_instances ... ...

Revision history for this message
Jay Pipes (jaypipes) wrote :

grr...

non-deterministic testing--

setting to approve again...this is just docs, shouldn't be any test failures. :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/source/getting.started.rst'
--- doc/source/getting.started.rst 2010-07-25 01:06:22 +0000
+++ doc/source/getting.started.rst 2010-08-13 13:39:41 +0000
@@ -40,6 +40,7 @@
4040
41* M2Crypto: python library interface for openssl41* M2Crypto: python library interface for openssl
42* curl42* curl
43* XenAPI: Needed only for Xen Cloud Platform or XenServer support. Available from http://wiki.xensource.com/xenwiki/XCP_SDK or http://community.citrix.com/cdn/xs/sdks.
4344
44Vendored python libaries (don't require any installation)45Vendored python libaries (don't require any installation)
4546
4647
=== modified file 'nova/virt/connection.py'
--- nova/virt/connection.py 2010-07-18 17:28:21 +0000
+++ nova/virt/connection.py 2010-08-13 13:39:41 +0000
@@ -27,6 +27,15 @@
2727
2828
29def get_connection(read_only=False):29def get_connection(read_only=False):
30 """Returns an object representing the connection to a virtualization
31 platform. This could be nova.virt.fake.FakeConnection in test mode,
32 a connection to KVM or QEMU via libvirt, or a connection to XenServer
33 or Xen Cloud Platform via XenAPI.
34
35 Any object returned here must conform to the interface documented by
36 FakeConnection.
37 """
38
30 # TODO(termie): maybe lazy load after initial check for permissions39 # TODO(termie): maybe lazy load after initial check for permissions
31 # TODO(termie): check whether we can be disconnected40 # TODO(termie): check whether we can be disconnected
32 t = FLAGS.connection_type41 t = FLAGS.connection_type
3342
=== modified file 'nova/virt/fake.py'
--- nova/virt/fake.py 2010-07-18 17:15:12 +0000
+++ nova/virt/fake.py 2010-08-13 13:39:41 +0000
@@ -19,6 +19,7 @@
1919
20"""20"""
21A fake (in-memory) hypervisor+api. Allows nova testing w/o a hypervisor.21A fake (in-memory) hypervisor+api. Allows nova testing w/o a hypervisor.
22This module also documents the semantics of real hypervisor connections.
22"""23"""
2324
24import logging25import logging
@@ -32,6 +33,38 @@
3233
3334
34class FakeConnection(object):35class FakeConnection(object):
36 """
37 The interface to this class talks in terms of 'instances' (Amazon EC2 and
38 internal Nova terminology), by which we mean 'running virtual machine'
39 (XenAPI terminology) or domain (Xen or libvirt terminology).
40
41 An instance has an ID, which is the identifier chosen by Nova to represent
42 the instance further up the stack. This is unfortunately also called a
43 'name' elsewhere. As far as this layer is concerned, 'instance ID' and
44 'instance name' are synonyms.
45
46 Note that the instance ID or name is not human-readable or
47 customer-controlled -- it's an internal ID chosen by Nova. At the
48 nova.virt layer, instances do not have human-readable names at all -- such
49 things are only known higher up the stack.
50
51 Most virtualization platforms will also have their own identity schemes,
52 to uniquely identify a VM or domain. These IDs must stay internal to the
53 platform-specific layer, and never escape the connection interface. The
54 platform-specific layer is responsible for keeping track of which instance
55 ID maps to which platform-specific ID, and vice versa.
56
57 In contrast, the list_disks and list_interfaces calls may return
58 platform-specific IDs. These identify a specific virtual disk or specific
59 virtual network interface, and these IDs are opaque to the rest of Nova.
60
61 Some methods here take an instance of nova.compute.service.Instance. This
62 is the datastructure used by nova.compute to store details regarding an
63 instance, and pass them into this layer. This layer is responsible for
64 translating that generic datastructure into terms that are specific to the
65 virtualization platform.
66 """
67
35 def __init__(self):68 def __init__(self):
36 self.instances = {}69 self.instances = {}
3770
@@ -42,20 +75,59 @@
42 return cls._instance75 return cls._instance
4376
44 def list_instances(self):77 def list_instances(self):
78 """
79 Return the names of all the instances known to the virtualization
80 layer, as a list.
81 """
45 return self.instances.keys()82 return self.instances.keys()
4683
47 def spawn(self, instance):84 def spawn(self, instance):
85 """
86 Create a new instance/VM/domain on the virtualization platform.
87
88 The given parameter is an instance of nova.compute.service.Instance.
89 This function should use the data there to guide the creation of
90 the new instance.
91
92 Once this function successfully completes, the instance should be
93 running (power_state.RUNNING).
94
95 If this function fails, any partial instance should be completely
96 cleaned up, and the virtualization platform should be in the state
97 that it was before this call began.
98 """
99
48 fake_instance = FakeInstance()100 fake_instance = FakeInstance()
49 self.instances[instance.name] = fake_instance101 self.instances[instance.name] = fake_instance
50 fake_instance._state = power_state.RUNNING102 fake_instance._state = power_state.RUNNING
51103
52 def reboot(self, instance):104 def reboot(self, instance):
105 """
106 Reboot the specified instance.
107
108 The given parameter is an instance of nova.compute.service.Instance,
109 and so the instance is being specified as instance.name.
110 """
53 pass111 pass
54 112
55 def destroy(self, instance):113 def destroy(self, instance):
114 """
115 Destroy (shutdown and delete) the specified instance.
116
117 The given parameter is an instance of nova.compute.service.Instance,
118 and so the instance is being specified as instance.name.
119 """
56 del self.instances[instance.name]120 del self.instances[instance.name]
57121
58 def get_info(self, instance_id):122 def get_info(self, instance_id):
123 """
124 Get a block of information about the given instance. This is returned
125 as a dictionary containing 'state': The power_state of the instance,
126 'max_mem': The maximum memory for the instance, in KiB, 'mem': The
127 current memory the instance has, in KiB, 'num_cpu': The current number
128 of virtual CPUs the instance has, 'cpu_time': The total CPU time used
129 by the instance, in nanoseconds.
130 """
59 i = self.instances[instance_id]131 i = self.instances[instance_id]
60 return {'state': i._state,132 return {'state': i._state,
61 'max_mem': 0,133 'max_mem': 0,
@@ -64,15 +136,70 @@
64 'cpu_time': 0}136 'cpu_time': 0}
65137
66 def list_disks(self, instance_id):138 def list_disks(self, instance_id):
139 """
140 Return the IDs of all the virtual disks attached to the specified
141 instance, as a list. These IDs are opaque to the caller (they are
142 only useful for giving back to this layer as a parameter to
143 disk_stats). These IDs only need to be unique for a given instance.
144
145 Note that this function takes an instance ID, not a
146 compute.service.Instance, so that it can be called by compute.monitor.
147 """
67 return ['A_DISK']148 return ['A_DISK']
68149
69 def list_interfaces(self, instance_id):150 def list_interfaces(self, instance_id):
151 """
152 Return the IDs of all the virtual network interfaces attached to the
153 specified instance, as a list. These IDs are opaque to the caller
154 (they are only useful for giving back to this layer as a parameter to
155 interface_stats). These IDs only need to be unique for a given
156 instance.
157
158 Note that this function takes an instance ID, not a
159 compute.service.Instance, so that it can be called by compute.monitor.
160 """
70 return ['A_VIF']161 return ['A_VIF']
71162
72 def block_stats(self, instance_id, disk_id):163 def block_stats(self, instance_id, disk_id):
164 """
165 Return performance counters associated with the given disk_id on the
166 given instance_id. These are returned as [rd_req, rd_bytes, wr_req,
167 wr_bytes, errs], where rd indicates read, wr indicates write, req is
168 the total number of I/O requests made, bytes is the total number of
169 bytes transferred, and errs is the number of requests held up due to a
170 full pipeline.
171
172 All counters are long integers.
173
174 This method is optional. On some platforms (e.g. XenAPI) performance
175 statistics can be retrieved directly in aggregate form, without Nova
176 having to do the aggregation. On those platforms, this method is
177 unused.
178
179 Note that this function takes an instance ID, not a
180 compute.service.Instance, so that it can be called by compute.monitor.
181 """
73 return [0L, 0L, 0L, 0L, null]182 return [0L, 0L, 0L, 0L, null]
74183
75 def interface_stats(self, instance_id, iface_id):184 def interface_stats(self, instance_id, iface_id):
185 """
186 Return performance counters associated with the given iface_id on the
187 given instance_id. These are returned as [rx_bytes, rx_packets,
188 rx_errs, rx_drop, tx_bytes, tx_packets, tx_errs, tx_drop], where rx
189 indicates receive, tx indicates transmit, bytes and packets indicate
190 the total number of bytes or packets transferred, and errs and dropped
191 is the total number of packets failed / dropped.
192
193 All counters are long integers.
194
195 This method is optional. On some platforms (e.g. XenAPI) performance
196 statistics can be retrieved directly in aggregate form, without Nova
197 having to do the aggregation. On those platforms, this method is
198 unused.
199
200 Note that this function takes an instance ID, not a
201 compute.service.Instance, so that it can be called by compute.monitor.
202 """
76 return [0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L]203 return [0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L]
77204
78205
79206
=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2010-08-10 15:37:07 +0000
+++ nova/virt/libvirt_conn.py 2010-08-13 13:39:41 +0000
@@ -261,12 +261,6 @@
261261
262262
263 def get_disks(self, instance_id):263 def get_disks(self, instance_id):
264 """
265 Note that this function takes an instance ID, not an Instance, so
266 that it can be called by monitor.
267
268 Returns a list of all block devices for this domain.
269 """
270 domain = self._conn.lookupByName(instance_id)264 domain = self._conn.lookupByName(instance_id)
271 # TODO(devcamcar): Replace libxml2 with etree.265 # TODO(devcamcar): Replace libxml2 with etree.
272 xml = domain.XMLDesc(0)266 xml = domain.XMLDesc(0)
@@ -304,12 +298,6 @@
304298
305299
306 def get_interfaces(self, instance_id):300 def get_interfaces(self, instance_id):
307 """
308 Note that this function takes an instance ID, not an Instance, so
309 that it can be called by monitor.
310
311 Returns a list of all network interfaces for this instance.
312 """
313 domain = self._conn.lookupByName(instance_id)301 domain = self._conn.lookupByName(instance_id)
314 # TODO(devcamcar): Replace libxml2 with etree.302 # TODO(devcamcar): Replace libxml2 with etree.
315 xml = domain.XMLDesc(0)303 xml = domain.XMLDesc(0)
@@ -347,18 +335,10 @@
347335
348336
349 def block_stats(self, instance_id, disk):337 def block_stats(self, instance_id, disk):
350 """
351 Note that this function takes an instance ID, not an Instance, so
352 that it can be called by monitor.
353 """
354 domain = self._conn.lookupByName(instance_id)338 domain = self._conn.lookupByName(instance_id)
355 return domain.blockStats(disk)339 return domain.blockStats(disk)
356340
357341
358 def interface_stats(self, instance_id, interface):342 def interface_stats(self, instance_id, interface):
359 """
360 Note that this function takes an instance ID, not an Instance, so
361 that it can be called by monitor.
362 """
363 domain = self._conn.lookupByName(instance_id)343 domain = self._conn.lookupByName(instance_id)
364 return domain.interfaceStats(interface)344 return domain.interfaceStats(interface)
365345
=== modified file 'plugins/xenapi/README'
--- plugins/xenapi/README 2010-08-02 23:52:06 +0000
+++ plugins/xenapi/README 2010-08-13 13:39:41 +0000
@@ -1,2 +1,6 @@
1This directory contains files that are required for the XenAPI support. They1This directory contains files that are required for the XenAPI support. They
2should be installed in the XenServer / Xen Cloud Platform domain 0.2should be installed in the XenServer / Xen Cloud Platform domain 0.
3
4Also, you need to
5
6chmod u+x /etc/xapi.d/plugins/objectstore