debuggers.hg
changeset 10959:4c2fab8f8c34
[qemu] Use xenstore to configure ioemu block devices.
- read ioemu block device config from xenstore
- don't require the ioemu: prefix on block devices any longer
- allow change of media associated with cdrom drives
- replace cdrom= option by :cdrom suffix on regular block device config:
'file:/root/mytest.iso,hdc:cdrom,r'
- don't create default cdrom drive anymore - to create default empty
cdrom drive use: ',hdc:cdrom,r'
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
- read ioemu block device config from xenstore
- don't require the ioemu: prefix on block devices any longer
- allow change of media associated with cdrom drives
- replace cdrom= option by :cdrom suffix on regular block device config:
'file:/root/mytest.iso,hdc:cdrom,r'
- don't create default cdrom drive anymore - to create default empty
cdrom drive use: ',hdc:cdrom,r'
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author | chris@kneesaa.uk.xensource.com |
---|---|
date | Thu Aug 03 18:28:29 2006 +0100 (2006-08-03) |
parents | bfe12b4d45d3 |
children | 955f02563a13 |
files | tools/examples/block tools/examples/xmexample.hvm tools/ioemu/Makefile.target tools/ioemu/block.c tools/ioemu/hw/ide.c tools/ioemu/monitor.c tools/ioemu/vl.c tools/ioemu/vl.h tools/ioemu/xenstore.c tools/python/xen/xend/image.py tools/python/xen/xend/server/blkif.py tools/python/xen/xm/create.py |
line diff
1.1 --- a/tools/examples/block Thu Aug 03 15:22:25 2006 +0100 1.2 +++ b/tools/examples/block Thu Aug 03 18:28:29 2006 +0100 1.3 @@ -239,8 +239,11 @@ case "$command" in 1.4 exit 0 1.5 fi 1.6 1.7 - p=$(xenstore_read "$XENBUS_PATH/params") 1.8 - mode=$(xenstore_read "$XENBUS_PATH/mode") 1.9 + if [ -n "$t" ] 1.10 + then 1.11 + p=$(xenstore_read "$XENBUS_PATH/params") 1.12 + mode=$(xenstore_read "$XENBUS_PATH/mode") 1.13 + fi 1.14 1.15 case $t in 1.16 phy) 1.17 @@ -370,6 +373,13 @@ mount it read-write in a guest domain." 1.18 release_lock "block" 1.19 exit 0 1.20 ;; 1.21 + 1.22 + "") 1.23 + claim_lock "block" 1.24 + success 1.25 + echo happy gun \"$t\" >>/tmp/block.$$ 1.26 + release_lock "block" 1.27 + ;; 1.28 esac 1.29 ;; 1.30 1.31 @@ -384,6 +394,10 @@ mount it read-write in a guest domain." 1.32 losetup -d "$node" 1.33 exit 0 1.34 ;; 1.35 + 1.36 + "") 1.37 + exit 0 1.38 + ;; 1.39 esac 1.40 ;; 1.41
2.1 --- a/tools/examples/xmexample.hvm Thu Aug 03 15:22:25 2006 +0100 2.2 +++ b/tools/examples/xmexample.hvm Thu Aug 03 18:28:29 2006 +0100 2.3 @@ -66,7 +66,7 @@ vif = [ 'type=ioemu, bridge=xenbr0' ] 2.4 # and MODE is r for read-only, w for read-write. 2.5 2.6 #disk = [ 'phy:hda1,hda1,r' ] 2.7 -disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ] 2.8 +disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ] 2.9 2.10 #---------------------------------------------------------------------------- 2.11 # Configure the behaviour when a domain exits. There are three 'reasons' 2.12 @@ -111,10 +111,6 @@ disk = [ 'file:/var/images/min-el3-i386. 2.13 device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm' 2.14 2.15 #----------------------------------------------------------------------------- 2.16 -# Disk image for 2.17 -#cdrom= 2.18 - 2.19 -#----------------------------------------------------------------------------- 2.20 # boot on floppy (a), hard disk (c) or CD-ROM (d) 2.21 #boot=[a|c|d] 2.22 #-----------------------------------------------------------------------------
3.1 --- a/tools/ioemu/Makefile.target Thu Aug 03 15:22:25 2006 +0100 3.2 +++ b/tools/ioemu/Makefile.target Thu Aug 03 18:28:29 2006 +0100 3.3 @@ -336,6 +336,7 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO 3.4 VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o 3.5 VL_OBJS+= cirrus_vga.o mixeng.o parallel.o 3.6 VL_OBJS+= piix4acpi.o 3.7 +VL_OBJS+= xenstore.o 3.8 DEFINES += -DHAS_AUDIO 3.9 endif 3.10 ifeq ($(TARGET_BASE_ARCH), ppc)
4.1 --- a/tools/ioemu/block.c Thu Aug 03 15:22:25 2006 +0100 4.2 +++ b/tools/ioemu/block.c Thu Aug 03 18:28:29 2006 +0100 4.3 @@ -750,6 +750,7 @@ static int raw_write(BlockDriverState *b 4.4 static void raw_close(BlockDriverState *bs) 4.5 { 4.6 BDRVRawState *s = bs->opaque; 4.7 + bs->total_sectors = 0; 4.8 close(s->fd); 4.9 } 4.10
5.1 --- a/tools/ioemu/hw/ide.c Thu Aug 03 15:22:25 2006 +0100 5.2 +++ b/tools/ioemu/hw/ide.c Thu Aug 03 18:28:29 2006 +0100 5.3 @@ -1279,6 +1279,7 @@ static void ide_atapi_cmd(IDEState *s) 5.4 } else { 5.5 ide_atapi_cmd_error(s, SENSE_NOT_READY, 5.6 ASC_MEDIUM_NOT_PRESENT); 5.7 + xenstore_check_new_media_present(1000); 5.8 } 5.9 break; 5.10 case GPCMD_MODE_SENSE_10:
6.1 --- a/tools/ioemu/monitor.c Thu Aug 03 15:22:25 2006 +0100 6.2 +++ b/tools/ioemu/monitor.c Thu Aug 03 18:28:29 2006 +0100 6.3 @@ -24,6 +24,7 @@ 6.4 #include "vl.h" 6.5 #include "disas.h" 6.6 #include <dirent.h> 6.7 +#include "block_int.h" 6.8 6.9 //#define DEBUG 6.10 //#define DEBUG_COMPLETION 6.11 @@ -328,7 +329,7 @@ static int eject_device(BlockDriverState 6.12 return 0; 6.13 } 6.14 6.15 -static void do_eject(int force, const char *filename) 6.16 +void do_eject(int force, const char *filename) 6.17 { 6.18 BlockDriverState *bs; 6.19 6.20 @@ -340,7 +341,7 @@ static void do_eject(int force, const ch 6.21 eject_device(bs, force); 6.22 } 6.23 6.24 -static void do_change(const char *device, const char *filename) 6.25 +void do_change(const char *device, const char *filename) 6.26 { 6.27 BlockDriverState *bs; 6.28 int i;
7.1 --- a/tools/ioemu/vl.c Thu Aug 03 15:22:25 2006 +0100 7.2 +++ b/tools/ioemu/vl.c Thu Aug 03 18:28:29 2006 +0100 7.3 @@ -4709,9 +4709,11 @@ void help(void) 7.4 "Standard options:\n" 7.5 "-M machine select emulated machine (-M ? for list)\n" 7.6 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n" 7.7 +#ifndef CONFIG_DM 7.8 "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n" 7.9 "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" 7.10 "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" 7.11 +#endif /* !CONFIG_DM */ 7.12 "-boot [a|c|d] boot on floppy (a), hard disk (c) or CD-ROM (d)\n" 7.13 "-snapshot write to temporary files instead of disk image files\n" 7.14 "-m megs set virtual RAM size to megs MB [default=%d]\n" 7.15 @@ -4841,11 +4843,13 @@ enum { 7.16 QEMU_OPTION_M, 7.17 QEMU_OPTION_fda, 7.18 QEMU_OPTION_fdb, 7.19 +#ifndef CONFIG_DM 7.20 QEMU_OPTION_hda, 7.21 QEMU_OPTION_hdb, 7.22 QEMU_OPTION_hdc, 7.23 QEMU_OPTION_hdd, 7.24 QEMU_OPTION_cdrom, 7.25 +#endif /* !CONFIG_DM */ 7.26 QEMU_OPTION_boot, 7.27 QEMU_OPTION_snapshot, 7.28 QEMU_OPTION_m, 7.29 @@ -4911,11 +4915,13 @@ const QEMUOption qemu_options[] = { 7.30 { "M", HAS_ARG, QEMU_OPTION_M }, 7.31 { "fda", HAS_ARG, QEMU_OPTION_fda }, 7.32 { "fdb", HAS_ARG, QEMU_OPTION_fdb }, 7.33 +#ifndef CONFIG_DM 7.34 { "hda", HAS_ARG, QEMU_OPTION_hda }, 7.35 { "hdb", HAS_ARG, QEMU_OPTION_hdb }, 7.36 { "hdc", HAS_ARG, QEMU_OPTION_hdc }, 7.37 { "hdd", HAS_ARG, QEMU_OPTION_hdd }, 7.38 { "cdrom", HAS_ARG, QEMU_OPTION_cdrom }, 7.39 +#endif /* !CONFIG_DM */ 7.40 { "boot", HAS_ARG, QEMU_OPTION_boot }, 7.41 { "snapshot", 0, QEMU_OPTION_snapshot }, 7.42 { "m", HAS_ARG, QEMU_OPTION_m }, 7.43 @@ -5250,10 +5256,16 @@ int main(int argc, char **argv) 7.44 #ifdef CONFIG_GDBSTUB 7.45 int use_gdbstub, gdbstub_port; 7.46 #endif 7.47 - int i, cdrom_index; 7.48 + int i; 7.49 +#ifndef CONFIG_DM 7.50 + int cdrom_index; 7.51 +#endif /* !CONFIG_DM */ 7.52 int snapshot, linux_boot; 7.53 const char *initrd_filename; 7.54 - const char *hd_filename[MAX_DISKS], *fd_filename[MAX_FD]; 7.55 +#ifndef CONFIG_DM 7.56 + const char *hd_filename[MAX_DISKS]; 7.57 +#endif /* !CONFIG_DM */ 7.58 + const char *fd_filename[MAX_FD]; 7.59 const char *kernel_filename, *kernel_cmdline; 7.60 DisplayState *ds = &display_state; 7.61 int cyls, heads, secs, translation; 7.62 @@ -5288,8 +5300,10 @@ int main(int argc, char **argv) 7.63 initrd_filename = NULL; 7.64 for(i = 0; i < MAX_FD; i++) 7.65 fd_filename[i] = NULL; 7.66 +#ifndef CONFIG_DM 7.67 for(i = 0; i < MAX_DISKS; i++) 7.68 hd_filename[i] = NULL; 7.69 +#endif /* !CONFIG_DM */ 7.70 ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; 7.71 vga_ram_size = VGA_RAM_SIZE; 7.72 bios_size = BIOS_SIZE; 7.73 @@ -5302,11 +5316,13 @@ int main(int argc, char **argv) 7.74 vncviewer = 0; 7.75 kernel_filename = NULL; 7.76 kernel_cmdline = ""; 7.77 +#ifndef CONFIG_DM 7.78 #ifdef TARGET_PPC 7.79 cdrom_index = 1; 7.80 #else 7.81 cdrom_index = 2; 7.82 #endif 7.83 +#endif /* !CONFIG_DM */ 7.84 cyls = heads = secs = 0; 7.85 translation = BIOS_ATA_TRANSLATION_AUTO; 7.86 pstrcpy(monitor_device, sizeof(monitor_device), "vc"); 7.87 @@ -5339,7 +5355,11 @@ int main(int argc, char **argv) 7.88 break; 7.89 r = argv[optind]; 7.90 if (r[0] != '-') { 7.91 +#ifndef CONFIG_DM 7.92 hd_filename[0] = argv[optind++]; 7.93 +#else 7.94 + help(); 7.95 +#endif /* !CONFIG_DM */ 7.96 } else { 7.97 const QEMUOption *popt; 7.98 7.99 @@ -5383,6 +5403,7 @@ int main(int argc, char **argv) 7.100 case QEMU_OPTION_initrd: 7.101 initrd_filename = optarg; 7.102 break; 7.103 +#ifndef CONFIG_DM 7.104 case QEMU_OPTION_hda: 7.105 case QEMU_OPTION_hdb: 7.106 case QEMU_OPTION_hdc: 7.107 @@ -5395,6 +5416,7 @@ int main(int argc, char **argv) 7.108 cdrom_index = -1; 7.109 } 7.110 break; 7.111 +#endif /* !CONFIG_DM */ 7.112 case QEMU_OPTION_snapshot: 7.113 snapshot = 1; 7.114 break; 7.115 @@ -5447,11 +5469,13 @@ int main(int argc, char **argv) 7.116 case QEMU_OPTION_append: 7.117 kernel_cmdline = optarg; 7.118 break; 7.119 +#ifndef CONFIG_DM 7.120 case QEMU_OPTION_cdrom: 7.121 if (cdrom_index >= 0) { 7.122 hd_filename[cdrom_index] = optarg; 7.123 } 7.124 break; 7.125 +#endif /* !CONFIG_DM */ 7.126 case QEMU_OPTION_boot: 7.127 boot_device = optarg[0]; 7.128 if (boot_device != 'a' && 7.129 @@ -5690,12 +5714,18 @@ int main(int argc, char **argv) 7.130 } 7.131 } 7.132 7.133 +#ifdef CONFIG_DM 7.134 + bdrv_init(); 7.135 + xenstore_parse_domain_config(domid); 7.136 +#endif /* CONFIG_DM */ 7.137 + 7.138 #ifdef USE_KQEMU 7.139 if (smp_cpus > 1) 7.140 kqemu_allowed = 0; 7.141 #endif 7.142 linux_boot = (kernel_filename != NULL); 7.143 7.144 +#ifndef CONFIG_DM 7.145 if (!linux_boot && 7.146 hd_filename[0] == '\0' && 7.147 (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') && 7.148 @@ -5709,6 +5739,7 @@ int main(int argc, char **argv) 7.149 else 7.150 boot_device = 'd'; 7.151 } 7.152 +#endif /* !CONFIG_DM */ 7.153 7.154 #if !defined(CONFIG_SOFTMMU) 7.155 /* must avoid mmap() usage of glibc by setting a buffer "by hand" */ 7.156 @@ -5848,6 +5879,7 @@ int main(int argc, char **argv) 7.157 7.158 #endif /* !CONFIG_DM */ 7.159 7.160 +#ifndef CONFIG_DM 7.161 /* we always create the cdrom drive, even if no disk is there */ 7.162 bdrv_init(); 7.163 if (cdrom_index >= 0) { 7.164 @@ -5874,6 +5906,7 @@ int main(int argc, char **argv) 7.165 } 7.166 } 7.167 } 7.168 +#endif /* !CONFIG_DM */ 7.169 7.170 /* we always create at least one floppy disk */ 7.171 fd_table[0] = bdrv_new("fda"); 7.172 @@ -6009,6 +6042,8 @@ int main(int argc, char **argv) 7.173 #endif 7.174 init_timers(); 7.175 7.176 + qemu_set_fd_handler(xenstore_fd(), xenstore_process_event, NULL, NULL); 7.177 + 7.178 machine->init(ram_size, vga_ram_size, boot_device, 7.179 ds, fd_filename, snapshot, 7.180 kernel_filename, kernel_cmdline, initrd_filename,
8.1 --- a/tools/ioemu/vl.h Thu Aug 03 15:22:25 2006 +0100 8.2 +++ b/tools/ioemu/vl.h Thu Aug 03 18:28:29 2006 +0100 8.3 @@ -1092,6 +1092,8 @@ void term_flush(void); 8.4 void term_print_help(void); 8.5 void monitor_readline(const char *prompt, int is_password, 8.6 char *buf, int buf_size); 8.7 +void do_eject(int force, const char *filename); 8.8 +void do_change(const char *device, const char *filename); 8.9 8.10 /* readline.c */ 8.11 typedef void ReadLineFunc(void *opaque, const char *str); 8.12 @@ -1104,6 +1106,13 @@ const char *readline_get_history(unsigne 8.13 void readline_start(const char *prompt, int is_password, 8.14 ReadLineFunc *readline_func, void *opaque); 8.15 8.16 +/* xenstore.c */ 8.17 +void xenstore_parse_domain_config(int domid); 8.18 +int xenstore_fd(void); 8.19 +void xenstore_process_event(void *opaque); 8.20 +void xenstore_check_new_media_present(int timeout); 8.21 + 8.22 + 8.23 void kqemu_record_dump(void); 8.24 8.25 extern char domain_name[];
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/tools/ioemu/xenstore.c Thu Aug 03 18:28:29 2006 +0100 9.3 @@ -0,0 +1,187 @@ 9.4 +/* 9.5 + * This file is subject to the terms and conditions of the GNU General 9.6 + * Public License. See the file "COPYING" in the main directory of 9.7 + * this archive for more details. 9.8 + * 9.9 + * Copyright (C) 2006 Christian Limpach 9.10 + * Copyright (C) 2006 XenSource Ltd. 9.11 + * 9.12 + */ 9.13 + 9.14 +#include "vl.h" 9.15 +#include "block_int.h" 9.16 + 9.17 +static struct xs_handle *xsh = NULL; 9.18 +static char *hd_filename[MAX_DISKS]; 9.19 +static QEMUTimer *insert_timer = NULL; 9.20 + 9.21 +static int pasprintf(char **buf, const char *fmt, ...) 9.22 +{ 9.23 + va_list ap; 9.24 + int ret = 0; 9.25 + 9.26 + if (*buf) 9.27 + free(*buf); 9.28 + va_start(ap, fmt); 9.29 + if (vasprintf(buf, fmt, ap) == -1) { 9.30 + buf = NULL; 9.31 + ret = -1; 9.32 + } 9.33 + va_end(ap); 9.34 + return ret; 9.35 +} 9.36 + 9.37 +static void insert_media(void *opaque) 9.38 +{ 9.39 + int i; 9.40 + 9.41 + for (i = 0; i < MAX_DISKS; i++) { 9.42 + if (hd_filename[i]) { 9.43 + do_change(bs_table[i]->device_name, hd_filename[i]); 9.44 + free(hd_filename[i]); 9.45 + hd_filename[i] = NULL; 9.46 + } 9.47 + } 9.48 +} 9.49 + 9.50 +void xenstore_check_new_media_present(int timeout) 9.51 +{ 9.52 + 9.53 + if (insert_timer == NULL) 9.54 + insert_timer = qemu_new_timer(rt_clock, insert_media, NULL); 9.55 + qemu_mod_timer(insert_timer, qemu_get_clock(rt_clock) + timeout); 9.56 +} 9.57 + 9.58 +void xenstore_parse_domain_config(int domid) 9.59 +{ 9.60 + char **e = NULL; 9.61 + char *buf = NULL, *path; 9.62 + char *bpath = NULL, *dev = NULL, *params = NULL, *type = NULL; 9.63 + int i; 9.64 + unsigned int len, num, hd_index; 9.65 + 9.66 + for(i = 0; i < MAX_DISKS; i++) 9.67 + hd_filename[i] = NULL; 9.68 + 9.69 + xsh = xs_daemon_open(); 9.70 + if (xsh == NULL) { 9.71 + fprintf(logfile, "Could not contact xenstore for domain config\n"); 9.72 + return; 9.73 + } 9.74 + 9.75 + path = xs_get_domain_path(xsh, domid); 9.76 + if (path == NULL) { 9.77 + fprintf(logfile, "xs_get_domain_path() error\n"); 9.78 + goto out; 9.79 + } 9.80 + 9.81 + if (pasprintf(&buf, "%s/device/vbd", path) == -1) 9.82 + goto out; 9.83 + 9.84 + e = xs_directory(xsh, XBT_NULL, buf, &num); 9.85 + if (e == NULL) 9.86 + goto out; 9.87 + 9.88 + for (i = 0; i < num; i++) { 9.89 + /* read the backend path */ 9.90 + if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1) 9.91 + continue; 9.92 + free(bpath); 9.93 + bpath = xs_read(xsh, XBT_NULL, buf, &len); 9.94 + if (bpath == NULL) 9.95 + continue; 9.96 + /* read the name of the device */ 9.97 + if (pasprintf(&buf, "%s/dev", bpath) == -1) 9.98 + continue; 9.99 + free(dev); 9.100 + dev = xs_read(xsh, XBT_NULL, buf, &len); 9.101 + if (dev == NULL) 9.102 + continue; 9.103 + if (strncmp(dev, "hd", 2) || strlen(dev) != 3) 9.104 + continue; 9.105 + hd_index = dev[2] - 'a'; 9.106 + if (hd_index > MAX_DISKS) 9.107 + continue; 9.108 + /* read the type of the device */ 9.109 + if (pasprintf(&buf, "%s/device/vbd/%s/device-type", path, e[i]) == -1) 9.110 + continue; 9.111 + free(type); 9.112 + type = xs_read(xsh, XBT_NULL, buf, &len); 9.113 + /* read params to get the patch of the image -- read it last 9.114 + * so that we have its path in buf when setting up the 9.115 + * watch */ 9.116 + if (pasprintf(&buf, "%s/params", bpath) == -1) 9.117 + continue; 9.118 + free(params); 9.119 + params = xs_read(xsh, XBT_NULL, buf, &len); 9.120 + if (params == NULL) 9.121 + continue; 9.122 + if (params[0]) { 9.123 + hd_filename[hd_index] = params; /* strdup() */ 9.124 + params = NULL; /* don't free params on re-use */ 9.125 + } 9.126 + bs_table[hd_index] = bdrv_new(dev); 9.127 + /* check if it is a cdrom */ 9.128 + if (type && !strcmp(type, "cdrom")) { 9.129 + bdrv_set_type_hint(bs_table[hd_index], BDRV_TYPE_CDROM); 9.130 + xs_watch(xsh, buf, dev); 9.131 + } 9.132 + if (hd_filename[hd_index]) { 9.133 + if (bdrv_open(bs_table[hd_index], hd_filename[hd_index], 9.134 + 0 /* snapshot */) < 0) 9.135 + fprintf(stderr, "qemu: could not open hard disk image '%s'\n", 9.136 + hd_filename[hd_index]); 9.137 + } 9.138 + } 9.139 + 9.140 + out: 9.141 + free(type); 9.142 + free(params); 9.143 + free(dev); 9.144 + free(bpath); 9.145 + free(buf); 9.146 + free(path); 9.147 + free(e); 9.148 + return; 9.149 +} 9.150 + 9.151 +int xenstore_fd(void) 9.152 +{ 9.153 + if (xsh) 9.154 + return xs_fileno(xsh); 9.155 + return -1; 9.156 +} 9.157 + 9.158 +void xenstore_process_event(void *opaque) 9.159 +{ 9.160 + char **vec, *image = NULL; 9.161 + unsigned int len, num, hd_index; 9.162 + 9.163 + vec = xs_read_watch(xsh, &num); 9.164 + if (!vec) 9.165 + return; 9.166 + 9.167 + if (strncmp(vec[XS_WATCH_TOKEN], "hd", 2) || 9.168 + strlen(vec[XS_WATCH_TOKEN]) != 3) 9.169 + goto out; 9.170 + hd_index = vec[XS_WATCH_TOKEN][2] - 'a'; 9.171 + image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len); 9.172 + if (image == NULL || !strcmp(image, bs_table[hd_index]->filename)) 9.173 + goto out; /* gone or identical */ 9.174 + 9.175 + do_eject(0, vec[XS_WATCH_TOKEN]); 9.176 + bs_table[hd_index]->filename[0] = 0; 9.177 + if (hd_filename[hd_index]) { 9.178 + free(hd_filename[hd_index]); 9.179 + hd_filename[hd_index] = NULL; 9.180 + } 9.181 + 9.182 + if (image[0]) { 9.183 + hd_filename[hd_index] = strdup(image); 9.184 + xenstore_check_new_media_present(5000); 9.185 + } 9.186 + 9.187 + out: 9.188 + free(image); 9.189 + free(vec); 9.190 +}
10.1 --- a/tools/python/xen/xend/image.py Thu Aug 03 15:22:25 2006 +0100 10.2 +++ b/tools/python/xen/xend/image.py Thu Aug 03 18:28:29 2006 +0100 10.3 @@ -249,7 +249,7 @@ class HVMImageHandler(ImageHandler): 10.4 # Return a list of cmd line args to the device models based on the 10.5 # xm config file 10.6 def parseDeviceModelArgs(self, imageConfig, deviceConfig): 10.7 - dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'audio', 10.8 + dmargs = [ 'boot', 'fda', 'fdb', 'audio', 10.9 'localtime', 'serial', 'stdvga', 'isa', 'vcpus', 10.10 'usb', 'usbdevice'] 10.11 ret = [] 10.12 @@ -277,24 +277,11 @@ class HVMImageHandler(ImageHandler): 10.13 for (name, info) in deviceConfig: 10.14 if name == 'vbd': 10.15 uname = sxp.child_value(info, 'uname') 10.16 - typedev = sxp.child_value(info, 'dev') 10.17 - (_, vbdparam) = string.split(uname, ':', 1) 10.18 - 10.19 - if 'file:' in uname and not os.path.isfile(vbdparam): 10.20 - raise VmError('Disk image does not exist: %s' % vbdparam) 10.21 - 10.22 - if 'ioemu:' in typedev: 10.23 - (emtype, vbddev) = string.split(typedev, ':', 1) 10.24 - else: 10.25 - emtype = 'vbd' 10.26 - vbddev = typedev 10.27 - if emtype == 'vbd': 10.28 - continue; 10.29 - vbddev_list = ['hda', 'hdb', 'hdc', 'hdd'] 10.30 - if vbddev not in vbddev_list: 10.31 - raise VmError("hvm: for qemu vbd type=file&dev=hda~hdd") 10.32 - ret.append("-%s" % vbddev) 10.33 - ret.append("%s" % vbdparam) 10.34 + if 'file:' in uname: 10.35 + (_, vbdparam) = string.split(uname, ':', 1) 10.36 + if not os.path.isfile(vbdparam): 10.37 + raise VmError('Disk image does not exist: %s' % 10.38 + vbdparam) 10.39 if name == 'vif': 10.40 type = sxp.child_value(info, 'type') 10.41 if type != 'ioemu':
11.1 --- a/tools/python/xen/xend/server/blkif.py Thu Aug 03 15:22:25 2006 +0100 11.2 +++ b/tools/python/xen/xend/server/blkif.py Thu Aug 03 18:28:29 2006 +0100 11.3 @@ -45,7 +45,17 @@ class BlkifController(DevController): 11.4 11.5 dev = sxp.child_value(config, 'dev') 11.6 11.7 - (typ, params) = string.split(uname, ':', 1) 11.8 + if 'ioemu:' in dev: 11.9 + (_, dev) = string.split(dev, ':', 1) 11.10 + try: 11.11 + (dev, dev_type) = string.split(dev, ':', 1) 11.12 + except ValueError: 11.13 + dev_type = "disk" 11.14 + 11.15 + try: 11.16 + (typ, params) = string.split(uname, ':', 1) 11.17 + except ValueError: 11.18 + (typ, params) = ("", "") 11.19 back = { 'dev' : dev, 11.20 'type' : typ, 11.21 'params' : params, 11.22 @@ -58,13 +68,10 @@ class BlkifController(DevController): 11.23 'acm_ssidref': str(ssidref), 11.24 'acm_policy' : policy}) 11.25 11.26 - if 'ioemu:' in dev: 11.27 - (dummy, dev1) = string.split(dev, ':', 1) 11.28 - devid = blkif.blkdev_name_to_number(dev1) 11.29 - front = {} 11.30 - else: 11.31 - devid = blkif.blkdev_name_to_number(dev) 11.32 - front = { 'virtual-device' : "%i" % devid } 11.33 + devid = blkif.blkdev_name_to_number(dev) 11.34 + front = { 'virtual-device' : "%i" % devid, 11.35 + 'device-type' : dev_type 11.36 + } 11.37 11.38 return (devid, back, front) 11.39
12.1 --- a/tools/python/xen/xm/create.py Thu Aug 03 15:22:25 2006 +0100 12.2 +++ b/tools/python/xen/xm/create.py Thu Aug 03 18:28:29 2006 +0100 12.3 @@ -392,10 +392,6 @@ gopts.var('isa', val='no|yes', 12.4 fn=set_bool, default=0, 12.5 use="Simulate an ISA only system?") 12.6 12.7 -gopts.var('cdrom', val='FILE', 12.8 - fn=set_value, default='', 12.9 - use="Path to cdrom") 12.10 - 12.11 gopts.var('boot', val="a|b|c|d", 12.12 fn=set_value, default='c', 12.13 use="Default boot device") 12.14 @@ -629,7 +625,7 @@ def configure_vifs(config_devs, vals): 12.15 def configure_hvm(config_image, vals): 12.16 """Create the config for HVM devices. 12.17 """ 12.18 - args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb', 12.19 + args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb', 12.20 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio', 12.21 'vnc', 'vncdisplay', 'vncconsole', 'sdl', 'display', 12.22 'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]