Commit Graph

53695 Commits

Author SHA1 Message Date
Kashyap Chamarthy e7b64eaad8 qemu: Make disk image conversion dramatically faster
tl;dr: Use 'writeback' instead of 'writethrough' as the cache mode of
the target image for `qemu-img convert`.  Two reasons: (a) if the image
conversion completes succesfully, then 'writeback' calls fsync() to
safely write data to the physical disk; and (b) 'writeback' makes the
image conversion a _lot_ faster.

Back-of-the-envelope "benchmark" (on an SSD)
--------------------------------------------

(Ran both the tests thrice each; version: qemu-img-2.11.0)

With 'writethrough':

    $> time (qemu-img convert -t writethrough -f qcow2 -O raw \
            Fedora-Cloud-Base-29.qcow2 Fedora-Cloud-Base-29.raw)
    real    1m43.470s
    user    0m8.310s
    sys     0m3.661s

With 'writeback':

    $> time (qemu-img convert -t writeback  -f qcow2 -O raw \
            Fedora-Cloud-Base-29.qcow2 5-Fedora-Cloud-Base-29.raw)

    real    0m7.390s
    user    0m5.179s
    sys     0m1.780s

I.e. ~103 seconds of elapsed wall-clock time for 'writethrough' vs. ~7
seconds for 'writeback' -- IOW, 'writeback' is nearly _15_ times faster!

Details
-------

Nova commit e6ce9557f8 ("qemu-img do not
use cache=none if no O_DIRECT support") was introduced to make instances
boot on filesystems that don't support 'O_DIRECT' (which bypasses the
host page cache and flushes data directly to the disk), such as 'tmpfs'.
In doing so it introduced the 'writethrough' cache for the target image
for `qemu-img convert`.

This patch proposes to change that to 'writeback'.

Let's addresses the 'safety' concern:

  "What about data integrity in the event of a host crash (especially
   on shared file systems such as NFS)?"

Answer: If the host crashes mid-way during image conversion, then
neither "data integrity" nor the cache mode in use matters.  But if the
image conversion completes _succesfully_, then 'writeback' will safely
write the data to the physical disk, just as 'writethough' does.

So we are as safe as we can, but with the extra benefit of image
conversion being _much_ faster.

        * * *

The `qemu-img convert` command defaults to 'cache=writeback' for the
source image.  And 'cache=unsafe' for the target, because if `qemu-img`
"crashes during the conversion, the user will throw away the broken
output file anyway and start over"[1].  And `qemu-img convert`
supports[2] fsync() for the target image since QEMU 1.1 (2012).

[1] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=1bd8e175
    -- "qemu-img convert: Use cache=unsafe for output image"
[2] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=80ccf93b
    -- "qemu-img: let 'qemu-img convert' flush data"

Closes-Bug: #1818847

Change-Id: I574be2b629aaff23556e25f8db0d740105be6f07
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Looks-good-to-me'd-by: Kevin Wolf <kwolf@redhat.com>
2019-03-18 14:53:39 -05:00
Zuul e608568518 Merge "Remove fake_libvirt_utils from the cache concurrency tests." 2019-03-12 00:12:32 +00:00
Zuul 9942649546 Merge "Handle templated cell mappings in nova-status" 2019-03-11 23:33:19 +00:00
Zuul a2d7ffba32 Merge "fix race in test_interface_detach_with_port_with_bandwidth_request" 2019-03-11 16:58:35 +00:00
Balazs Gibizer d52c8fea06 fix race in test_interface_detach_with_port_with_bandwidth_request
During port detach the unbind towards neutron happens before the
port allocation is removed from placement. The functional test only
waited for the port unbind before asserted the remaining allocations and
therefore it was racy.

Fortunately the instance.interface_detach.end is emitted after the both
the unbind and the allocation shrink. So the test is changed to wait for
this notification instead.

Change-Id: I53d76d6353ae634e387672e14943f518955b221e
Closes-Bug: #1819374
2019-03-11 15:38:29 +01:00
Takashi NATSUME 892ead1438 doc: Fix a typo
Replace 'listeing' with 'listening'.

TrivialFix
Change-Id: I0fe3b75c5005e3ca83b3e6bcc2998327595635ab
2019-03-11 17:45:25 +09:00
Michael Still 28f2baca02 Remove fake_libvirt_utils from the cache concurrency tests.
These tests weren't even calling libvirt.utils methods.

Change-Id: I2377e45dba8fdfaa2ef52be6738aafcba3fde705
2019-03-11 06:54:37 +00:00
Zuul f853e04cd2 Merge "Add online data migration for populating user_id" 2019-03-11 02:33:11 +00:00
Zuul b577b73555 Merge "Populate InstanceMapping.user_id during migrations and schedules" 2019-03-11 02:33:05 +00:00
Zuul 51e3787bf8 Merge "Add get_instance_pci_request_from_vif" 2019-03-10 21:28:55 +00:00
Zuul d3d6229b52 Merge "Allow per-port modification of vnic_type and profile" 2019-03-10 15:06:30 +00:00
Zuul 0c77580ba3 Merge "Add user_id field to InstanceMapping" 2019-03-09 18:48:26 +00:00
Zuul 151deebde8 Merge "Do not run tempest.scenario.test_network* tests in nova-next" 2019-03-09 14:18:16 +00:00
melanie witt a6bc544aae Add online data migration for populating user_id
This adds an online data migration for the user_id field on
InstanceMapping. It does this by processing instance mappings that do
not have a value set for the field (i.e. are NULL in the database) and
queries instances in each cell that need to be updated.

Part of blueprint count-quota-usage-from-placement

Change-Id: I8cc873ba63db7b806ab1de0a88fe8a87d4baeea9
2019-03-08 19:01:41 -05:00
melanie witt a7de4917a0 Populate InstanceMapping.user_id during migrations and schedules
The InstanceMapping user_id field is a new, non-nullable field
representing the user_id for the instance.

When new instance create requests come in, we create the instance
mapping. We will set user_id here before creating the record.

Some virtual interface online data migration and map_instances routine
create InstanceMapping records and since the user_id field did not
previously exist, they were not setting it. We will populate user_id in
these cases.

Finally, whenever an API does a compute_api.get(), we can
opportunistically set and save user_id on the instance mapping if it is
not set.

Part of blueprint count-quota-usage-from-placement

Change-Id: Ic4bb7b49b90a3d6d7ce6c6c62d87836f96309f06
2019-03-08 19:01:25 -05:00
melanie witt 7475e85017 Add user_id field to InstanceMapping
This adds the new user_id column from the instance_mappings table as
a field in the InstanceMapping object. There is already a project_id
field containing the project_id for the instance. The user_id field
will contain the corresponding user_id for the instance.

Part of blueprint count-quota-usage-from-placement

Change-Id: I0f523b2a2e09e1ece9e1911325e55cffd183a9d5
2019-03-08 19:01:16 -05:00
Sean Mooney 30550d3d94 update gate test for removal of force evacuate
micro-version 2.68 removed force evacuation, this chage
updates gate/test_evacuate.sh to use micro-version 2.67

Closes-Bug: #1819166

Change-Id: I44a3514b4b0ba1648aa96f92e896729c823b151c
2019-03-08 16:31:31 +00:00
Zuul 4f9bc72401 Merge "doc: mark the max microversion for stein" 2019-03-08 03:06:13 +00:00
Zuul f12bdc9008 Merge "Add user_id column to the instance_mappings table" 2019-03-08 03:06:07 +00:00
Zuul c756e868b6 Merge "Remove cells v1 (for the most part) from the docs" 2019-03-08 01:29:10 +00:00
Takashi NATSUME 5074bbfef7 doc: mark the max microversion for stein
Just follows the pattern that we do every release.

Change-Id: I7a135c3373cb4a831a0f611d529cd586b50d59e5
2019-03-08 09:25:29 +09:00
melanie witt 9073445b38 Add user_id column to the instance_mappings table
The instance_mappings table already contains the project_id for an
instance. This adds the corresponding user_id. This also adds an index
on (user_id, project_id) because later patches in this series will be
using these columns for quota counting.

Part of blueprint count-quota-usage-from-placement

Change-Id: Id9eef7a58f66c73cd638c6c3e228447b7ab81e34
2019-03-07 16:33:58 -05:00
Zuul 131f7606c1 Merge "Separate methods to free claimed and allocated devs" 2019-03-07 20:41:03 +00:00
Zuul eaaade924d Merge "Make nova-grenade-live-migration voting and gating" 2019-03-07 19:10:56 +00:00
Zuul fb4308e33a Merge "Move legacy-grenade-dsvm-neutron-multinode-live-migration in-tree" 2019-03-07 18:58:39 +00:00
Zuul d50d8b6357 Merge "tests: Create PCI tests for NUMA'y tests" 2019-03-07 18:34:04 +00:00
Zuul 352e535eae Merge "Update --max-rows parameter description for archive_deleted_rows" 2019-03-07 18:33:53 +00:00
Zuul f8612db10a Merge "FUP for test_reshape" 2019-03-07 18:33:37 +00:00
Zuul caa37cf099 Merge "Test proper allocation of devices during reshape" 2019-03-07 10:35:34 +00:00
Adrian Chiris 30295f1a14 Add get_instance_pci_request_from_vif
This change extends nova/pci/request.py with a method
that retrieves an instance's PCI request from a given VIF
if the given VIF required a PCI allocation during instance
creation.

The PCI request, if retrieved, belongs to a PCI device
in the compute node where the instance is running.

The change is required to facilitate SR-IOV live migration
allowing to claim VIF related PCI resources on
the destination node.

Change-Id: I9ba475e91b8283f063db446de74d3e4b2de002c5
Partial-Implements: blueprint libvirt-neutron-sriov-livemigration
2019-03-07 11:37:53 +02:00
Sean Mooney a7fae371a7 Allow per-port modification of vnic_type and profile
Today neutronv2's bind_ports_to_host() method is being used
by the conductor during live-migration to bind neutron ports
to the destination host when neutron port binding API extention
is supported[1].

Until now, modifying the vnic_type and profile was not required
as the only vnic_type which was officially supported for live-migration
is the 'normal' vnic_type. Port profile updates were not required.

Support for live-migration with SR-IOV ports requires updates to
the port's profile with host specific information e.g the
claimed PCI device address on the destination node.

- This change modifies bind_ports_to_host to accept a per port
  dictionary for both vnic_type and port profile.
  Allowing the user to override each attribute on a per-port
  basis.

- This change updates bind_ports_to_host to generate
  a separate payload per vif instead of assuming all
  vifs attached to an interface share the same
  vnic_type and profile data.

- The change aims to extend the existing logic of
  bind_ports_to_host to allow the flexibility for the
  user to augment port attributes on a per-port basis.
  The change does not protect the user from wrongfully
  calling this method.

[1] https://blueprints.launchpad.net/nova/+spec/neutron-new-port-binding-api

Change-Id: I958685ee20676d45e5fbdf020b82d5844dcc85fe
Partial-Implements: blueprint libvirt-neutron-sriov-livemigration
Co-Authored-By: Adrian Chiris <adrianc@mellanox.com>
2019-03-07 10:24:58 +02:00
Adrian Chiris 2a3179affb Separate methods to free claimed and allocated devs
The existing PCI manager exposes a single method to free PCI resources
free_instance(), which frees both claimed and allocated PCI resources
for an instance.

This change proposes to extend the PCI manager API with two methods:
  1. free_instance_claims() : free PCI resources claims for instance.
  2. free_instance_allocations() : free PCI resources allocations for
     instance.

This change refactors free_instance() to use (1) and (2) from above.

This change is required to enable SR-IOV live migration as it is
required to free instance PCI allocations on the source node
in case of a successful migration and free instance PCI claims
on the destination node in case of an unsuccessful migration.

Change-Id: Id961f0fc219f32a2cf0282859f228e87cb36ffeb
Partial-Implements: blueprint libvirt-neutron-sriov-livemigration
2019-03-07 10:21:41 +02:00
Zuul 221026eafe Merge "fakelibvirt: Add ability to generate fake PCI devices" 2019-03-07 06:40:50 +00:00
Zuul ed06ae8254 Merge "Cleanup the exec_ebtables code a little." 2019-03-07 05:52:56 +00:00
Zuul 5391d95c92 Merge "Move killing processes to privsep." 2019-03-07 05:52:48 +00:00
Zuul acfeefb5c4 Merge "Move cleaning conntrack to privsep." 2019-03-07 05:52:39 +00:00
Zuul 7a9b0b4efe Merge "Move arping to privsep." 2019-03-07 05:52:33 +00:00
Zuul 4ae7fb4ec7 Merge "doc: cleanup pci.alias references" 2019-03-07 00:52:18 +00:00
Zuul d3254af0fe Merge "Extend volume for libvirt network volumes (RBD)" 2019-03-07 00:52:10 +00:00
Eric Fried e3376eaa42 FUP for test_reshape
Fix a couple of minor issues found while working the reshaper series:

- Move mdev name/uuid conversions to helpers [0], [1]
- Typo: PR=>RP [2]
- Typo: temporally=>temporarily [3]

[0] https://review.openstack.org/#/c/599208/18/nova/virt/libvirt/driver.py@6835
[1] https://review.openstack.org/#/c/639854/4/nova/tests/functional/libvirt/test_reshape.py@117
[2] https://review.openstack.org/#/c/639854/4/nova/tests/functional/libvirt/test_reshape.py@189
[3] https://review.openstack.org/#/c/639854/4/nova/tests/functional/libvirt/test_reshape.py@98

Change-Id: I8d9b2b2f49a72e656a7ab263025f59000813f5b4
2019-03-06 15:12:54 -06:00
Eric Fried a5d174c29f Test proper allocation of devices during reshape
Ensure that the correct pGPU devices appear in placement allocations
after a reshape.

Change-Id: Ibe5aca8edc3a4d21b7b7217ff4f96ae7719bd0d2
2019-03-06 14:42:30 -06:00
Zuul eaa29f71ef Merge "Test live migration with config drive" 2019-03-06 20:06:16 +00:00
Michael Still 2ed9fd8e86 Cleanup the exec_ebtables code a little.
No functional changes, but clean things up as a pre-cursor step
to converting to privsep.

Change-Id: I7ac98038b74d0261f52176aa7962f92755f735f5
2019-03-06 11:51:04 -08:00
Michael Still 0250d66219 Move killing processes to privsep.
The usual pattern, except we need to lookup signals a bit
differently.

Change-Id: I956d761b1dc0bdafd4cd29540b7d16ed0bd0f45f
2019-03-06 11:51:03 -08:00
Michael Still f3388d3e26 Move cleaning conntrack to privsep.
Change-Id: I42869720b27fa7987ada7a9932078237419b292c
2019-03-06 11:45:24 -08:00
Michael Still 7e212ed8dc Move arping to privsep.
Change-Id: Ic755908249d7f1c4519d4868d6efca26c5975c11
2019-03-06 11:44:22 -08:00
Zuul 7480eaf61b Merge "Warn if group_policy is missing from flavor" 2019-03-06 18:46:00 +00:00
Matt Riedemann fbfb1a25df doc: cleanup pci.alias references
The admin and user flavor docs on pci.alias were not super
helpful by just throwing the user to the config docs or
flavor docs and letting them figure it out. This change
helps the reader by linking directly to the things being
referenced.

Also cleans up a pci.passthrough config option reference
while in here.

Change-Id: Ie2e28a14ff4655e38a5db3925adcd605ac773843
2019-03-06 17:59:26 +00:00
Zuul 64b4f41b24 Merge "objects: Store InstancePCIRequest.numa_policy in DB" 2019-03-06 16:59:42 +00:00
Zuul 38c96993fd Merge "Support server create with ports having resource request" 2019-03-06 16:59:35 +00:00