Skip to content

Commit 4a0cf5a

Browse files
committed
vfkit: Extract isoPath() helper
For consistency with other path helpers.
1 parent 7498245 commit 4a0cf5a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/drivers/vfkit/vfkit.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,10 @@ func (d *Driver) Create() error {
223223

224224
func (d *Driver) extractKernel() error {
225225
log.Info("Extracting bzimage and initrd...")
226-
isoPath := d.ResolveStorePath(isoFilename)
227-
if err := pkgdrivers.ExtractFile(isoPath, "/boot/bzimage", d.kernelPath()); err != nil {
226+
if err := pkgdrivers.ExtractFile(d.isoPath(), "/boot/bzimage", d.kernelPath()); err != nil {
228227
return err
229228
}
230-
return pkgdrivers.ExtractFile(isoPath, "/boot/initrd", d.initrdPath())
229+
return pkgdrivers.ExtractFile(d.isoPath(), "/boot/initrd", d.initrdPath())
231230
}
232231

233232
func (d *Driver) Start() error {
@@ -258,8 +257,6 @@ func (d *Driver) Start() error {
258257
// startVfkit starts the vfkit child process. If socketPath is not empty, vfkit
259258
// is connected to the vmnet network via the socket instead of "nat" network.
260259
func (d *Driver) startVfkit(socketPath string) error {
261-
machineDir := filepath.Join(d.StorePath, "machines", d.GetMachineName())
262-
263260
var startCmd []string
264261

265262
startCmd = append(startCmd,
@@ -296,9 +293,8 @@ func (d *Driver) startVfkit(socketPath string) error {
296293
startCmd = append(startCmd,
297294
"--device", "virtio-rng")
298295

299-
var isoPath = filepath.Join(machineDir, isoFilename)
300296
startCmd = append(startCmd,
301-
"--device", fmt.Sprintf("virtio-blk,path=%s", isoPath))
297+
"--device", fmt.Sprintf("virtio-blk,path=%s", d.isoPath()))
302298

303299
startCmd = append(startCmd,
304300
"--device", fmt.Sprintf("virtio-blk,path=%s", d.diskPath()))
@@ -516,6 +512,10 @@ func (d *Driver) publicSSHKeyPath() string {
516512
return d.sshKeyPath() + ".pub"
517513
}
518514

515+
func (d *Driver) isoPath() string {
516+
return d.ResolveStorePath(isoFilename)
517+
}
518+
519519
func (d *Driver) kernelPath() string {
520520
return d.ResolveStorePath("bzimage")
521521
}

0 commit comments

Comments
 (0)