From 4ac675453f17e0f5412157f5e2a94f45ae4f052d Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 13 Jul 2018 18:07:28 +0800 Subject: [PATCH] qemu: remove append9PVolumes It is not used and we actully cannot append multiple 9pfs volumes to a guest. Signed-off-by: Peng Tao --- virtcontainers/qemu.go | 1 - virtcontainers/qemu_arch_base.go | 12 --------- virtcontainers/qemu_arch_base_test.go | 39 --------------------------- 3 files changed, 52 deletions(-) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index a018f578c4..53dbffa78a 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -359,7 +359,6 @@ func (q *qemu) createSandbox(sandboxConfig SandboxConfig) error { // bridge gets the first available PCI address i.e bridgePCIStartAddr devices = q.arch.appendBridges(devices, q.state.Bridges) - devices = q.arch.append9PVolumes(devices, sandboxConfig.Volumes) console, err := q.getSandboxConsole(sandboxConfig.ID) if err != nil { return err diff --git a/virtcontainers/qemu_arch_base.go b/virtcontainers/qemu_arch_base.go index 54dbc3d1e3..e0188c4d3d 100644 --- a/virtcontainers/qemu_arch_base.go +++ b/virtcontainers/qemu_arch_base.go @@ -50,9 +50,6 @@ type qemuArch interface { // memoryTopology returns the memory topology using the given amount of memoryMb and hostMemoryMb memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.Memory - // append9PVolumes appends volumes to devices - append9PVolumes(devices []govmmQemu.Device, volumes []Volume) []govmmQemu.Device - // appendConsole appends a console to devices appendConsole(devices []govmmQemu.Device, path string) []govmmQemu.Device @@ -253,15 +250,6 @@ func (q *qemuArchBase) memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.M return memory } -func (q *qemuArchBase) append9PVolumes(devices []govmmQemu.Device, volumes []Volume) []govmmQemu.Device { - // Add the shared volumes - for _, v := range volumes { - devices = q.append9PVolume(devices, v) - } - - return devices -} - func (q *qemuArchBase) appendConsole(devices []govmmQemu.Device, path string) []govmmQemu.Device { serial := govmmQemu.SerialDevice{ Driver: govmmQemu.VirtioSerial, diff --git a/virtcontainers/qemu_arch_base_test.go b/virtcontainers/qemu_arch_base_test.go index 906d354cc6..77e3f880c3 100644 --- a/virtcontainers/qemu_arch_base_test.go +++ b/virtcontainers/qemu_arch_base_test.go @@ -206,8 +206,6 @@ func testQemuArchBaseAppend(t *testing.T, structure interface{}, expected []govm devices = qemuArchBase.append9PVolume(devices, s) case Socket: devices = qemuArchBase.appendSocket(devices, s) - case []Volume: - devices = qemuArchBase.append9PVolumes(devices, s) case drivers.Drive: devices = qemuArchBase.appendBlockDevice(devices, s) case drivers.VFIODevice: @@ -219,43 +217,6 @@ func testQemuArchBaseAppend(t *testing.T, structure interface{}, expected []govm assert.Equal(devices, expected) } -func TestQemuArchBaseAppend9PVolumes(t *testing.T) { - volMountTag := "testVolMountTag" - volHostPath := "testVolHostPath" - - expectedOut := []govmmQemu.Device{ - govmmQemu.FSDevice{ - Driver: govmmQemu.Virtio9P, - FSDriver: govmmQemu.Local, - ID: fmt.Sprintf("extra-9p-%s", fmt.Sprintf("%s.1", volMountTag)), - Path: fmt.Sprintf("%s.1", volHostPath), - MountTag: fmt.Sprintf("%s.1", volMountTag), - SecurityModel: govmmQemu.None, - }, - govmmQemu.FSDevice{ - Driver: govmmQemu.Virtio9P, - FSDriver: govmmQemu.Local, - ID: fmt.Sprintf("extra-9p-%s", fmt.Sprintf("%s.2", volMountTag)), - Path: fmt.Sprintf("%s.2", volHostPath), - MountTag: fmt.Sprintf("%s.2", volMountTag), - SecurityModel: govmmQemu.None, - }, - } - - volumes := []Volume{ - { - MountTag: fmt.Sprintf("%s.1", volMountTag), - HostPath: fmt.Sprintf("%s.1", volHostPath), - }, - { - MountTag: fmt.Sprintf("%s.2", volMountTag), - HostPath: fmt.Sprintf("%s.2", volHostPath), - }, - } - - testQemuArchBaseAppend(t, volumes, expectedOut) -} - func TestQemuArchBaseAppendConsoles(t *testing.T) { var devices []govmmQemu.Device assert := assert.New(t)