Fixes bug #910295
The None, True, and False values are singletons.
All variable *comparisons* to singletons should use 'is' or 'is not'.
All variable *evaluations* to boolean should use 'if' or 'if not'.
"== None", "== True", "== False", and "!= None" comparisons in sqlalchemy's
where(), or_(), filter(), and_(), and select() functions should not be changed.
Incorrect comparisons or evaluations in comments were not changed.
Change-Id: I087f0883bf115b5fe714ccfda86a794b9b2a87f7
This adds a periodic task to cleanup erroneously running instances. The
impetus of the patch was a XenServer specific issue bug #911366, where deleted
instances would remain running on the host machine.
The patch however is hypervisor agnostic and is generally useful as a
housekeeping task to make sure these 'zombied' instances are detected.
Change-Id: Iddc6a88920a537a3a115f8b9bc0039ec0e24a194
Fixes bug #910763
According to PEP8,
- Object type comparisons should always use isinstance() instead
of comparing types directly.
Yes: if isinstance(obj, int):
No: if type(obj) is type(1):
When checking if an object is a string, keep in mind that it might be a
unicode string too! In Python 2.3, str and unicode have a common base
class, basestring, so you can do:
if isinstance(obj, basestring):
Change-Id: I7c0fdecf99872f5b8f72b2c2ed4f5c539c33def1
Windows has a complexity requirement of at least three of these
criteria:
- one or more upper case characters
- one or more lower case characters
- one or more numbers
- one or more special characters
In some cases, the passwords generated didn't meet three of these four
critera. This change enforces that three of these criteria will be
met in the generated passwords.
Change-Id: Ibe0055b8830b426aee1c9b722cc2fae2f5db4c5c
Rather than providing two mutually exlusive image
access methods (loop and qemu-nbd), try each in turn.
This is to prepare for a follow up patch which will
add libguestfs as a method to try.
* nova/virt/mount.py: A new Mount class to abstract the
devce allocation, partition mapping and file sys mounting,
for each access type.
* nova/virt/disk/loop.py: A specialization of the base Mount class
to provide loop back mounting support.
* nova/virt/disk/nbd.py: A specialization of the base Mount class
to provide qemu-nbd mounting support.
* nova/virt/disk/api.py: A new file containing the nova.virt.disk
module interface.
(img_handlers): A new list of access methods to try,
with the order being honored.
(_DiskImage): An internal helper class that uses the plugin classes
above, to provide the operations available on a disk image file.
When mounting, iterate over each access method until one succeeds.
If a hint is provided about a CoW format image, the list of
methods to try will be reduced accordingly.
Note expected errors are no longer raised as exceptions during mounting.
Instead, on failure to mount an image, errors are collated and raised.
Interveining errors are logged in debug mode for successful mounts.
* nova/virt/libvirt/connection.py: Adjust the function parameter
names to be more general, rather than referencing specific
implementations like 'nbd' and 'tune2fs'.
Simplify the destroy_container() by storing and passing
back a reference to the _DiskImage object, which has the
necessary state to unmount.
* nova/utils.py (trycmd): A helper function to both deal with,
commands that issue ignorable warnings to stderr,
and commands that EXIT_SUCCESS while issuing errors to stderr.
nova/virt/xenapi/vm_utils.py: Adjust for the moved virt.disk package
Change-Id: If3a4b1c8f4e2f2e7300a21071340dcc839cb36d7
This patch uses the same logic from glance to verify if a UUID is
properly formed. It just tries to build a uuid.UUID from the string.
A test case has been added which previously would have failed, but now
passes.
A second test case has been added that verifies that the result of the
gen_uuid() function is considered valid, as well.
Change-Id: I33fe37b23ef03eda0f0e9d69afb601ca260aabde
The XML templates have been converted into properties, thus we can
compare the mtime of the XML templates (libvirt and cpuinfo) each
time they are needed, checking if they have been modified and
reloading them. Added a function to read cached files.
Change-Id: I6cf0229c6435300e73f9d9a6b10b0bf9bf144a55
Change utils.execute to accept a list or a single integer in
check_exit_code.
In libvirt.disconnect_volume() return codes 0 and 255 are both valid
for logout/delete, where 255 is returned if the volume is already
disconnected.
Change-Id: Icffeb0fe8269a02d95ac6ed180ba0bb9f458a6ed
Currently, we log it when we attempt to acquire a log, but we don't
mention it when we succesfully do acquire it. This makes people think
it's stuck.
This patch logs the succesful acquiry of locks.
Change-Id: I3b49ff331641ceafa46c93d8f5233c85fe45e5e2
Updated hostname sanitization method to more closely follow RFC-952
and RFC-1123. Also moved it to nova.utils, where it seems to fit
better.
Fixes bug 885374
(Patch Set 1) Updated hostname sanitization with more efficient and
[opinion] more readable implementation.
Change-Id: I60d7ee89867c05950bec1fd53b072a1c6247ebea
Introduced various sanity checks before adding security group rule
into the database. The checks have been implemented both in EC2 and
openstack extension code.
Implemented the suggestions made in first patch by Brian
Fixed the unit tests in security groups
Fixed pep8 issues in security group unit tests
Fixes bug 869979.
Change-Id: I2ac28666e90e7bdeacb7b1c2676c0719cfb9e441
update: pep8, and fixing log output.
update2: more pep8, I'm looking at you vim
update3: more formating
update4: mailmap
update5: more pep8
Change-Id: I38617e14260e65ed5cb81b3554479d3720850aae
If a exception is caught while processing a previous exception, make sure
to log it so it doesn't silently get discarded
Change-Id: Ic887db9c2592229970737daf5dd9732b2258877b
With this modification both nova-manage and scheduler use the flag
service_down_time and check positive and negative values in a
correct way.
Fixes bug: 867674.
Change-Id: I15c48d80cafa2089cd228c09c61b0a1e513730e8
Adds in bandwidth, state and IP data on standard notifications,
and new notifications on add/remove IP.
These were missing before, and are needed to meet spec.
This fixes bug 849117
Change-Id: Ie586ff3a91a56e5f5eff8abc6905ba6a0b624451
By doing this, we allow the error messages to be more useful. When an import
of a class fails because of a missing module dependency, it would have fail
that way for example:
$ nova-manage
Traceback (most recent call last):
File "./bin/nova-manage", line 84, in <module>
from nova import image
File "/home/jd/Work/src/nova/nova/image/__init__.py", line 22, in <module>
from nova.image import glance
File "/home/jd/Work/src/nova/nova/image/glance.py", line 42, in <module>
GlanceClient = utils.import_class('glance.client.Client')
File "/home/jd/Work/src/nova/nova/utils.py", line 66, in import_class
raise exception.ClassNotFound(class_name=class_str)
nova.exception.ClassNotFound: Class Client could not be found
This does not help the user, since it indicates the class Client cannot be
found, even if it is actually found but fail to import.
With this commit, the error message is better:
nova-manage
Traceback (most recent call last):
File "./bin/nova-manage", line 84, in <module>
from nova import image
File "/home/jd/Work/src/nova/nova/image/__init__.py", line 22, in <module>
from nova.image import glance
File "/home/jd/Work/src/nova/nova/image/glance.py", line 42, in <module>
GlanceClient = utils.import_class('glance.client.Client')
File "/home/jd/Work/src/nova/nova/utils.py", line 66, in import_class
raise exception.ClassNotFound(class_name=class_str, exception=exc)
nova.exception.ClassNotFound: Class Client could not be found: No module named kombu.connection
This helps to know that in this kombu is missing.
It would probably even better to rename ClassNotFound to
ClassCannotBeImported or something like that too.
Change-Id: I4100d931a0a825fa0729d5467d2f9268fdd2a261
Signed-off-by: Julien Danjou <julien.danjou@enovance.com>