Block layer patches:
- Add block export infrastructure - iotests improvements - Document the throttle block filter - Misc code cleanups -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAl93OwURHGt3b2xmQHJl ZGhhdC5jb20ACgkQfwmycsiPL9Z6EA/+P5nqjxkhZy8CMj3nNh7d8pLN7JElRxkm Ie/nNwlHtCa1C2PO/Y3IDM8UZgRqKKiZGZEzRiYVEtvssF+hpf7aL1U09Y8V/zXH LGxEIzAV2uZ5ig5VIR9yBvMYufN1p0v2J0iMVcFyVxzMAAGKGq6vVx8IX/O6mggB e0w/jdoMsPwKY+egb4QEOZGu/Ae+rLDos6ka+uq8BBppa6FY6jfkkm87ogZfWu+i HRCifAKjX419KSH+1qC1r2hEHXmnbNRFEacPpbPjSjkTIPLtQcSBCQfS+U7jUlCy hVEgl0AEbduqhWy8ckBRHuPGPjGcTgh0jBv1btXsbDDbrPsLTdX2FZK2P5qqUSod nk6nngBq1ULgTHYjsReR5Q8y6DM5Or3vn58fLGb0tSymrpl8DAIt2zLlOhqat2uF L89nryn7imZ6GdNb4ZUg5yf/2p2gJQ8jcPrO9p7KNNWdIbIbZ52SjTSLgtscaKft zJ13oZNskBt3Ts4PuWxxeqn4+l+Y0/YdWm58pSSWzt7xbRt/QDxPAgvvgJNZK/XG xhZSNRRLdwnXrj5tc/cVl2jsKoSxzX8smGmmFUFbUFMLCX8SE7lK2THO1bPLfdUQ SYlkmrFYVEwk9lRlTY7zVjRYEst+J5mwP7XISOn7dU23BGy99NmbC231g0a4c9vM x66nUYdVWbw= =VIZ3 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches: - Add block export infrastructure - iotests improvements - Document the throttle block filter - Misc code cleanups # gpg: Signature made Fri 02 Oct 2020 15:36:53 BST # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (37 commits) qcow2: Use L1E_SIZE in qcow2_write_l1_entry() qemu-storage-daemon: Fix help line for --export iotests: Test block-export-* QMP interface iotests: Allow supported and unsupported formats at the same time iotests: Introduce qemu_nbd_list_log() iotests: Factor out qemu_tool_pipe_and_status() nbd: Deprecate nbd-server-add/remove nbd: Merge nbd_export_new() and nbd_export_create() block/export: Move writable to BlockExportOptions block/export: Add query-block-exports block/export: Create BlockBackend in blk_exp_add() block/export: Move blk to BlockExport block/export: Add BLOCK_EXPORT_DELETED event block/export: Add block-export-del block/export: Move strong user reference to block_exports block/export: Add 'id' option to block-export-add block/export: Add blk_exp_close_all(_type) block/export: Allocate BlockExport in blk_exp_add() block/export: Add node-name to BlockExportOptions block/export: Move AioContext from NBDExport to BlockExport ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
469e72ab7d
30 changed files with 1434 additions and 551 deletions
89
include/block/export.h
Normal file
89
include/block/export.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Declarations for block exports
|
||||
*
|
||||
* Copyright (c) 2012, 2020 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Paolo Bonzini <pbonzini@redhat.com>
|
||||
* Kevin Wolf <kwolf@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef BLOCK_EXPORT_H
|
||||
#define BLOCK_EXPORT_H
|
||||
|
||||
#include "qapi/qapi-types-block-export.h"
|
||||
#include "qemu/queue.h"
|
||||
|
||||
typedef struct BlockExport BlockExport;
|
||||
|
||||
typedef struct BlockExportDriver {
|
||||
/* The export type that this driver services */
|
||||
BlockExportType type;
|
||||
|
||||
/*
|
||||
* The size of the driver-specific state that contains BlockExport as its
|
||||
* first field.
|
||||
*/
|
||||
size_t instance_size;
|
||||
|
||||
/* Creates and starts a new block export */
|
||||
int (*create)(BlockExport *, BlockExportOptions *, Error **);
|
||||
|
||||
/*
|
||||
* Frees a removed block export. This function is only called after all
|
||||
* references have been dropped.
|
||||
*/
|
||||
void (*delete)(BlockExport *);
|
||||
|
||||
/*
|
||||
* Start to disconnect all clients and drop other references held
|
||||
* internally by the export driver. When the function returns, there may
|
||||
* still be active references while the export is in the process of
|
||||
* shutting down.
|
||||
*/
|
||||
void (*request_shutdown)(BlockExport *);
|
||||
} BlockExportDriver;
|
||||
|
||||
struct BlockExport {
|
||||
const BlockExportDriver *drv;
|
||||
|
||||
/* Unique identifier for the export */
|
||||
char *id;
|
||||
|
||||
/*
|
||||
* Reference count for this block export. This includes strong references
|
||||
* both from the owner (qemu-nbd or the monitor) and clients connected to
|
||||
* the export.
|
||||
*/
|
||||
int refcount;
|
||||
|
||||
/*
|
||||
* True if one of the references in refcount belongs to the user. After the
|
||||
* user has dropped their reference, they may not e.g. remove the same
|
||||
* export a second time (which would decrease the refcount without having
|
||||
* it incremented first).
|
||||
*/
|
||||
bool user_owned;
|
||||
|
||||
/* The AioContext whose lock protects this BlockExport object. */
|
||||
AioContext *ctx;
|
||||
|
||||
/* The block device to export */
|
||||
BlockBackend *blk;
|
||||
|
||||
/* List entry for block_exports */
|
||||
QLIST_ENTRY(BlockExport) next;
|
||||
};
|
||||
|
||||
BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp);
|
||||
BlockExport *blk_exp_find(const char *id);
|
||||
void blk_exp_ref(BlockExport *exp);
|
||||
void blk_exp_unref(BlockExport *exp);
|
||||
void blk_exp_request_shutdown(BlockExport *exp);
|
||||
void blk_exp_close_all(void);
|
||||
void blk_exp_close_all_type(BlockExportType type);
|
||||
|
||||
#endif
|
||||
|
|
@ -20,11 +20,13 @@
|
|||
#ifndef NBD_H
|
||||
#define NBD_H
|
||||
|
||||
#include "qapi/qapi-types-block.h"
|
||||
#include "block/export.h"
|
||||
#include "io/channel-socket.h"
|
||||
#include "crypto/tlscreds.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
extern const BlockExportDriver blk_exp_nbd;
|
||||
|
||||
/* Handshake phase structs - this struct is passed on the wire */
|
||||
|
||||
struct NBDOption {
|
||||
|
|
@ -328,21 +330,10 @@ int nbd_errno_to_system_errno(int err);
|
|||
typedef struct NBDExport NBDExport;
|
||||
typedef struct NBDClient NBDClient;
|
||||
|
||||
NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t dev_offset,
|
||||
uint64_t size, const char *name, const char *desc,
|
||||
const char *bitmap, bool readonly, bool shared,
|
||||
void (*close)(NBDExport *), bool writethrough,
|
||||
BlockBackend *on_eject_blk, Error **errp);
|
||||
void nbd_export_close(NBDExport *exp);
|
||||
void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp);
|
||||
void nbd_export_get(NBDExport *exp);
|
||||
void nbd_export_put(NBDExport *exp);
|
||||
|
||||
BlockBackend *nbd_export_get_blockdev(NBDExport *exp);
|
||||
void nbd_export_set_on_eject_blk(BlockExport *exp, BlockBackend *blk);
|
||||
|
||||
AioContext *nbd_export_aio_context(NBDExport *exp);
|
||||
NBDExport *nbd_export_find(const char *name);
|
||||
void nbd_export_close_all(void);
|
||||
|
||||
void nbd_client_new(QIOChannelSocket *sioc,
|
||||
QCryptoTLSCreds *tlscreds,
|
||||
|
|
@ -351,8 +342,11 @@ void nbd_client_new(QIOChannelSocket *sioc,
|
|||
void nbd_client_get(NBDClient *client);
|
||||
void nbd_client_put(NBDClient *client);
|
||||
|
||||
void nbd_server_is_qemu_nbd(bool value);
|
||||
bool nbd_server_is_running(void);
|
||||
void nbd_server_start(SocketAddress *addr, const char *tls_creds,
|
||||
const char *tls_authz, Error **errp);
|
||||
const char *tls_authz, uint32_t max_connections,
|
||||
Error **errp);
|
||||
void nbd_server_start_options(NbdServerOptions *arg, Error **errp);
|
||||
|
||||
/* nbd_read
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue