diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-12-08 07:47:52 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-12-08 07:47:52 +0000 |
commit | 7b4effff892d18d8e83563a7e6868bb7c7749fc5 (patch) | |
tree | 75fff8f77c32c9d773064852abc8b549921c6e85 /tools/libxl/libxl_utils.c | |
parent | 4baca0b56014781751a5dcca4eb8abf4c08b16ba (diff) | |
download | xen-7b4effff892d18d8e83563a7e6868bb7c7749fc5.tar.gz xen-7b4effff892d18d8e83563a7e6868bb7c7749fc5.tar.bz2 xen-7b4effff892d18d8e83563a7e6868bb7c7749fc5.zip |
libxenlight: implement cdrom insert/eject
This patch implements functions in libxenlight to change the cdrom in
a VM at run time and to handle cdrom eject requests from guests.
This patch adds two new commands to xl: cd-insert and cd-eject; it
also modifies xl to handle cdrom eject requests coming from guests
(actually coming from qemu).
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 3d731ce029..66730c39ff 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -214,3 +214,33 @@ int libxl_create_logfile(struct libxl_ctx *ctx, char *name, char **full_name) return 0; } +int libxl_string_to_phystype(struct libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype) +{ + char *p; + int rc = 0; + + if (!strcmp(s, "phy")) { + *phystype = PHYSTYPE_PHY; + } else if (!strcmp(s, "file")) { + *phystype = PHYSTYPE_FILE; + } else if (!strcmp(s, "tap")) { + p = strchr(s, ':'); + if (!p) { + rc = -1; + goto out; + } + p++; + if (!strcmp(p, "aio")) { + *phystype = PHYSTYPE_AIO; + } else if (!strcmp(p, "vhd")) { + *phystype = PHYSTYPE_VHD; + } else if (!strcmp(p, "qcow")) { + *phystype = PHYSTYPE_QCOW; + } else if (!strcmp(p, "qcow2")) { + *phystype = PHYSTYPE_QCOW2; + } + } +out: + return rc; +} + |