Don't copy qemu.conf when running as root
Root is using /etc/libvirt/qemu.conf
$XDG_CONFIG_HOME/libvirt/qemu.conf is used only in non-root
@@ -35,6 +35,7 @@ const (
qemuConfPath = "/etc/libvirt/qemu.conf"
libvirdConfPath = "/etc/libvirt/libvirtd.conf"
libvirtRuntimePath = "/var/run/libvirt"
+ qemuNonRootConfPath = libvirtRuntimePath + "/qemu.conf"
)
var LifeCycleTranslationMap = map[libvirt.DomainState]api.LifeCycle{
@@ -485,10 +486,14 @@ func copyFile(from, to string) error {
}
func (l LibvirtWrapper) SetupLibvirt() (err error) {
- runtimeQemuConfPath := path.Join(libvirtRuntimePath, "qemu.conf")
+ runtimeQemuConfPath := qemuConfPath
+ if !l.root() {
+ runtimeQemuConfPath = qemuNonRootConfPath
+
if err := copyFile(qemuConfPath, runtimeQemuConfPath); err != nil {
return err
}
+ }
if err := configureQemuConf(runtimeQemuConfPath); err != nil {
return err
