forked from nrgaway/qubes-core-libvirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-conf-add-script-attribute-to-disk-specification.patch
107 lines (97 loc) · 3.82 KB
/
0001-conf-add-script-attribute-to-disk-specification.patch
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
From 27ba61b7267f9e1ad9186771c9746710ed302362 Mon Sep 17 00:00:00 2001
From: Marek Marczykowski <marmarek@invisiblethingslab.com>
Date: Fri, 5 Apr 2013 01:37:29 +0200
Subject: [PATCH] conf: add 'script' attribute to disk specification
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Script to be called to prepare custom device for domain. Done with Xen
in mind, it maps to libxl_device_disk.script.
XML configuration would be:
<disk type='block' device='disk'>
<source dev='/dev/mapper/custom-device'/>
<script path='/script/to/setup/custom-device'/>
<target dev='xvdc'/>
</disk>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
docs/schemas/domaincommon.rng | 8 ++++++++
src/conf/domain_conf.c | 7 +++++++
src/conf/domain_conf.h | 1 +
3 files changed, 16 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6727cd743b..96fe4abcce 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1388,6 +1388,14 @@
<empty/>
</element>
</optional>
+ <optional>
+ <element name="script">
+ <attribute name="path">
+ <ref name="filePath"/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
<optional>
<element name="readonly">
<empty/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1406cf079e..a7f75eb53d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2192,6 +2192,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
VIR_FREE(def->domain_name);
VIR_FREE(def->blkdeviotune.group_name);
VIR_FREE(def->virtio);
+ VIR_FREE(def->script);
virDomainDeviceInfoClear(&def->info);
virObjectUnref(def->privateData);
@@ -10423,6 +10424,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
g_autofree char *vendor = NULL;
g_autofree char *product = NULL;
g_autofree char *domain_name = NULL;
+ g_autofree char *script = NULL;
if (!(def = virDomainDiskDefNew(xmlopt)))
return NULL;
@@ -10499,6 +10501,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
} else if (virXMLNodeNameEqual(cur, "geometry")) {
if (virDomainDiskDefGeometryParse(def, cur) < 0)
goto error;
+ } else if (!script &&
+ virXMLNodeNameEqual(cur, "script")) {
+ script = virXMLPropString(cur, "path");
} else if (virXMLNodeNameEqual(cur, "blockio")) {
logical_block_size =
virXMLPropString(cur, "logical_block_size");
@@ -10778,6 +10783,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
def->src->encryption = g_steal_pointer(&encryption);
}
def->domain_name = g_steal_pointer(&domain_name);
+ def->script = g_steal_pointer(&script);
def->serial = g_steal_pointer(&serial);
def->wwn = g_steal_pointer(&wwn);
def->vendor = g_steal_pointer(&vendor);
@@ -25451,6 +25457,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
return -1;
virBufferEscapeString(buf, "<backenddomain name='%s'/>\n", def->domain_name);
+ virBufferEscapeString(buf, "<script path='%s'/>\n", def->script);
virDomainDiskGeometryDefFormat(buf, def);
virDomainDiskBlockIoDefFormat(buf, def);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e152c599ca..d072569ce9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -579,6 +579,7 @@ struct _virDomainDiskDef {
unsigned int queues;
int model; /* enum virDomainDiskModel */
virDomainVirtioOptionsPtr virtio;
+ char *script;
bool diskElementAuth;
bool diskElementEnc;
--
2.25.4