From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, kwolf@redhat.com,
Corey Bryant <coreyb@linux.vnet.ibm.com>,
eblake@redhat.com
Subject: [Qemu-devel] [PATCH 3/4] qemu-config: Add -drive fd and opaque options
Date: Fri, 5 Oct 2012 14:07:04 -0400 [thread overview]
Message-ID: <1349460425-30601-4-git-send-email-coreyb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com>
These new options can be used for passing drive file descriptors
on the command line, instead of using the file option to specify
a file name.
These new command line options mirror the existing add-fd QMP
command which allows an fd to be passed to QEMU via SCM_RIGHTS and
added to an fd set. The opaque option is also available with
add-fd, and allows a free-form string to be stored in the fd set
along with the fd.
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
---
qemu-config.c | 8 ++++++++
qemu-options.hx | 15 +++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/qemu-config.c b/qemu-config.c
index cd1ec21..91053dd 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -114,6 +114,14 @@ static QemuOptsList qemu_drive_opts = {
.name = "copy-on-read",
.type = QEMU_OPT_BOOL,
.help = "copy read data from backing file into image file",
+ },{
+ .name = "fd",
+ .type = QEMU_OPT_NUMBER,
+ .help = "disk image file descriptor",
+ },{
+ .name = "opaque",
+ .type = QEMU_OPT_STRING,
+ .help = "free-form string used to describe fd",
},
{ /* end of list */ }
},
diff --git a/qemu-options.hx b/qemu-options.hx
index 7d97f96..513530f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -149,7 +149,7 @@ using @file{/dev/cdrom} as filename (@pxref{host_drives}).
ETEXI
DEF("drive", HAS_ARG, QEMU_OPTION_drive,
- "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
+ "-drive [file=file|fd=fd[,opaque=o]][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n"
" [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n"
" [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n"
" [,serial=s][,addr=A][,id=name][,aio=threads|native]\n"
@@ -170,6 +170,12 @@ this drive. If the filename contains comma, you must double it
Special files such as iSCSI devices can be specified using protocol
specific URLs. See the section for "Device URL Syntax" for more information.
+@item fd=@var{fd}
+This option defines which disk image (@pxref{disk_images}) file descriptor to
+use with this drive.
+@item opaque=@var{opaque}
+This option defines a free-form string that describes @var{fd}. This is used
+when storing @var{fd} in a file descriptor set.
@item if=@var{interface}
This option defines on which type on interface the drive is connected.
Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio.
@@ -257,12 +263,17 @@ qemu-system-i386 -drive file=file,index=2,media=disk
qemu-system-i386 -drive file=file,index=3,media=disk
@end example
+You can open an image using a pre-opened file descriptor:
+@example
+qemu-system-i386 -drive fd=24,opaque="rdwr:/path/to/file",index=0,media=disk
+@end example
+
You can connect a CDROM to the slave of ide0:
@example
qemu-system-i386 -drive file=file,if=ide,index=1,media=cdrom
@end example
-If you don't specify the "file=" argument, you define an empty drive:
+If you don't specify the "file=" or "fd=" arguments, you define an empty drive:
@example
qemu-system-i386 -drive if=ide,index=1,media=cdrom
@end example
--
1.7.11.4
next prev parent reply other threads:[~2012-10-05 18:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 18:07 [Qemu-devel] [PATCH 0/4] command line fd passing using fd sets Corey Bryant
2012-10-05 18:07 ` [Qemu-devel] [PATCH 1/4] monitor: Less restrictive fd matching for " Corey Bryant
2012-10-05 18:35 ` Eric Blake
2012-10-05 18:50 ` Corey Bryant
2012-10-05 18:07 ` [Qemu-devel] [PATCH 2/4] monitor: Enable adding an inherited fd to an fd set Corey Bryant
2012-10-05 18:07 ` Corey Bryant [this message]
2012-10-05 18:25 ` [Qemu-devel] [PATCH 3/4] qemu-config: Add -drive fd and opaque options Blue Swirl
2012-10-05 18:30 ` Eric Blake
2012-10-05 18:44 ` Corey Bryant
2012-10-05 18:51 ` Eric Blake
2012-10-05 18:57 ` Corey Bryant
2012-10-05 18:48 ` Corey Bryant
2012-10-05 18:07 ` [Qemu-devel] [PATCH 4/4] blockdev: Process " Corey Bryant
2012-10-05 18:26 ` [Qemu-devel] [PATCH 0/4] command line fd passing using fd sets Eric Blake
2012-10-05 18:37 ` Corey Bryant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349460425-30601-4-git-send-email-coreyb@linux.vnet.ibm.com \
--to=coreyb@linux.vnet.ibm.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=libvir-list@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).