Skip to content

Commit a2a0e24

Browse files
committed
Move the NFS and 9p mounting code from Create to Start.
This will re-mount on a re-start.
1 parent 46a94c2 commit a2a0e24

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

xhyve/xhyve.go

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -441,21 +441,7 @@ func (d *Driver) Create() error {
441441
return err
442442
}
443443

444-
if d.Virtio9p {
445-
err = d.setupVirt9pShare()
446-
if err != nil {
447-
log.Errorf("virtio-9p setup failed: %s", err.Error())
448-
}
449-
}
450-
451-
// Setup NFS sharing
452-
if d.NFSShare {
453-
log.Infof("NFS share folder must be root. Please insert root password.")
454-
err = d.setupNFSShare()
455-
if err != nil {
456-
log.Errorf("NFS setup failed: %s", err.Error())
457-
}
458-
}
444+
d.setupMounts()
459445

460446
return nil
461447
}
@@ -496,6 +482,8 @@ func (d *Driver) Start() error {
496482
}
497483
}()
498484

485+
d.setupMounts()
486+
499487
return d.waitForIP()
500488
}
501489

@@ -744,6 +732,27 @@ func (d *Driver) generateQcow2Image(size int64) error {
744732
return nil
745733
}
746734

735+
func (d *Driver) setupMounts() error {
736+
if d.Virtio9p {
737+
err = d.setupVirt9pShare()
738+
if err != nil {
739+
log.Errorf("virtio-9p setup failed: %s", err.Error())
740+
return err
741+
}
742+
}
743+
744+
// Setup NFS sharing
745+
if d.NFSShare {
746+
log.Infof("NFS share folder must be root. Please insert root password.")
747+
err = d.setupNFSShare()
748+
if err != nil {
749+
log.Errorf("NFS setup failed: %s", err.Error())
750+
return err
751+
}
752+
}
753+
return nil
754+
}
755+
747756
// zeroFill writes n zero bytes into w.
748757
func zeroFill(w io.Writer, n int64) error {
749758
const blocksize = 32 << 10

0 commit comments

Comments
 (0)