@@ -21,7 +21,7 @@ import (
21
21
"strconv"
22
22
"strings"
23
23
24
- "github.com/awslabs/go-firecracker"
24
+ firecracker "github.com/awslabs/go-firecracker"
25
25
flags "github.com/jessevdk/go-flags"
26
26
log "github.com/sirupsen/logrus"
27
27
)
@@ -31,7 +31,7 @@ func validateDriveEntry(entry string) error {
31
31
return nil
32
32
}
33
33
34
- func checkConfig (cfg machine .Config ) error {
34
+ func checkConfig (cfg firecracker .Config ) error {
35
35
var err error
36
36
37
37
// Check for the existence of some required files:
@@ -57,8 +57,8 @@ func checkConfig(cfg machine.Config) error {
57
57
return nil
58
58
}
59
59
60
- func parseBlockDevices (entries []string ) ([]machine .BlockDevice , error ) {
61
- var devices []machine .BlockDevice
60
+ func parseBlockDevices (entries []string ) ([]firecracker .BlockDevice , error ) {
61
+ var devices []firecracker .BlockDevice
62
62
for _ , entry := range entries {
63
63
var path string
64
64
if strings .HasSuffix (entry , ":rw" ) {
@@ -67,7 +67,7 @@ func parseBlockDevices(entries []string) ([]machine.BlockDevice, error) {
67
67
path = strings .TrimSuffix (entry , ":ro" )
68
68
} else {
69
69
msg := fmt .Sprintf ("Invalid drive specification. Must have :rw or :ro suffix" )
70
- return []machine .BlockDevice {}, errors .New (msg )
70
+ return []firecracker .BlockDevice {}, errors .New (msg )
71
71
}
72
72
if path == "" {
73
73
return nil , errors .New ("Invalid drive specification" )
@@ -76,7 +76,7 @@ func parseBlockDevices(entries []string) ([]machine.BlockDevice, error) {
76
76
if err != nil {
77
77
return nil , err
78
78
}
79
- e := machine .BlockDevice {
79
+ e := firecracker .BlockDevice {
80
80
HostPath : path ,
81
81
Mode : "rw" ,
82
82
}
@@ -99,18 +99,18 @@ func parseNicConfig(cfg string) (string, string, error) {
99
99
100
100
// Given a list of string representations of vsock devices,
101
101
// return a corresponding slice of machine.VsockDevice objects
102
- func parseVsocks (devices []string ) ([]machine .VsockDevice , error ) {
103
- var result []machine .VsockDevice
102
+ func parseVsocks (devices []string ) ([]firecracker .VsockDevice , error ) {
103
+ var result []firecracker .VsockDevice
104
104
for _ , entry := range devices {
105
105
fields := strings .Split (entry , ":" )
106
106
if len (fields ) != 2 {
107
- return []machine .VsockDevice {}, errors .New ("Could not parse" )
107
+ return []firecracker .VsockDevice {}, errors .New ("Could not parse" )
108
108
}
109
109
CID , err := strconv .ParseUint (fields [1 ], 10 , 32 )
110
110
if err != nil {
111
- return []machine .VsockDevice {}, errors .New ("Vsock CID could not be parsed as a number" )
111
+ return []firecracker .VsockDevice {}, errors .New ("Vsock CID could not be parsed as a number" )
112
112
}
113
- dev := machine .VsockDevice {
113
+ dev := firecracker .VsockDevice {
114
114
Path : fields [0 ],
115
115
CID : uint32 (CID ),
116
116
}
@@ -162,24 +162,24 @@ func main() {
162
162
logger .SetLevel (log .DebugLevel )
163
163
}
164
164
165
- var NICs []machine .NetworkInterface
165
+ var NICs []firecracker .NetworkInterface
166
166
167
167
if len (opts .FcNicConfig ) > 0 {
168
168
tapDev , tapMacAddr , err := parseNicConfig (opts .FcNicConfig )
169
169
if err != nil {
170
170
log .Fatalf ("Unable to parse NIC config: %s" , err )
171
171
} else {
172
172
log .Printf ("Adding tap device %s" , tapDev )
173
- NICs = []machine .NetworkInterface {
174
- machine .NetworkInterface {
173
+ NICs = []firecracker .NetworkInterface {
174
+ firecracker .NetworkInterface {
175
175
MacAddress : tapMacAddr ,
176
176
HostDevName : tapDev ,
177
177
},
178
178
}
179
179
}
180
180
}
181
181
182
- rootDrive := machine .BlockDevice {HostPath : opts .FcRootDrivePath , Mode : "rw" }
182
+ rootDrive := firecracker .BlockDevice {HostPath : opts .FcRootDrivePath , Mode : "rw" }
183
183
184
184
blockDevices , err := parseBlockDevices (opts .FcAdditionalDrives )
185
185
if err != nil {
@@ -191,7 +191,7 @@ func main() {
191
191
log .Fatalf ("Invalid vsock specification: %s" , err )
192
192
}
193
193
194
- fcCfg := machine .Config {
194
+ fcCfg := firecracker .Config {
195
195
BinPath : opts .FcBinary ,
196
196
SocketPath : "./firecracker.sock" ,
197
197
LogFifo : opts .FcLogFifo ,
@@ -206,7 +206,7 @@ func main() {
206
206
VsockDevices : vsocks ,
207
207
Console : opts .FcConsole ,
208
208
CPUCount : opts .FcCPUCount ,
209
- CPUTemplate : machine .CPUTemplate (opts .FcCPUTemplate ),
209
+ CPUTemplate : firecracker .CPUTemplate (opts .FcCPUTemplate ),
210
210
HtEnabled : ! opts .FcDisableHt ,
211
211
MemInMiB : opts .FcMemSz ,
212
212
}
@@ -216,8 +216,8 @@ func main() {
216
216
log .Fatalf ("Configuration error: %s" , err )
217
217
}
218
218
219
- fireracker := machine .NewFirecrackerClient (fcCfg .SocketPath )
220
- m := machine .NewMachine (fcCfg , fireracker , logger )
219
+ fireracker := firecracker .NewFirecrackerClient (fcCfg .SocketPath )
220
+ m := firecracker .NewMachine (fcCfg , fireracker , logger )
221
221
222
222
ctx := context .Background ()
223
223
vmmCtx , vmmCancel := context .WithCancel (ctx )
0 commit comments