engine: resources: Make the qemu guest agent automatic
This commit is contained in:
@@ -187,7 +187,8 @@ type VirtBuilderRes struct {
|
|||||||
LogOutput bool `lang:"log_output" yaml:"log_output"`
|
LogOutput bool `lang:"log_output" yaml:"log_output"`
|
||||||
|
|
||||||
// Tweaks adds some random tweaks to work around common bugs. This
|
// Tweaks adds some random tweaks to work around common bugs. This
|
||||||
// defaults to true.
|
// defaults to true. It also does some useful things that most may find
|
||||||
|
// desirable.
|
||||||
Tweaks bool `lang:"tweaks" yaml:"tweaks"`
|
Tweaks bool `lang:"tweaks" yaml:"tweaks"`
|
||||||
|
|
||||||
varDir string
|
varDir string
|
||||||
@@ -508,6 +509,12 @@ func (obj *VirtBuilderRes) CheckApply(ctx context.Context, apply bool) (bool, er
|
|||||||
extraPackages = append(extraPackages, p...)
|
extraPackages = append(extraPackages, p...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Magic vm things should happen automatically.
|
||||||
|
if d := obj.getDistro(); obj.Tweaks && (d == "fedora" || d == "debian") {
|
||||||
|
p := "qemu-guest-agent" // same for debian and fedora
|
||||||
|
extraPackages = append(extraPackages, p)
|
||||||
|
}
|
||||||
|
|
||||||
if len(obj.Packages) > 0 || len(extraPackages) > 0 {
|
if len(obj.Packages) > 0 || len(extraPackages) > 0 {
|
||||||
packages := []string{} // I think the ordering _may_ matter.
|
packages := []string{} // I think the ordering _may_ matter.
|
||||||
packages = append(packages, obj.Packages...)
|
packages = append(packages, obj.Packages...)
|
||||||
@@ -516,6 +523,13 @@ func (obj *VirtBuilderRes) CheckApply(ctx context.Context, apply bool) (bool, er
|
|||||||
cmdArgs = append(cmdArgs, args...)
|
cmdArgs = append(cmdArgs, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Magic vm things should happen automatically.
|
||||||
|
if d := obj.getDistro(); obj.Tweaks && (d == "fedora" || d == "debian") {
|
||||||
|
x := "/usr/bin/systemctl enable qemu-guest-agent.service"
|
||||||
|
args := []string{"--run-command", x}
|
||||||
|
cmdArgs = append(cmdArgs, args...)
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: Tweak for debian grub-pc bug:
|
// XXX: Tweak for debian grub-pc bug:
|
||||||
// https://www.mail-archive.com/guestfs@lists.libguestfs.org/msg00062.html
|
// https://www.mail-archive.com/guestfs@lists.libguestfs.org/msg00062.html
|
||||||
if obj.Tweaks && obj.Update && obj.getDistro() == "debian" {
|
if obj.Tweaks && obj.Update && obj.getDistro() == "debian" {
|
||||||
|
|||||||
Reference in New Issue
Block a user