|
class SetupLibvirt(ConfigTask): |
|
name = "libvirt setup" |
|
cfgline = "export CGROUP_DAEMON='cpu:/virt'" |
|
def done(self): |
|
try: |
|
if distro in (Fedora,CentOS, RHEL6): libvirtfile = "/etc/sysconfig/libvirtd" |
|
elif distro is Ubuntu: libvirtfile = "/etc/default/libvirt-bin" |
|
else: raise AssertionError, "We should not reach this" |
|
return self.cfgline in file(libvirtfile,"r").read(-1) |
|
except IOError,e: |
|
if e.errno is 2: raise TaskFailed("libvirt has not been properly installed on this system") |
|
raise |
|
|
|
def execute(self): |
|
if distro in (Fedora,CentOS, RHEL6): libvirtfile = "/etc/sysconfig/libvirtd" |
|
elif distro is Ubuntu: libvirtfile = "/etc/default/libvirt-bin" |
|
else: raise AssertionError, "We should not reach this" |
|
libvirtbin = file(libvirtfile,"r").read(-1) |
|
libvirtbin = libvirtbin + "\n" + self.cfgline + "\n" |
|
file(libvirtfile,"w").write(libvirtbin) |
|
|
|
if distro in (CentOS, Fedora, RHEL6): svc = "libvirtd" |
|
else: svc = "libvirt-bin" |
|
stop_service(svc) |
|
enable_service(svc) |
|
|
|
class SetupLiveMigration(ConfigTask): |
|
name = "live migration setup" |
|
stanzas = ( |
|
"listen_tcp=1", |
|
'tcp_port="16509"', |
|
'auth_tcp="none"', |
|
"listen_tls=0", |
|
) |
|
|
|
def done(self): |
|
try: |
|
lines = [ s.strip() for s in file("/etc/libvirt/libvirtd.conf").readlines() ] |
|
if all( [ stanza in lines for stanza in self.stanzas ] ): return True |
|
except IOError,e: |
|
if e.errno is 2: raise TaskFailed("libvirt has not been properly installed on this system") |
|
raise |
|
|
|
def execute(self): |
|
|
|
for stanza in self.stanzas: |
|
startswith = stanza.split("=")[0] + '=' |
|
replace_or_add_line("/etc/libvirt/libvirtd.conf",startswith,stanza) |
|
|
|
if distro in (Fedora, RHEL6): |
|
replace_or_add_line("/etc/sysconfig/libvirtd","LIBVIRTD_ARGS=","LIBVIRTD_ARGS=-l") |
|
|
|
elif distro is Ubuntu: |
|
if os.path.exists("/etc/init/libvirt-bin.conf"): |
|
replace_line("/etc/init/libvirt-bin.conf", "exec /usr/sbin/libvirtd","exec /usr/sbin/libvirtd -d -l") |
|
else: |
|
replace_or_add_line("/etc/default/libvirt-bin","libvirtd_opts=","libvirtd_opts='-l'") |
|
|
|
else: |
|
raise AssertionError("Unsupported distribution") |
|
|
|
if distro in (CentOS, Fedora, RHEL6): svc = "libvirtd" |
|
else: svc = "libvirt-bin" |
|
stop_service(svc) |
|
enable_service(svc) |
cloudstack/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPostCertificateRenewalCommandWrapper.java
Lines 41 to 45 in 7667846
cloudstack/debian/rules
Lines 47 to 48 in 7313a5e
cloudstack/debian/control
Line 25 in 7313a5e
cloudstack/python/lib/cloud_utils.py
Lines 706 to 770 in 1d05fea
Debian does not have libvirt-bin it has libvirtd
https://packages.debian.org/search?suite=stable§ion=all&arch=any&searchon=names&keywords=libvirt