예제 #1
0
파일: filestore.go 프로젝트: cheyang/scloud
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

}
예제 #2
0
파일: pkg_test.go 프로젝트: cheyang/scloud
	"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())