summaryrefslogtreecommitdiff
path: root/xen.libxl.dmmd.patch
blob: fef056a27065be84807968ae22147b7c796a3e48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
References: bsc#954872

---
 tools/libxl/libxl.c         |    4 ++++
 tools/libxl/libxl_device.c  |    3 ++-
 tools/libxl/libxl_dm.c      |   34 +++++++++++++++++++++++++++++-----
 tools/libxl/libxlu_disk_l.l |    2 ++
 4 files changed, 37 insertions(+), 6 deletions(-)

Index: xen-4.13.0-testing/tools/libxl/libxl_disk.c
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxl_disk.c
+++ xen-4.13.0-testing/tools/libxl/libxl_disk.c
@@ -178,7 +178,7 @@ static int libxl__device_disk_setdefault
     return rc;
 }
 
-static int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
+int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
                                    const libxl_device_disk *disk,
                                    libxl__device *device)
 {
@@ -336,6 +336,10 @@ static void device_disk_add(libxl__egc *
                 rc = ERROR_FAIL;
                 goto out;
             case LIBXL_DISK_BACKEND_QDISK:
+		if (disk->script) {
+                    script = libxl__abs_path(gc, disk->script, libxl__xen_script_dir_path());
+		    flexarray_append_pair(back, "script", script);
+		}
                 flexarray_append(back, "params");
                 flexarray_append(back, GCSPRINTF("%s:%s",
                               libxl__device_disk_string_of_format(disk->format),
Index: xen-4.13.0-testing/tools/libxl/libxl_device.c
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxl_device.c
+++ xen-4.13.0-testing/tools/libxl/libxl_device.c
@@ -326,7 +326,8 @@ static int disk_try_backend(disk_try_bac
         return 0;
 
     case LIBXL_DISK_BACKEND_QDISK:
-        if (a->disk->script) goto bad_script;
+        LOG(DEBUG, "Disk vdev=%s, uses script=%s on %s backend",
+           a->disk->vdev, a->disk->script, libxl_disk_backend_to_string(backend));
         return backend;
 
     default:
@@ -343,11 +344,6 @@ static int disk_try_backend(disk_try_bac
                libxl_disk_format_to_string(a->disk->format));
     return 0;
 
- bad_script:
-    LOG(DEBUG, "Disk vdev=%s, backend %s not compatible with script=...",
-        a->disk->vdev, libxl_disk_backend_to_string(backend));
-    return 0;
-
  bad_colo:
     LOG(DEBUG, "Disk vdev=%s, backend %s not compatible with colo",
         a->disk->vdev, libxl_disk_backend_to_string(backend));
Index: xen-4.13.0-testing/tools/libxl/libxl_dm.c
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxl_dm.c
+++ xen-4.13.0-testing/tools/libxl/libxl_dm.c
@@ -1162,6 +1162,30 @@ out:
     return rc;
 }
 
+static void libxl__suse_node_to_path(libxl__gc *gc, int domid, const libxl_device_disk *dp, const char **pdev_path)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *be_path, *node;
+    libxl__device device;
+    libxl_device_disk disk;
+    int rc;
+
+    disk = *dp;
+    rc = libxl__device_from_disk(gc, domid, &disk, &device);
+    if (rc) {
+        LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "libxl__device_from_disk failed %d", rc);
+        return;
+    }
+    be_path = libxl__device_backend_path(gc, &device);
+
+    node = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/node", be_path));
+    if (!node)
+        return;
+
+    LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "replacing '%s' with '%s' from %s/node, just for qemu-xen", *pdev_path, node, be_path);
+    *pdev_path = node;
+}
+
 static int libxl__build_device_model_args_new(libxl__gc *gc,
                                         const char *dm, int guest_domid,
                                         const libxl_domain_config *guest_config,
@@ -1795,9 +1819,11 @@ static int libxl__build_device_model_arg
                 libxl__device_disk_dev_number(disks[i].vdev, &disk, &part);
             const char *format;
             char *drive;
-            const char *target_path = NULL;
+            const char *target_path = disks[i].pdev_path;
             int colo_mode;
 
+            libxl__suse_node_to_path(gc, guest_domid, disks + i, &target_path);
+
             if (dev_number == -1) {
                 LOGD(WARN, guest_domid, "unable to determine"" disk number for %s",
                      disks[i].vdev);
Index: xen-4.13.0-testing/tools/libxl/libxlu_disk_l.l
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxlu_disk_l.l
+++ xen-4.13.0-testing/tools/libxl/libxlu_disk_l.l
@@ -230,6 +230,8 @@ target=.*	{ STRIP(','); SAVESTRING("targ
                     free(newscript);
                 }
 
+dmmd:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+npiv:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
 tapdisk:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
 tap2?:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
 aio:/.*		{ DPC->had_depr_prefix=1; DEPRECATE(0); }
Index: xen-4.13.0-testing/tools/libxl/libxl_internal.h
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxl_internal.h
+++ xen-4.13.0-testing/tools/libxl/libxl_internal.h
@@ -2042,6 +2042,10 @@ struct libxl__cpuid_policy {
     char *policy[4];
 };
 
+_hidden int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
+                                   const libxl_device_disk *disk,
+                                   libxl__device *device);
+
 /* Calls poll() again - useful to check whether a signaled condition
  * is still true.  Cannot fail.  Returns currently-true revents. */
 _hidden short libxl__fd_poll_recheck(libxl__egc *egc, int fd, short events);