Merged with current trunk
Updated _get_vm_opaqueref: OpaqueRef inspection not performed anymore No test-specific code path No weird lists for known vm references merged stubout_db_network_api with stubout_db_instance_api Unit tests passed pep8 errors fixed
This commit is contained in:
3
.mailmap
3
.mailmap
@@ -15,10 +15,12 @@
|
||||
<corywright@gmail.com> <cory.wright@rackspace.com>
|
||||
<devin.carlen@gmail.com> <devcamcar@illian.local>
|
||||
<ewan.mellor@citrix.com> <emellor@silver>
|
||||
<itoumsn@nttdata.co.jp> <itoumsn@shayol>
|
||||
<jaypipes@gmail.com> <jpipes@serialcoder>
|
||||
<jmckenty@gmail.com> <jmckenty@joshua-mckentys-macbook-pro.local>
|
||||
<jmckenty@gmail.com> <jmckenty@yyj-dhcp171.corp.flock.com>
|
||||
<jmckenty@gmail.com> <joshua.mckenty@nasa.gov>
|
||||
<josh@jk0.org> <josh.kearney@rackspace.com>
|
||||
<justin@fathomdb.com> <justinsb@justinsb-desktop>
|
||||
<justin@fathomdb.com> <superstack@superstack.org>
|
||||
<masumotok@nttdata.co.jp> Masumoto<masumotok@nttdata.co.jp>
|
||||
@@ -40,4 +42,5 @@
|
||||
<ueno.nachi@lab.ntt.co.jp> <openstack@lab.ntt.co.jp>
|
||||
<vishvananda@gmail.com> <root@mirror.nasanebula.net>
|
||||
<vishvananda@gmail.com> <root@ubuntu>
|
||||
<naveedm9@gmail.com> <naveed.massjouni@rackspace.com>
|
||||
<vishvananda@gmail.com> <vishvananda@yahoo.com>
|
||||
|
||||
6
Authors
6
Authors
@@ -32,7 +32,7 @@ John Dewey <john@dewey.ws>
|
||||
Jonathan Bryce <jbryce@jbryce.com>
|
||||
Jordan Rinke <jordan@openstack.org>
|
||||
Josh Durgin <joshd@hq.newdream.net>
|
||||
Josh Kearney <josh.kearney@rackspace.com>
|
||||
Josh Kearney <josh@jk0.org>
|
||||
Joshua McKenty <jmckenty@gmail.com>
|
||||
Justin Santa Barbara <justin@fathomdb.com>
|
||||
Kei Masumoto <masumotok@nttdata.co.jp>
|
||||
@@ -40,6 +40,7 @@ Ken Pepple <ken.pepple@gmail.com>
|
||||
Kevin L. Mitchell <kevin.mitchell@rackspace.com>
|
||||
Koji Iida <iida.koji@lab.ntt.co.jp>
|
||||
Lorin Hochstein <lorin@isi.edu>
|
||||
Masanori Itoh <itoumsn@nttdata.co.jp>
|
||||
Matt Dietz <matt.dietz@rackspace.com>
|
||||
Michael Gundlach <michael.gundlach@rackspace.com>
|
||||
Monsyne Dragon <mdragon@rackspace.com>
|
||||
@@ -47,7 +48,8 @@ Monty Taylor <mordred@inaugust.com>
|
||||
MORITA Kazutaka <morita.kazutaka@gmail.com>
|
||||
Muneyuki Noguchi <noguchimn@nttdata.co.jp>
|
||||
Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
|
||||
Naveed Massjouni <naveed.massjouni@rackspace.com>
|
||||
Naveed Massjouni <naveedm9@gmail.com>
|
||||
Nirmal Ranganathan <nirmal.ranganathan@rackspace.com>
|
||||
Paul Voccio <paul@openstack.org>
|
||||
Ricardo Carrillo Cruz <emaildericky@gmail.com>
|
||||
Rick Clark <rick@openstack.org>
|
||||
|
||||
@@ -84,6 +84,7 @@ from nova import utils
|
||||
from nova.api.ec2.cloud import ec2_id_to_id
|
||||
from nova.auth import manager
|
||||
from nova.cloudpipe import pipelib
|
||||
from nova.compute import instance_types
|
||||
from nova.db import migration
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
@@ -661,6 +662,79 @@ class VolumeCommands(object):
|
||||
"mountpoint": volume['mountpoint']}})
|
||||
|
||||
|
||||
class InstanceTypeCommands(object):
|
||||
"""Class for managing instance types / flavors."""
|
||||
|
||||
def _print_instance_types(self, n, val):
|
||||
deleted = ('', ', inactive')[val["deleted"] == 1]
|
||||
print ("%s: Memory: %sMB, VCPUS: %s, Storage: %sGB, FlavorID: %s, "
|
||||
"Swap: %sGB, RXTX Quota: %sGB, RXTX Cap: %sMB%s") % (
|
||||
n, val["memory_mb"], val["vcpus"], val["local_gb"],
|
||||
val["flavorid"], val["swap"], val["rxtx_quota"],
|
||||
val["rxtx_cap"], deleted)
|
||||
|
||||
def create(self, name, memory, vcpus, local_gb, flavorid,
|
||||
swap=0, rxtx_quota=0, rxtx_cap=0):
|
||||
"""Creates instance types / flavors
|
||||
arguments: name memory vcpus local_gb flavorid [swap] [rxtx_quota]
|
||||
[rxtx_cap]
|
||||
"""
|
||||
try:
|
||||
instance_types.create(name, memory, vcpus, local_gb,
|
||||
flavorid, swap, rxtx_quota, rxtx_cap)
|
||||
except exception.InvalidInputException:
|
||||
print "Must supply valid parameters to create instance type"
|
||||
print e
|
||||
sys.exit(1)
|
||||
except exception.DBError, e:
|
||||
print "DB Error: %s" % e
|
||||
sys.exit(2)
|
||||
except:
|
||||
print "Unknown error"
|
||||
sys.exit(3)
|
||||
else:
|
||||
print "%s created" % name
|
||||
|
||||
def delete(self, name, purge=None):
|
||||
"""Marks instance types / flavors as deleted
|
||||
arguments: name"""
|
||||
try:
|
||||
if purge == "--purge":
|
||||
instance_types.purge(name)
|
||||
verb = "purged"
|
||||
else:
|
||||
instance_types.destroy(name)
|
||||
verb = "deleted"
|
||||
except exception.ApiError:
|
||||
print "Valid instance type name is required"
|
||||
sys.exit(1)
|
||||
except exception.DBError, e:
|
||||
print "DB Error: %s" % e
|
||||
sys.exit(2)
|
||||
except:
|
||||
sys.exit(3)
|
||||
else:
|
||||
print "%s %s" % (name, verb)
|
||||
|
||||
def list(self, name=None):
|
||||
"""Lists all active or specific instance types / flavors
|
||||
arguments: [name]"""
|
||||
try:
|
||||
if name == None:
|
||||
inst_types = instance_types.get_all_types()
|
||||
elif name == "--all":
|
||||
inst_types = instance_types.get_all_types(1)
|
||||
else:
|
||||
inst_types = instance_types.get_instance_type(name)
|
||||
except exception.DBError, e:
|
||||
_db_error(e)
|
||||
if isinstance(inst_types.values()[0], dict):
|
||||
for k, v in inst_types.iteritems():
|
||||
self._print_instance_types(k, v)
|
||||
else:
|
||||
self._print_instance_types(name, inst_types)
|
||||
|
||||
|
||||
CATEGORIES = [
|
||||
('user', UserCommands),
|
||||
('project', ProjectCommands),
|
||||
@@ -673,7 +747,9 @@ CATEGORIES = [
|
||||
('service', ServiceCommands),
|
||||
('log', LogCommands),
|
||||
('db', DbCommands),
|
||||
('volume', VolumeCommands)]
|
||||
('volume', VolumeCommands),
|
||||
('instance_type', InstanceTypeCommands),
|
||||
('flavor', InstanceTypeCommands)]
|
||||
|
||||
|
||||
def lazy_match(name, key_value_tuples):
|
||||
|
||||
@@ -40,6 +40,9 @@ source/api/nova..db.sqlalchemy.migrate_repo.versions.001_austin.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.002_bexar.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.003_add_label_to_networks.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.004_add_zone_tables.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.005_add_instance_metadata.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.006_add_provider_data_to_volumes.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.007_add_instance_types.rst
|
||||
source/api/nova..db.sqlalchemy.migration.rst
|
||||
source/api/nova..db.sqlalchemy.models.rst
|
||||
source/api/nova..db.sqlalchemy.session.rst
|
||||
@@ -98,6 +101,7 @@ source/api/nova..tests.test_compute.rst
|
||||
source/api/nova..tests.test_console.rst
|
||||
source/api/nova..tests.test_direct.rst
|
||||
source/api/nova..tests.test_flags.rst
|
||||
source/api/nova..tests.test_instance_types.rst
|
||||
source/api/nova..tests.test_localization.rst
|
||||
source/api/nova..tests.test_log.rst
|
||||
source/api/nova..tests.test_middleware.rst
|
||||
@@ -107,7 +111,9 @@ source/api/nova..tests.test_quota.rst
|
||||
source/api/nova..tests.test_rpc.rst
|
||||
source/api/nova..tests.test_scheduler.rst
|
||||
source/api/nova..tests.test_service.rst
|
||||
source/api/nova..tests.test_test.rst
|
||||
source/api/nova..tests.test_twistd.rst
|
||||
source/api/nova..tests.test_utils.rst
|
||||
source/api/nova..tests.test_virt.rst
|
||||
source/api/nova..tests.test_volume.rst
|
||||
source/api/nova..tests.test_xenapi.rst
|
||||
@@ -176,6 +182,9 @@ source/api/nova..db.sqlalchemy.migrate_repo.versions.001_austin.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.002_bexar.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.003_add_label_to_networks.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.004_add_zone_tables.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.005_add_instance_metadata.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.006_add_provider_data_to_volumes.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.007_add_instance_types.rst
|
||||
source/api/nova..db.sqlalchemy.migration.rst
|
||||
source/api/nova..db.sqlalchemy.models.rst
|
||||
source/api/nova..db.sqlalchemy.session.rst
|
||||
@@ -234,6 +243,7 @@ source/api/nova..tests.test_compute.rst
|
||||
source/api/nova..tests.test_console.rst
|
||||
source/api/nova..tests.test_direct.rst
|
||||
source/api/nova..tests.test_flags.rst
|
||||
source/api/nova..tests.test_instance_types.rst
|
||||
source/api/nova..tests.test_localization.rst
|
||||
source/api/nova..tests.test_log.rst
|
||||
source/api/nova..tests.test_middleware.rst
|
||||
@@ -243,142 +253,9 @@ source/api/nova..tests.test_quota.rst
|
||||
source/api/nova..tests.test_rpc.rst
|
||||
source/api/nova..tests.test_scheduler.rst
|
||||
source/api/nova..tests.test_service.rst
|
||||
source/api/nova..tests.test_test.rst
|
||||
source/api/nova..tests.test_twistd.rst
|
||||
source/api/nova..tests.test_virt.rst
|
||||
source/api/nova..tests.test_volume.rst
|
||||
source/api/nova..tests.test_xenapi.rst
|
||||
source/api/nova..tests.xenapi.stubs.rst
|
||||
source/api/nova..twistd.rst
|
||||
source/api/nova..utils.rst
|
||||
source/api/nova..version.rst
|
||||
source/api/nova..virt.connection.rst
|
||||
source/api/nova..virt.disk.rst
|
||||
source/api/nova..virt.fake.rst
|
||||
source/api/nova..virt.hyperv.rst
|
||||
source/api/nova..virt.images.rst
|
||||
source/api/nova..virt.libvirt_conn.rst
|
||||
source/api/nova..virt.xenapi.fake.rst
|
||||
source/api/nova..virt.xenapi.network_utils.rst
|
||||
source/api/nova..virt.xenapi.vm_utils.rst
|
||||
source/api/nova..virt.xenapi.vmops.rst
|
||||
source/api/nova..virt.xenapi.volume_utils.rst
|
||||
source/api/nova..virt.xenapi.volumeops.rst
|
||||
source/api/nova..virt.xenapi_conn.rst
|
||||
source/api/nova..volume.api.rst
|
||||
source/api/nova..volume.driver.rst
|
||||
source/api/nova..volume.manager.rst
|
||||
source/api/nova..volume.san.rst
|
||||
source/api/nova..wsgi.rst
|
||||
source/api/nova..adminclient.rst
|
||||
source/api/nova..api.direct.rst
|
||||
source/api/nova..api.ec2.admin.rst
|
||||
source/api/nova..api.ec2.apirequest.rst
|
||||
source/api/nova..api.ec2.cloud.rst
|
||||
source/api/nova..api.ec2.metadatarequesthandler.rst
|
||||
source/api/nova..api.openstack.auth.rst
|
||||
source/api/nova..api.openstack.backup_schedules.rst
|
||||
source/api/nova..api.openstack.common.rst
|
||||
source/api/nova..api.openstack.consoles.rst
|
||||
source/api/nova..api.openstack.faults.rst
|
||||
source/api/nova..api.openstack.flavors.rst
|
||||
source/api/nova..api.openstack.images.rst
|
||||
source/api/nova..api.openstack.servers.rst
|
||||
source/api/nova..api.openstack.shared_ip_groups.rst
|
||||
source/api/nova..api.openstack.zones.rst
|
||||
source/api/nova..auth.dbdriver.rst
|
||||
source/api/nova..auth.fakeldap.rst
|
||||
source/api/nova..auth.ldapdriver.rst
|
||||
source/api/nova..auth.manager.rst
|
||||
source/api/nova..auth.signer.rst
|
||||
source/api/nova..cloudpipe.pipelib.rst
|
||||
source/api/nova..compute.api.rst
|
||||
source/api/nova..compute.instance_types.rst
|
||||
source/api/nova..compute.manager.rst
|
||||
source/api/nova..compute.monitor.rst
|
||||
source/api/nova..compute.power_state.rst
|
||||
source/api/nova..console.api.rst
|
||||
source/api/nova..console.fake.rst
|
||||
source/api/nova..console.manager.rst
|
||||
source/api/nova..console.xvp.rst
|
||||
source/api/nova..context.rst
|
||||
source/api/nova..crypto.rst
|
||||
source/api/nova..db.api.rst
|
||||
source/api/nova..db.base.rst
|
||||
source/api/nova..db.migration.rst
|
||||
source/api/nova..db.sqlalchemy.api.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.manage.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.001_austin.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.002_bexar.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.003_add_label_to_networks.rst
|
||||
source/api/nova..db.sqlalchemy.migrate_repo.versions.004_add_zone_tables.rst
|
||||
source/api/nova..db.sqlalchemy.migration.rst
|
||||
source/api/nova..db.sqlalchemy.models.rst
|
||||
source/api/nova..db.sqlalchemy.session.rst
|
||||
source/api/nova..exception.rst
|
||||
source/api/nova..fakememcache.rst
|
||||
source/api/nova..fakerabbit.rst
|
||||
source/api/nova..flags.rst
|
||||
source/api/nova..image.glance.rst
|
||||
source/api/nova..image.local.rst
|
||||
source/api/nova..image.s3.rst
|
||||
source/api/nova..image.service.rst
|
||||
source/api/nova..log.rst
|
||||
source/api/nova..manager.rst
|
||||
source/api/nova..network.api.rst
|
||||
source/api/nova..network.linux_net.rst
|
||||
source/api/nova..network.manager.rst
|
||||
source/api/nova..objectstore.bucket.rst
|
||||
source/api/nova..objectstore.handler.rst
|
||||
source/api/nova..objectstore.image.rst
|
||||
source/api/nova..objectstore.stored.rst
|
||||
source/api/nova..quota.rst
|
||||
source/api/nova..rpc.rst
|
||||
source/api/nova..scheduler.chance.rst
|
||||
source/api/nova..scheduler.driver.rst
|
||||
source/api/nova..scheduler.manager.rst
|
||||
source/api/nova..scheduler.simple.rst
|
||||
source/api/nova..scheduler.zone.rst
|
||||
source/api/nova..service.rst
|
||||
source/api/nova..test.rst
|
||||
source/api/nova..tests.api.openstack.fakes.rst
|
||||
source/api/nova..tests.api.openstack.test_adminapi.rst
|
||||
source/api/nova..tests.api.openstack.test_api.rst
|
||||
source/api/nova..tests.api.openstack.test_auth.rst
|
||||
source/api/nova..tests.api.openstack.test_common.rst
|
||||
source/api/nova..tests.api.openstack.test_faults.rst
|
||||
source/api/nova..tests.api.openstack.test_flavors.rst
|
||||
source/api/nova..tests.api.openstack.test_images.rst
|
||||
source/api/nova..tests.api.openstack.test_ratelimiting.rst
|
||||
source/api/nova..tests.api.openstack.test_servers.rst
|
||||
source/api/nova..tests.api.openstack.test_shared_ip_groups.rst
|
||||
source/api/nova..tests.api.openstack.test_zones.rst
|
||||
source/api/nova..tests.api.test_wsgi.rst
|
||||
source/api/nova..tests.db.fakes.rst
|
||||
source/api/nova..tests.declare_flags.rst
|
||||
source/api/nova..tests.fake_flags.rst
|
||||
source/api/nova..tests.glance.stubs.rst
|
||||
source/api/nova..tests.hyperv_unittest.rst
|
||||
source/api/nova..tests.objectstore_unittest.rst
|
||||
source/api/nova..tests.real_flags.rst
|
||||
source/api/nova..tests.runtime_flags.rst
|
||||
source/api/nova..tests.test_access.rst
|
||||
source/api/nova..tests.test_api.rst
|
||||
source/api/nova..tests.test_auth.rst
|
||||
source/api/nova..tests.test_cloud.rst
|
||||
source/api/nova..tests.test_compute.rst
|
||||
source/api/nova..tests.test_console.rst
|
||||
source/api/nova..tests.test_direct.rst
|
||||
source/api/nova..tests.test_flags.rst
|
||||
source/api/nova..tests.test_localization.rst
|
||||
source/api/nova..tests.test_log.rst
|
||||
source/api/nova..tests.test_middleware.rst
|
||||
source/api/nova..tests.test_misc.rst
|
||||
source/api/nova..tests.test_network.rst
|
||||
source/api/nova..tests.test_quota.rst
|
||||
source/api/nova..tests.test_rpc.rst
|
||||
source/api/nova..tests.test_scheduler.rst
|
||||
source/api/nova..tests.test_service.rst
|
||||
source/api/nova..tests.test_twistd.rst
|
||||
source/api/nova..tests.test_utils.rst
|
||||
source/api/nova..tests.test_virt.rst
|
||||
source/api/nova..tests.test_volume.rst
|
||||
source/api/nova..tests.test_xenapi.rst
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
nova..db.sqlalchemy.migrate_repo.versions.002_bexar.rst
|
||||
nova..db.sqlalchemy.migrate_repo.versions.003_add_label_to_networks.rst
|
||||
nova..db.sqlalchemy.migrate_repo.versions.004_add_zone_tables.rst
|
||||
nova..db.sqlalchemy.migrate_repo.versions.005_add_instance_metadata.rst
|
||||
nova..db.sqlalchemy.migrate_repo.versions.006_add_provider_data_to_volumes.rst
|
||||
nova..db.sqlalchemy.migrate_repo.versions.007_add_instance_types.rst
|
||||
nova..db.sqlalchemy.migration.rst
|
||||
nova..db.sqlalchemy.models.rst
|
||||
nova..db.sqlalchemy.session.rst
|
||||
@@ -101,6 +104,7 @@
|
||||
nova..tests.test_console.rst
|
||||
nova..tests.test_direct.rst
|
||||
nova..tests.test_flags.rst
|
||||
nova..tests.test_instance_types.rst
|
||||
nova..tests.test_localization.rst
|
||||
nova..tests.test_log.rst
|
||||
nova..tests.test_middleware.rst
|
||||
@@ -110,7 +114,9 @@
|
||||
nova..tests.test_rpc.rst
|
||||
nova..tests.test_scheduler.rst
|
||||
nova..tests.test_service.rst
|
||||
nova..tests.test_test.rst
|
||||
nova..tests.test_twistd.rst
|
||||
nova..tests.test_utils.rst
|
||||
nova..tests.test_virt.rst
|
||||
nova..tests.test_volume.rst
|
||||
nova..tests.test_xenapi.rst
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..db.sqlalchemy.migrate_repo.versions.005_add_instance_metadata` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..db.sqlalchemy.migrate_repo.versions.005_add_instance_metadata
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..db.sqlalchemy.migrate_repo.versions.006_add_provider_data_to_volumes` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..db.sqlalchemy.migrate_repo.versions.006_add_provider_data_to_volumes
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..db.sqlalchemy.migrate_repo.versions.007_add_instance_types` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..db.sqlalchemy.migrate_repo.versions.007_add_instance_types
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
6
doc/source/api/nova..tests.test_instance_types.rst
Normal file
6
doc/source/api/nova..tests.test_instance_types.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..tests.test_instance_types` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..tests.test_instance_types
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
6
doc/source/api/nova..tests.test_test.rst
Normal file
6
doc/source/api/nova..tests.test_test.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..tests.test_test` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..tests.test_test
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
6
doc/source/api/nova..tests.test_utils.rst
Normal file
6
doc/source/api/nova..tests.test_utils.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
The :mod:`nova..tests.test_utils` Module
|
||||
==============================================================================
|
||||
.. automodule:: nova..tests.test_utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -179,6 +179,42 @@ Nova Floating IPs
|
||||
|
||||
Displays a list of all floating IP addresses.
|
||||
|
||||
Nova Flavor
|
||||
~~~~~~~~~~~
|
||||
|
||||
``nova-manage flavor list``
|
||||
|
||||
Outputs a list of all active flavors to the screen.
|
||||
|
||||
``nova-manage flavor list --all``
|
||||
|
||||
Outputs a list of all flavors (active and inactive) to the screen.
|
||||
|
||||
``nova-manage flavor create <name> <memory> <vCPU> <local_storage> <flavorID> <(optional) swap> <(optional) RXTX Quota> <(optional) RXTX Cap>``
|
||||
|
||||
creates a flavor with the following positional arguments:
|
||||
* memory (expressed in megabytes)
|
||||
* vcpu(s) (integer)
|
||||
* local storage (expressed in gigabytes)
|
||||
* flavorid (unique integer)
|
||||
* swap space (expressed in megabytes, defaults to zero, optional)
|
||||
* RXTX quotas (expressed in gigabytes, defaults to zero, optional)
|
||||
* RXTX cap (expressed in gigabytes, defaults to zero, optional)
|
||||
|
||||
``nova-manage flavor delete <name>``
|
||||
|
||||
Delete the flavor with the name <name>. This marks the flavor as inactive and cannot be launched. However, the record stays in the database for archival and billing purposes.
|
||||
|
||||
``nova-manage flavor delete <name> --purge``
|
||||
|
||||
Purges the flavor with the name <name>. This removes this flavor from the database.
|
||||
|
||||
|
||||
Nova Instance_type
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The instance_type command is provided as an alias for the flavor command. All the same subcommands and arguments from nova-manage flavor can be used.
|
||||
|
||||
|
||||
FILES
|
||||
========
|
||||
|
||||
@@ -64,6 +64,11 @@ Concept: Instances
|
||||
|
||||
An 'instance' is a word for a virtual machine that runs inside the cloud.
|
||||
|
||||
Concept: Instance Type
|
||||
----------------------
|
||||
|
||||
An 'instance type' describes the compute, memory and storage capacity of nova computing instances. In layman terms, this is the size (in terms of vCPUs, RAM, etc.) of the virtual server that you will be launching.
|
||||
|
||||
Concept: System Architecture
|
||||
----------------------------
|
||||
|
||||
|
||||
84
doc/source/runnova/managing.instance.types.rst
Normal file
84
doc/source/runnova/managing.instance.types.rst
Normal file
@@ -0,0 +1,84 @@
|
||||
..
|
||||
Copyright 2011 Ken Pepple
|
||||
|
||||
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.
|
||||
|
||||
Managing Instance Types and Flavors
|
||||
===================================
|
||||
|
||||
What are Instance Types or Flavors ?
|
||||
------------------------------------
|
||||
|
||||
Instance types describe the compute, memory and storage capacity of nova computing instances. In layman terms, this is the size (in terms of vCPUs, RAM, etc.) of the virtual server that you will be launching. In the EC2 API, these are called by names such as "m1.large" or "m1.tiny", while the OpenStack API terms these "flavors" with names like "512 MB Server".
|
||||
|
||||
In Nova, "flavor" and "instance type" are equivalent terms. When you create an EC2 instance type, you are also creating a OpenStack API flavor. To reduce repetition, for the rest of this document I will refer to these as instance types.
|
||||
|
||||
Instance types can be in either the active or inactive state:
|
||||
* Active instance types are available to be used for launching instances
|
||||
* Inactive instance types are not available for launching instances
|
||||
|
||||
In the current (Cactus) version of nova, instance types can only be created by the nova administrator through the nova-manage command. Future versions of nova (in concert with the OpenStack API or EC2 API), may expose this functionality directly to users.
|
||||
|
||||
Basic Management
|
||||
----------------
|
||||
|
||||
Instance types / flavor are managed through the nova-manage binary with
|
||||
the "instance_type" command and an appropriate subcommand. Note that you can also use
|
||||
the "flavor" command as a synonym for "instance_types".
|
||||
|
||||
To see all currently active instance types, use the list subcommand::
|
||||
|
||||
# nova-manage instance_type list
|
||||
m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
|
||||
By default, the list subcommand only shows active instance types. To see all instance types (inactive and active), use the list subcommand with the "--all" flag::
|
||||
|
||||
# nova-manage instance_type list --all
|
||||
m1.medium: Memory: 4096MB, VCPUS: 2, Storage: 40GB, FlavorID: 3, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.large: Memory: 8192MB, VCPUS: 4, Storage: 80GB, FlavorID: 4, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.xlarge: Memory: 16384MB, VCPUS: 8, Storage: 160GB, FlavorID: 5, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.small: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB
|
||||
m1.deleted: Memory: 2048MB, VCPUS: 1, Storage: 20GB, FlavorID: 2, Swap: 0GB, RXTX Quota: 0GB, RXTX Cap: 0MB, inactive
|
||||
|
||||
To create an instance type, use the "create" subcommand with the following positional arguments:
|
||||
* memory (expressed in megabytes)
|
||||
* vcpu(s) (integer)
|
||||
* local storage (expressed in gigabytes)
|
||||
* flavorid (unique integer)
|
||||
* swap space (expressed in megabytes, defaults to zero, optional)
|
||||
* RXTX quotas (expressed in gigabytes, defaults to zero, optional)
|
||||
* RXTX cap (expressed in gigabytes, defaults to zero, optional)
|
||||
|
||||
The following example creates an instance type named "m1.xxlarge"::
|
||||
|
||||
# nova-manage instance_type create m1.xxlarge 32768 16 320 0 0 0
|
||||
m1.xxlarge created
|
||||
|
||||
To delete an instance type, use the "delete" subcommand and specify the name::
|
||||
|
||||
# nova-manage instance_type delete m1.xxlarge
|
||||
m1.xxlarge deleted
|
||||
|
||||
Please note that the "delete" command only marks the instance type as
|
||||
inactive in the database; it does not actually remove the instance type. This is done
|
||||
to preserve the instance type definition for long running instances (which may not
|
||||
terminate for months or years). If you are sure that you want to delete this instance
|
||||
type from the database, pass the "--purge" flag after the name::
|
||||
|
||||
# nova-manage instance_type delete m1.xxlarge --purge
|
||||
m1.xxlarge purged
|
||||
@@ -267,7 +267,7 @@ class CloudTestCase(test.TestCase):
|
||||
self._create_key('test1')
|
||||
self._create_key('test2')
|
||||
result = self.cloud.describe_key_pairs(self.context)
|
||||
keys = result["keypairsSet"]
|
||||
keys = result["keySet"]
|
||||
self.assertTrue(filter(lambda k: k['keyName'] == 'test1', keys))
|
||||
self.assertTrue(filter(lambda k: k['keyName'] == 'test2', keys))
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ from nova import log as logging
|
||||
from nova import test
|
||||
from nova import utils
|
||||
from nova.auth import manager
|
||||
from nova.compute import instance_types
|
||||
|
||||
|
||||
LOG = logging.getLogger('nova.tests.compute')
|
||||
@@ -266,3 +267,10 @@ class ComputeTestCase(test.TestCase):
|
||||
self.assertEqual(ret_val, None)
|
||||
|
||||
self.compute.terminate_instance(self.context, instance_id)
|
||||
|
||||
def test_get_by_flavor_id(self):
|
||||
type = instance_types.get_by_flavor_id(1)
|
||||
self.assertEqual(type, 'm1.tiny')
|
||||
|
||||
type = instance_types.get_by_flavor_id("1")
|
||||
self.assertEqual(type, 'm1.tiny')
|
||||
|
||||
86
nova/tests/test_instance_types.py
Normal file
86
nova/tests/test_instance_types.py
Normal file
@@ -0,0 +1,86 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2011 Ken Pepple
|
||||
# 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.
|
||||
"""
|
||||
Unit Tests for instance types code
|
||||
"""
|
||||
import time
|
||||
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import test
|
||||
from nova import utils
|
||||
from nova.compute import instance_types
|
||||
from nova.db.sqlalchemy.session import get_session
|
||||
from nova.db.sqlalchemy import models
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
LOG = logging.getLogger('nova.tests.compute')
|
||||
|
||||
|
||||
class InstanceTypeTestCase(test.TestCase):
|
||||
"""Test cases for instance type code"""
|
||||
def setUp(self):
|
||||
super(InstanceTypeTestCase, self).setUp()
|
||||
session = get_session()
|
||||
max_flavorid = session.query(models.InstanceTypes).\
|
||||
order_by("flavorid desc").\
|
||||
first()
|
||||
self.flavorid = max_flavorid["flavorid"] + 1
|
||||
self.name = str(int(time.time()))
|
||||
|
||||
def test_instance_type_create_then_delete(self):
|
||||
"""Ensure instance types can be created"""
|
||||
starting_inst_list = instance_types.get_all_types()
|
||||
instance_types.create(self.name, 256, 1, 120, self.flavorid)
|
||||
new = instance_types.get_all_types()
|
||||
self.assertNotEqual(len(starting_inst_list),
|
||||
len(new),
|
||||
'instance type was not created')
|
||||
instance_types.destroy(self.name)
|
||||
self.assertEqual(1,
|
||||
instance_types.get_instance_type(self.name)["deleted"])
|
||||
self.assertEqual(starting_inst_list, instance_types.get_all_types())
|
||||
instance_types.purge(self.name)
|
||||
self.assertEqual(len(starting_inst_list),
|
||||
len(instance_types.get_all_types()),
|
||||
'instance type not purged')
|
||||
|
||||
def test_get_all_instance_types(self):
|
||||
"""Ensures that all instance types can be retrieved"""
|
||||
session = get_session()
|
||||
total_instance_types = session.query(models.InstanceTypes).\
|
||||
count()
|
||||
inst_types = instance_types.get_all_types()
|
||||
self.assertEqual(total_instance_types, len(inst_types))
|
||||
|
||||
def test_invalid_create_args_should_fail(self):
|
||||
"""Ensures that instance type creation fails with invalid args"""
|
||||
self.assertRaises(
|
||||
exception.InvalidInputException,
|
||||
instance_types.create, self.name, 0, 1, 120, self.flavorid)
|
||||
self.assertRaises(
|
||||
exception.InvalidInputException,
|
||||
instance_types.create, self.name, 256, -1, 120, self.flavorid)
|
||||
self.assertRaises(
|
||||
exception.InvalidInputException,
|
||||
instance_types.create, self.name, 256, 1, "aa", self.flavorid)
|
||||
|
||||
def test_non_existant_inst_type_shouldnt_delete(self):
|
||||
"""Ensures that instance type creation fails with invalid args"""
|
||||
self.assertRaises(exception.ApiError,
|
||||
instance_types.destroy, "sfsfsdfdfs")
|
||||
@@ -35,6 +35,7 @@ from nova.compute import power_state
|
||||
from nova.virt import xenapi_conn
|
||||
from nova.virt.xenapi import fake as xenapi_fake
|
||||
from nova.virt.xenapi import volume_utils
|
||||
from nova.virt.xenapi import vm_utils
|
||||
from nova.virt.xenapi.vmops import SimpleDH
|
||||
from nova.virt.xenapi.vmops import VMOps
|
||||
from nova.tests.db import fakes as db_fakes
|
||||
@@ -58,7 +59,7 @@ class XenAPIVolumeTestCase(test.TestCase):
|
||||
FLAGS.xenapi_connection_url = 'test_url'
|
||||
FLAGS.xenapi_connection_password = 'test_pass'
|
||||
db_fakes.stub_out_db_instance_api(self.stubs)
|
||||
db_fakes.stub_out_db_network_api(self.stubs)
|
||||
#db_fakes.stub_out_db_network_api(self.stubs)
|
||||
stubs.stub_out_get_target(self.stubs)
|
||||
xenapi_fake.reset()
|
||||
self.values = {'name': 1, 'id': 1,
|
||||
@@ -171,7 +172,7 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
xenapi_fake.reset()
|
||||
xenapi_fake.create_local_srs()
|
||||
db_fakes.stub_out_db_instance_api(self.stubs)
|
||||
db_fakes.stub_out_db_network_api(self.stubs)
|
||||
#db_fakes.stub_out_db_network_api(self.stubs)
|
||||
xenapi_fake.create_network('fake', FLAGS.flat_network_bridge)
|
||||
stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests)
|
||||
stubs.stubout_get_this_vm_uuid(self.stubs)
|
||||
@@ -242,7 +243,7 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
vm_ref, vm = vms[0]
|
||||
|
||||
# Check that m1.large above turned into the right thing.
|
||||
instance_type = instance_types.INSTANCE_TYPES['m1.large']
|
||||
instance_type = db.instance_type_get_by_name(conn, 'm1.large')
|
||||
mem_kib = long(instance_type['memory_mb']) << 10
|
||||
mem_bytes = str(mem_kib << 10)
|
||||
vcpus = instance_type['vcpus']
|
||||
@@ -271,6 +272,10 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
'ips': [{'ip': '10.0.0.3',
|
||||
'netmask':'255.255.255.0',
|
||||
'enabled':'1'}],
|
||||
'ip6s': [{'ip': '',
|
||||
'netmask': '',
|
||||
'enabled': '1',
|
||||
'gateway': ''}],
|
||||
'mac': 'aa:bb:cc:dd:ee:ff',
|
||||
'dns': ['10.0.0.2'],
|
||||
'gateway': '10.0.0.1'})
|
||||
@@ -310,15 +315,21 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
|
||||
def test_spawn_raw_glance(self):
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self._test_spawn(1, None, None)
|
||||
self._test_spawn(glance_stubs.FakeGlance.IMAGE_RAW, None, None)
|
||||
|
||||
def test_spawn_vhd_glance(self):
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None)
|
||||
|
||||
def test_spawn_glance(self):
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self._test_spawn(1, 2, 3)
|
||||
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
|
||||
glance_stubs.FakeGlance.IMAGE_KERNEL,
|
||||
glance_stubs.FakeGlance.IMAGE_RAMDISK)
|
||||
|
||||
def test_spawn_netinject_file(self):
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
db_fakes.stub_out_db_network_api(self.stubs, injected=True)
|
||||
db_fakes.stub_out_db_instance_api(self.stubs, injected=True)
|
||||
|
||||
self._tee_executed = False
|
||||
|
||||
@@ -347,12 +358,16 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
# Capture the sudo tee .../etc/network/interfaces command
|
||||
(r'(sudo\s+)?tee.*interfaces', _tee_handler),
|
||||
])
|
||||
self._test_spawn(1, 2, 3, check_injection=True)
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
|
||||
glance_stubs.FakeGlance.IMAGE_KERNEL,
|
||||
glance_stubs.FakeGlance.IMAGE_RAMDISK,
|
||||
check_injection=True)
|
||||
self.assertTrue(self._tee_executed)
|
||||
|
||||
def test_spawn_netinject_xenstore(self):
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
db_fakes.stub_out_db_network_api(self.stubs, injected=True)
|
||||
db_fakes.stub_out_db_instance_api(self.stubs, injected=True)
|
||||
|
||||
self._tee_executed = False
|
||||
|
||||
@@ -443,3 +458,63 @@ class XenAPIDiffieHellmanTestCase(test.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
super(XenAPIDiffieHellmanTestCase, self).tearDown()
|
||||
|
||||
|
||||
class XenAPIDetermineDiskImageTestCase(test.TestCase):
|
||||
"""
|
||||
Unit tests for code that detects the ImageType
|
||||
"""
|
||||
def setUp(self):
|
||||
super(XenAPIDetermineDiskImageTestCase, self).setUp()
|
||||
glance_stubs.stubout_glance_client(self.stubs,
|
||||
glance_stubs.FakeGlance)
|
||||
|
||||
class FakeInstance(object):
|
||||
pass
|
||||
|
||||
self.fake_instance = FakeInstance()
|
||||
self.fake_instance.id = 42
|
||||
|
||||
def assert_disk_type(self, disk_type):
|
||||
dt = vm_utils.VMHelper.determine_disk_image_type(
|
||||
self.fake_instance)
|
||||
self.assertEqual(disk_type, dt)
|
||||
|
||||
def test_instance_disk(self):
|
||||
"""
|
||||
If a kernel is specified then the image type is DISK (aka machine)
|
||||
"""
|
||||
FLAGS.xenapi_image_service = 'objectstore'
|
||||
self.fake_instance.image_id = glance_stubs.FakeGlance.IMAGE_MACHINE
|
||||
self.fake_instance.kernel_id = glance_stubs.FakeGlance.IMAGE_KERNEL
|
||||
self.assert_disk_type(vm_utils.ImageType.DISK)
|
||||
|
||||
def test_instance_disk_raw(self):
|
||||
"""
|
||||
If the kernel isn't specified, and we're not using Glance, then
|
||||
DISK_RAW is assumed.
|
||||
"""
|
||||
FLAGS.xenapi_image_service = 'objectstore'
|
||||
self.fake_instance.image_id = glance_stubs.FakeGlance.IMAGE_RAW
|
||||
self.fake_instance.kernel_id = None
|
||||
self.assert_disk_type(vm_utils.ImageType.DISK_RAW)
|
||||
|
||||
def test_glance_disk_raw(self):
|
||||
"""
|
||||
If we're using Glance, then defer to the image_type field, which in
|
||||
this case will be 'raw'.
|
||||
"""
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self.fake_instance.image_id = glance_stubs.FakeGlance.IMAGE_RAW
|
||||
self.fake_instance.kernel_id = None
|
||||
self.assert_disk_type(vm_utils.ImageType.DISK_RAW)
|
||||
|
||||
def test_glance_disk_vhd(self):
|
||||
"""
|
||||
If we're using Glance, then defer to the image_type field, which in
|
||||
this case will be 'vhd'.
|
||||
"""
|
||||
FLAGS.xenapi_image_service = 'glance'
|
||||
self.fake_instance.image_id = glance_stubs.FakeGlance.IMAGE_VHD
|
||||
self.fake_instance.kernel_id = None
|
||||
self.assert_disk_type(vm_utils.ImageType.DISK_VHD)
|
||||
|
||||
@@ -27,7 +27,7 @@ def stubout_instance_snapshot(stubs):
|
||||
def fake_fetch_image(cls, session, instance_id, image, user, project,
|
||||
type):
|
||||
# Stubout wait_for_task
|
||||
def fake_wait_for_task(self, id, task):
|
||||
def fake_wait_for_task(self, task, id):
|
||||
class FakeEvent:
|
||||
|
||||
def send(self, value):
|
||||
@@ -177,24 +177,18 @@ class FakeSessionForVMTests(fake.SessionBase):
|
||||
def VM_destroy(self, session_ref, vm_ref):
|
||||
fake.destroy_vm(vm_ref)
|
||||
|
||||
def VM_get_VIFs(self, session_ref, vm_ref):
|
||||
return (['0', '1', '2'])
|
||||
|
||||
def VIF_get_device(self, session_ref, vif_ref):
|
||||
return ('1', '0', '2')[int(vif_ref)]
|
||||
|
||||
def VIF_get_MAC(self, session_ref, vif_ref):
|
||||
return (
|
||||
'11:22:2a:b3:CC:dd',
|
||||
'22:33:2a:b3:CC:dd',
|
||||
'44:44:2a:b3:CC:dd')[int(vif_ref)]
|
||||
|
||||
def VM_add_to_xenstore_data(self, session_ref, vm_ref, key, value):
|
||||
fake.VM_add_to_xenstore_data(vm_ref, key, value)
|
||||
|
||||
def VM_remove_from_xenstore_data(self, session_ref, vm_ref, key):
|
||||
fake.VM_remove_from_xenstore_data(vm_ref, key)
|
||||
|
||||
def SR_scan(self, session_ref, sr_ref):
|
||||
pass
|
||||
|
||||
def VDI_set_name_label(self, session_ref, vdi_ref, name_label):
|
||||
pass
|
||||
|
||||
|
||||
class FakeSessionForVolumeTests(fake.SessionBase):
|
||||
""" Stubs out a XenAPISession for Volume tests """
|
||||
|
||||
@@ -84,7 +84,7 @@ fi
|
||||
if [ -z "$noseargs" ];
|
||||
then
|
||||
srcfiles=`find bin -type f ! -name "nova.conf*"`
|
||||
srcfiles+=" nova setup.py"
|
||||
srcfiles+=" nova setup.py plugins/xenserver/xenapi/etc/xapi.d/plugins/glance"
|
||||
run_tests && pep8 --repeat --show-pep8 --show-source --exclude=vcsversion.py ${srcfiles} || exit 1
|
||||
else
|
||||
run_tests
|
||||
|
||||
Reference in New Issue
Block a user