资源简介
qemu-4.1.0.tar.xz压缩包下载,下载后在环境目录里解压,运用命令安装。
在一些直接用命令安装失败时可以用这个办法。
在一些直接用命令安装失败时可以用这个办法。
代码片段和文件信息
/*
* Serving QEMU block devices via NBD
*
* Copyright (c) 2012 Red Hat Inc.
*
* Author: Paolo Bonzini
*
* This work is licensed under the terms of the GNU GPL version 2 or
* later. See the COPYING file in the top-level directory.
*/
#include “qemu/osdep.h“
#include “sysemu/blockdev.h“
#include “sysemu/block-backend.h“
#include “hw/block/block.h“
#include “qapi/error.h“
#include “qapi/qapi-commands-block.h“
#include “sysemu/sysemu.h“
#include “block/nbd.h“
#include “io/channel-socket.h“
#include “io/net-listener.h“
typedef struct NBDServerData {
QIONetListener *listener;
QCryptoTLSCreds *tlscreds;
char *tlsauthz;
} NBDServerData;
static NBDServerData *nbd_server;
static void nbd_blockdev_client_closed(NBDClient *client bool ignored)
{
nbd_client_put(client);
}
static void nbd_accept(QIONetListener *listener QIOChannelSocket *cioc
gpointer opaque)
{
qio_channel_set_name(QIO_CHANNEL(cioc) “nbd-server“);
nbd_client_new(cioc nbd_server->tlscreds nbd_server->tlsauthz
nbd_blockdev_client_closed);
}
static void nbd_server_free(NBDServerData *server)
{
if (!server) {
return;
}
qio_net_listener_disconnect(server->listener);
object_unref(object(server->listener));
if (server->tlscreds) {
object_unref(object(server->tlscreds));
}
g_free(server->tlsauthz);
g_free(server);
}
static QCryptoTLSCreds *nbd_get_tls_creds(const char *id Error **errp)
{
object *obj;
QCryptoTLSCreds *creds;
obj = object_resolve_path_component(
object_get_objects_root() id);
if (!obj) {
error_setg(errp “No TLS credentials with id ‘%s‘“
id);
return NULL;
}
creds = (QCryptoTLSCreds *)
object_dynamic_cast(obj TYPE_QCRYPTO_TLS_CREDS);
if (!creds) {
error_setg(errp “object with id ‘%s‘ is not TLS credentials“
id);
return NULL;
}
if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
error_setg(errp
“Expecting TLS credentials with a server endpoint“);
return NULL;
}
object_ref(obj);
return creds;
}
void nbd_server_start(SocketAddress *addr const char *tls_creds
const char *tls_authz Error **errp)
{
if (nbd_server) {
error_setg(errp “NBD server already running“);
return;
}
nbd_server = g_new0(NBDServerData 1);
nbd_server->listener = qio_net_listener_new();
qio_net_listener_set_name(nbd_server->listener
“nbd-listener“);
if (qio_net_listener_open_sync(nbd_server->listener addr errp) < 0) {
goto error;
}
if (tls_creds) {
nbd_server->tlscreds = nbd_get_tls_creds(tls_creds errp);
if (!nbd_server->tlscreds) {
goto error;
}
/* TODO SOCKET_ADDRESS_TYPE_FD where fd has AF_INET or AF_INET6 */
相关资源
- qemu-0.8.1-windows-2
- 收藏奉献_DOS汉字系统21:国家统计局
- Qemu Libvirt & KVM.pdf
- QEMU for windows+安装说明
- 虚拟机镜像的制作
- FGT_VM64_KVM-v5-build1484-FORTINET.out.kvm.qco
- qemu内核镜像 Linux-0.2.img
- 智能硬件安全
- qemu2.4.0.1
- 收藏奉献_DOS汉字系统12:WPS 1.0 for w
- qemu-2.5.0.tar.bz2
- GNS3模拟Qemu Host_Pix_ASA配置方法及工具
- qemu内存管理流程
- QEMU使用教程
- kqemu-1.3.0pre11
- kqemu-1.3.0pre11.tar.gz
- flashimg-master
- qemu-kvm源码分析
- qemu-img for Windows
- qemu-kvm0.12.1.tar.gz kvm虚拟化软件包
- Qemu-1.0.1 for windows
评论
共有 条评论