From 4227909507df524f7544c786ba68d0623e413f5c Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Wed, 6 Dec 2023 10:15:33 -0500 Subject: [PATCH] xenmgr: Change libxl disk-spec for blktap With libxl supporting blktap/vbd3, we can switch from backendtype=phy to backendtype=tap. When doing so, the target= no longer needs an tap:/aio: prefix, but the format= needs to convey the information. backendtype=phy is still required for LVM partitions, so a little more care is needed for specifying it. Signed-off-by: Jason Andryuk --- xenmgr/Vm/Config.hs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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]