Skip to content

Commit

Permalink
bridges: Check if this fixes netmon error
Browse files Browse the repository at this point in the history
TODO: Put changes into right commits

Fixes: kata-containers#1153
Signed-off-by: Jan Schintag <jan.schintag@de.ibm.com>
  • Loading branch information
jschintag committed Aug 28, 2019
1 parent 590e9e8 commit 4d55774
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type CPUDevice struct {

// QemuState keeps Qemu's state
type QemuState struct {
Bridges []types.Bridge
// HotpluggedCPUs is the list of CPUs that were hot-added
HotpluggedVCPUs []CPUDevice
HotpluggedMemory int
Expand Down Expand Up @@ -260,6 +261,8 @@ func (q *qemu) setup(id string, hypervisorConfig *HypervisorConfig, vcStore *sto
if err := q.store.Load(store.Hypervisor, &q.state); err != nil {
// hypervisor doesn't exist, create new one
create = true
} else {
q.arch.setBridges(q.state.Bridges)
}
} else if q.state.UUID == "" { // new store
create = true
Expand Down Expand Up @@ -1976,6 +1979,7 @@ func (q *qemu) toGrpc() ([]byte, error) {

func (q *qemu) storeState() error {
if q.store != nil {
q.state.Bridges = q.arch.getBridges()
if err := q.store.Store(store.Hypervisor, q.state); err != nil {
return err
}
Expand Down
7 changes: 7 additions & 0 deletions virtcontainers/qemu_arch_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ type qemuArch interface {
// getBridges grants access to Bridges
getBridges() []types.Bridge

// setBridges grants access to Bridges
setBridges(bridges []types.Bridge)

// addBridge adds a new Bridge to the list of Bridges
addBridge(types.Bridge)

Expand Down Expand Up @@ -673,6 +676,10 @@ func (q *qemuArchBase) getBridges() []types.Bridge {
return q.Bridges
}

func (q *qemuArchBase) setBridges(bridges []types.Bridge) {
q.Bridges = bridges
}

func (q *qemuArchBase) addBridge(b types.Bridge) {
q.Bridges = append(q.Bridges, b)
}

0 comments on commit 4d55774

Please sign in to comment.