Skip to content

Commit

Permalink
Leave pci address enumeration to qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
jellonek committed Apr 12, 2018
1 parent a06ca4a commit 0fd31bc
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions cmd/vmwrapper/vmwrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"flag"
"fmt"
"os"
"strconv"
"strings"
"syscall"

"github.com/golang/glog"
Expand All @@ -40,19 +38,6 @@ const (
vmsProcFile = "/var/lib/virtlet/vms.procfile"
)

func extractLastUsedPCIAddress(args []string) int {
var lastUsed int
for _, arg := range args {
i := strings.LastIndex(arg, "addr=0x")
if i < 0 {
continue
}
parsed, _ := strconv.ParseInt(arg[i+7:], 16, 32)
lastUsed = int(parsed)
}
return lastUsed
}

type reexecArg struct {
Args []string
}
Expand Down Expand Up @@ -94,7 +79,6 @@ func main() {
emulator = defaultEmulator
} else {
netFdKey := os.Getenv(netKeyEnvVar)
nextToUsePCIAddress := extractLastUsedPCIAddress(os.Args[1:]) + 1
nextToUseHostdevNo := 0

if netFdKey != "" {
Expand Down Expand Up @@ -127,18 +111,14 @@ func main() {
case network.InterfaceTypeVF:
netArgs = append(netArgs,
"-device",
// fmt.Sprintf("pci-assign,configfd=%d,host=%s,id=hostdev%d,bus=pci.0,addr=0x%x",
fmt.Sprintf("pci-assign,host=%s,id=hostdev%d,bus=pci.0,addr=0x%x",
// desc.FdIndex,
fmt.Sprintf("pci-assign,host=%s,id=hostdev%d",
desc.PCIAddress[5:],
nextToUseHostdevNo,
nextToUsePCIAddress,
),
)
nextToUseHostdevNo += 1
nextToUsePCIAddress += 1
default:
// Impssible situation when tapmanager is built from other sources than vmwrapper
// Impossible situation when tapmanager is built from other sources than vmwrapper
glog.Errorf("Received unknown interface type: %d", int(desc.Type))
os.Exit(1)
}
Expand Down

0 comments on commit 0fd31bc

Please sign in to comment.