当前位置: 首页>>代码示例>>Golang>>正文


Golang log.Debugf函数代码示例

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


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


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