To format logical volume, you need the use the block-device command (it’s a lite confusing)
The basic steps are:
# Create logical volume
out=$(maas $login volume-group create-logical-volume $system_id $vg_id name=$name size=$size)
# Get the id of the new logical-volume
id=$(echo $out | jq -r '.id')
# Format the partition
maas $login block-device format $system_id $id fstype=$fs > /dev/null
# Mount the partition
maas $login block-device mount $system_id $id mount_point=$mp mount_options=$mo
Note:
The block-device id used for formatting and mounting is the logical-volume id.
Settings used for swap type: fstype="swap", mount_point="none" and mount_options=sw