Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devimc In the other PR you are reusing the pci slots. Not sure if a slot will ever be reused (block device unplug followed by a plug in the real world with virtcontainers). However if that does happen, what happens to the mount points?

Also how do we know when the rescan is complete?

Copy link
Copy Markdown
Author

@devimc devimc Oct 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcastelino pci slots can be reused once it's free

what happens to the mount points?

There is still missing that part, in qemu <= 2.9 Q35 PCI devices must be removed manually, I guess we have to implement an extra command in the agent to clean up unplugged devices

Also how do we know when the rescan is complete?

it is a blocking IO operation, process will not continue until all PCI buses are re-scanned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devimc will the pci slot reuse happen in the real world. Do we support removing a container from a POD?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we can remove a container from a POD, but we can unplug devices from bridges.
we could reuse that slot to hot plug another device if we need it since we have a limitation in the number of devices per bridge.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devimc so when will we ever unplug a device? I cannot think of a case. Which means we are ok for now and need no special logic or unmount/remount.

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")
}
Expand Down