[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch 08/24] QEMU/KVM: drive removal support
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [patch 08/24] QEMU/KVM: drive removal support |
Date: |
Tue, 11 Mar 2008 17:11:59 -0300 |
User-agent: |
quilt/0.46-1 |
To be used by hot-remove.
Signed-off-by: Marcelo Tosatti <address@hidden>
Index: kvm-userspace.hotplug2/qemu/vl.c
===================================================================
--- kvm-userspace.hotplug2.orig/qemu/vl.c
+++ kvm-userspace.hotplug2/qemu/vl.c
@@ -5010,6 +5010,12 @@ static int drive_add(const char *file, c
return index;
}
+void drive_remove(int index)
+{
+ drives_opt[index].used = 0;
+ nb_drives_opt--;
+}
+
int drive_get_index(BlockInterfaceType type, int bus, int unit)
{
int index;
@@ -5040,6 +5046,20 @@ int drive_get_max_bus(BlockInterfaceType
return max_bus;
}
+void drive_uninit(BlockDriverState *bdrv)
+{
+ int i;
+
+ for (i = 0; i < MAX_DRIVES; i++)
+ if (drives_table[i].bdrv == bdrv) {
+ drives_table[i].bdrv = NULL;
+ drives_table[i].used = 0;
+ drive_remove(drives_table[i].drive_opt_idx);
+ nb_drives--;
+ break;
+ }
+}
+
static int drive_init(struct drive_opt *arg, int snapshot,
QEMUMachine *machine)
{
@@ -5313,6 +5333,7 @@ static int drive_init(struct drive_opt *
drives_table[drives_table_idx].type = type;
drives_table[drives_table_idx].bus = bus_id;
drives_table[drives_table_idx].unit = unit_id;
+ drives_table[drives_table_idx].drive_opt_idx = arg - drives_opt;
nb_drives++;
switch(type) {
Index: kvm-userspace.hotplug2/qemu/sysemu.h
===================================================================
--- kvm-userspace.hotplug2.orig/qemu/sysemu.h
+++ kvm-userspace.hotplug2/qemu/sysemu.h
@@ -140,6 +140,7 @@ typedef struct DriveInfo {
int bus;
int unit;
int used;
+ int drive_opt_idx;
} DriveInfo;
#define MAX_IDE_DEVS 2
@@ -153,6 +154,9 @@ int extboot_drive;
extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
extern int drive_get_max_bus(BlockInterfaceType type);
+extern void drive_uninit(BlockDriverState *bdrv);
+extern void drive_remove(int index);
+
/* acpi */
void qemu_system_cpu_hot_add(int cpu, int state);
void qemu_system_hot_add_init(char *cpu_model);
--
- [Qemu-devel] [patch 17/24] QEMU/KVM: add cpu_unregister_io_memory and make io mem table index dynamic, (continued)
[Qemu-devel] [patch 19/24] QEMU/KVM: handle SEJ notifications, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 20/24] QEMU/KVM: add qemu_free_irqs, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 22/24] QEMU/KVM: LSI SCSI and e1000 unregister callbacks, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 23/24] QEMU/KVM: zero ioport_opaque on isa_unassign_ioport, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 24/24] QEMU/KVM: device hot-remove, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 08/24] QEMU/KVM: drive removal support,
Marcelo Tosatti <=
[Qemu-devel] [patch 16/24] QEMU/KVM: device and disk hot-add, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 21/24] QEMU/KVM: add pci_unregister_device, Marcelo Tosatti, 2008/03/12
[Qemu-devel] [patch 18/24] QEMU/KVM: notify _EJ0 through _SEJ OperationRegion, Marcelo Tosatti, 2008/03/12
[Qemu-devel] Re: [kvm-devel] [patch 00/24] QEMU ACPI PCI hotplug support, Avi Kivity, 2008/03/16