├── .gitignore
├── LICENSE
├── README.md
└── ant-spk
├── app
└── dsm
│ ├── config
│ ├── images
│ ├── icon_256.png
│ └── icon_72.png
│ └── index.html
├── build.xml
├── libvirtd.conf
└── spk
├── scripts
├── postinst
├── postuninst
├── postupgrade
├── preinst
├── preuninst
├── preupgrade
└── start-stop-status
└── wizard
├── install_uifile
└── install_uifile_chs
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Object files
5 | *.o
6 | *.ko
7 | *.obj
8 | *.elf
9 |
10 | # Linker output
11 | *.ilk
12 | *.map
13 | *.exp
14 |
15 | # Precompiled Headers
16 | *.gch
17 | *.pch
18 |
19 | # Libraries
20 | *.lib
21 | *.a
22 | *.la
23 | *.lo
24 |
25 | # Shared objects (inc. Windows DLLs)
26 | *.dll
27 | *.so
28 | *.so.*
29 | *.dylib
30 |
31 | # Executables
32 | *.exe
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Debug files
40 | *.dSYM/
41 | *.su
42 | *.idb
43 | *.pdb
44 |
45 | # Kernel Module Compile Results
46 | *.mod*
47 | *.cmd
48 | .tmp_versions/
49 | modules.order
50 | Module.symvers
51 | Mkfile.old
52 | dkms.conf
53 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2017, bsdcpp
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Warning
2 | This project has been abandoned and no further support will be given.
3 |
4 | # synokvm
5 | Libvirt, Qemu for Synology DSM X86 platform(with kvm support).
6 |
7 | Tested on DSM v6.0/6.1. Try this on your own risk.
8 |
9 | # Usage:
10 | > 1. Install spk first;
11 | > 2. This spk carry a webvirtmgr web management, also you can use virsh or virt-manager.
12 |
13 | # Building tips
14 | ```bash
15 | Qemu build with:
16 | ./configure --prefix=/usr/local --target-list="x86_64-softmmu arm-softmmu" \
17 | --disable-gtk --disable-xen --enable-{kvm,linux-aio,vhost-net,vnc,vnc-png,vnc-jpeg,guest-agent} \
18 | --enable-{spice,coroutine-pool,libiscsi,libusb,curl,libssh2,tpm} \
19 | --enable-{modules,usb-redir,vhost-vsock,virglrenderer,replication,bzip2,rbd,attr,virtfs,vnc-sasl,tcmalloc,jemalloc,lzo} \
20 | --audio-drv-list='sdl oss alsa pa'
21 |
22 |
23 | ```
24 |
25 | ```bash
26 | Libvirt build with:
27 | ./configure --prefix=/usr/local --with-yajl --with-openssl --with-blkid \
28 | --with-curl --with-ssh2 --with-qemu --with-lxc --with-remote --with-libvirtd \
29 | --with-pm-utils --with-sysctl --with-network --with-storage-scsi --with-virtualport \
30 | --with-esx --with-blkid --with-hal --with-avahi --with-udev --with-storage-iscsi
31 |
32 | ```
33 |
34 | > 1. Build these on Debian jessie distribution,
35 | and made packages with this amazing tool https://github.com/rednoah/ant-spk, thanks to rednoah.
36 | > 2. Devlepment tutorial: https://developer.synology.com/developer-guide/getting_started/index.html
37 |
38 | # 中文教程参考
39 | http://koolshare.cn/thread-95071-1-1.html
40 |
41 | 关于软路由的部分介绍请参考我之前发的帖子:http://koolshare.cn/thread-76860-1-1.html
42 |
--------------------------------------------------------------------------------
/ant-spk/app/dsm/config:
--------------------------------------------------------------------------------
1 | {
2 | ".url": {
3 | "org.example.synokvm": {
4 | "type": "url",
5 | "allUsers": true,
6 | "title": "synoKVM",
7 | "icon": "images/icon_{0}.png",
8 | "protocol": "http",
9 | "url": "/",
10 | "port": "8000"
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ant-spk/app/dsm/images/icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bsdcpp/synoKVM/83fd8af8b27756e58f49a0c98af1c567a4642744/ant-spk/app/dsm/images/icon_256.png
--------------------------------------------------------------------------------
/ant-spk/app/dsm/images/icon_72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bsdcpp/synoKVM/83fd8af8b27756e58f49a0c98af1c567a4642744/ant-spk/app/dsm/images/icon_72.png
--------------------------------------------------------------------------------
/ant-spk/app/dsm/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ant-spk/build.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/ant-spk/libvirtd.conf:
--------------------------------------------------------------------------------
1 | # Master libvirt daemon configuration file
2 | #
3 | # For further information consult http://libvirt.org/format.html
4 | #
5 | # NOTE: the tests/daemon-conf regression test script requires
6 | # that each "PARAMETER = VALUE" line in this file have the parameter
7 | # name just after a leading "#".
8 |
9 | #################################################################
10 | #
11 | # Network connectivity controls
12 | #
13 |
14 | # Flag listening for secure TLS connections on the public TCP/IP port.
15 | # NB, must pass the --listen flag to the libvirtd process for this to
16 | # have any effect.
17 | #
18 | # It is necessary to setup a CA and issue server certificates before
19 | # using this capability.
20 | #
21 | # This is enabled by default, uncomment this to disable it
22 | listen_tls = 0
23 |
24 | # Listen for unencrypted TCP connections on the public TCP/IP port.
25 | # NB, must pass the --listen flag to the libvirtd process for this to
26 | # have any effect.
27 | #
28 | # Using the TCP socket requires SASL authentication by default. Only
29 | # SASL mechanisms which support data encryption are allowed. This is
30 | # DIGEST_MD5 and GSSAPI (Kerberos5)
31 | #
32 | # This is disabled by default, uncomment this to enable it.
33 | listen_tcp = 1
34 |
35 |
36 |
37 | # Override the port for accepting secure TLS connections
38 | # This can be a port number, or service name
39 | #
40 | #tls_port = "16514"
41 |
42 | # Override the port for accepting insecure TCP connections
43 | # This can be a port number, or service name
44 | #
45 | #tcp_port = "16509"
46 |
47 |
48 | # Override the default configuration which binds to all network
49 | # interfaces. This can be a numeric IPv4/6 address, or hostname
50 | #
51 | # If the libvirtd service is started in parallel with network
52 | # startup (e.g. with systemd), binding to addresses other than
53 | # the wildcards (0.0.0.0/::) might not be available yet.
54 | #
55 | #listen_addr = "192.168.0.1"
56 |
57 |
58 | # Flag toggling mDNS advertizement of the libvirt service.
59 | #
60 | # Alternatively can disable for all services on a host by
61 | # stopping the Avahi daemon
62 | #
63 | # This is disabled by default, uncomment this to enable it
64 | #mdns_adv = 1
65 |
66 | # Override the default mDNS advertizement name. This must be
67 | # unique on the immediate broadcast network.
68 | #
69 | # The default is "Virtualization Host HOSTNAME", where HOSTNAME
70 | # is substituted for the short hostname of the machine (without domain)
71 | #
72 | #mdns_name = "Virtualization Host Joe Demo"
73 |
74 |
75 | #################################################################
76 | #
77 | # UNIX socket access controls
78 | #
79 |
80 | # Set the UNIX domain socket group ownership. This can be used to
81 | # allow a 'trusted' set of users access to management capabilities
82 | # without becoming root.
83 | #
84 | # This is restricted to 'root' by default.
85 | #unix_sock_group = "libvirt"
86 |
87 | # Set the UNIX socket permissions for the R/O socket. This is used
88 | # for monitoring VM status only
89 | #
90 | # Default allows any user. If setting group ownership, you may want to
91 | # restrict this too.
92 | #unix_sock_ro_perms = "0777"
93 |
94 | # Set the UNIX socket permissions for the R/W socket. This is used
95 | # for full management of VMs
96 | #
97 | # Default allows only root. If PolicyKit is enabled on the socket,
98 | # the default will change to allow everyone (eg, 0777)
99 | #
100 | # If not using PolicyKit and setting group ownership for access
101 | # control, then you may want to relax this too.
102 | #unix_sock_rw_perms = "0770"
103 |
104 | # Set the UNIX socket permissions for the admin interface socket.
105 | #
106 | # Default allows only owner (root), do not change it unless you are
107 | # sure to whom you are exposing the access to.
108 | #unix_sock_admin_perms = "0700"
109 |
110 | # Set the name of the directory in which sockets will be found/created.
111 | #unix_sock_dir = "/var/run/libvirt"
112 |
113 |
114 |
115 | #################################################################
116 | #
117 | # Authentication.
118 | #
119 | # - none: do not perform auth checks. If you can connect to the
120 | # socket you are allowed. This is suitable if there are
121 | # restrictions on connecting to the socket (eg, UNIX
122 | # socket permissions), or if there is a lower layer in
123 | # the network providing auth (eg, TLS/x509 certificates)
124 | #
125 | # - sasl: use SASL infrastructure. The actual auth scheme is then
126 | # controlled from /etc/sasl2/libvirt.conf. For the TCP
127 | # socket only GSSAPI & DIGEST-MD5 mechanisms will be used.
128 | # For non-TCP or TLS sockets, any scheme is allowed.
129 | #
130 | # - polkit: use PolicyKit to authenticate. This is only suitable
131 | # for use on the UNIX sockets. The default policy will
132 | # require a user to supply their own password to gain
133 | # full read/write access (aka sudo like), while anyone
134 | # is allowed read/only access.
135 | #
136 | # Set an authentication scheme for UNIX read-only sockets
137 | # By default socket permissions allow anyone to connect
138 | #
139 | # To restrict monitoring of domains you may wish to enable
140 | # an authentication mechanism here
141 | #auth_unix_ro = "none"
142 |
143 | # Set an authentication scheme for UNIX read-write sockets
144 | # By default socket permissions only allow root. If PolicyKit
145 | # support was compiled into libvirt, the default will be to
146 | # use 'polkit' auth.
147 | #
148 | # If the unix_sock_rw_perms are changed you may wish to enable
149 | # an authentication mechanism here
150 | #auth_unix_rw = "none"
151 |
152 | # Change the authentication scheme for TCP sockets.
153 | #
154 | # If you don't enable SASL, then all TCP traffic is cleartext.
155 | # Don't do this outside of a dev/test scenario. For real world
156 | # use, always enable SASL and use the GSSAPI or DIGEST-MD5
157 | # mechanism in /etc/sasl2/libvirt.conf
158 | #auth_tcp = "sasl"
159 | auth_tcp = "none"
160 |
161 | # Change the authentication scheme for TLS sockets.
162 | #
163 | # TLS sockets already have encryption provided by the TLS
164 | # layer, and limited authentication is done by certificates
165 | #
166 | # It is possible to make use of any SASL authentication
167 | # mechanism as well, by using 'sasl' for this option
168 | #auth_tls = "none"
169 |
170 |
171 | # Change the API access control scheme
172 | #
173 | # By default an authenticated user is allowed access
174 | # to all APIs. Access drivers can place restrictions
175 | # on this. By default the 'nop' driver is enabled,
176 | # meaning no access control checks are done once a
177 | # client has authenticated with libvirtd
178 | #
179 | #access_drivers = [ "polkit" ]
180 |
181 | #################################################################
182 | #
183 | # TLS x509 certificate configuration
184 | #
185 |
186 |
187 | # Override the default server key file path
188 | #
189 | #key_file = "/etc/pki/libvirt/private/serverkey.pem"
190 |
191 | # Override the default server certificate file path
192 | #
193 | #cert_file = "/etc/pki/libvirt/servercert.pem"
194 |
195 | # Override the default CA certificate path
196 | #
197 | #ca_file = "/etc/pki/CA/cacert.pem"
198 |
199 | # Specify a certificate revocation list.
200 | #
201 | # Defaults to not using a CRL, uncomment to enable it
202 | #crl_file = "/etc/pki/CA/crl.pem"
203 |
204 |
205 |
206 | #################################################################
207 | #
208 | # Authorization controls
209 | #
210 |
211 |
212 | # Flag to disable verification of our own server certificates
213 | #
214 | # When libvirtd starts it performs some sanity checks against
215 | # its own certificates.
216 | #
217 | # Default is to always run sanity checks. Uncommenting this
218 | # will disable sanity checks which is not a good idea
219 | #tls_no_sanity_certificate = 1
220 |
221 | # Flag to disable verification of client certificates
222 | #
223 | # Client certificate verification is the primary authentication mechanism.
224 | # Any client which does not present a certificate signed by the CA
225 | # will be rejected.
226 | #
227 | # Default is to always verify. Uncommenting this will disable
228 | # verification - make sure an IP whitelist is set
229 | #tls_no_verify_certificate = 1
230 |
231 |
232 | # A whitelist of allowed x509 Distinguished Names
233 | # This list may contain wildcards such as
234 | #
235 | # "C=GB,ST=London,L=London,O=Red Hat,CN=*"
236 | #
237 | # See the POSIX fnmatch function for the format of the wildcards.
238 | #
239 | # NB If this is an empty list, no client can connect, so comment out
240 | # entirely rather than using empty list to disable these checks
241 | #
242 | # By default, no DN's are checked
243 | #tls_allowed_dn_list = ["DN1", "DN2"]
244 |
245 |
246 | # A whitelist of allowed SASL usernames. The format for username
247 | # depends on the SASL authentication mechanism. Kerberos usernames
248 | # look like username@REALM
249 | #
250 | # This list may contain wildcards such as
251 | #
252 | # "*@EXAMPLE.COM"
253 | #
254 | # See the POSIX fnmatch function for the format of the wildcards.
255 | #
256 | # NB If this is an empty list, no client can connect, so comment out
257 | # entirely rather than using empty list to disable these checks
258 | #
259 | # By default, no Username's are checked
260 | #sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]
261 |
262 |
263 | # Override the compile time default TLS priority string. The
264 | # default is usually "NORMAL" unless overridden at build time.
265 | # Only set this is it is desired for libvirt to deviate from
266 | # the global default settings.
267 | #
268 | #tls_priority="NORMAL"
269 |
270 |
271 | #################################################################
272 | #
273 | # Processing controls
274 | #
275 |
276 | # The maximum number of concurrent client connections to allow
277 | # over all sockets combined.
278 | #max_clients = 5000
279 |
280 | # The maximum length of queue of connections waiting to be
281 | # accepted by the daemon. Note, that some protocols supporting
282 | # retransmission may obey this so that a later reattempt at
283 | # connection succeeds.
284 | #max_queued_clients = 1000
285 |
286 | # The maximum length of queue of accepted but not yet
287 | # authenticated clients. The default value is 20. Set this to
288 | # zero to turn this feature off.
289 | #max_anonymous_clients = 20
290 |
291 | # The minimum limit sets the number of workers to start up
292 | # initially. If the number of active clients exceeds this,
293 | # then more threads are spawned, up to max_workers limit.
294 | # Typically you'd want max_workers to equal maximum number
295 | # of clients allowed
296 | #min_workers = 5
297 | #max_workers = 20
298 |
299 |
300 | # The number of priority workers. If all workers from above
301 | # pool are stuck, some calls marked as high priority
302 | # (notably domainDestroy) can be executed in this pool.
303 | #prio_workers = 5
304 |
305 | # Total global limit on concurrent RPC calls. Should be
306 | # at least as large as max_workers. Beyond this, RPC requests
307 | # will be read into memory and queued. This directly impacts
308 | # memory usage, currently each request requires 256 KB of
309 | # memory. So by default up to 5 MB of memory is used
310 | #
311 | # XXX this isn't actually enforced yet, only the per-client
312 | # limit is used so far
313 | #max_requests = 20
314 |
315 | # Limit on concurrent requests from a single client
316 | # connection. To avoid one client monopolizing the server
317 | # this should be a small fraction of the global max_requests
318 | # and max_workers parameter
319 | #max_client_requests = 5
320 |
321 | # Same processing controls, but this time for the admin interface.
322 | # For description of each option, be so kind to scroll few lines
323 | # upwards.
324 |
325 | #admin_min_workers = 1
326 | #admin_max_workers = 5
327 | #admin_max_clients = 5
328 | #admin_max_queued_clients = 5
329 | #admin_max_client_requests = 5
330 |
331 | #################################################################
332 | #
333 | # Logging controls
334 | #
335 |
336 | # Logging level: 4 errors, 3 warnings, 2 information, 1 debug
337 | # basically 1 will log everything possible
338 | # Note: Journald may employ rate limiting of the messages logged
339 | # and thus lock up the libvirt daemon. To use the debug level with
340 | # journald you have to specify it explicitly in 'log_outputs', otherwise
341 | # only information level messages will be logged.
342 | #log_level = 3
343 |
344 | # Logging filters:
345 | # A filter allows to select a different logging level for a given category
346 | # of logs
347 | # The format for a filter is one of:
348 | # x:name
349 | # x:+name
350 |
351 | # where name is a string which is matched against the category
352 | # given in the VIR_LOG_INIT() at the top of each libvirt source
353 | # file, e.g., "remote", "qemu", or "util.json" (the name in the
354 | # filter can be a substring of the full category name, in order
355 | # to match multiple similar categories), the optional "+" prefix
356 | # tells libvirt to log stack trace for each message matching
357 | # name, and x is the minimal level where matching messages should
358 | # be logged:
359 |
360 | # 1: DEBUG
361 | # 2: INFO
362 | # 3: WARNING
363 | # 4: ERROR
364 | #
365 | # Multiple filters can be defined in a single @filters, they just need to be
366 | # separated by spaces.
367 | #
368 | # e.g. to only get warning or errors from the remote layer and only errors
369 | # from the event layer:
370 | #log_filters="3:remote 4:event"
371 |
372 | # Logging outputs:
373 | # An output is one of the places to save logging information
374 | # The format for an output can be:
375 | # x:stderr
376 | # output goes to stderr
377 | # x:syslog:name
378 | # use syslog for the output and use the given name as the ident
379 | # x:file:file_path
380 | # output to a file, with the given filepath
381 | # x:journald
382 | # output to journald logging system
383 | # In all case the x prefix is the minimal level, acting as a filter
384 | # 1: DEBUG
385 | # 2: INFO
386 | # 3: WARNING
387 | # 4: ERROR
388 | #
389 | # Multiple outputs can be defined, they just need to be separated by spaces.
390 | # e.g. to log all warnings and errors to syslog under the libvirtd ident:
391 | #log_outputs="3:syslog:libvirtd"
392 | #
393 |
394 | # Log debug buffer size:
395 | #
396 | # This configuration option is no longer used, since the global
397 | # log buffer functionality has been removed. Please configure
398 | # suitable log_outputs/log_filters settings to obtain logs.
399 | #log_buffer_size = 64
400 |
401 |
402 | ##################################################################
403 | #
404 | # Auditing
405 | #
406 | # This setting allows usage of the auditing subsystem to be altered:
407 | #
408 | # audit_level == 0 -> disable all auditing
409 | # audit_level == 1 -> enable auditing, only if enabled on host (default)
410 | # audit_level == 2 -> enable auditing, and exit if disabled on host
411 | #
412 | #audit_level = 2
413 | #
414 | # If set to 1, then audit messages will also be sent
415 | # via libvirt logging infrastructure. Defaults to 0
416 | #
417 | #audit_logging = 1
418 |
419 | ###################################################################
420 | # UUID of the host:
421 | # Host UUID is read from one of the sources specified in host_uuid_source.
422 | #
423 | # - 'smbios': fetch the UUID from 'dmidecode -s system-uuid'
424 | # - 'machine-id': fetch the UUID from /etc/machine-id
425 | #
426 | # The host_uuid_source default is 'smbios'. If 'dmidecode' does not provide
427 | # a valid UUID a temporary UUID will be generated.
428 | #
429 | # Another option is to specify host UUID in host_uuid.
430 | #
431 | # Keep the format of the example UUID below. UUID must not have all digits
432 | # be the same.
433 |
434 | # NB This default all-zeros UUID will not work. Replace
435 | # it with the output of the 'uuidgen' command and then
436 | # uncomment this entry
437 | #host_uuid = "00000000-0000-0000-0000-000000000000"
438 | #host_uuid_source = "smbios"
439 |
440 | ###################################################################
441 | # Keepalive protocol:
442 | # This allows libvirtd to detect broken client connections or even
443 | # dead clients. A keepalive message is sent to a client after
444 | # keepalive_interval seconds of inactivity to check if the client is
445 | # still responding; keepalive_count is a maximum number of keepalive
446 | # messages that are allowed to be sent to the client without getting
447 | # any response before the connection is considered broken. In other
448 | # words, the connection is automatically closed approximately after
449 | # keepalive_interval * (keepalive_count + 1) seconds since the last
450 | # message received from the client. If keepalive_interval is set to
451 | # -1, libvirtd will never send keepalive requests; however clients
452 | # can still send them and the daemon will send responses. When
453 | # keepalive_count is set to 0, connections will be automatically
454 | # closed after keepalive_interval seconds of inactivity without
455 | # sending any keepalive messages.
456 | #
457 | #keepalive_interval = 5
458 | #keepalive_count = 5
459 |
460 | #
461 | # These configuration options are no longer used. There is no way to
462 | # restrict such clients from connecting since they first need to
463 | # connect in order to ask for keepalive.
464 | #
465 | #keepalive_required = 1
466 | #admin_keepalive_required = 1
467 |
468 | # Keepalive settings for the admin interface
469 | #admin_keepalive_interval = 5
470 | #admin_keepalive_count = 5
471 |
472 | ###################################################################
473 | # Open vSwitch:
474 | # This allows to specify a timeout for openvswitch calls made by
475 | # libvirt. The ovs-vsctl utility is used for the configuration and
476 | # its timeout option is set by default to 5 seconds to avoid
477 | # potential infinite waits blocking libvirt.
478 | #
479 | #ovs_timeout = 5
480 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 | #SYNOPKG_PKGDEST=/synokvm
4 |
5 | ln -sf $SYNOPKG_PKGDEST/synokvm /usr/local/
6 |
7 | #echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/synokvm/lib' >> /root/.bashrc
8 | echo 'export PATH=$PATH:/usr/local/synokvm/bin' >> /root/.bashrc
9 |
10 | ln -sf $SYNOPKG_PKGDEST/synokvm/sbin/ldconfig* /sbin/
11 | ln -sf $SYNOPKG_PKGDEST/synokvm/sbin/ebtables /usr/sbin/ebtables
12 | ln -sf $SYNOPKG_PKGDEST/synokvm/sbin/dnsmasq /usr/sbin/dnsmasq
13 | ln -sf $SYNOPKG_PKGDEST/synokvm/sbin/pm-is-supported /usr/sbin/pm-is-supported
14 |
15 | echo "/usr/local/synokvm/lib" >> /etc/ld.so.conf
16 | ldconfig &
17 |
18 | chmod +x /usr/local/synokvm/libexec/libvirt_leaseshelper
19 | cd /usr/local/synokvm/lib
20 | ln -sf libvirt.so.0.3009.0 libvirt.so.0
21 | ln -sf libvirt.so.0.3009.0 libvirt.so
22 | ln -sf libvirt-qemu.so.0.3009.0 libvirt-qemu.so.0
23 | ln -sf libvirt-qemu.so.0.3009.0 libvirt-qemu.so
24 | ln -sf libvirt-lxc.so.0.3009.0 libvirt-lxc.so.0
25 | ln -sf libvirt-lxc.so.0.3009.0 libvirt-lxc.so
26 | ln -sf libvirt-admin.so.0.3009.0 libvirt-admin.so.0
27 | ln -sf libvirt-admin.so.0.3009.0 libvirt-admin.so
28 |
29 | export PYTHONPATH=$PYTHONPATH:/usr/local/synokvm/python2.7/site-packages
30 | python2 /usr/local/synokvm/webvirtmgr/autouser.py -u ${webvirtmgr_user} -p ${webvirtmgr_pass}
31 |
32 | exit 0
33 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/postuninst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 | #sed -i '/^export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:\/usr\/local\/synokvm\/lib/d' /root/.bashrc
5 | sed -i '/^export PATH=$PATH:\/usr\/local\/synokvm\/bin/d' /root/.bashrc
6 |
7 | rm -f /sbin/ldconfig*
8 | rm -f /usr/sbin/ebtables
9 | rm -f /usr/sbin/dnsmasq
10 | rm -f /usr/sbin/pm-is-supported
11 |
12 | #find /usr/local/ -type l -ls |grep synokvm |awk -F"->" '{print $1}'|awk '{print $NF}'|xargs rm -f
13 | rm -f /usr/local/synokvm
14 |
15 | exit 0
16 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/postupgrade:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 | exit 0
5 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/preinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 |
5 | exit 0
6 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/preuninst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 | mkdir -p /root/.synokvm/xmls
5 | cp /usr/local/synokvm/etc/libvirt/qemu/*.xml /root/.synokvm/xmls
6 | exit 0
7 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/preupgrade:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 | exit 0
5 |
--------------------------------------------------------------------------------
/ant-spk/spk/scripts/start-stop-status:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (C) 2000-2016 Synology Inc. All rights reserved.
3 |
4 |
5 | insert_module()
6 | {
7 | local module=$1
8 | local symbol=$2
9 | if ! /sbin/lsmod | grep -q "\<${symbol}\>"; then
10 | if [ "xkvm_intel" == "x${symbol}" ]; then
11 | /sbin/insmod /lib/modules/kvm-intel.ko nested=1 enable_apicv=0 || \
12 | ( /usr/bin/logger -p err "Failed to insert ${module}, stop"; false )
13 | else
14 | /sbin/insmod /lib/modules/${module} || \
15 | ( /usr/bin/logger -p err "Failed to insert ${module}, stop"; false )
16 | fi
17 | else
18 | true
19 | fi
20 | }
21 |
22 | insert_kernel_modules()
23 | {
24 | insert_module kvm.ko kvm
25 | it=`grep vmx /proc/cpuinfo`
26 | amd=`grep svm /proc/cpuinfo`
27 | if [ ! -z "${it}" ]; then
28 | insert_module kvm-intel.ko kvm_intel
29 | elif [ ! -z "${amd}" ]; then
30 | insert_module kvm-amd.ko kvm_amd
31 | else
32 | echo 0
33 | fi
34 |
35 | insert_module vhost.ko vhost
36 | insert_module tun.ko tun
37 | insert_module vhost_net.ko vhost_net
38 | # vhost_scsi.ko were inserted in synoiscsiep
39 | insert_module pci-stub.ko pci_stub
40 |
41 | /usr/syno/bin/synoiscsiep --insmod vhost
42 | /usr/syno/bin/synoiscsiep --insmod loopback
43 | /usr/syno/bin/synoiscsiep --startall loopback
44 | /usr/syno/bin/synoiscsiep --startall vhost-scsi
45 | }
46 | remove_kernel_modules()
47 | {
48 | /usr/syno/bin/synoiscsiep --stopall loopback
49 | /usr/syno/bin/synoiscsiep --rmmod loopback
50 | /usr/syno/bin/synoiscsiep --stopall vhost-scsi
51 | /usr/syno/bin/synoiscsiep --rmmod vhost
52 |
53 | rmmod pci_stub
54 | rmmod vhost_net
55 | rmmod vhost
56 | rmmod tun
57 | it=`grep vmx /proc/cpuinfo`
58 | amd=`grep svm /proc/cpuinfo`
59 | if [ ! -z "${it}" ]; then
60 | rmmod kvm_intel
61 | elif [ ! -z "${amd}" ]; then
62 | rmmod kvm_amd
63 | else
64 | echo 0
65 | fi
66 | rmmod kvm
67 | }
68 |
69 | case $1 in
70 | start)
71 | ret=`insert_kernel_modules`
72 | if [ "$ret" != "0" ]; then
73 |
74 | export PATH=$PATH:/usr/local/synokvm/bin:/usr/local/synokvm/sbin
75 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/synokvm/lib
76 | /usr/local/synokvm/sbin/virtlogd -d
77 | /usr/local/synokvm/sbin/libvirtd -l -d -f /usr/local/synokvm/etc/libvirt/libvirtd.conf
78 |
79 | export PYTHONPATH=$PYTHONPATH:/usr/local/synokvm/python2.7/site-packages
80 | iptables -N REJECT
81 | python2 /usr/local/synokvm/webvirtmgr/manage.py run_gunicorn -c /usr/local/synokvm/webvirtmgr/conf/gunicorn.conf.py &
82 | python2 /usr/local/synokvm/webvirtmgr/console/webvirtmgr-console &
83 |
84 | for f in `ls /root/.synokvm/xmls/*.xml`; do
85 | /usr/local/synokvm/bin/virsh define ${f}
86 | rm -f ${f}
87 | done
88 | exit 0
89 | else
90 | exit 1
91 | fi
92 | ;;
93 | stop)
94 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/synokvm/lib
95 | for f in `/usr/local/synokvm/bin/virsh list --state-running --name 2>/dev/null`;do
96 | virsh shutdown ${f}
97 | done
98 | sleep 5
99 | iptables -X REJECT
100 | killall libvirtd
101 | killall virtlogd
102 | ps -ef|grep webvirtmgr-console|grep -v grep|awk '{print "kill -9 "$2}'|sh
103 | ps -ef|grep run_gunicorn|grep -v grep|awk '{print "kill -9 "$2}'|sh
104 | remove_kernel_modules
105 | exit 0
106 | ;;
107 | status)
108 | if [ -f "/usr/local/synokvm/var/run/virtlogd.pid" -a -f "/usr/local/synokvm/var/run/libvirtd.pid" ]; then
109 | exit 0
110 | else
111 | exit 1
112 | fi
113 | ;;
114 | killall)
115 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/synokvm/lib
116 | for f in `/usr/local/synokvm/bin/virsh list --state-running --name 2>/dev/null`;do
117 | virsh shutdown ${f}
118 | done
119 | sleep 5
120 | killall libvirtd
121 | killall virtlogd
122 | remove_kernel_modules
123 | ;;
124 | log)
125 | exit 0
126 | ;;
127 | esac
128 |
--------------------------------------------------------------------------------
/ant-spk/spk/wizard/install_uifile:
--------------------------------------------------------------------------------
1 | [{
2 | "step_title": "Webvirtmgr User configuration",
3 | "items": [{
4 | "type": "textfield",
5 | "desc": "Create Webvirtmgr manager",
6 | "subitems": [{
7 | "key": "webvirtmgr_user",
8 | "desc": "Username",
9 | "defaultValue": "admin",
10 | "validator": {
11 | "allowBlank": false,
12 | "regex": {
13 | "expr": "/^[a-zA-Z0-9]+/",
14 | "errorText": "User name should be alphabet or numbers"
15 | }
16 | }
17 | }]
18 | }, {
19 | "type": "password",
20 | "desc": " ",
21 | "subitems": [{
22 | "key": "webvirtmgr_pass",
23 | "desc": "Password",
24 | "defaultValue": "",
25 | "validator": {
26 | "allowBlank": false,
27 | "regex": {
28 | "expr": "/^[a-zA-Z0-9]+/",
29 | "errorText": "Password should be alphabet or numbers"
30 | }
31 | }
32 | }]
33 | }]
34 | }]
35 |
--------------------------------------------------------------------------------
/ant-spk/spk/wizard/install_uifile_chs:
--------------------------------------------------------------------------------
1 | [{
2 | "step_title": "添加Webvirtmgr管理员帐户",
3 | "items": [{
4 | "type": "textfield",
5 | "desc": "webvirtmgr超级管理员",
6 | "subitems": [{
7 | "key": "webvirtmgr_user",
8 | "desc": "用户名",
9 | "defaultValue": "admin",
10 | "validator": {
11 | "allowBlank": false,
12 | "regex": {
13 | "expr": "/^[a-zA-Z0-9]+/",
14 | "errorText": "用户名必须是数字或者字母"
15 | }
16 | }
17 | }]
18 | }, {
19 | "type": "password",
20 | "desc": " ",
21 | "subitems": [{
22 | "key": "webvirtmgr_pass",
23 | "desc": "密码",
24 | "defaultValue": "",
25 | "validator": {
26 | "allowBlank": false,
27 | "regex": {
28 | "expr": "/^[a-zA-Z0-9]+/",
29 | "errorText": "密码必须是数字或者字母"
30 | }
31 | }
32 | }]
33 | }]
34 | }]
35 |
--------------------------------------------------------------------------------