Esempio n. 1
0
func main() {

	err := scloudLog.InitLog()

	if err != nil {
		fmt.Println("Failed to init log")
	}

	defer scloudLog.CloseLog()

	name := "SIDRK8SNODE"
	hosts, err := FindGuestByHostname(name)

	if err != nil {
		fmt.Println("err:", err)
	}

	fmt.Printf("hosts = %v", hosts)

	t1 := time.Now()

	service, err := CreateVirtualGuestService()

	if err != nil {
		fmt.Println("err:", err)
	}

	for _, h := range hosts {
		waitgroup.Add(1)
		fmt.Println(h.PrimaryBackendIpAddress)
		reload_OS_Config := datatypes.Image_Template_Config{
			ImageTemplateId: "​904419",
		}

		err = service.ReloadOperatingSystem(h.Id, reload_OS_Config)

		if err != nil {

			fmt.Println("Failed to reload")
			os.Exit(1)
		}

		go reloadVM(h.Id)
	}

	waitgroup.Wait()

	t2 := time.Now()

	fmt.Printf("The call took %v to run.\n", t2.Sub(t1))

	fmt.Fprintf(os.Stderr, "The call took %v to run.\n", t2.Sub(t1))

}
Esempio n. 2
0
func TestDeploy(t *testing.T) {

	err := scloudLog.InitLog()

	if err != nil {
		t.Errorf("Failed to init log")
	}

	defer scloudLog.CloseLog()

	RegisterFailHandler(Fail)
	RunSpecs(t, "Deploy Suite")
}