diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-22 15:19:39 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-22 15:19:39 +0000 |
commit | 2c8b24a3914361de941e959e38e3c163a5adeea7 (patch) | |
tree | 411b956f4fbe8f95bb971f4241ff90087bee7bd7 /hw/xen_machine_pv.c | |
parent | e613b064a88a94b2e887f2cb7a5a3a9082e67d9b (diff) |
xen: blk & nic configuration via cmd line. (Gerd Hoffmann)
This patch makes qemu create backend and frontend device entries in
xenstore for devices configured on the command line. It will use
qdisk and qnic backend names, so the qemu internal backends will
be used.
Disks can be created using -drive if=xen,file=...
Nics can be created using -net nic,macaddr=...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7225 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/xen_machine_pv.c')
-rw-r--r-- | hw/xen_machine_pv.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c index c21617ab1f..154cf71584 100644 --- a/hw/xen_machine_pv.c +++ b/hw/xen_machine_pv.c @@ -39,6 +39,7 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, const char *cpu_model) { CPUState *env; + int i, index; /* Initialize a dummy CPU */ if (cpu_model == NULL) { @@ -62,6 +63,24 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, xen_be_register("qdisk", &xen_blkdev_ops); xen_be_register("qnic", &xen_netdev_ops); + /* configure disks */ + for (i = 0; i < 16; i++) { + index = drive_get_index(IF_XEN, 0, i); + if (index == -1) + continue; + xen_config_dev_blk(drives_table + index); + } + + /* configure nics */ + for (i = 0; i < nb_nics; i++) { + if (!nd_table[i].model || 0 != strcmp(nd_table[i].model, "xen")) + continue; + xen_config_dev_nic(nd_table + i); + } + + /* config cleanup hook */ + atexit(xen_config_cleanup); + /* setup framebuffer */ xen_init_display(xen_domid); } |