diff --git a/xenmgr/Vm/Config.hs b/xenmgr/Vm/Config.hs index f8f83620..a549e317 100644 --- a/xenmgr/Vm/Config.hs +++ b/xenmgr/Vm/Config.hs @@ -688,20 +688,26 @@ diskSpec :: Uuid -> Disk -> Rpc DiskSpec diskSpec uuid d = do stubdom <- readConfigPropertyDef uuid vmStubdom False hd_type <- readConfigPropertyDef uuid vmHdType "ide" - return $ printf "'format=raw,backendtype=%s,vdev=%s,access=%s,devtype=%s,script=%s,target=%s'" - (cdType stubdom d) + return $ printf "'format=%s,backendtype=%s,vdev=%s,access=%s,devtype=%s,script=%s,target=%s'" + (format disk_type) + (backendType disk_type disk_dev_type) (adjDiskDevice d hd_type) (enumMarshall $ diskMode d) (if (disk_dev_type == "cdrom") then disk_dev_type else "disk") (script disk_type) - (target disk_type (diskPath d)) + (diskPath d) where disk_type = enumMarshall $ diskType d disk_dev_type = enumMarshall $ diskDeviceType d - cdType stubdom d = - case disk_dev_type of - "cdrom" -> "phy" - _ -> "phy" + format "vhd" = "vhd" + format "aio" = "aio" + format _ = "raw" + backendType disk_type disk_dev_type = + case (disk_dev_type, disk_type) of + ("cdrom", _ ) -> "phy" + (_ , "vhd") -> "tap" + (_ , "aio") -> "tap" + (_ , _ ) -> "phy" -- convert hdX -> xvdX if hdtype is 'ahci' adjDiskDevice d hd_type = case hd_type of @@ -710,9 +716,6 @@ diskSpec uuid d = do script "vhd" = "block-tap" script "aio" = "block-tap" script _ = "block" - target "vhd" path = printf "vhd:%s" path - target "aio" path = printf "aio:%s" path - target _ path = path -- Next section: information about Network Interfaces nicSpecs :: VmConfig -> Rpc [NicSpec]