Markus Zoeller [Tue, 6 Dec 2016 10:40:25 +0000 (11:40 +0100)]
libvirt: virtlogd: use virtlogd for char devices
This change makes actual usage of the "logd" sub-element for char devices.
The two REST APIs ``os-getConsoleOutput`` and ``os-getSerialConsole`` can
now be satisfied at the same time. This is valid for any combination of:
* char device element: "console", "serial"
* char device type: "tcp", "pty"
There is also no need to create multiple different device types anymore.
If we have a tcp device, we don't need the pty device anymore. The logging
will be done in the tcp device.
Markus Zoeller [Mon, 7 Nov 2016 09:01:45 +0000 (10:01 +0100)]
libvirt: create consoles in an understandable/extensible way
This change refactors the way the consoles of a libvirt guest get
created. This is basically just a reshuffle of code and an extraction
of methods with the goal to make the plethora of conditionals easier
to understand. Also, future enhancements should be easier this way.
For example, the blueprint libvirt-virtlogd (targeted for Ocata) will
have to be integrated in this console creation flow.
During the implementation I noticed that the host caps are *not*
needed for creation. That was an unnecessary special case for s390x
which didn't make any sense as the guest arch is the important piece.
That's the reason I dropped the "caps" parameter of the method
"_create_consoles". That also made it necessary to adjust the unit
tests.
I also took the chance to rename the "guest" parameter, which represents
the domain *configuration object*, to "guest_cfg". This is (almost) used
in every other place in the libvirt driver.
Dan Smith [Tue, 1 Nov 2016 15:54:59 +0000 (08:54 -0700)]
Require cellsv2 setup before migrating to Ocata
We have code going into Ocata that needs to be sure that cell and
host mappings are in place. Since this was required homework in
Newton, we can land a migration to intentionally fail if this was
not completed.
This is, however, a little difficult to require because a first-time
deployment will be initialized schema-wise with none of these records,
which is also sane. So, we look to see if any flavors are defined as
a sentinel to indicate that this is an upgrade of an existing
deployment instead of a first-time event. Not perfect, but since this
is really just a helper for the user, it seems like a reasonable
risk.
Matt Riedemann [Fri, 2 Dec 2016 20:28:01 +0000 (15:28 -0500)]
Fix placement API version history 1.1 title
This needs to use dashes otherwise it doesn't render
properly in the docs. Also adds an informative title
for the 1.1 microversion since that seems to be a pattern
we're going with now in 1.2.
Roman Dobosz [Fri, 2 Dec 2016 09:22:27 +0000 (10:22 +0100)]
placement: Perform build list of standard classes once
To prevent rebuilding list of standard resource classes every time
destroy() method is called on ResourceClass object, move it to class
attribute. Also, removed get_standards call in destroy method of
ResourceClass, and simply access list through the cache object.
Jay Pipes [Mon, 31 Oct 2016 19:33:40 +0000 (15:33 -0400)]
placement: REST API for resource classes
This patch adds support for a REST API for CRUD operations on custom
resource classes:
GET /resource_classes: return all resource classes
POST /resource_classes: create a new custom resource class
PUT /resource_classes/{name}: update name of custom resource class
DELETE /resource_classes/{name}: deletes a custom resource class
GET /resource_classes/{name}: get a single resource class
Balazs Gibizer [Mon, 5 Dec 2016 15:10:08 +0000 (16:10 +0100)]
support polling free notification testing
There are multiple instance action notifications where the only
way to test notification sample is to wait for the notfication
to arrive as there is no indication on the REST API that the
certain action has been finished.
Until now the only way to implement such test was to poll the
fake_notifier.VERSIONED_NOTIFICATIONS list to see if the notification
is arrived.
This patch adds a polling free solution based on threading.Event
- Remove newlines between options
- Place option name on the same line as the declaration
- Use 'Related options', not 'Interdepencies to other options'
- Slightly reword some options to provide a clear summary-description
help text
Jay Pipes [Mon, 21 Nov 2016 20:21:25 +0000 (15:21 -0500)]
placement: adds ResourceClass.save()
Implement the ability to update the name of a custom resource class. We
raise similar exceptions to ResourceClass.destroy() if the user attempts
to modify the name of a standard resource class.
Some hyperv unit tests was creating a "fake" directory under the nova
root directory. This cause this directory to show up on "git status"
as untracked.
zhaolihui [Tue, 1 Nov 2016 08:09:04 +0000 (16:09 +0800)]
Fix pci_alias that include white spaces
When the PCI alias was getting translated to a PCI request,
all the white spaces were getting removed. So the pci_passthrough:alias
specified in the flavor never matched the device in pci_alias.
This patch fixes the bug by only stripping the white spaces
at the beginning or the end of the elements
melanie witt [Thu, 1 Dec 2016 22:04:48 +0000 (22:04 +0000)]
Always use python2.7 for docs target
The docs testenv doesn't work with python 3.x on our codebase.
If someone is on a platform that defaults to python => python3,
building docs will fail for them.
Matthew Booth [Fri, 17 Jun 2016 12:05:24 +0000 (13:05 +0100)]
libvirt: Don't re-resize disks in finish_migration()
finish_migration is called by finish_resize() in compute manager,
which has updated the instance size and flavor before calling us. This
means that _create_image has already resized disks and (where
possible) their contained filesystems by calling cache() with the
correct size. That makes the additional resize in finish_migration a
no-op.
Matthew Booth [Fri, 17 Jun 2016 09:29:49 +0000 (10:29 +0100)]
libvirt: Never copy a swap disk during cold migration
We previously didn't copy a swap disk if we were resizing it, and
instead recreated it on the remote end. With this change we never
copy a swap disk, even if we aren't resizing it. This is more
efficient and less surprising.
Matthew Booth [Wed, 22 Jun 2016 13:41:09 +0000 (14:41 +0100)]
libvirt: Rename Backend snapshot and image
snapshot and image didn't accurately describe what the methods did.
snapshot in particular suggested that the returned object was in some
way specific to a snapshot, whereas snapshot was simply the only user.
We also take the opportunity to rename all variables we touch in
driver to refer to disks rather than images.
Matthew Booth [Thu, 7 Jul 2016 14:29:45 +0000 (15:29 +0100)]
libvirt: Cleanup test_create_configdrive
This test made a tortured trip into _create_image_helper without using
much of its functionality. We pull this out and have it call
_create_configdrive directly.
This leaves _create_image_helper with only a single caller:
test_create_image_with_flavor_swap. This test is almost identical in
purpose to the much better test_create_image_with_swap and
test_create_image_with_legacy_swap_resizing. We refactor
test_create_image_with_swap to use ddt to cover all 3 cases, and
remove _create_image_helper.
This introduces the first use of ddt in Nova tests. It is already in
global-requirements. It was approved for use in Nova tests during the
Ocata contributor meetup:
Matthew Booth [Wed, 6 Jul 2016 09:38:31 +0000 (10:38 +0100)]
libvirt: Test disk creation in test_hard_reboot
This test was asserting a call to _create_images_and_backing in a way
that didn't validate the data passed in any way. We update this to
instead validate that the expected disks are created.
This test highlights a bug in _create_images_and_backing, which is
passing a full path in place of a disk name. This will be fixed by
removing the call to _create_images_and_backing in a subsequent
commit.
This also allows us to validate the future removal of the call to
_create_images_and_backing.
Matthew Booth [Fri, 1 Jul 2016 16:09:39 +0000 (17:09 +0100)]
libvirt: Rewrite _test_finish_migration
Rewrite the finish_migration tests in anticipation of a major update.
Apart from switching from mox to mock, the principal change is that
we're now mocking at the backend boundary rather than the
_create_image boundary, which means we can test what we do to
individual disks. In the updated finish_migration we no longer use
_create_image, so making this change in advance allows us to see the
functional changes more clearly.
guestfs: Don't report exception if there's read access to kernel
Commit 92ae0f1 ("libvirt - Add log if libguestfs can't read host
kernel") reworks the logic of handling access to Kernel for libguestfs.
In doing that, it erroneously raises an exception when libguestfs is
_able_ to access the Kernel.
Fix it by reporting exception only when libguestfs does _not_ have
read access to the Kernel.
This was first tried by Kevin Zhao here
Ic6802650cb8f93e0d02c51e9014eb85a7e71f6fe, but is abandoned for some
reason.
This also adds a little more direction on what to do to fix this error.
Timofey Durakov [Thu, 1 Dec 2016 08:58:18 +0000 (11:58 +0300)]
Fix for live-migration job
Commit 9293ac0 to devstack-plugin-ceph altered
CEPH_LOOPBACK_DISK_SIZE_DEFAULT variable initialization
This fix added source for setting this variable in correct way.
Support detach interface with same MAC from instance
When detach_interface nova uses <interface> XML generated
from scatch, which is missing the PCI device information that
libvirt would use to uniquely identify devices.
In case instance has mutiple interfaces with same MAC address.
Libvirt will failed with below error message:
libvirtError: operation failed: multiple devices matching
mac address fa:16:3e:60:46:1f found
This patch fixes this problem by provide a new function
get_interface_by_cfg, this function uses cfg generated by
nova.virt.libvirt.vif.get_config as parameter,
return a LibvirtConfigGuestInterface object.
Also added function format_dom for
LibvirtConfigGuestDeviceAddressPCI, which will be used to
generate pci address for LibvirtConfigGuestInterface.
Jay Pipes [Mon, 31 Oct 2016 15:03:54 +0000 (11:03 -0400)]
placement: adds ResourceClass.destroy()
Adds ResourceClass.destroy() method to delete a custom resource class.
Deletions of standard resource classes or resource classes that are
referenced in an inventory record are forbidden.