* [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file
@ 2013-09-05 14:11 Wei Liu
2013-09-12 15:23 ` Wei Liu
2013-09-12 15:49 ` Roger Pau Monné
0 siblings, 2 replies; 4+ messages in thread
From: Wei Liu @ 2013-09-05 14:11 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Stefano Stabellini, Wei Liu, Roger Pau Monné
Modify libxl to allow raw format file to use phy backend.
For the hotplug script part, learn from NetBSD's block hotplug script --
test 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 > qdisk > tap), we will use phy backend for raw format file by
default.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/hotplug/Linux/block | 16 +++++++++-------
tools/libxl/libxl_linux.c | 6 +++---
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
index da26e22..8d2ee9d 100644
--- a/tools/hotplug/Linux/block
+++ b/tools/hotplug/Linux/block
@@ -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
;;
diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
index 37815eb..3cfa6da 100644
--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -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
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file
2013-09-05 14:11 [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file Wei Liu
@ 2013-09-12 15:23 ` Wei Liu
2013-09-12 15:49 ` Roger Pau Monné
1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2013-09-12 15:23 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Stefano Stabellini, Wei Liu, Roger Pau Monné
Ping?
On Thu, Sep 05, 2013 at 03:11:31PM +0100, Wei Liu wrote:
> Modify libxl to allow raw format file to use phy backend.
>
> For the hotplug script part, learn from NetBSD's block hotplug script --
> test 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 > qdisk > tap), we will use phy backend for raw format file by
> default.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
> tools/hotplug/Linux/block | 16 +++++++++-------
> tools/libxl/libxl_linux.c | 6 +++---
> 2 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/tools/hotplug/Linux/block b/tools/hotplug/Linux/block
> index da26e22..8d2ee9d 100644
> --- a/tools/hotplug/Linux/block
> +++ b/tools/hotplug/Linux/block
> @@ -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
> ;;
> diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
> index 37815eb..3cfa6da 100644
> --- a/tools/libxl/libxl_linux.c
> +++ b/tools/libxl/libxl_linux.c
> @@ -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
> --
> 1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file
2013-09-05 14:11 [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file Wei Liu
2013-09-12 15:23 ` Wei Liu
@ 2013-09-12 15:49 ` Roger Pau Monné
2013-09-13 10:09 ` Ian Jackson
1 sibling, 1 reply; 4+ messages in thread
From: Roger Pau Monné @ 2013-09-12 15:49 UTC (permalink / raw)
To: Wei Liu; +Cc: xen-devel, Ian Jackson, Stefano Stabellini
On 05/09/13 16:11, Wei Liu wrote:
> Modify libxl to allow raw format file to use phy backend.
>
> For the hotplug script part, learn from NetBSD's block hotplug script --
> test 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 > qdisk > tap), we will use phy backend for raw format file by
> default.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file
2013-09-12 15:49 ` Roger Pau Monné
@ 2013-09-13 10:09 ` Ian Jackson
0 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2013-09-13 10:09 UTC (permalink / raw)
To: Roger Pau Monné; +Cc: xen-devel, Wei Liu, Stefano Stabellini
Roger Pau Monné writes ("Re: [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file"):
> On 05/09/13 16:11, Wei Liu wrote:
> > Modify libxl to allow raw format file to use phy backend.
...
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-13 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-05 14:11 [PATCH] libxl, hotplug/Linux: default to phy backend for raw format file Wei Liu
2013-09-12 15:23 ` Wei Liu
2013-09-12 15:49 ` Roger Pau Monné
2013-09-13 10:09 ` Ian Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.