Esempio n. 1
0
func Create(store persist.Store, host *host.Host) error {

	fmt.Fprintf(os.Stderr, "Running pre-create check for %s ... \n", host.Name)

	if host.Driver.DriverName() != "None" {
		return fmt.Errorf("Not an implmented cloud driver")
	}

	if err := host.Driver.PreCreateCheck(); err != nil {

		return fmt.Errorf("Error with precheck for machien %s : %s", host.Name, err)
	}

	fmt.Fprintf(os.Stderr, "Creating machine... for %s ...", host.Name)

	if err := host.Driver.Create(); err != nil {
		return fmt.Errorf("Error in driver during machine %s creation: %s", host.Name, err)
	}

	//	if err := store.NewHost(host); err != nil {
	//		return fmt.Errorf("Error with saving meta data for %s", host.Name)
	//	}

	if err := waitForReady(host); err != nil {
		return fmt.Errorf("Error with waiting for %s: %s", host.Name, err)
	}

	if err := store.Update(host); err != nil {
		return fmt.Errorf("Error with Saving for %s: %s", host.Name, err)
	}

	return nil

}
Esempio 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())