12424 Commits

Author SHA1 Message Date
Devananda van der Veen
b107b2d6b1 Improve baremetal driver error handling
Several improvements to baremetal driver are implemented in this patch.
There is now significantly more error handling during spawn().

It also includes an addition to nova/tests/utils.py to provide
additional sample information from get_test_network_info().

blueprint general-bare-metal-provisioning-framework

Change-Id: I65d93051d7fcfd79f4d24d4ddb62fb1a55bee646
2012-12-27 17:19:21 -08:00
Devananda van der Veen
45fa41ba92 baremetal power driver takes **kwargs
Some baremetal power drivers may require different information passed to
them. This patch prepares the way by having the base class take only
**kwargs, and having the driver pass both 'instance' and 'node', instead
of just passing 'node'.

blueprint general-bare-metal-provisioning-framework

Change-Id: Iff91024b1d019b0d07f2cbfe991748e618bfcb18
2012-12-27 15:13:58 -08:00
Devananda van der Veen
f9c10b39e4 Implement IPMI sub-driver for baremetal compute
This patch implements only the IPMI power manager for baremetal nova
compute. Documentation will come in a separate patch.

blueprint general-bare-metal-provisioning-framework

Change-Id: I60ccfbf963d7bbf6f840e627396601b7bba80e7f
2012-12-21 20:15:38 -08:00
Devananda van der Veen
755a945a17 Fix tests/baremetal/test_driver.py
Unit tests for baremetal/driver.py were not functioning and were
falsely reporting success due to inheriting from the wrong class.
This lead to drift between the tests and the code over time.
I decided it was easier to re-implement tests/baremetal/test_driver.py
instead of trying to fix the drift. This gave me the chance to make
the test class easier to extend. Additional tests will be added
in the future, when I refactor driver.py:spawn().

This patch also has some minor variable name changes for baremetal/driver.py.

blueprint general-bare-metal-provisioning-framework.

Change-Id: I36ba5ed340b722b9a6e8d02d6d57d3c8d53b1eef
2012-12-22 16:35:58 -08:00
Devananda van der Veen
b4d44338b9 Move baremetal options to [BAREMETAL] OptGroup
Move all the baremetal options into a new [BAREMETAL] OptGroup,
except for 'baremetal_db_backend', which breaks LazyPluggable if moved.

blueprint general-bare-metal-provisioning-framework

Change-Id: I06f53dcf10b9bbd3fd7cc0725cc6076af3d74d19
2012-12-21 11:09:48 -08:00
Boris Pavlovic
8001d748ea Remove session.flush() and session.query() monkey patching
Use custom Session class to avoid monkey patching of SqlAlchemy
Session instance.

blueprint db-session-cleanup

Change-Id: I7d40c20e585782403556f3587141805c197bfa64
2012-12-28 15:21:08 +04:00
Joe Gordon
022f405691 Remove unused imports
And one unused variable

Change-Id: I81edaf7ddedd7723c2601b30951ca82bd2cd5256
2012-12-26 23:42:14 +00:00
Chuck Short
e9cf0dce98 Removed unused imports.
Removed a bunch of unused imports based on pyflakes.

Change-Id: I00952371200cb4531ddf163447433da756582a21
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2012-12-21 08:39:32 -06:00
Devananda van der Veen
c75e6b8f8e Parameterize database connection in test.py
Make more of the db connection options into parameters instead of CONF
values so that they behave better when testing multiple DB back-ends,
as with the baremetal driver.

Change-Id: Ib122b86ded4bce430773c36fdb5f85bb71100d3d
2012-12-20 09:40:01 -08:00
Mikyung Kang
35536a5ac7 Baremetal VIF and Volume sub-drivers.
This patch implements VIF and Volume subdrivers for baremetal driver.
It was separated from review 11354.

blueprint general-bare-metal-provisioning-framework.

Change-Id: Id187d04b6bd7b838159d46d61be72256414d0e72
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
2012-12-13 02:56:56 +09:00
Mikyung Kang
aaeb899f98 New Baremetal provisioning framework.
This is a minimal patch for the new baremetal driver.

With this driver, nova compute registers multiple entries of baremetal
nodes. It periodically updates the capabilities of the multiple
baremetal nodes and reports it as a list of capabilities.

It does not include Tilera or PXE back-ends, which will be provided
by subsequent patches. It also does not include VIF or volume components.

Part 4 of 7: blueprint general-bare-metal-provisioning-framework.

Change-Id: I55617a8da52d20d4df727b8bbde8e5f72d3bf130
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
Co-authored-by: Chris Krelle <NobodyCam@gmail.com>
Co-authored-by: Devananda van der Veen <devananda.vdv@gmail.com>
2012-12-13 02:56:56 +09:00
Monty Taylor
63f55af401 Move baremetal database tests to fixtures.
The baremetal database tests didn't get migrated to fixtures when we migrated
base nova. Funny story: maybe we should re-use code rather than copying!

So I did that. It's reusable now.

Change-Id: I730aad4a6aedb3993e032a14c9b8d2cd58913b4f
2012-12-19 13:04:21 -08:00
Devananda van der Veen
63fff7e661 Add exceptions to baremetal/db/api
Raise exceptions from baremetal/db/sqlalchemy/api.py
  following the precedents from nova/db/sqlalchemy/api.py.
Fixes tests to expect the new exceptions.
Adds __init__ so that baremetal tests work in isolation.

blueprint general-bare-metal-provisioning-framework

Change-Id: Ic8ef66e8f3180460a7bf117fccbfe15078905d8b
2012-11-20 16:06:51 -08:00
Russell Bryant
a3dbc4c866 Add blank nova/virt/baremetal/__init__.py
Without this file in place I was seeing some test failures from the
baremetal unit tests.  The failure was:

    ImportError: No module named baremetal.db

Change-Id: I7596e7916796d5cb382d3856918b35c01814a455
2012-11-26 18:13:29 -05:00
Mark McLoughlin
0ad0d54a2b Move sql options to nova.db.sqlalchemy.session
With a few minor exceptions, the sql config options are used solely
within the nova.db.sqlalchemy.session module so it makes sense to move
their declaration into that module.

Change-Id: Iea9c2bb000cd713b01750ab3e796132ebeaa4ca8
2012-11-21 12:15:20 +00:00
Mark McLoughlin
afabe86de5 Use CONF.import_opt() for nova.config opts
The only reason for importing nova.config now is where one of the
options defined in that file is needed. Rather than importing
nova.config using an import statement, use CONF.import_opt() so
that it is clear which option we actually require.

In future, we will move many options out of nova.config so many
of these import_opt() calls will either go away or cause a module
other than nova.config to be imported.

Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
2012-11-17 22:50:21 +00:00
Mark McLoughlin
8414a7c79f Remove nova.config.CONF
Modules import nova.config for two reasons right now - firstly, to
reference nova.config.CONF and, secondly, if they use one of the
options defined in nova.config.

Often modules import nova.openstack.common.cfg and nova.config
which is a bit pointless since they could just use cfg.CONF if
they just want to nova.config in order to reference CONF.

Let's just use cfg.CONF everywhere and we can explicitly state
where we actually require options defined in nova.config.

Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
2012-11-17 22:50:17 +00:00
Devananda van der Veen
3deb8f1e13 remove old baremetal driver
Remove files from the old baremetal driver
to prepare the way for the new driver to be
added in the next patch.

Change-Id: I51f998444c805838d3cf20db59407f90f278399f
2012-11-16 10:00:48 -08:00
Mark McLoughlin
e22e6b38bd Remove nova.flags
Now that options have all moved from nova.flags to nova.config, we can
safely remove the nova.flags imports and replace them with nova.config
imports.

Change-Id: Ic077a72dd6419bbf1e1babe71acfa43c4e8b55c8
2012-11-15 19:41:58 -05:00
Chris Behrens
dafbf987cf Fix a couple uses of FLAGS
The services API extension was still using FLAGS.  And baremetal virt
driver define FLAGS but never used it.

Change-Id: I95c78d04f9103f13c09cbdbc23d6d4ed0d39dde8
2012-11-15 23:10:22 +00:00
Mikyung Kang
e0f10ea3be Added separate bare-metal MySQL DB.
Part 2 of 6: blueprint general-bare-metal-provisioning-framework

In baremetal provisioning, one nova-compute manages multiple bare-metal
machines. A bare-metal machine does not run openstack at all.
Previously, bare-metal provisioning used text files to store information
of bare-metal machines. In this patch, a MySQL database is used to store
the information. We target only MySQL database. The DB is designed to
support PXE/non-PXE booting methods, heterogeneous hypervisor types, and
architectures. Using a MySQL database makes maintenance and upgrades
easier than using text files. The DB for bare-metal machines is
implemented as a separate DB from the main Nova DB. The DB can be on any
machines/places. The location of the DB and its server needs to be
specified as a flag in the nova.conf file (as in the case of glance).
There are a couple of reasons for this approach. First, the information
needed for bare-metal machines is different from that for non-bare-metal
machines. With a separate database for bare-metal machines, the database
can be customized without affecting the main Nova DB. Second, fault
tolerance can be embedded in nova-compute. Since one nova-compute
manages multiple bare-metal machines, fault tolerance of a nova-compute
node is very important. With a separate DB for bare-metal machines,
fault-tolerance can be achieved independently from the main Nova DB.
Replication of the bare-metal DB and implementation of fault-tolerance
are not part of this patch. The implementation models nova and its DB as
much as possible. The bare-metal driver must be upgraded to use this DB.

Change-Id: I7b7ba1903a672a50c567f95fc6554d119463b0c5
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
2012-11-07 19:10:56 +09:00
Mark McLoughlin
0416bd96a7 Switch from FLAGS to CONF in tests
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ic0168188dfe214fc81af04c8a9644d2d9f31600d
2012-11-04 21:32:53 +00:00
Mikyung Kang
c14b4282ea Updated scheduler and compute for multiple capabilities.
Part 1 of 6: blueprint general-bare-metal-provisioning-framework.

This patch includes updates on scheduler and compute codes for
multiple capabilities. This feature is needed in bare-metal
provisioning which is implemented in later patches --- a bare-metal
nova-compute manages multiple bare-metal nodes where instances are
provisioned. Nova DB's compute_nodes entry needs to be created for
each bare-metal node, and a scheduler can choose an appropriate
bare-metal node to provision an instance.

With this patch, one service entry with multiple compute_node entries
can be registered by nova-compute. Distinct 'node name' is given for
each node and is stored at compute_node['hypervisor_hostname'].
And we added a new column "node" to "instances" table in Nova DB to
associate instances with compute_node. FilterScheduler puts <nodename>
to the column when it provisions the instance. And nova-computes
respect <nodename> when run/stop instances and when calculate
resources.

Also, 'capability’ is extended from a dictionary to a list of
dictionaries to describe the multiple capabilities of the multiple
nodes.

Change-Id: I527febe4dbd887b2e6596ce7226c1ae3386e2ae6
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
2012-11-10 10:20:45 +09:00
Mark McLoughlin
e98697fba0 Switch from FLAGS to CONF in nova.virt
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Icb61d67965628dca65bda393d4373beab5c5c64a
2012-11-04 21:32:52 +00:00
Arata Notsu
a926c2ce2b Make ComputeDrivers send hypervisor_hostname
hypervisor_hostname is set in get_available_resource() and
in get_host_stats(). Except for vmwareapi driver.

Change-Id: I66348ae1e986162b8139b04ab03c42c424338175
2012-11-06 23:12:20 +09:00
Dan Smith
09c0ce4f05 Introduce VirtAPI to nova/virt
This patch introduces a VirtAPI class which will house
callbacks provided by the manager to the virt drivers, allowing
things such as direct database accesses to be pulled out of
the virt drivers and delegated to another service.

As a first step, this introduces an instance_update() method
and makes all the virt drivers use it instead of direct calls
to db.instance_update.*().

Change-Id: I2e40831f5cfb20a03b304097d84d592aab035ef1
2012-10-31 11:51:05 -07:00
Michael Still
39016b9672 Migrate to fileutils and lockutils.
Migrate nova to using openstack-common's file and lock utilities.
Resolves bug 1063230.

Change-Id: I1a4c87856bc08cd33b61d7098ed856baa4583654
2012-10-23 14:25:25 -07:00
Arata Notsu
d466c3ba4d Remove ComputeDriver.update_host_status()
Nobody calls the method.

Change-Id: Ib585f769788753c64e19fe49a1f186880e1c6f49
2012-10-18 22:40:01 +09:00
Michael Still
e4770a1792 Rename imagebackend arguments.
Rename function arguments to something which more clearly indicates
their purpose. No functional changes.

Change-Id: Iedbc5477ac54527b60c520fd7c774e608adb07c0
2012-09-03 20:49:45 +10:00
Michael Still
1d65383e08 Move ensure_tree to utils
Its useful to people other that virt drivers.

Change-Id: I721094a1785d7a275f4bfa8994b7b114a6ec07f6
2012-08-26 21:26:50 +10:00
Brian Elliott
2a052a30ab Keep the ComputeNode model updated with usage
Keep the compute host's ComputeNode model in sync with the
level of resource usage.  This enables the ComputeNode
model to be used as a basis for scheduling decisions
rather than forcing scheduler to calculate free
resources from an instance_get_all on each request.

Resources like memory and disk are claimed as instances are built
or deleted.  There is also support for configurable compute node
stats (a generic key/value store) for extensible advertising of other
usage stats that may be useful for a particular scheduler
implementation.  Additionally, there is a periodic task on the
compute host that audits actual resource consumption at the virt
layer to ensure that the database stays in sync.

This change partially implements blueprint: scheduler-resource-race

This patch complements:
https://review.openstack.org/#/c/9540/  (build re-scheduling support)

Change-Id: Ibbe3839a054f8b80664b413d47f766ca8d68e3f2
2012-06-21 04:25:24 +00:00
Johannes Erdfelt
cb6bf2cf18 Don't stuff non-db data into instance dict
The RPC API passes admin_pass and injected_files as arguments, but when
calling the driver API, those values get stuffed into the instance dict
which is otherwise all data that is stored in the database. This has
led to some bugs (such as 1034948) which could have been avoided if
the code was consistent.

Change-Id: I09a7de8eca3791a5ab27e93b22e5ccccee31cf09
2012-08-12 04:15:41 +00:00
David McNally
743ef64258 Making security group refresh more specific
Fixes bug 1029495

The trigger_members_refresh method in compute.api.py specifies
a group id in the call to refresh_security_group_members. This
is just the last group id seen and ignores the fact that a
refresh may impact members of multiple groups.

This is masked by the fact that on the host the group id is
ignored and all instances have their security rules refreshed
regardless of if they are part of the changed group or not.

This change modifies the logic surrounding refreshes so we send
a refresh request for each instance which is affected by a
security group change, this ensures we aren't spending time
refreshing unaffected instances and also removes the possibility
of refreshing an instance multiple times if it is a member of
more than one group.

Also changed to be instance-centric is the refresh carried out
when a rule is added/removed to a security group.

Change-Id: Iec98e9aed818fdc4ecc88c8dcdd4ee5fa9386e00
2012-08-01 15:51:29 +01:00
Russell Bryant
94d8f1c3cc Use dict style access for image_ref.
When reading image_ref from an instance, use dict style syntax.  This is
to be compatible with no-db-messaging changes.

Part of blueprint no-db-messaging.

Change-Id: I19753da6301c5d78b8fb13b30fbc6996ba828096
2012-08-03 22:07:22 -04:00
Dan Prince
a730ec52e3 Remove unused InstanceInfo class.
We no longer use InstanceInfo.

Also removes some unused _map_to_instance_info functions in
various virt drivers.

Change-Id: I02ead10e43426b9ad051970e9e78e970de5b1ac1
2012-08-06 12:09:23 -04:00
Dan Prince
4af0c9aa7c Remove list_instances_detail from compute drivers.
Removes the list_instances_detail function from various compute drivers
which implement it. We no longer make use of this compute driver
call when syncing power states.

Change-Id: I4980bd8d4ec14c61e16d5be105659f0d5b6748ba
2012-08-06 11:44:11 -04:00
Pádraig Brady
8559919e15 maint: remove an unused import in libvirt.driver
This import was recently reintroduced, due to
confusing pylint output. Therefore remove it again
and adjust things so pylint won't warn in future.

Change-Id: I25f293f171c651c25d27e8d55c9240fd808590ba
2012-08-04 06:01:32 +01:00
Mikyung Kang
815ed0ce6d Fixes bare-metal spawn error.
Implements blueprint Bare-metal provisioning. Fixes bug 1025942.

Change-Id: I55d16747d117de728b02ac938083ef8a79eaaca7
2012-07-17 20:22:25 -04:00
John Garbutt
bf171ac8c7 Refactoring required for blueprint xenapi-live-migration
This refactoring of the libvirt live migration code is
required to enable live migration in the xenapi driver.

This change ensures libvirt specific checks are performed
only when the libvirt driver is enabled.

The complication is that some of these checks require
information to be passed between the source and destination
hosts. For example, when comparing CPU flags.

Change-Id: I7389f0b7f03313d7f04b907f481787dadf0716fd
2012-01-31 14:49:04 +00:00
Sean Dague
d72bf92224 refactor baremetal/proxy => baremetal/driver
Part of bp:virt-driver-cleanup

Make the baremetal driver consistent in naming as a driver
instead of a proxy / connection.

Change-Id: I75d7d90bd8139842b588f1fafb1267511f29a1fb
2012-07-06 10:30:04 -04:00
Andrew Bogott
38b594fedc Switch to common logging.
I only just moved logging from nova to common, so behavior should remain the same.

Change-Id: I1d7304ca200f9d024bb7244d25be2f9a670318fb
2012-06-28 15:59:23 -05:00
Vishvananda Ishaya
86c77ef73b Make libvirt LoopingCalls actually wait()
* Adds wait() to all the LoopingCall timers
 * Fixes loopingCalls in baremetal/proxy.py as well
 * Includes failing test to verify result from destroy
 * Fixes tests depending on improper behavior
 * Fixes bug 1015355

Change-Id: I9e1914c446170e49f0aab76c7745b55d12132425
2012-06-20 00:44:25 +00:00
Zhongyue Luo
d3a8e89f37 Imports cleanup
Fixes bug #1013770

1. Reorder imports by full module path
2. Insert two blank lines after the last import

Change-Id: I294ac3ab528f17a72811392d1732158e9487f3bf
2012-06-16 00:58:36 +08:00
Zhongyue Luo
fc358d95bf Unused imports cleanup (folsom-2)
Fixes bug #1008023

Change-Id: Ifb8ecbb7430fdabd7b5d81ab23df66942abd9cb7
2012-06-03 13:23:11 +08:00
Sean Dague
0ed1297863 convert virt drivers to fully dynamic loading
Progress on bp:virt-driver-cleanup

This series of patches converts the virt drivers to loading via
importutils making it possible to add a virt driver without changing
core code. It deprecates the use of connection_type in favor of a
full driver name in compute_driver.

Based on email thread with Vish and Jay Pipes on approaches to do
this.

Change-Id: I48366ec7efc7b095859988e5e6ac5a853b98b8a7
2012-05-22 15:13:20 -04:00
Yun Mao
032636dd59 cleanup power state (partially implements bp task-management)
Removed duplicate and invalid state in power_state:
FAILED, SHUTOFF, BLOCKED
This is the first step in cleaning up nova state machine
and do better task management (bp/task-management)

http://wiki.openstack.org/VMState

Change-Id: I586b9058fada5efd468870fb187590fc0e37aa8f
2012-05-24 21:51:57 -04:00
Armando Migliaccio
8cb93721b8 clean-up of the bare-metal framework.
address minor problems and errors found in the driver, such as old
docstrings, unused imports, and variables, references of non-existent
classes, and methods; plus remove the requirement that every sub-driver
needs to be implemented as singleton, as the tilera one.

Change-Id: I5943bcdd785c1b4b83e95f88bd7d69c1edc5f62f
2012-05-25 02:16:51 +01:00
Brian Elliott
95173b4f45 Added a instance state update notification
Added a instance update notification (compute.instance.update) that
will report on changes to vm_state and task_state. The goal here is
to provide useful insight into instance state transitions.  (e.g.
BUILDING->ACTIVE)

The new notification has minimial dependencies and is intended for
wide use across the different layers/packages within nova.  Calls
in compute api/manager, scheduler, and the virt layer that modify
the instance state have been instrumented with this notification.

Change-Id: I223eb7eccc8aa079b782f6bb17727cd0b71d18ed
2012-05-13 21:06:29 +00:00
Brian Waldon
62ab8e18bf Update pep8 dependency to v1.1
The latest release of pep8 adds stricter rules for extraneous
whitespace within lines. This patch also addresses these new
violations acoss the codebase.

Change-Id: Ib7e50281870473df1704ed50868c5c2e26bdb02e
2012-05-24 06:56:15 -07:00
Joe Gordon
6c5a501a18 Alphabetize imports in nova/tests/
Change-Id: Ib8e747f91f5277aecc3be01a5e8cee5bc911e823
2012-05-14 14:42:29 -07:00