Matt Riedemann [Mon, 5 Dec 2016 21:24:05 +0000 (16:24 -0500)]
Handle MarkerNotFound from cell0 database
When listing instances in the cellv2 world we look them up
from three locations:
1. Build requests which exist before the instances are created
in the cell database (after the scheduler picks a host to
build the instance). Currently instances and build requests
are both created before casting to conductor, but that's going
away in Ocata with the support for multiple cellsv2 cells.
2. The cell0 database for instances which failed to get scheduled
to a compute host (and therefore a cell).
3. The actual cell database that the instance lives in. Currently
that's only a single traditional nova database, but could be one
of multiple cellsv2 cells when we add that support in Ocata.
If a marker is passed in when listing instances, if the instance
lives in an actual cell database, we'll get a MarkerNotFound failure
from cell0 because the instance doesn't exist in cell0, but we check
cell0 before we check the cell database. This makes the instance
listing short-circuit and fail with a 400 from the REST API.
This patch simply handles the MarkerNotFound when listing instances
from the cell0 database and ignores it so we can continue onto the
cell database.
- 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.
Matt Riedemann [Fri, 4 Nov 2016 14:39:57 +0000 (10:39 -0400)]
libvirt: prefer cinder rbd auth values over nova.conf
In the case that the ceph storage backing volumes is different
from the one backing ephemeral storage in nova, the auth values
in the rbd connection_info could be different and not work if
we are using the nova.conf values for ephemeral storage.
This change makes the volume connection config code for rbd
prefer the cinder connection_info values if they exist, and
only falls back to nova config values if cinder doesn't have
anything set.
The LibvirtNetVolumeDriver is handling both rbd and
sheepdog (iscsi) connections. The auth config logic
is mingling both backends which is really confusing.
For example, the iscsi protocol only defines auth_method,
auth_username and auth_password. It does not set an
auth_enabled value in the connection_info['data'] dict.
This change simplifies the logic involved for setting
the auth config by decoupling the rbd/iscsi handlers.
A follow-up change will build on this to fix the
rbd auth config to prefer the cinder volume connection_info
auth data over the local config for nova in the case
that different cinder backends are used for ephemeral
and block storage.
int32bit [Wed, 23 Nov 2016 10:21:16 +0000 (18:21 +0800)]
Fix wait for detach code to handle 'disk not found error'
Currently, the code does an initial detach from the persistent and
transient domains in one call, then follows up with a call of the
retryable function, which first checks the domain xml before retrying
the transient domain detach. If the transient domain detach (which is
asynchronous) completes after we checked the domain xml, trying to
detach it again will raise a LibvirtError exception. Then, our loop
code in `_do_wait_and_retry_detach` doesn't catch it and will respond
with error. We should be handling the `disk not found error` from
libvirt and consider the job complete.
If live_migration_inbound_addr is set in nova.conf, value of the option
will be saved under target_connect_addr in migrate_data. Unfortunately,
the type of value saved in target_connect_addr is unicode, therefore
when creating URI for live migration over dedicated interface we are
ending up with unicode type which is not acceptable by libvirt. To fix
the issue let's convert URI explictly back to string.
Dan Smith [Tue, 29 Nov 2016 15:05:17 +0000 (07:05 -0800)]
Never pass boolean deleted to instance_create()
This explicitly converts the deleted flag to an integer (which will
always be zero) at Instance.create() time. We already require it to
be False, but if set, we will pass the boolean instead of an integer,
which will confuse some (self-respecting) DBMs.