mirror of https://github.com/xemu-project/xemu.git
Merge remote branch 'kwolf/for-anthony' into staging
This commit is contained in:
commit
c7ba56c4f0
|
@ -238,7 +238,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
|
||||||
|
|
||||||
if (!bdrv_is_read_only(bs)) {
|
if (!bdrv_is_read_only(bs)) {
|
||||||
sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
|
sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
|
||||||
if (sectors == 0) {
|
if (sectors <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2630,6 +2630,10 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
|
||||||
s->drive_kind = IDE_CD;
|
s->drive_kind = IDE_CD;
|
||||||
bdrv_set_change_cb(bs, cdrom_change_cb, s);
|
bdrv_set_change_cb(bs, cdrom_change_cb, s);
|
||||||
} else {
|
} else {
|
||||||
|
if (!bdrv_is_inserted(s->bs)) {
|
||||||
|
error_report("Device needs media, but drive is empty");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (bdrv_is_read_only(bs)) {
|
if (bdrv_is_read_only(bs)) {
|
||||||
error_report("Can't use a read-only drive");
|
error_report("Can't use a read-only drive");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1059,6 +1059,11 @@ static int scsi_disk_initfn(SCSIDevice *dev)
|
||||||
s->bs = s->qdev.conf.bs;
|
s->bs = s->qdev.conf.bs;
|
||||||
is_cd = bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM;
|
is_cd = bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM;
|
||||||
|
|
||||||
|
if (!is_cd && !bdrv_is_inserted(s->bs)) {
|
||||||
|
error_report("Device needs media, but drive is empty");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) {
|
if (bdrv_get_on_error(s->bs, 1) != BLOCK_ERR_REPORT) {
|
||||||
error_report("Device doesn't support drive option rerror");
|
error_report("Device doesn't support drive option rerror");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qemu-common.h>
|
#include <qemu-common.h>
|
||||||
|
#include "qemu-error.h"
|
||||||
#include "virtio-blk.h"
|
#include "virtio-blk.h"
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include <scsi/sg.h>
|
# include <scsi/sg.h>
|
||||||
|
@ -490,6 +491,15 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
|
||||||
static int virtio_blk_id;
|
static int virtio_blk_id;
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
|
|
||||||
|
if (!conf->bs) {
|
||||||
|
error_report("virtio-blk-pci: drive property not set");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!bdrv_is_inserted(conf->bs)) {
|
||||||
|
error_report("Device needs media, but drive is empty");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK,
|
s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK,
|
||||||
sizeof(struct virtio_blk_config),
|
sizeof(struct virtio_blk_config),
|
||||||
sizeof(VirtIOBlock));
|
sizeof(VirtIOBlock));
|
||||||
|
|
|
@ -546,11 +546,10 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
|
||||||
proxy->class_code != PCI_CLASS_STORAGE_OTHER)
|
proxy->class_code != PCI_CLASS_STORAGE_OTHER)
|
||||||
proxy->class_code = PCI_CLASS_STORAGE_SCSI;
|
proxy->class_code = PCI_CLASS_STORAGE_SCSI;
|
||||||
|
|
||||||
if (!proxy->block.bs) {
|
vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
|
||||||
error_report("virtio-blk-pci: drive property not set");
|
if (!vdev) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
|
|
||||||
vdev->nvectors = proxy->nvectors;
|
vdev->nvectors = proxy->nvectors;
|
||||||
virtio_init_pci(proxy, vdev,
|
virtio_init_pci(proxy, vdev,
|
||||||
PCI_VENDOR_ID_REDHAT_QUMRANET,
|
PCI_VENDOR_ID_REDHAT_QUMRANET,
|
||||||
|
|
|
@ -54,6 +54,6 @@ ETEXI
|
||||||
DEF("resize", img_resize,
|
DEF("resize", img_resize,
|
||||||
"resize filename [+ | -]size")
|
"resize filename [+ | -]size")
|
||||||
STEXI
|
STEXI
|
||||||
@item rebase @var{filename} [+ | -]@var{size}
|
@item resize @var{filename} [+ | -]@var{size}
|
||||||
@end table
|
@end table
|
||||||
ETEXI
|
ETEXI
|
||||||
|
|
Loading…
Reference in New Issue