Merge pull request #109 from jschintag/qemu-img-sharing

virtio-blk: Add support for share-rw flag
This commit is contained in:
Mark Ryan 2019-09-16 09:15:17 +02:00 committed by GitHub
commit 8cba5a8e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -728,6 +728,9 @@ type BlockDevice struct {
// DevNo identifies the ccw devices for s390x architecture
DevNo string
// ShareRW enables multiple qemu instances to share the File
ShareRW bool
}
// Valid returns true if the BlockDevice structure is valid and complete.
@ -766,6 +769,10 @@ func (blkdev BlockDevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", blkdev.DevNo))
}
if blkdev.ShareRW {
deviceParams = append(deviceParams, fmt.Sprintf(",share-rw=on"))
}
blkParams = append(blkParams, fmt.Sprintf("id=%s", blkdev.ID))
blkParams = append(blkParams, fmt.Sprintf(",file=%s", blkdev.File))
blkParams = append(blkParams, fmt.Sprintf(",aio=%s", blkdev.AIO))