Skip to content

Commit

Permalink
In preparation for XenAPI support, refactor the interface between
Browse files Browse the repository at this point in the history
nova.compute and the hypervisor (i.e. libvirt).

compute.node is no longer coupled tightly with libvirt.  Instead, hypervisor
connections are handled through a simple abstract interface.   This has the
additional advantage that there is no need to riddle the code with
FLAGS.fake_libvirt checks, as we now have an interface behind which we can mock.

The libvirt-specific code, and the fakevirt code used for unit tests, have
moved into nova.virt.

The fake_libvirt flag has been replaced with a connection_type flag, that will
allow us to specify different connection types.

The disk image handling (S3 or local disk image fetch) has moved into
nova.virt.images, where it will be easier to share between connection types.

The power_state values (Instance.RUNNING etc) and the INSTANCE_TYPES dictionary
have moved into their own files (nova.compute.instance_types and
nova.compute.power_state) so that we can share them without mutual
dependencies between nova.compute.node and nova.virt.libvirt_conn.
  • Loading branch information
Ewan Mellor committed Jul 18, 2010
1 parent d5309ef commit f39d654
Show file tree
Hide file tree
Showing 24 changed files with 667 additions and 378 deletions.
2 changes: 1 addition & 1 deletion bin/dhcpleasor.py
Expand Up @@ -71,7 +71,7 @@ def main(argv=None):
FLAGS.fake_rabbit = True
FLAGS.redis_db = 8
FLAGS.network_size = 32
FLAGS.fake_libvirt=True
FLAGS.connection_type = 'fake'
FLAGS.fake_network=True
FLAGS.fake_users = True
action = argv[1]
Expand Down
4 changes: 2 additions & 2 deletions docs/fakes.rst
Expand Up @@ -18,10 +18,10 @@
Nova Fakes
==========

The :mod:`fakevirt` Module
The :mod:`virt.fake` Module
--------------------------

.. automodule:: nova.fakevirt
.. automodule:: nova.virt.fake
:members:
:undoc-members:
:show-inheritance:
Expand Down
30 changes: 30 additions & 0 deletions nova/compute/instance_types.py
@@ -0,0 +1,30 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# 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.

"""
The built-in instance properties.
"""

INSTANCE_TYPES = {}
INSTANCE_TYPES['m1.tiny'] = {'memory_mb': 512, 'vcpus': 1, 'local_gb': 0}
INSTANCE_TYPES['m1.small'] = {'memory_mb': 1024, 'vcpus': 1, 'local_gb': 10}
INSTANCE_TYPES['m1.medium'] = {'memory_mb': 2048, 'vcpus': 2, 'local_gb': 10}
INSTANCE_TYPES['m1.large'] = {'memory_mb': 4096, 'vcpus': 4, 'local_gb': 10}
INSTANCE_TYPES['m1.xlarge'] = {'memory_mb': 8192, 'vcpus': 4, 'local_gb': 10}
INSTANCE_TYPES['c1.medium'] = {'memory_mb': 2048, 'vcpus': 4, 'local_gb': 10}

0 comments on commit f39d654

Please sign in to comment.