• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang log.Debugf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/docker/machine/libmachine/log.Debugf函数的典型用法代码示例。如果您正苦于以下问题:Golang Debugf函数的具体用法?Golang Debugf怎么用?Golang Debugf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Debugf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Start

func (d *Driver) Start() error {
	log.Infof("Starting %s...", d.MachineName)
	vmrun("start", d.vmxPath(), "nogui")

	// Do not execute the rest of boot2docker specific configuration, exit here
	if d.ConfigDriveURL != "" {
		log.Debugf("Leaving start sequence early, configdrive found")
		return nil
	}

	log.Debugf("Mounting Shared Folders...")
	var shareName, shareDir string // TODO configurable at some point
	switch runtime.GOOS {
	case "darwin":
		shareName = "Users"
		shareDir = "/Users"
		// TODO "linux" and "windows"
	}

	if shareDir != "" {
		if _, err := os.Stat(shareDir); err != nil && !os.IsNotExist(err) {
			return err
		} else if !os.IsNotExist(err) {
			// create mountpoint and mount shared folder
			command := "[ ! -d " + shareDir + " ]&& sudo mkdir " + shareDir + "; [ -f /usr/local/bin/vmhgfs-fuse ]&& sudo /usr/local/bin/vmhgfs-fuse -o allow_other .host:/" + shareName + " " + shareDir + " || sudo mount -t vmhgfs .host:/" + shareName + " " + shareDir
			vmrun("-gu", B2DUser, "-gp", B2DPass, "runScriptInGuest", d.vmxPath(), "/bin/sh", command)
		}
	}

	return nil
}
开发者ID:rominirani,项目名称:machine,代码行数:31,代码来源:fusion.go


示例2: Create

func (d *Driver) Create() error {
	client, err := d.getClient()
	if err != nil {
		return err
	}
	log.Infof("Creating SSH key...")
	err = d.createSSHkey()
	if err != nil {
		return err
	}
	userdata, err := d.getCloudInit()
	if err != nil {
		return err
	}
	encoded := base64.StdEncoding.EncodeToString(userdata)
	d.UserData = &encoded
	log.Infof("Creating Brightbox Server...")
	log.Debugf("with the following Userdata")
	log.Debugf("%s", string(userdata))
	log.Debugf("Brightbox API Call: Create Server using image %s", d.Image)
	server, err := client.CreateServer(&d.ServerOptions)
	if err != nil {
		return err
	}
	d.MachineID = server.Id
	return nil
}
开发者ID:brightbox,项目名称:docker-machine-driver-brightbox,代码行数:27,代码来源:driver.go


示例3: Start

func (d *Driver) Start() error {
	log.Debugf("Starting VM %s", d.MachineName)
	d.validateVMRef()
	err := d.VM.Create()
	if err != nil {
		log.Warnf("Failed to start: %s", err)
		return err
	}

	// They wont start immediately
	time.Sleep(5 * time.Second)

	for i := 0; i < 90; i++ {
		time.Sleep(time.Second)
		ip, _ := d.GetIP()
		if ip != "" {
			// Add a second to let things settle
			time.Sleep(time.Second)
			return nil
		}
		log.Debugf("Waiting for the VM to come up... %d", i)
	}
	log.Warnf("Unable to determine VM's IP address, did it fail to boot?")
	return err
}
开发者ID:b0d0nne11,项目名称:docker-machine-kvm,代码行数:25,代码来源:kvm.go


示例4: GetServerBySerialNumber

//GetServerBySerialNumber use the serial number to find the server
func (c *ICSPClient) GetServerBySerialNumber(serial string) (Server, error) {
	var (
		servers ServerList
		server  Server
	)
	servers, err := c.GetServers()
	if err != nil {
		return server, err
	}
	log.Debugf("GetServerBySerialNumber: server count: %d, serialnumber: %s", servers.Count, serial)
	// grab the target
	var srv Server
	for _, server := range servers.Members {
		log.Debugf("server: %v, serial : %v", server.HostName, server.SerialNumber)
		if strings.EqualFold(server.SerialNumber, serial) {
			log.Debugf("found server host: %v", server.HostName)
			srv = server
			srv, err = srv.ReloadFull(c)
			if err != nil {
				return srv, err
			}
			break
		}
	}
	return srv, nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:27,代码来源:servers.go


示例5: GetServerByIP

// GetServerByIP use the server ip to get the server
func (c *ICSPClient) GetServerByIP(ip string) (Server, error) {
	var (
		servers ServerList
		server  Server
	)
	servers, err := c.GetServers()
	if err != nil {
		return server, err
	}
	log.Debugf("GetServerByIP: server count: %d", servers.Count)
	// grab the target
	var srv Server
	for _, randServer := range servers.Members {
		server, err := c.GetServerByID(randServer.MID)
		if err != nil {
			return server, err
		}
		if strings.EqualFold(server.ILO.IPAddress, ip) {
			log.Debugf("server ip: %v", &server.ILO.IPAddress)
			srv = server
			srv, err = srv.ReloadFull(c)
			if err != nil {
				return srv, err
			}
			break
		}

	}
	return srv, nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:31,代码来源:servers.go


示例6: mountSharedFolder

func (d *Driver) mountSharedFolder(shareDir, shareName string) error {
	// create mountpoint and mount shared folder
	addr, err := d.GetSSHHostname()
	if err != nil {
		return err
	}

	port, err := d.GetSSHPort()
	if err != nil {
		return err
	}

	auth := &ssh.Auth{
		Keys: []string{d.GetSSHKeyPath()},
	}

	client, err := ssh.NewClient(d.GetSSHUsername(), addr, port, auth)
	if err != nil {
		return err
	}

	command := "[ ! -d " + shareDir + " ]&& sudo mkdir " + shareDir + "; [ -f /usr/bin/vmhgfs-fuse ]&& sudo /usr/bin/vmhgfs-fuse -o allow_other .host:/" + shareName + " " + shareDir + " || sudo mount -t vmhgfs .host:/" + shareName + " " + shareDir

	log.Debugf("About to run SSH command:\n%s", command)
	output, err := client.Output(command)
	log.Debugf("SSH cmd err, output: %v: %s", err, output)
	return err
}
开发者ID:vmware,项目名称:docker-machine-driver-vmwareappcatalyst,代码行数:28,代码来源:appcatalyst.go


示例7: TestSessionLogout

// Test SessionLogout
func TestSessionLogout(t *testing.T) {
	var (
		//d *OVTest
		c *ICSPClient
		//testSerial string
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		_, c = getTestDriverA()
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		//data, err := c.SessionLogin()
		// this is needed so we can "copy" the session id to the ov client
		err := c.RefreshLogin()
		//log.Debugf(" login key -> %s, session data -> %+v", c.APIKey, data)
		log.Debugf(" login key -> %s", c.APIKey)
		assert.NoError(t, err, "SessionLogin threw error -> %s", err)
		//assert.NotEmpty(t, data.ID, fmt.Sprintf("SessionLogin is empty! something went wrong, err -> %s, data -> %+v\n", err, data))
		//assert.Equal(t, "none", c.APIKey)
		err = c.SessionLogout()
		log.Debugf(" login key after logout -> %s", c.APIKey)
		assert.NoError(t, err, "SessionLogout threw error -> %s", err)
		// test if we can perform an op after logout
		//_, err = c.GetProfileBySN(testSerial)
		//assert.Error(t, err, "SessionLogin threw error -> %s", err)
	} else {
		/*_, c = getTestDriverU()
		data, err := c.SessionLogin()
		assert.Error(t,err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n",err, data))
		assert.Equal(t, "none", c.APIKey)
		*/
	}
}
开发者ID:wenlock,项目名称:oneview-golang,代码行数:34,代码来源:auth_test.go


示例8: waitForIP

func (d *Driver) waitForIP() error {
	var ip string
	var err error

	log.Infof("Waiting for VM to come online...")
	for i := 1; i <= 60; i++ {
		ip, err = d.getIPfromDHCPLease()
		if err != nil {
			log.Debugf("Not there yet %d/%d, error: %s", i, 60, err)
			time.Sleep(2 * time.Second)
			continue
		}

		if ip != "" {
			log.Debugf("Got an ip: %s", ip)
			d.IPAddress = ip

			break
		}
	}

	if ip == "" {
		return fmt.Errorf("Machine didn't return an IP after 120 seconds, aborting")
	}

	// Wait for SSH over NAT to be available before returning to user
	if err := drivers.WaitForSSH(d); err != nil {
		return err
	}

	return nil
}
开发者ID:johanneswuerbach,项目名称:docker-machine-xhyve,代码行数:32,代码来源:xhyve.go


示例9: extractKernelImages

func (d *Driver) extractKernelImages() error {
	log.Debugf("Mounting %s", isoFilename)

	err := hdiutil("attach", d.ResolveStorePath(isoFilename), "-mountpoint", d.ResolveStorePath("b2d-image"))
	if err != nil {
		return err
	}

	volumeRootDir := d.ResolveStorePath(isoMountPath)
	vmlinuz64 := volumeRootDir + "/boot/vmlinuz64"
	initrd := volumeRootDir + "/boot/initrd.img"

	log.Debugf("Extracting vmlinuz64 into %s", d.ResolveStorePath("."))
	if err := mcnutils.CopyFile(vmlinuz64, d.ResolveStorePath("vmlinuz64")); err != nil {
		return err
	}
	log.Debugf("Extracting initrd.img into %s", d.ResolveStorePath("."))
	if err := mcnutils.CopyFile(initrd, d.ResolveStorePath("initrd.img")); err != nil {
		return err
	}
	log.Debugf("Unmounting %s", isoFilename)
	if err := hdiutil("detach", volumeRootDir); err != nil {
		return err
	}

	return nil
}
开发者ID:johanneswuerbach,项目名称:docker-machine-xhyve,代码行数:27,代码来源:xhyve.go


示例10: Provision

func (provisioner *CoreOSProvisioner) Provision(swarmOptions swarm.Options, authOptions auth.Options, engineOptions engine.Options) error {
	provisioner.SwarmOptions = swarmOptions
	provisioner.AuthOptions = authOptions
	provisioner.EngineOptions = engineOptions

	if err := provisioner.SetHostname(provisioner.Driver.GetMachineName()); err != nil {
		return err
	}

	if err := makeDockerOptionsDir(provisioner); err != nil {
		return err
	}

	log.Debugf("Preparing certificates")
	provisioner.AuthOptions = setRemoteAuthOptions(provisioner)

	log.Debugf("Setting up certificates")
	if err := ConfigureAuth(provisioner); err != nil {
		return err
	}

	log.Debug("Configuring swarm")
	if err := configureSwarm(provisioner, swarmOptions, provisioner.AuthOptions); err != nil {
		return err
	}

	return nil
}
开发者ID:tsuru,项目名称:tsuru,代码行数:28,代码来源:coreos.go


示例11: GetIP

func (d *Driver) GetIP() (string, error) {
	// DHCP is used to get the IP, so virtualbox hosts don't have IPs unless
	// they are running
	s, err := d.GetState()
	if err != nil {
		return "", err
	}
	if s != state.Running {
		return "", drivers.ErrHostIsNotRunning
	}

	macAddress, err := d.getHostOnlyMACAddress()
	if err != nil {
		return "", err
	}

	log.Debugf("Host-only MAC: %s\n", macAddress)

	output, err := drivers.RunSSHCommandFromDriver(d, "ip addr show")
	if err != nil {
		return "", err
	}

	log.Debugf("SSH returned: %s\nEND SSH\n", output)

	ipAddress, err := d.parseIPForMACFromIPAddr(output, macAddress)
	if err != nil {
		return "", err
	}

	return ipAddress, nil
}
开发者ID:dduportal,项目名称:machine,代码行数:32,代码来源:virtualbox.go


示例12: UpdateEnclosureGroup

func (c *OVClient) UpdateEnclosureGroup(enclosureGroup EnclosureGroup) error {
	log.Infof("Initializing update of enclosure group for %s.", enclosureGroup.Name)
	var (
		uri = enclosureGroup.URI.String()
		t   *Task
	)
	// refresh login
	c.RefreshLogin()
	c.SetAuthHeaderOptions(c.GetAuthHeaderMap())

	t = t.NewProfileTask(c)
	t.ResetTask()
	log.Debugf("REST : %s \n %+v\n", uri, enclosureGroup)
	log.Debugf("task -> %+v", t)
	data, err := c.RestAPICall(rest.PUT, uri, enclosureGroup)
	if err != nil {
		t.TaskIsDone = true
		log.Errorf("Error submitting update enclosure group request: %s", err)
		return err
	}

	log.Debugf("Response update EnclosureGroup %s", data)
	if err := json.Unmarshal([]byte(data), &t); err != nil {
		t.TaskIsDone = true
		log.Errorf("Error with task un-marshal: %s", err)
		return err
	}

	return nil
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:30,代码来源:enclosure_group.go


示例13: ReadTLSConfig

// ReadTLSConfig reads the tls config for a machine.
func (xcg *X509CertGenerator) ReadTLSConfig(addr string, authOptions *auth.Options) (*tls.Config, error) {
	caCertPath := authOptions.CaCertPath
	serverCertPath := authOptions.ServerCertPath
	serverKeyPath := authOptions.ServerKeyPath

	log.Debugf("Reading CA certificate from %s", caCertPath)
	caCert, err := ioutil.ReadFile(caCertPath)
	if err != nil {
		return nil, err
	}

	log.Debugf("Reading server certificate from %s", serverCertPath)
	serverCert, err := ioutil.ReadFile(serverCertPath)
	if err != nil {
		return nil, err
	}

	log.Debugf("Reading server key from %s", serverKeyPath)
	serverKey, err := ioutil.ReadFile(serverKeyPath)
	if err != nil {
		return nil, err
	}

	return xcg.getTLSConfig(caCert, serverCert, serverKey, false)
}
开发者ID:containerx,项目名称:machine,代码行数:26,代码来源:cert.go


示例14: GetCurrentTaskStatus

// GetCurrentTaskStatus - Get the current status
func (t *Task) GetCurrentTaskStatus() error {
	log.Debugf("Working on getting current task status")
	var (
		uri = t.URI
	)
	if uri != "" {
		log.Debugf(uri.String())
		data, err := t.Client.RestAPICall(rest.GET, uri.String(), nil)
		if err != nil {
			return err
		}
		log.Debugf("data: %s", data)
		if err := json.Unmarshal([]byte(data), &t); err != nil {
			return err
		}
	} else {
		log.Debugf("Unable to get current task, no URI found")
	}
	if len(t.TaskErrors) > 0 {
		var errmsg string
		errmsg = ""
		for _, te := range t.TaskErrors {
			errmsg += te.Message + " \n" + strings.Join(te.RecommendedActions, " ")
		}
		return errors.New(errmsg)
	}
	return nil
}
开发者ID:wenlock,项目名称:oneview-golang,代码行数:29,代码来源:task.go


示例15: vbmOutErr

func (v *VBoxCmdManager) vbmOutErr(args ...string) (string, string, error) {
	cmd := exec.Command(vboxManageCmd, args...)
	log.Debugf("COMMAND: %v %v", vboxManageCmd, strings.Join(args, " "))
	var stdout bytes.Buffer
	var stderr bytes.Buffer
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	err := cmd.Run()
	stderrStr := stderr.String()
	if len(args) > 0 {
		log.Debugf("STDOUT:\n{\n%v}", stdout.String())
		log.Debugf("STDERR:\n{\n%v}", stderrStr)
	}

	if err != nil {
		if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound {
			err = ErrVBMNotFound
		}
	}

	if err == nil || strings.HasPrefix(err.Error(), "exit status ") {
		// VBoxManage will sometimes not set the return code, but has a fatal error
		// such as VBoxManage.exe: error: VT-x is not available. (VERR_VMX_NO_VMX)
		if strings.Contains(stderrStr, "error:") {
			err = fmt.Errorf("%v %v failed:\n%v", vboxManageCmd, strings.Join(args, " "), stderrStr)
		}
	}

	return stdout.String(), stderrStr, err
}
开发者ID:MerlinDMC,项目名称:machine,代码行数:30,代码来源:vbm.go


示例16: getMACAdress

func (d *Driver) getMACAdress() (string, error) {
	args := append(d.xhyveArgs(), "-M")

	stdout := bytes.Buffer{}

	cmd := exec.Command(os.Args[0], args...) // TODO: Should be possible without exec
	log.Debugf("Running command: %s %s", os.Args[0], args)

	cmd.Stdout = &stdout
	if err := cmd.Run(); err != nil {
		if exitErr, ok := err.(*exec.ExitError); ok {
			log.Debugf("Stderr: %s", exitErr.Stderr)
		}
		return "", err
	}

	mac := bytes.TrimPrefix(stdout.Bytes(), []byte("MAC: "))
	mac = bytes.TrimSpace(mac)

	hw, err := net.ParseMAC(string(mac))
	if err != nil {
		return "", err
	}
	return hw.String(), nil
}
开发者ID:johanneswuerbach,项目名称:docker-machine-xhyve,代码行数:25,代码来源:xhyve.go


示例17: GetIP

func (d *Driver) GetIP() (string, error) {
	s, err := d.GetState()
	if err != nil {
		return "", err
	}
	if s != state.Running {
		return "", drivers.ErrHostIsNotRunning
	}

	c, err := NewClient("http://localhost:" + strconv.Itoa(d.APIPort))
	if err != nil {
		return "", err
	}

	var ip string
	for i := 1; i <= 60; i++ {
		vmip, err := c.GetVMIPAddress(d.MachineName)
		if err != nil && vmip.Code != 200 {
			log.Debugf("Not there yet %d/%d, error code: %d, message %s", i, 60, vmip.Code, err)
			time.Sleep(2 * time.Second)
			continue
		}
		ip = vmip.Message
		log.Debugf("Got an ip: %s", ip)
		break
	}

	if ip == "" {
		return "", fmt.Errorf("machine didn't return an IP after 120 seconds, aborting")
	}

	return ip, nil
}
开发者ID:vmware,项目名称:docker-machine-driver-vmwareappcatalyst,代码行数:33,代码来源:appcatalyst.go


示例18: waitForSetupTransactions

func (d *Driver) waitForSetupTransactions() {
	log.Infof("Waiting for host setup transactions to complete")
	// sometimes we'll hit a case where there's no active transaction, but if
	// we check again in a few seconds, it moves to the next transaction. We
	// don't want to get false-positives, so we check a few times in a row to make sure!
	noActiveCount, maxNoActiveCount := 0, 3
	for {
		t, err := d.GetActiveTransaction()
		if err != nil {
			noActiveCount = 0
			log.Debugf("Failed to GetActiveTransaction - %+v", err)
			continue
		}

		if t == "" {
			if noActiveCount == maxNoActiveCount {
				break
			}
			noActiveCount++
		} else {
			noActiveCount = 0
			log.Debugf("Still waiting - active transaction is %s...", t)
		}
		time.Sleep(2 * time.Second)
	}
}
开发者ID:rogaha,项目名称:machine,代码行数:26,代码来源:driver.go


示例19: Start

func (lbe *LocalBinaryExecutor) Start() (*bufio.Scanner, *bufio.Scanner, error) {
	log.Debugf("Launching plugin server for driver %s", lbe.DriverName)

	binaryPath, err := exec.LookPath(fmt.Sprintf("docker-machine-driver-%s", lbe.DriverName))
	if err != nil {
		return nil, nil, fmt.Errorf("Driver %q not found. Do you have the plugin binary accessible in your PATH?", lbe.DriverName)
	}

	log.Debugf("Found binary path at %s", binaryPath)

	cmd := exec.Command(binaryPath)

	lbe.pluginStdout, err = cmd.StdoutPipe()
	if err != nil {
		return nil, nil, fmt.Errorf("Error getting cmd stdout pipe: %s", err)
	}

	lbe.pluginStderr, err = cmd.StderrPipe()
	if err != nil {
		return nil, nil, fmt.Errorf("Error getting cmd stderr pipe: %s", err)
	}

	outScanner := bufio.NewScanner(lbe.pluginStdout)
	errScanner := bufio.NewScanner(lbe.pluginStderr)

	os.Setenv(PluginEnvKey, PluginEnvVal)

	if err := cmd.Start(); err != nil {
		return nil, nil, fmt.Errorf("Error starting plugin binary: %s", err)
	}

	return outScanner, errScanner, nil
}
开发者ID:nlamirault,项目名称:docker-machine-scaleway,代码行数:33,代码来源:plugin.go


示例20: TestGetIloIPAddress

// TestGetIloIPAddress verify get ip address for hardware
func TestGetIloIPAddress(t *testing.T) {

	var (
		d           *OVTest
		c           *ov.OVClient
		testData    utils.Nstring
		expectsData string
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA("dev")
		testData = utils.Nstring(d.Tc.GetTestData(d.Env, "ServerHardwareURI").(string))
		expectsData = d.Tc.GetExpectsData(d.Env, "IloIPAddress").(string)
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		s, err := c.GetServerHardware(testData)
		assert.NoError(t, err, "GetServerHardware threw error -> %s", err)
		ip := s.GetIloIPAddress()
		log.Debugf("server -> %+v", s)
		log.Debugf("ip -> %+v", ip)
		assert.Equal(t, expectsData, ip)

	}

}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:26,代码来源:server_hardware_test.go



注:本文中的github.com/docker/machine/libmachine/log.Debugf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang log.Error函数代码示例发布时间:2022-05-23
下一篇:
Golang log.Debug函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap