Merge pull request #2385 from betabrand/hyperkit-nfs-cleanupexports
Cleanup NFS Exports after stop and deletepull/2390/head
commit
80b949d64d
|
@ -230,6 +230,7 @@ func (d *Driver) Start() error {
|
||||||
|
|
||||||
// Stop a host gracefully
|
// Stop a host gracefully
|
||||||
func (d *Driver) Stop() error {
|
func (d *Driver) Stop() error {
|
||||||
|
d.cleanupNfsExports()
|
||||||
return d.sendSignal(syscall.SIGTERM)
|
return d.sendSignal(syscall.SIGTERM)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,3 +328,18 @@ func (d *Driver) getPid() int {
|
||||||
|
|
||||||
return config.Pid
|
return config.Pid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Driver) cleanupNfsExports() {
|
||||||
|
if len(d.NFSShares) > 0 {
|
||||||
|
log.Infof("You must be root to remove NFS shared folders. Please type root password.")
|
||||||
|
for _, share := range d.NFSShares {
|
||||||
|
if _, err := nfsexports.Remove("", d.nfsExportIdentifier(share)); err != nil {
|
||||||
|
log.Errorf("failed removing nfs share (%s): %s", share, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := nfsexports.ReloadDaemon(); err != nil {
|
||||||
|
log.Errorf("failed to reload the nfs daemon: %s", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue