Exemple #1
0
func (this FileStore) NewHost(driver drivers.Driver) (*host.Host, error) {
	hostDir := filepath.Join(this.getMachinesDir(), driver.GetMachineName())

	_, err := os.Stat(hostDir)

	// if the directory has already existed
	if !os.IsNotExist(err) {
		return nil, HostEntryAlreadyExistError
	}

	vm := &host.Host{
		Name:       driver.GetMachineName(),
		Driver:     driver,
		DriverName: driver.DriverName(),
	}

	err = this.save(vm)

	return vm, nil

}