libvirt:moved into main repo for pisi 2.0
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#/usr/bin/python
|
||||
|
||||
import os
|
||||
|
||||
permissions = {
|
||||
"/etc/libvirt" : ["0700", "root:root"],
|
||||
"/etc/libvirt/qemu" : ["0700", "root:root"],
|
||||
"/etc/libvirt/nwfilter" : ["0700", "root:root"],
|
||||
"/etc/libvirt/qemu/networks" : ["0700", "root:root"],
|
||||
"/etc/libvirt/qemu/networks/autostart" : ["0700", "root:root"],
|
||||
"/var/log/libvirt" : ["0700", "root:root"],
|
||||
"/var/log/libvirt/qemu" : ["0700", "root:root"],
|
||||
"/var/log/libvirt/lxc" : ["0700", "root:root"],
|
||||
"/var/log/libvirt/uml" : ["0700", "root:root"],
|
||||
"/var/lib/libvirt" : ["0755", "root:root"],
|
||||
"/var/lib/libvirt/images" : ["0711", "root:root"],
|
||||
"/var/lib/libvirt/boot" : ["0711", "root:root"],
|
||||
"/var/lib/libvirt/qemu" : ["0750", "qemu:qemu"],
|
||||
"/var/lib/libvirt/lxc" : ["0700", "root:root"],
|
||||
"/var/lib/libvirt/uml" : ["0700", "root:root"],
|
||||
"/var/lib/libvirt/network" : ["0700", "root:root"],
|
||||
"/var/lib/libvirt/dnsmasq" : ["0755", "root:root"],
|
||||
"/var/cache/libvirt/qemu" : ["0750", "qemu:qemu"],
|
||||
"/var/cache/libvirt" : ["0700", "root:root"],
|
||||
"/run/libvirt" : ["0755", "root:root"],
|
||||
"/run/libvirt/qemu" : ["0700", "qemu:qemu"],
|
||||
"/run/libvirt/uml" : ["0700", "root:root"],
|
||||
"/usr/libexec/libvirt_proxy" : ["4755", "root:root"],
|
||||
}
|
||||
|
||||
|
||||
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
|
||||
for _file, perms in permissions.items():
|
||||
# The list above is general, some paths may not exist depending on the configuration
|
||||
if os.path.exists(_file):
|
||||
os.system("/bin/chown -R %s %s" % (perms[1], _file))
|
||||
os.system("/bin/chmod %s %s" % (perms[0], _file))
|
||||
os.system("groupadd libvirt")
|
||||
os.system("usermod -G libvirt %s" % os.getusername())
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from comar.service import *
|
||||
import os
|
||||
|
||||
serviceType = "local"
|
||||
serviceDesc = _({"en": "libvirt virtualization API daemon",
|
||||
"tr": "libvirt sanallaştırma hizmeti"})
|
||||
serviceDefault = "on"
|
||||
|
||||
PIDFILE = "/run/libvirt/libvirtd.pid"
|
||||
KRB5_KTNAME = "/etc/libvirt/krb5.tab"
|
||||
LIBVIRTD_CONFIG = "/etc/libvirt/libvirtd.conf"
|
||||
|
||||
@synchronized
|
||||
def start():
|
||||
os.environ["KRB5_KTNAME"] = config.get("KRB5_KTNAME", KRB5_KTNAME)
|
||||
os.environ["PATH"] = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin"
|
||||
|
||||
if os.path.exists(PIDFILE):
|
||||
os.unlink(PIDFILE)
|
||||
|
||||
startService(command="/usr/sbin/libvirtd",
|
||||
args="--daemon --config %s %s --pid-file %s" % (
|
||||
config.get("LIBVIRTD_ARGS", ""),
|
||||
config.get("LIBVIRTD_CONFIG", LIBVIRTD_CONFIG),
|
||||
PIDFILE,
|
||||
),
|
||||
donotify=True)
|
||||
|
||||
@synchronized
|
||||
def stop():
|
||||
stopService(pidfile="/run/libvirt/libvirtd.pid",
|
||||
donotify=True)
|
||||
if os.path.exists(PIDFILE):
|
||||
os.unlink(PIDFILE)
|
||||
|
||||
@synchronized
|
||||
def reload():
|
||||
if os.path.exists(PIDFILE):
|
||||
os.kill(int(open(PIDFILE, "r").read().strip()), 1)
|
||||
|
||||
def status():
|
||||
return isServiceRunning(pidfile=PIDFILE)
|
||||
Reference in New Issue
Block a user