Exemplo n.º 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

}
Exemplo n.º 2
0
	"github.com/cheyang/scloud/pkg/drivers"
	//	"github.com/cheyang/scloud/pkg/log"
	"github.com/cheyang/scloud/pkg/persist"
	"github.com/cheyang/scloud/pkg/state"
	"github.com/cheyang/scloud/pkg/utils"
	datatypes "github.com/maximilien/softlayer-go/data_types"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("pkg", func() {

	var (
		sl_driver drivers.Driver
		store     persist.Store
		err       error
		name      string
	)

	BeforeEach(func() {

		name = "apmwdc-001"

		store = lib.GetDefaultStore(name)

		hostname := name

		sl_driver, err = sl_cloud.NewDriver(hostname, store.MyDir())

		Expect(err).To(BeNil())