summary refs log tree commit diff stats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorFloris Bos <bos@je-eigen-domein.nl>2012-03-12 21:05:09 +0100
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:39 +0200
commit27e0c9a1bbd166a67c16291016fba298a8e47140 (patch)
tree02a8183547b76d83f6ac422834d97814278bef5a /hw/ide/qdev.c
parent2844bdd99a96dc32a6ebf464f49e65be31da1c14 (diff)
downloadfocaccia-qemu-27e0c9a1bbd166a67c16291016fba298a8e47140.tar.gz
focaccia-qemu-27e0c9a1bbd166a67c16291016fba298a8e47140.zip
ide: Add "model=s" qdev option
Allow the user to override the default disk model name "QEMU HARDDISK".

Some Linux distributions use the /dev/disk/by-id/scsi-SATA_name-of-disk-
model_serial addressing scheme when refering to partitions in /etc/fstab
and elsewhere. This causes problems when starting a disk image taken from
an existing physical server under qemu, because when running under qemu
name-of-disk-model is always "QEMU HARDDISK".

This patch introduces a model=s option which in combination with the
existing serial=s option can be used to fake the disk the operating
system was previously on, allowing the OS to boot properly.

Cc: kwolf@redhat.com
Signed-off-by: Floris Bos <dev@noc-ps.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index f6a48961c5..07227c7455 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -136,7 +136,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
         }
     }
 
-    if (ide_init_drive(s, dev->conf.bs, kind, dev->version, serial) < 0) {
+    if (ide_init_drive(s, dev->conf.bs, kind,
+                       dev->version, serial, dev->model) < 0) {
         return -1;
     }
 
@@ -173,7 +174,8 @@ static int ide_drive_initfn(IDEDevice *dev)
 #define DEFINE_IDE_DEV_PROPERTIES()                     \
     DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),        \
     DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),  \
-    DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial)
+    DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial),\
+    DEFINE_PROP_STRING("model", IDEDrive, dev.model)
 
 static Property ide_hd_properties[] = {
     DEFINE_IDE_DEV_PROPERTIES(),