From 047864c2490efeca59cdc611505ef4a214bf182c Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Fri, 20 Oct 2017 14:36:33 -0500 Subject: [PATCH] agent: re-scan pci bus to discover hidden devices qemu <= 2.9 does not support ACPI pci hotplug in Q35 machines, this means the linux kernel will not receive the order to re-enumerate/re-scan the pci devices connected to the buses, hence pci bus must be re-scanned manually looking for hidden devices fixes #138 Signed-off-by: Julio Montes --- agent.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agent.go b/agent.go index ba01d355a..f12360111 100644 --- a/agent.go +++ b/agent.go @@ -65,6 +65,8 @@ const ( logLevelFlag = optionPrefix + "log" defaultLogLevel = logrus.InfoLevel cannotGetTimeMsg = "Failed to get time for event %s:%v" + pciBusRescanFile = "/sys/bus/pci/rescan" + pciBusMode = 0220 ) var capsList = []string{ @@ -1060,6 +1062,12 @@ func addMounts(config *configs.Config, fsmaps []hyper.Fsmap) error { func newContainerCb(pod *pod, data []byte) error { var payload hyper.NewContainer + // re-scan PCI bus + // looking for hidden devices + if err := ioutil.WriteFile(pciBusRescanFile, []byte("1"), pciBusMode); err != nil { + agentLog.WithError(err).Warnf("Could not rescan PCI bus") + } + if pod.running == false { return fmt.Errorf("Pod not started, impossible to run a new container") }