Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com -- v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass --- hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else { - l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev))); + return l; } } l += snprintf(p + l , size - l, "/"); @@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{ + return g_strdup(object_get_typename(OBJECT(dev))); +} + static void bus_class_init(ObjectClass *class, void *data) { + BusClass *bc = BUS_CLASS(class); + class->unparent = bus_unparent; + bc->get_fw_dev_path = default_bus_get_fw_dev_path; }
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{ + return NULL; +} + static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path; + bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path; }
static const TypeInfo virtio_bus_info = {
Il 29/05/2013 09:56, Amos Kong ha scritto:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
Thanks!
Reviewed-by: Paolo Bonzini pbonzini@redhat.com
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
On 05/29/13 09:56, Amos Kong wrote:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
Ah, the happiness of finally understanding what Paolo suggested. (Or at least believing so.)
My R-b is superfluous after Paolo's, but I can't resist.
Reviewed-by: Laszlo Ersek lersek@redhat.com
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
Stefan
On Thu, May 30, 2013 at 02:09:25PM +0200, Stefan Priebe - Profihost AG wrote:
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
Hi Stefan,
Can you provide your full command-lines ?
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
For me, they all work, (1. check the bootindex string, 2. check boot menu by entering F12, 3. check by waiting ).
[root@t430s qemu]# qemu-upstream -drive file=/images/RHEL-Server-6.4-64-virtio.qcow2,if=none,id=drive-system-disk \ -device virtio-scsi-pci,bus=pci.0,addr=0x4,id=scsi0 -device scsi-hd,drive=drive-system-disk,bus=scsi0.0,bootindex=201 \ -device virtio-net-pci,netdev=h1,bootindex=100 \ -netdev tap,id=h1 -monitor stdio -boot menu=on \ -drive file=/images/RHEL-Server-6.4-64-virtio.qcow2,if=none,id=drive-system-disk2 \ -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi02 \ -device scsi-hd,drive=drive-system-disk2,bus=scsi0.0,bootindex=202 /pci@i0cf8/ethernet@3/ethernet-phy@0 /pci@i0cf8/scsi@4/channel@0/disk@0,0 /pci@i0cf8/scsi@4/channel@0/disk@1,0
[root@t430s qemu]# qemu-upstream -drive file=/images/RHEL-Server-6.4-64-virtio.qcow2,if=none,id=drive-system-disk \ -device virtio-scsi-pci,bus=pci.0,addr=0x4,id=scsi0 -device scsi-hd,drive=drive-system-disk,bus=scsi0.0,bootindex=200 \ -device virtio-net-pci,netdev=h1,bootindex=101 \ -netdev tap,id=h1 -monitor stdio -boot menu=on \ -drive file=/images/RHEL-Server-6.4-64-virtio.qcow2,if=none,id=drive-system-disk2 \ -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi02 \ -device scsi-hd,drive=drive-system-disk2,bus=scsi0.0,bootindex=202 /pci@i0cf8/ethernet@3/ethernet-phy@0 /pci@i0cf8/scsi@4/channel@0/disk@0,0 /pci@i0cf8/scsi@4/channel@0/disk@1,0
(I outputed the bootindex string) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 479113b..3f42660 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -476,6 +476,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data) FWCfgState *s = container_of(n, FWCfgState, machine_ready); char *bootindex = get_boot_devices_list(&len);
+ printf("%s\n", bootindex); fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len); }
Am 30.05.2013 15:13, schrieb Amos Kong:
On Thu, May 30, 2013 at 02:09:25PM +0200, Stefan Priebe - Profihost AG wrote:
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
return l; } } l += snprintf(p + l , size - l, "/");
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
BusClass *bc = BUS_CLASS(class);
class->unparent = bus_unparent;
bc->get_fw_dev_path = default_bus_get_fw_dev_path; }
static void qbus_finalize(Object *obj)
diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path; }
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
Hi Stefan,
Can you provide your full command-lines ?
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
For me, they all work, (1. check the bootindex string, 2. check boot menu by entering F12, 3. check by waiting ).
Oh it does only NOT work if i have TWO network cards. It never seems to try to boot from scsi0. It tries PXE net0 then net1 and then it restarts.
Example: Command line: qemu -chardev socket,id=qmp,path=/var/run/qemu-server/155.qmp,server,nowait -mon chardev=qmp,mode=control -pidfile /var/run/qemu-server/155.pid -daemonize -name TTT -smp sockets=1,cores=4 -nodefaults -boot menu=on -vga cirrus -k de -m 4096 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 -drive file=rbd:stor/vmdisk-1:mon_host=10.255.0.100:6789;10.255.0.101:6789;10.255.0.102:6789;:auth_supported=none,if=none,id=drive-scsi0,iops_rd=215,iops_wr=155,bps_rd=136314880,bps_wr=94371840,aio=native,discard=on -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=200 -drive if=none,id=drive-ide2,media=cdrom,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2 -netdev type=tap,id=net0,ifname=tap155i0,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=6A:32:5C:4B:38:F4,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=100 -netdev type=tap,id=net1,ifname=tap155i1,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=D6:3A:F6:E2:91:0A,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=101 -rtc base=localtime
Stefan
On Thu, May 30, 2013 at 10:30:21PM +0200, Stefan Priebe wrote:
Am 30.05.2013 15:13, schrieb Amos Kong:
On Thu, May 30, 2013 at 02:09:25PM +0200, Stefan Priebe - Profihost AG wrote:
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
Hi Stefan,
Can you provide your full command-lines ?
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
For me, they all work, (1. check the bootindex string, 2. check boot menu by entering F12, 3. check by waiting ).
Thanks for your reply.
Oh it does only NOT work if i have TWO network cards. It never seems to try to boot from scsi0. It tries PXE net0 then net1 and then it restarts.
Something is wrong here, '-boot menu=on ' -> guest could not restart if no available boot device, it will also try to boot from other unselected devices (DVD, floppy)
'-boot menu=on,strict=on,reboot-timeout=1000' -> boot from net0, net1, disk1, then restart ...
It seems the problem of your bios.bin or rbd device.
You can try with a scsi disk (unavailable) # qemu-img create /tmp/none.qcow2 -f qcow2 1M
I'm using seabios(pc-bios/bios.bin) in qemu repo & latest seabios in seabios.org
Example: Command line: qemu -chardev socket,id=qmp,path=/var/run/qemu-server/155.qmp,server,nowait -mon chardev=qmp,mode=control -pidfile /var/run/qemu-server/155.pid -daemonize -name TTT -smp sockets=1,cores=4 -nodefaults -boot menu=on -vga cirrus -k de -m 4096 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 -drive file=rbd:stor/vmdisk-1:mon_host=10.255.0.100:6789;10.255.0.101:6789;10.255.0.102:6789;:auth_supported=none,if=none,id=drive-scsi0,iops_rd=215,iops_wr=155,bps_rd=136314880,bps_wr=94371840,aio=native,discard=on -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=200 -drive if=none,id=drive-ide2,media=cdrom,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2 -netdev type=tap,id=net0,ifname=tap155i0,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=6A:32:5C:4B:38:F4,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=100 -netdev type=tap,id=net1,ifname=tap155i1,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=D6:3A:F6:E2:91:0A,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=101 -rtc base=localtime
This patch only fixed the 'wrong' fw_dev_path. If qemu passes valid bootindex string to seabios, then patch works as expected.
---
I re-tested with a similar commandline. it tried to boot from net0, net1, disk1 (works as expected).
1. boot guest ( paused in the begin stage) # qemu-upstream -name TTT -smp sockets=1,cores=4 -nodefaults -boot menu=on \ -vga cirrus -m 4096 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 \ -device usb-tablet,id=tablet,bus=uhci.0,port=1 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 \ -drive file=/images/none.qcow2,if=none,id=drive-scsi0,aio=native,discard=on \ -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=200 \ -drive if=none,id=drive-ide2,media=cdrom,aio=native \ -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2 \ -netdev type=tap,id=net0,ifname=tap155i0,vhost=on \ -device virtio-net-pci,mac=6A:32:5C:4B:38:F4,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=100 \ -netdev type=tap,id=net1,ifname=tap155i1,vhost=on \ -device virtio-net-pci,mac=D6:3A:F6:E2:91:0A,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=101 \ -rtc base=localtime \ -chardev socket,id=seabioslog,path=/tmp/seabioslog,server,nowait \ -device isa-debugcon,chardev=seabioslog,iobase=0x402 -S -monitor stdio
2. start to connect seabios debug log # nc -U /tmp/seabioslog
3. continue guest in monitor # (qemu) cont
| Press F12 for boot menu. | | Searching bootorder for: HALT | drive 0x000fd870: PCHS=2/16/64 translation=large LCHS=2/16/64 s=2048 | Running option rom at cb00:0003 | Space available for UMB: 000cd800-000ed000 | Returned 57344 bytes of ZoneHigh | e820 map has 8 items: | 0: 0000000000000000 - 000000000009fc00 = 1 RAM | 1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED | 2: 00000000000f0000 - 0000000000100000 = 2 RESERVED | 3: 0000000000100000 -enter handle_19: | NULL | Booting from ROM... | Booting from c900:0358 | enter handle_18: | NULL | Booting from ROM... | Booting from ca00:0358 | enter handle_18: | NULL | Booting from Hard Disk... | Boot failed: not a bootable disk | | enter handle_18: | NULL | Booting from DVD/CD... | Device reports MEDIUM NOT PRESENT | scsi_is_ready returned -1 | Boot failed: Could not read from CDROM (code 0003) | enter handle_18: | NULL | Booting from Floppy... | Boot failed: could not read the boot disk | | enter handle_18: | NULL | No bootable device.
Stefan
Am 31.05.2013 00:51, schrieb Amos Kong:
On Thu, May 30, 2013 at 10:30:21PM +0200, Stefan Priebe wrote:
Am 30.05.2013 15:13, schrieb Amos Kong:
On Thu, May 30, 2013 at 02:09:25PM +0200, Stefan Priebe - Profihost AG wrote:
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
Hi Stefan,
Can you provide your full command-lines ?
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
For me, they all work, (1. check the bootindex string, 2. check boot menu by entering F12, 3. check by waiting ).
Thanks for your reply.
Oh it does only NOT work if i have TWO network cards. It never seems to try to boot from scsi0. It tries PXE net0 then net1 and then it restarts.
Something is wrong here, '-boot menu=on ' -> guest could not restart if no available boot device, it will also try to boot from other unselected devices (DVD, floppy)
'-boot menu=on,strict=on,reboot-timeout=1000' -> boot from net0, net1, disk1, then restart ...
It seems the problem of your bios.bin or rbd device.
I've also updated to seabios 1.7.2.2
I'm using seabios(pc-bios/bios.bin) in qemu repo & latest seabios in seabios.org
Example: Command line: qemu -chardev socket,id=qmp,path=/var/run/qemu-server/155.qmp,server,nowait -mon chardev=qmp,mode=control -pidfile /var/run/qemu-server/155.pid -daemonize -name TTT -smp sockets=1,cores=4 -nodefaults -boot menu=on -vga cirrus -k de -m 4096 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 -drive file=rbd:stor/vmdisk-1:mon_host=10.255.0.100:6789;10.255.0.101:6789;10.255.0.102:6789;:auth_supported=none,if=none,id=drive-scsi0,iops_rd=215,iops_wr=155,bps_rd=136314880,bps_wr=94371840,aio=native,discard=on -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=200 -drive if=none,id=drive-ide2,media=cdrom,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2 -netdev type=tap,id=net0,ifname=tap155i0,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=6A:32:5C:4B:38:F4,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=100 -netdev type=tap,id=net1,ifname=tap155i1,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=D6:3A:F6:E2:91:0A,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=101 -rtc base=localtime
This patch only fixed the 'wrong' fw_dev_path. If qemu passes valid bootindex string to seabios, then patch works as expected.
I re-tested with a similar commandline. it tried to boot from net0, net1, disk1 (works as expected).
...
thanks for this great explanation. I've done what you sayd but it still does not work.
Here is the output of the seabis debug log where you see the loop: http://pastebin.com/raw.php?i=e53rdW2b
Stefan
On Fri, May 31, 2013 at 08:57:00AM +0200, Stefan Priebe - Profihost AG wrote:
Am 31.05.2013 00:51, schrieb Amos Kong:
On Thu, May 30, 2013 at 10:30:21PM +0200, Stefan Priebe wrote:
Am 30.05.2013 15:13, schrieb Amos Kong:
On Thu, May 30, 2013 at 02:09:25PM +0200, Stefan Priebe - Profihost AG wrote:
Am 29.05.2013 09:56, schrieb Amos Kong:
Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, typename will be added to fw_dev_path by default, the new fw_dev_path could not be identified by seabios. It causes that bootindex parameter of scsi device doesn't work.
This patch implements get_fw_dev_path() in BusClass, it will be called if bus doesn't implement the method, tyename will be added to fw_dev_path. If the implemented method returns NULL, nothing will be added to fw_dev_path.
It also implements virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios.
Signed-off-by: Amos Kong akong@redhat.com
v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: implement default get_fw_dev_path() in BusClass
hw/core/qdev.c | 10 +++++++++- hw/virtio/virtio-bus.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6985ad8..9190a7e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -515,7 +515,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else {
l += snprintf(p + l, size - l, "%s", object_get_typename(OBJECT(dev)));
} l += snprintf(p + l , size - l, "/");return l; }
@@ -867,9 +867,17 @@ static void qbus_initfn(Object *obj) QTAILQ_INIT(&bus->children); }
+static char *default_bus_get_fw_dev_path(DeviceState *dev) +{
- return g_strdup(object_get_typename(OBJECT(dev)));
+}
static void bus_class_init(ObjectClass *class, void *data) {
- BusClass *bc = BUS_CLASS(class);
- class->unparent = bus_unparent;
- bc->get_fw_dev_path = default_bus_get_fw_dev_path;
}
static void qbus_finalize(Object *obj) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index ea2e11a..6849a01 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) return qdev_get_dev_path(proxy); }
+static char *virtio_bus_get_fw_dev_path(DeviceState *dev) +{
- return NULL;
+}
static void virtio_bus_class_init(ObjectClass *klass, void *data) { BusClass *bus_class = BUS_CLASS(klass); bus_class->get_dev_path = virtio_bus_get_dev_path;
- bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path;
}
static const TypeInfo virtio_bus_info = {
To me booting VMs with more than one SCSI disk does still not work.
Hi Stefan,
Can you provide your full command-lines ?
net: bootindex=100 scsi0: bootindex=201
does not work
this one works fine: net: bootindex=200 scsi0: bootindex=101
For me, they all work, (1. check the bootindex string, 2. check boot menu by entering F12, 3. check by waiting ).
Thanks for your reply.
Oh it does only NOT work if i have TWO network cards. It never seems to try to boot from scsi0. It tries PXE net0 then net1 and then it restarts.
Something is wrong here, '-boot menu=on ' -> guest could not restart if no available boot device, it will also try to boot from other unselected devices (DVD, floppy)
'-boot menu=on,strict=on,reboot-timeout=1000' -> boot from net0, net1, disk1, then restart ...
It seems the problem of your bios.bin or rbd device.
I've also updated to seabios 1.7.2.2
I'm using seabios(pc-bios/bios.bin) in qemu repo & latest seabios in seabios.org
Example: Command line: qemu -chardev socket,id=qmp,path=/var/run/qemu-server/155.qmp,server,nowait -mon chardev=qmp,mode=control -pidfile /var/run/qemu-server/155.pid -daemonize -name TTT -smp sockets=1,cores=4 -nodefaults -boot menu=on -vga cirrus -k de -m 4096 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -device virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5 -drive file=rbd:stor/vmdisk-1:mon_host=10.255.0.100:6789;10.255.0.101:6789;10.255.0.102:6789;:auth_supported=none,if=none,id=drive-scsi0,iops_rd=215,iops_wr=155,bps_rd=136314880,bps_wr=94371840,aio=native,discard=on -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=200 -drive if=none,id=drive-ide2,media=cdrom,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2 -netdev type=tap,id=net0,ifname=tap155i0,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=6A:32:5C:4B:38:F4,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=100 -netdev type=tap,id=net1,ifname=tap155i1,script=/var/lib/qemu-server/pve-bridge,vhost=on -device virtio-net-pci,mac=D6:3A:F6:E2:91:0A,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=101 -rtc base=localtime
This patch only fixed the 'wrong' fw_dev_path. If qemu passes valid bootindex string to seabios, then patch works as expected.
I re-tested with a similar commandline. it tried to boot from net0, net1, disk1 (works as expected).
...
thanks for this great explanation. I've done what you sayd but it still does not work.
Here is the output of the seabis debug log where you see the loop: http://pastebin.com/raw.php?i=e53rdW2b
| found virtio-scsi at 0:5 | Searching bootorder for: /pci@i0cf8/*@5/*@0/*@0,0 | virtio-scsi vendor='QEMU' product='QEMU HARDDISK' rev='1.5.' type=0 removable=0 | virtio-scsi blksize=512 sectors=104857600
It mean the fixed fw_dev_path can be identified.
You problem is a disrelated issue. I didn't see handle_18 before restart, it means guest succeses to boot from second nic. How does the resume be caused?
Please only aasign two nics for guest, let's see if restart occurs.
Did you config pxe+tftp service for second nic? did you set some rom that just reboot the system?
Stefan
Am 31.05.2013 13:02, schrieb Amos Kong:
...
thanks for this great explanation. I've done what you sayd but it still does not work.
Here is the output of the seabis debug log where you see the loop: http://pastebin.com/raw.php?i=e53rdW2b
| found virtio-scsi at 0:5 | Searching bootorder for: /pci@i0cf8/*@5/*@0/*@0,0 | virtio-scsi vendor='QEMU' product='QEMU HARDDISK' rev='1.5.' type=0 removable=0 | virtio-scsi blksize=512 sectors=104857600
It mean the fixed fw_dev_path can be identified.
You problem is a disrelated issue. I didn't see handle_18 before restart, it means guest succeses to boot from second nic. How does the resume be caused?
No it def. does not succeed. Only the first nic gets a reply from a tftp server. It shows a menu and then does: localboot -1
which causes to go to the next boot device (pxelinux.cfg).
It then tries to boot from the 2nd nic. But there it gets only an IP through DHCP but no tftp details or even an answer.
PS: this was working fine with Qemu 1.4.2
Please only aasign two nics for guest, let's see if restart occurs.
With one nic i see correctly - no bootable device restart in 1 sec. With only two nics the "screen" just turns black and nothing happens at all after trying PXE from 2nd nic. But no message and no restart.
Did you config pxe+tftp service for second nic? did you set some rom that just reboot the system?
DHCP yes tftp service no.
Stefan
Am 31.05.2013 13:02, schrieb Amos Kong:
...
thanks for this great explanation. I've done what you sayd but it still does not work.
Here is the output of the seabis debug log where you see the loop: http://pastebin.com/raw.php?i=e53rdW2b
| found virtio-scsi at 0:5 | Searching bootorder for: /pci@i0cf8/*@5/*@0/*@0,0 | virtio-scsi vendor='QEMU' product='QEMU HARDDISK' rev='1.5.' type=0 removable=0 | virtio-scsi blksize=512 sectors=104857600
It mean the fixed fw_dev_path can be identified.
You problem is a disrelated issue. I didn't see handle_18 before restart, it means guest succeses to boot from second nic. How does the resume be caused?
No it def. does not succeed. Only the first nic gets a reply from a tftp server. It shows a menu and then does: localboot -1
which causes to go to the next boot device (pxelinux.cfg).
It then tries to boot from the 2nd nic. But there it gets only an IP through DHCP but no tftp details or even an answer.
PS: this was working fine with Qemu 1.4.2
Please only aasign two nics for guest, let's see if restart occurs.
With one nic i see correctly - no bootable device restart in 1 sec. With only two nics the "screen" just turns black and nothing happens at all after trying PXE from 2nd nic. But no message and no restart.
Did you config pxe+tftp service for second nic? did you set some rom that just reboot the system?
DHCP yes tftp service no.
Stefan
Applied. Thanks.
Regards,
Anthony Liguori