libxl, hotplug/Linux: default to phy backend for raw format file, take 2
PATCH RESEND 1/1 libxl, hotplug/Linux: default to phy backend for raw format file, take 2
This patch resurrects 11a63a166. The previous patch had a bug that wrong "physical-device" was written to xenstore causing block script execution fail. This patch fixes that problem.
Following configurations have been tested:
1. Raw file and PV
2. Raw file and HVM
3. Block device and PV
4. Block device and HVM
Creation / destruction / local migration all worked.
Original commit message from 11a63a166:
Modify libxl and hotplug script to allow raw format file to use phy backend.
The block script now tests the path and determine the actual type of file (block device or regular file) then use the actual type to determine which branch to run.
With these changes, plus the current ordering of backend preference (phy
Quoted 1 line
qdisk > tap), we will use phy backend for raw format file by default.
--- tools/hotplug/Linux/block | 16 +++++++++------- tools/libxl/libxl.c | 6 +++--- tools/libxl/libxl_device.c | 2 ++ tools/libxl/libxl_linux.c | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-)
tools/hotplug/Linux/block +9 -7
@@ -206,6 +206,13 @@ and so cannot be mounted ${m2}${when}." t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') +p=$(xenstore_read "$XENBUS_PATH/params") +mode=$(xenstore_read "$XENBUS_PATH/mode") +if [ -b "$p" ]; then + truetype="phy" +elif [ -f "$p" ]; then + truetype="file" +fi case "$command" in add)
@@ -217,16 +224,11 @@ case "$command" in exit 0 fi - if [ -n "$t" ] - then - p=$(xenstore_read "$XENBUS_PATH/params") - mode=$(xenstore_read "$XENBUS_PATH/mode") - fi FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") FRONTEND_UUID=$(xenstore_read_default \ "/local/domain/$FRONTEND_ID/vm" 'unknown') - case $t in + case $truetype in phy) dev=$(expand_dev $p)
@@ -319,7 +321,7 @@ mount it read-write in a guest domain." ;; remove) - case $t in + case $truetype in phy) exit 0 ;;
tools/libxl/libxl.c +3 -3
@@ -2413,9 +2413,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,if (!disk->script && disk->backend_domid ==LIBXL_TOOLSTACK_DOMID ) {int major, minor; -libxl__device_physdisk_major_minor (dev, &major, &minor); -flexarray_append_pair (back,"physical-device" , -libxl__sprintf (gc,"%x:%x" , major, minor)); +if (!libxl__device_physdisk_major_minor (dev, &major, &minor)) +flexarray_append_pair (back,"physical-device" , +libxl__sprintf (gc,"%x:%x" , major, minor)); }assert (device->backend_kind ==LIBXL__DEVICE_KIND_VBD );
tools/libxl/libxl_device.c +2 -0
@@ -332,6 +332,8 @@ int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *mistruct stat buf;if (stat (physpath, &buf) <0 )return -1 ; +if (!S_ISBLK (buf.st_mode)) +return -1 ; *major =major (buf.st_rdev); *minor =minor (buf.st_rdev);return 0 ;
tools/libxl/libxl_linux.c +3 -3
@@ -19,11 +19,11 @@int libxl__try_phy_backend (mode_t st_mode) { -if (!S_ISBLK (st_mode)) { -return 0 ; +if (S_ISBLK (st_mode) ||S_ISREG (st_mode)) { +return 1 ; } -return 1 ; +return 0 ; }#define EXT_SHIFT 28
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
oops, I was literally reviewing the previous send as you sent this...
Quoted 122 lines · Wei Liu
This patch resurrects
11a63a166. The previous patch had a bug that wrong "physical-device" was written to xenstore causing block script execution fail. This patch fixes that problem.Following configurations have been tested:
1. Raw file and PV
2. Raw file and HVM
3. Block device and PV
4. Block device and HVMCreation / destruction / local migration all worked.
Original commit message from
11a63a166:Modify libxl and hotplug script to allow raw format file to use phy backend.
The block script now tests the path and determine the actual type of file (block device or regular file) then use the actual type to determine which branch to run.
With these changes, plus the current ordering of backend preference (phy
Quoted 1 line
qdisk > tap), we will use phy backend for raw format file by default.
Signed-off-by Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Ian Jackson <[email protected]>Cc Roger Pau Monné <[email protected]>Acked-by Roger Pau Monné <[email protected]>--- tools/hotplug/Linux/block | 16 +++++++++------- tools/libxl/libxl.c | 6 +++--- tools/libxl/libxl_device.c | 2 ++ tools/libxl/libxl_linux.c | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-)tools/hotplug/Linux/block +9
-7@@ -206,6 +206,13 @@ and so cannot be mounted ${m2}${when}." t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') +p=$(xenstore_read "$XENBUS_PATH/params") +mode=$(xenstore_read "$XENBUS_PATH/mode") +if [ -b "$p" ]; then + truetype="phy" +elif [ -f "$p" ]; then + truetype="file" +fi case "$command" in add)@@ -217,16 +224,11 @@ case "$command" in exit 0 fi - if [ -n "$t" ] - then - p=$(xenstore_read "$XENBUS_PATH/params") - mode=$(xenstore_read "$XENBUS_PATH/mode") - fi FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") FRONTEND_UUID=$(xenstore_read_default \ "/local/domain/$FRONTEND_ID/vm" 'unknown') - case $t in + case $truetype in phy) dev=$(expand_dev $p)@@ -319,7 +321,7 @@ mount it read-write in a guest domain." ;; remove) - case $t in + case $truetype in phy) exit 0 ;;tools/libxl/libxl.c +3
-3@@ -2413,9 +2413,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,if (!disk->script && disk->backend_domid ==LIBXL_TOOLSTACK_DOMID ) {int major, minor; -libxl__device_physdisk_major_minor (dev, &major, &minor); -flexarray_append_pair (back,"physical-device" , -libxl__sprintf (gc,"%x:%x" , major, minor)); +if (!libxl__device_physdisk_major_minor (dev, &major, &minor)) +flexarray_append_pair (back,"physical-device" , +libxl__sprintf (gc,"%x:%x" , major, minor)); }assert (device->backend_kind ==LIBXL__DEVICE_KIND_VBD );tools/libxl/libxl_device.c +2
-0@@ -332,6 +332,8 @@ int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *mistruct stat buf;if (stat (physpath, &buf) <0 )return -1 ; +if (!S_ISBLK (buf.st_mode)) +return -1 ; *major =major (buf.st_rdev); *minor =minor (buf.st_rdev);return 0 ;tools/libxl/libxl_linux.c +0
-1@@ -19,11 +19,11 @@int libxl__try_phy_backend (mode_t st_mode) { -if (!S_ISBLK (st_mode)) {
tools/libxl/libxl_linux.c line 29
Quoted 10 lines
tools/libxl/libxl_linux.c +3
-2-return 0 ; +if (S_ISBLK (st_mode) ||S_ISREG (st_mode)) { +return 1 ; } -return 1 ; +return 0 ; }#define EXT_SHIFT 28
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Il 08/01/2015 14:46, Wei Liu ha scritto:
Quoted 15 lines
This patch resurrects
11a63a166. The previous patch had a bug that wrong "physical-device" was written to xenstore causing block script execution fail. This patch fixes that problem.Following configurations have been tested:
1. Raw file and PV
2. Raw file and HVM
3. Block device and PV
4. Block device and HVMCreation / destruction / local migration all worked.
Original commit message from
11a63a166:
Quoted 9 lines
Modify libxl and hotplug script to allow raw format file to use phy backend.
The block script now tests the path and determine the actual type of file (block device or regular file) then use the actual type to determine which branch to run.
With these changes, plus the current ordering of backend preference (phy
Quoted 1 line
qdisk > tap), we will use phy backend for raw format file by default.
Sorry for the probably stupid question, what are the pros and cons of default use of phy instead qdisk for raw files as domU disk?
Quoted 97 lines
Signed-off-by Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Ian Jackson <[email protected]>Cc Roger Pau Monné <[email protected]>Acked-by Roger Pau Monné <[email protected]>--- tools/hotplug/Linux/block | 16 +++++++++------- tools/libxl/libxl.c | 6 +++--- tools/libxl/libxl_device.c | 2 ++ tools/libxl/libxl_linux.c | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-)tools/hotplug/Linux/block +9
-7@@ -206,6 +206,13 @@ and so cannot be mounted ${m2}${when}." t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') +p=$(xenstore_read "$XENBUS_PATH/params") +mode=$(xenstore_read "$XENBUS_PATH/mode") +if [ -b "$p" ]; then + truetype="phy" +elif [ -f "$p" ]; then + truetype="file" +fi case "$command" in add)@@ -217,16 +224,11 @@ case "$command" in exit 0 fi - if [ -n "$t" ] - then - p=$(xenstore_read "$XENBUS_PATH/params") - mode=$(xenstore_read "$XENBUS_PATH/mode") - fi FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") FRONTEND_UUID=$(xenstore_read_default \ "/local/domain/$FRONTEND_ID/vm" 'unknown') - case $t in + case $truetype in phy) dev=$(expand_dev $p)@@ -319,7 +321,7 @@ mount it read-write in a guest domain." ;; remove) - case $t in + case $truetype in phy) exit 0 ;;tools/libxl/libxl.c +3
-3@@ -2413,9 +2413,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,if (!disk->script && disk->backend_domid ==LIBXL_TOOLSTACK_DOMID ) {int major, minor; -libxl__device_physdisk_major_minor (dev, &major, &minor); -flexarray_append_pair (back,"physical-device" , -libxl__sprintf (gc,"%x:%x" , major, minor)); +if (!libxl__device_physdisk_major_minor (dev, &major, &minor)) +flexarray_append_pair (back,"physical-device" , +libxl__sprintf (gc,"%x:%x" , major, minor)); }assert (device->backend_kind ==LIBXL__DEVICE_KIND_VBD );tools/libxl/libxl_device.c +2
-0@@ -332,6 +332,8 @@ int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *mistruct stat buf;if (stat (physpath, &buf) <0 )return -1 ; +if (!S_ISBLK (buf.st_mode)) +return -1 ; *major =major (buf.st_rdev); *minor =minor (buf.st_rdev);return 0 ;tools/libxl/libxl_linux.c +0
-1@@ -19,11 +19,11 @@int libxl__try_phy_backend (mode_t st_mode) { -if (!S_ISBLK (st_mode)) {
tools/libxl/libxl_linux.c line 29
Quoted 10 lines
tools/libxl/libxl_linux.c +3
-2-return 0 ; +if (S_ISBLK (st_mode) ||S_ISREG (st_mode)) { +return 1 ; } -return 1 ; +return 0 ; }#define EXT_SHIFT 28
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 23 lines · Fabio Fantoni
Il 08/01/2015 14:46, Wei Liu ha scritto:
Quoted 22 lines
This patch resurrects
11a63a166. The previous patch had a bug that wrong "physical-device" was written to xenstore causing block script execution fail. This patch fixes that problem.Following configurations have been tested:
1. Raw file and PV
2. Raw file and HVM
3. Block device and PV
4. Block device and HVMCreation / destruction / local migration all worked.
Original commit message from
11a63a166:Modify libxl and hotplug script to allow raw format file to use phy backend.
The block script now tests the path and determine the actual type of file (block device or regular file) then use the actual type to determine which branch to run.
Quoted 6 lines
Quoted 2 lines
With these changes, plus the current ordering of backend preference (phy
Quoted 1 line
qdisk > tap), we will use phy backend for raw format file by default.
Sorry for the probably stupid question, what are the pros and cons of default use of phy instead qdisk for raw files as domU disk?
There's no stupid question. :-)
I was told that it performs better and enables other potential improvements.
Wei.
Quoted 11 lines · Wei Liu
Quoted 3 lines · Fabio Fantoni
Sorry for the probably stupid question, what are the pros and cons of default use of phy instead qdisk for raw files as domU disk?
There's no stupid question. :-)
I was told that it performs better and enables other potential improvements.
Not a big deal, probably, but IMO it would be nice to have at least a few words about when it's happening in the changelog, wouldn't it?
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Il 09/01/2015 18:38, Dario Faggioli ha scritto:
Quoted 5 lines · Wei Liu
Quoted 4 lines · Fabio Fantoni
Quoted 3 lines
Sorry for the probably stupid question, what are the pros and cons of default use of phy instead qdisk for raw files as domU disk?
Quoted 7 lines
Quoted 5 lines
There's no stupid question. :-)
I was told that it performs better and enables other potential improvements.
Not a big deal, probably, but IMO it would be nice to have at least a few words about when it's happening in the changelog, wouldn't it?
I'm also interested in detailed changelog about.
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:
Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Thanks for any reply and sorry for my bad english.
Quoted 4 lines
Regards,
Dario
Quoted 8 lines · Fabio Fantoni
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Stefano already corrected me on this in this very thread.
Ian.
Il 12/01/2015 10:31, Ian Campbell ha scritto:
Quoted 5 lines · Fabio Fantoni
Quoted 4 lines
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Stefano already corrected me on this in this very thread.
Ian.
Thanks for your reply.
I saw other posts about and if I understand good when O_DIRECT patches will be in upstream loop driver the data loss risk will be solved, right?
Quoted 10 lines · Fabio Fantoni
Il 12/01/2015 10:31, Ian Campbell ha scritto:
Quoted 9 lines · Fabio Fantoni
Quoted 8 lines
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Quoted 8 lines
Quoted 4 lines
Stefano already corrected me on this in this very thread.
Ian.
Thanks for your reply.
I saw other posts about and if I understand good whenO_DIRECTpatches will be in upstream loop driver the data loss risk will be solved, right?
Stefano says that O_DIRECT is not needed, only correct barrier semantics are and he believes those are correctly implemented.
O_DIRECT would be an additional layer of safety perhaps, but sounds to be not strictly needed.
Ian.
Il 12/01/2015 11:06, Ian Campbell ha scritto:
Quoted 13 lines · Fabio Fantoni
Quoted 12 lines
Il 12/01/2015 10:31, Ian Campbell ha scritto:
Quoted 11 lines · Fabio Fantoni
Quoted 8 lines
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Stefano already corrected me on this in this very thread.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ian.
Thanks for your reply.
I saw other posts about and if I understand good whenO_DIRECTpatches will be in upstream loop driver the data loss risk will be solved, right?Stefano says that
O_DIRECTis not needed, only correct barrier semantics are and he believes those are correctly implemented.
I not understand if manual changes and/or settings are needed, about this I mean:
Quoted 1 line
only correct barrier semantics are and he believes those are correctly implemented
If yes what exactly?
Quoted 6 lines
O_DIRECTwould be an additional layer of safety perhaps, but sounds to be not strictly needed.Ian.
Quoted 19 lines · Fabio Fantoni
Il 12/01/2015 11:06, Ian Campbell ha scritto:
Quoted 18 lines · Fabio Fantoni
Quoted 17 lines
Il 12/01/2015 10:31, Ian Campbell ha scritto:
Quoted 5 lines · Fabio Fantoni
Quoted 4 lines
In the meantime, I saw this:
http://lists.xen.org/archives/html/xen-users/2015-01/msg00047.html
Based on the post above seems that phy will have important risk of data loss if I understand good, from Ian Campbell post:Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
xl also uses qdisk for raw disk images instead of loop+blkback which xend used, because there are concerns that the loop driver can lead to data loss (by not implementing direct i/o the underlying device, and/or not handling flushes correct, my memory is a bit fuzzy).
Stefano already corrected me on this in this very thread.
Ian.
Thanks for your reply.
I saw other posts about and if I understand good whenO_DIRECTpatches will be in upstream loop driver the data loss risk will be solved, right?
Quoted 7 lines
Quoted 2 lines
Stefano says that
O_DIRECTis not needed, only correct barrier semantics are and he believes those are correctly implemented.I not understand if manual changes and/or settings are needed, about this I mean:
Quoted 1 line
only correct barrier semantics are and he believes those are correctly implemented
If yes what exactly?
If Stefano is correct then it should all just work, no manual steps needed (if manual steps were needed we wouldn't be taking this patch).
Ian.