forked from photron/msys_setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibvirt-0.8.6-mingw.patch
326 lines (295 loc) · 9.21 KB
/
libvirt-0.8.6-mingw.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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
--- a/python/Makefile.am 2010-05-26 22:09:50 +0000
+++ b/python/Makefile.am 2010-09-10 20:26:24 +0000
@@ -41,9 +41,9 @@
libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS)
libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
- $(CYGWIN_EXTRA_LDFLAGS)
+ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs
libvirtmod_la_LIBADD = $(mylibs) \
- $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
+ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26
GENERATE = generator.py
API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
diff -ur a/python/Makefile.in b/python/Makefile.in
--- a/python/Makefile.in 2010-09-07 17:46:28 +0000
+++ b/python/Makefile.in 2010-09-10 21:04:52 +0000
@@ -1118,10 +1118,10 @@
# need extra flags here
@WITH_PYTHON_TRUE@libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS)
@WITH_PYTHON_TRUE@libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS)
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs
@WITH_PYTHON_TRUE@libvirtmod_la_LIBADD = $(mylibs) \
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD)
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26
@WITH_PYTHON_TRUE@GENERATE = generator.py
@WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml
--- a/src/libvirt_macvtap.syms
+++ b/src/libvirt_macvtap.syms
@@ -1,9 +1,10 @@
#
+# These symbols are dependent on WITH_MACVTAP.
+#
+
# macvtap.h
delMacvtap;
openMacvtapTap;
-virVMOperationTypeFromString;
-virVMOperationTypeToString;
vpAssociatePortProfileId;
vpDisassociatePortProfileId;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 310d8f4..3c1c823 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -504,6 +504,11 @@ virLogStartup;
virLogUnlock;
+# macvtap.h
+virVMOperationTypeFromString;
+virVMOperationTypeToString;
+
+
# memory.h
virAlloc;
virAllocN;
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11879,6 +11879,7 @@ cleanup:
return ret;
}
+#if WITH_MACVTAP
static void
qemudVPAssociatePortProfiles(virDomainDefPtr def) {
int i;
@@ -11913,6 +11914,10 @@ err_exit:
}
}
}
+#else /* !WITH_MACVTAP */
+static void
+qemudVPAssociatePortProfiles(virDomainDefPtr def ATTRIBUTE_UNUSED) { }
+#endif /* WITH_MACVTAP */
/* Finish is the third and final step, and it runs on the destination host. */
static virDomainPtr
--- a/src/util/macvtap.h
+++ b/src/util/macvtap.h
@@ -57,11 +57,6 @@ struct _virVirtualPortProfileParams {
} u;
};
-
-# if defined(WITH_MACVTAP)
-
-# include "internal.h"
-
enum virVMOperationType {
VIR_VM_OP_CREATE,
VIR_VM_OP_SAVE,
@@ -75,6 +70,10 @@ enum virVMOperationType {
VIR_VM_OP_LAST
};
+# if WITH_MACVTAP
+
+# include "internal.h"
+
int openMacvtapTap(const char *ifname,
const unsigned char *macaddress,
const char *linkdev,
@@ -90,11 +89,9 @@ void delMacvtap(const char *ifname,
const char *linkdev,
virVirtualPortProfileParamsPtr virtPortProfile);
-# endif /* WITH_MACVTAP */
-
-# define MACVTAP_MODE_PRIVATE_STR "private"
-# define MACVTAP_MODE_VEPA_STR "vepa"
-# define MACVTAP_MODE_BRIDGE_STR "bridge"
+# define MACVTAP_MODE_PRIVATE_STR "private"
+# define MACVTAP_MODE_VEPA_STR "vepa"
+# define MACVTAP_MODE_BRIDGE_STR "bridge"
int vpAssociatePortProfileId(const char *macvtap_ifname,
const unsigned char *macvtap_macaddr,
@@ -109,6 +106,8 @@ int vpDisassociatePortProfileId(const char *macvtap_ifname,
const virVirtualPortProfileParamsPtr virtPort,
enum virVMOperationType vmOp);
+# endif /* WITH_MACVTAP */
+
VIR_ENUM_DECL(virVirtualPort)
VIR_ENUM_DECL(virVMOperation)
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -27,12 +27,13 @@
#include <config.h>
+#include <stdint.h>
+
#if WITH_MACVTAP || WITH_VIRTUALPORT
# include <stdio.h>
# include <errno.h>
# include <fcntl.h>
-# include <stdint.h>
# include <c-ctype.h>
# include <sys/socket.h>
# include <sys/ioctl.h>
@@ -44,10 +45,15 @@
# include <netlink/msg.h>
-# include "util.h"
+#endif /* WITH_MACVTAP || WITH_VIRTUALPORT */
+
+#include "util.h"
+#include "macvtap.h"
+
+#if WITH_MACVTAP || WITH_VIRTUALPORT
+
# include "memory.h"
# include "logging.h"
-# include "macvtap.h"
# include "interface.h"
# include "conf/domain_conf.h"
# include "virterror_internal.h"
@@ -77,17 +83,6 @@
# define LLDPAD_PID_FILE "/var/run/lldpad.pid"
-VIR_ENUM_IMPL(virVMOperation, VIR_VM_OP_LAST,
- "create",
- "save",
- "restore",
- "destroy",
- "migrate out",
- "migrate in start",
- "migrate in finish",
- "no-op")
-
-
enum virVirtualPortOp {
ASSOCIATE = 0x1,
DISASSOCIATE = 0x2,
@@ -1609,3 +1604,13 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
}
#endif /* WITH_MACVTAP || WITH_VIRTUALPORT */
+
+VIR_ENUM_IMPL(virVMOperation, VIR_VM_OP_LAST,
+ "create",
+ "save",
+ "restore",
+ "destroy",
+ "migrate out",
+ "migrate in start",
+ "migrate in finish",
+ "no-op")
Make the remote driver use TLS certificates from %APPDATA%\libvirt\pki\ instead of /etc/pki/
--- a/src/remote/remote_driver.c 2010-11-11 17:25:02 +0000
+++ b/src/remote/remote_driver.c 2010-11-20 12:04:52 +0000
@@ -276,6 +276,70 @@
static int initialize_gnutls(void);
static gnutls_session_t negotiate_gnutls_on_connection (virConnectPtr conn, struct private_data *priv, int no_verify);
+#ifdef WIN32
+
+static char *remoteWin32CertPaths[5];
+
+static int
+remoteInitCertPaths(void)
+{
+ const char *appdata = getenv("APPDATA");
+
+ if (appdata == NULL || *appdata == '\0') {
+ appdata = "C:";
+
+ VIR_WARN("APPDATA not set, falling back to '%s'", appdata);
+ }
+
+ if (virAsprintf(&remoteWin32CertPaths[0],
+ "%s\\libvirt\\pki\\CA\\cacert.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[1],
+ "%s\\libvirt\\pki\\libvirt\\private\\clientkey.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[2],
+ "%s\\libvirt\\pki\\libvirt\\clientcert.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[3],
+ "%s\\libvirt\\pki\\libvirt\\private\\serverkey.pem", appdata) < 0 ||
+ virAsprintf(&remoteWin32CertPaths[4],
+ "%s\\libvirt\\pki\\libvirt\\servercert.pem", appdata) < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ return 0;
+}
+
+static const char *
+remoteCACertPath(void)
+{
+ return remoteWin32CertPaths[0];
+}
+
+static const char *
+remoteClientKeyPath(void)
+{
+ return remoteWin32CertPaths[1];
+}
+
+static const char *
+remoteClientCertPath(void)
+{
+ return remoteWin32CertPaths[2];
+}
+
+static const char *
+remoteServerKeyPath(void)
+{
+ return remoteWin32CertPaths[3];
+}
+
+static const char *
+remoteServerCertPath(void)
+{
+ return remoteWin32CertPaths[4];
+}
+
+#endif /* WIN32 */
+
#ifdef WITH_LIBVIRTD
static int
remoteStartup(int privileged ATTRIBUTE_UNUSED)
@@ -1246,7 +1328,7 @@
err =
gnutls_certificate_type_set_priority (session,
cert_type_priority);
- if (err) {
+ if (err && err != GNUTLS_E_UNIMPLEMENTED_FEATURE) {
remoteError(VIR_ERR_GNUTLS_ERROR,
_("unable to set certificate priority: %s"),
gnutls_strerror (err));
@@ -10881,6 +10971,10 @@
int
remoteRegister (void)
{
+#ifdef WIN32
+ if (remoteInitCertPaths()) return -1;
+#endif
+
if (virRegisterDriver (&remote_driver) == -1) return -1;
if (virRegisterNetworkDriver (&network_driver) == -1) return -1;
if (virRegisterInterfaceDriver (&interface_driver) == -1) return -1;
--- a/src/remote/remote_driver.h 2010-11-17 17:25:02 +0000
+++ b/src/remote/remote_driver.h 2010-11-18 08:24:54 +0000
@@ -41,12 +41,19 @@
# define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirtd.conf"
/* Defaults for PKI directory. */
-# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
-# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
-# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
-# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
-# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
-# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
-
+# ifndef WIN32
+# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
+# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
+# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem"
+# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"
+# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem"
+# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem"
+# else
+# define LIBVIRT_CACERT remoteCACertPath()
+# define LIBVIRT_CLIENTKEY remoteClientKeyPath()
+# define LIBVIRT_CLIENTCERT remoteClientCertPath()
+# define LIBVIRT_SERVERKEY remoteServerKeyPath()
+# define LIBVIRT_SERVERCERT remoteServerCertPath()
+# endif
#endif /* __VIR_REMOTE_INTERNAL_H__ */