X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=hw%2Fscsi%2Fscsi-disk.c;h=74e6a14c2963383fd0bedd0714c6974fc023e6ae;hb=129db3679c45bfc86d2003ebea808a2d626820e7;hp=02733dc507f5735f2fd242745b99e53ba1d7ec49;hpb=637d640fbbce498bd43a58b7a20b4190a1534751;p=qemu.git diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 02733dc50..74e6a14c2 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -61,8 +61,9 @@ typedef struct SCSIDiskReq { BlockAcctCookie acct; } SCSIDiskReq; -#define SCSI_DISK_F_REMOVABLE 0 -#define SCSI_DISK_F_DPOFUA 1 +#define SCSI_DISK_F_REMOVABLE 0 +#define SCSI_DISK_F_DPOFUA 1 +#define SCSI_DISK_F_NO_REMOVABLE_DEVOPS 2 struct SCSIDiskState { @@ -2110,7 +2111,8 @@ static int scsi_initfn(SCSIDevice *dev) return -1; } - if (s->features & (1 << SCSI_DISK_F_REMOVABLE)) { + if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) && + !(s->features & (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS))) { bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_removable_block_ops, s); } else { bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_block_ops, s); @@ -2322,6 +2324,12 @@ static int scsi_block_initfn(SCSIDevice *dev) } else { s->qdev.blocksize = 512; } + + /* Makes the scsi-block device not removable by using HMP and QMP eject + * command. + */ + s->features |= (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS); + return scsi_initfn(&s->qdev); }