本文整理汇总了Golang中github.com/docker/machine/libmachine/log.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: UpdateISOCache
func (b *B2dUtils) UpdateISOCache(isoURL string) error {
// recreate the cache dir if it has been manually deleted
if _, err := os.Stat(b.imgCachePath); os.IsNotExist(err) {
log.Infof("Image cache directory does not exist, creating it at %s...", b.imgCachePath)
if err := os.Mkdir(b.imgCachePath, 0700); err != nil {
return err
}
}
exists := b.exists()
if isoURL != "" {
if exists {
// Warn that the b2d iso won't be updated if isoURL is set
log.Warnf("Boot2Docker URL was explicitly set to %q at create time, so Docker Machine cannot upgrade this machine to the latest version.", isoURL)
}
// Non-default B2D are not cached
return nil
}
if !exists {
log.Info("No default Boot2Docker ISO found locally, downloading the latest release...")
return b.DownloadLatestBoot2Docker("")
}
latest := b.isLatest()
if !latest {
log.Info("Default Boot2Docker ISO is out-of-date, downloading the latest release...")
return b.DownloadLatestBoot2Docker("")
}
return nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:33,代码来源:b2d.go
示例2: Start
// Start a host
func (d *Driver) Start() error {
vmstate, err := d.GetState()
if err != nil {
return err
}
if vmstate == state.Running {
log.Info("Machine is already running")
return nil
}
if vmstate == state.Starting {
log.Info("Machine is already starting")
return nil
}
cs := d.getClient()
p := cs.VirtualMachine.NewStartVirtualMachineParams(d.Id)
if _, err = cs.VirtualMachine.StartVirtualMachine(p); err != nil {
return err
}
return nil
}
开发者ID:atsaki,项目名称:docker-machine-driver-cloudstack,代码行数:26,代码来源:cloudstack.go
示例3: CreateVirtualNetworkIfNotExists
func (a AzureClient) CreateVirtualNetworkIfNotExists(resourceGroup, name, location string) error {
f := logutil.Fields{
"name": name,
"location": location}
log.Info("Querying if virtual network already exists.", f)
if exists, err := a.virtualNetworkExists(resourceGroup, name); err != nil {
return err
} else if exists {
log.Info("Virtual network already exists.", f)
return nil
}
log.Debug("Creating virtual network.", f)
_, err := a.virtualNetworksClient().CreateOrUpdate(resourceGroup, name,
network.VirtualNetwork{
Location: to.StringPtr(location),
Properties: &network.VirtualNetworkPropertiesFormat{
AddressSpace: &network.AddressSpace{
AddressPrefixes: to.StringSlicePtr(defaultVnetAddressPrefixes),
},
},
}, nil)
return err
}
开发者ID:RaulKite,项目名称:machine,代码行数:26,代码来源:azureutil.go
示例4: DetectProvisioner
func (detector StandardDetector) DetectProvisioner(d drivers.Driver) (Provisioner, error) {
log.Info("Waiting for SSH to be available...")
if err := drivers.WaitForSSH(d); err != nil {
return nil, err
}
log.Info("Detecting the provisioner...")
osReleaseOut, err := drivers.RunSSHCommandFromDriver(d, "cat /etc/os-release")
if err != nil {
return nil, fmt.Errorf("Error getting SSH command: %s", err)
}
osReleaseInfo, err := NewOsRelease([]byte(osReleaseOut))
if err != nil {
return nil, fmt.Errorf("Error parsing /etc/os-release file: %s", err)
}
for _, p := range provisioners {
provisioner := p.New(d)
provisioner.SetOsReleaseInfo(osReleaseInfo)
if provisioner.CompatibleWithHost() {
log.Debugf("found compatible host: %s", osReleaseInfo.ID)
return provisioner, nil
}
}
return nil, ErrDetectionFailed
}
开发者ID:bgokden,项目名称:machine,代码行数:30,代码来源:provisioner.go
示例5: Create
// Create is the wrapper method which covers all of the boilerplate around
// actually creating, provisioning, and persisting an instance in the store.
func (api *Client) Create(h *host.Host) error {
if err := cert.BootstrapCertificates(h.HostOptions.AuthOptions); err != nil {
return fmt.Errorf("Error generating certificates: %s", err)
}
log.Info("Running pre-create checks...")
if err := h.Driver.PreCreateCheck(); err != nil {
return fmt.Errorf("Error with pre-create check: %s", err)
}
if err := api.Save(h); err != nil {
return fmt.Errorf("Error saving host to store before attempting creation: %s", err)
}
log.Info("Creating machine...")
if err := api.performCreate(h); err != nil {
sendCrashReport(err, api, h)
return err
}
log.Debug("Reticulating splines...")
return nil
}
开发者ID:sergey-stratoscale,项目名称:machine,代码行数:28,代码来源:libmachine.go
示例6: Upgrade
func (h *Host) Upgrade() error {
machineState, err := h.Driver.GetState()
if err != nil {
return err
}
if machineState != state.Running {
return errMachineMustBeRunningForUpgrade
}
provisioner, err := provision.DetectProvisioner(h.Driver)
if err != nil {
return crashreport.CrashError{
Cause: err,
Command: "Upgrade",
Context: "provision.DetectProvisioner",
DriverName: h.Driver.DriverName(),
}
}
log.Info("Upgrading docker...")
if err := provisioner.Package("docker", pkgaction.Upgrade); err != nil {
return crashreport.CrashError{
Cause: err,
Command: "Upgrade",
Context: "provisioner.Package",
DriverName: h.Driver.DriverName(),
}
}
log.Info("Restarting docker...")
return provisioner.Service("docker", serviceaction.Restart)
}
开发者ID:sheltowt,项目名称:machine,代码行数:33,代码来源:host.go
示例7: UpdateISOCache
func (b *B2dUtils) UpdateISOCache(isoURL string) error {
// recreate the cache dir if it has been manually deleted
if _, err := os.Stat(b.imgCachePath); os.IsNotExist(err) {
log.Infof("Image cache directory does not exist, creating it at %s...", b.imgCachePath)
if err := os.Mkdir(b.imgCachePath, 0700); err != nil {
return err
}
}
if isoURL != "" {
// Non-default B2D are not cached
return nil
}
exists := b.exists()
if !exists {
log.Info("No default Boot2Docker ISO found locally, downloading the latest release...")
return b.DownloadLatestBoot2Docker("")
}
latest := b.isLatest()
if !latest {
log.Info("Default Boot2Docker ISO is out-of-date, downloading the latest release...")
return b.DownloadLatestBoot2Docker("")
}
return nil
}
开发者ID:cvstebut,项目名称:machine,代码行数:28,代码来源:b2d.go
示例8: Create
// Create is the wrapper method which covers all of the boilerplate around
// actually creating, provisioning, and persisting an instance in the store.
func (api *Client) Create(h *host.Host) error {
if err := cert.BootstrapCertificates(h.AuthOptions()); err != nil {
return fmt.Errorf("Error generating certificates: %s", err)
}
log.Info("Running pre-create checks...")
if err := h.Driver.PreCreateCheck(); err != nil {
return mcnerror.ErrDuringPreCreate{
Cause: err,
}
}
if err := api.Save(h); err != nil {
return fmt.Errorf("Error saving host to store before attempting creation: %s", err)
}
log.Info("Creating machine...")
if err := api.performCreate(h); err != nil {
return fmt.Errorf("Error creating machine: %s", err)
}
log.Debug("Reticulating splines...")
return nil
}
开发者ID:gitroctiv,项目名称:machine,代码行数:29,代码来源:libmachine.go
示例9: upgradeIso
func (provisioner *Boot2DockerProvisioner) upgradeIso() error {
// TODO: Ideally, we should not read from mcndirs directory at all.
// The driver should be able to communicate how and where to place the
// relevant files.
b2dutils := mcnutils.NewB2dUtils(mcndirs.GetBaseDir())
// Check if the driver has specified a custom b2d url
jsonDriver, err := json.Marshal(provisioner.GetDriver())
if err != nil {
return err
}
var d struct {
Boot2DockerURL string
}
json.Unmarshal(jsonDriver, &d)
log.Info("Downloading latest boot2docker iso...")
// Usually we call this implicitly, but call it here explicitly to get
// the latest default boot2docker ISO.
if d.Boot2DockerURL == "" {
if err := b2dutils.DownloadLatestBoot2Docker(d.Boot2DockerURL); err != nil {
return err
}
}
log.Info("Stopping machine to do the upgrade...")
if err := provisioner.Driver.Stop(); err != nil {
return err
}
if err := mcnutils.WaitFor(drivers.MachineInState(provisioner.Driver, state.Stopped)); err != nil {
return err
}
machineName := provisioner.GetDriver().GetMachineName()
log.Infof("Upgrading machine %q...", machineName)
// Either download the latest version of the b2d url that was explicitly
// specified when creating the VM or copy the (updated) default ISO
if err := b2dutils.CopyIsoToMachineDir(d.Boot2DockerURL, machineName); err != nil {
return err
}
log.Infof("Starting machine back up...")
if err := provisioner.Driver.Start(); err != nil {
return err
}
return mcnutils.WaitFor(drivers.MachineInState(provisioner.Driver, state.Running))
}
开发者ID:mschygulla,项目名称:machine,代码行数:54,代码来源:boot2docker.go
示例10: Create
// Create is the wrapper method which covers all of the boilerplate around
// actually creating, provisioning, and persisting an instance in the store.
func (api *Client) Create(h *host.Host) error {
if err := cert.BootstrapCertificates(h.HostOptions.AuthOptions); err != nil {
return fmt.Errorf("Error generating certificates: %s", err)
}
log.Info("Running pre-create checks...")
if err := h.Driver.PreCreateCheck(); err != nil {
return fmt.Errorf("Error with pre-create check: %s", err)
}
if err := api.Save(h); err != nil {
return fmt.Errorf("Error saving host to store before attempting creation: %s", err)
}
log.Info("Creating machine...")
if err := h.Driver.Create(); err != nil {
return fmt.Errorf("Error in driver during machine creation: %s", err)
}
if err := api.Save(h); err != nil {
return fmt.Errorf("Error saving host to store after attempting creation: %s", err)
}
// TODO: Not really a fan of just checking "none" here.
if h.Driver.DriverName() != "none" {
log.Info("Waiting for machine to be running, this may take a few minutes...")
if err := mcnutils.WaitFor(drivers.MachineInState(h.Driver, state.Running)); err != nil {
return fmt.Errorf("Error waiting for machine to be running: %s", err)
}
log.Info("Machine is running, waiting for SSH to be available...")
if err := drivers.WaitForSSH(h.Driver); err != nil {
return fmt.Errorf("Error waiting for SSH: %s", err)
}
log.Info("Detecting operating system of created instance...")
provisioner, err := provision.DetectProvisioner(h.Driver)
if err != nil {
return fmt.Errorf("Error detecting OS: %s", err)
}
log.Infof("Provisioning with %s...", provisioner.String())
if err := provisioner.Provision(*h.HostOptions.SwarmOptions, *h.HostOptions.AuthOptions, *h.HostOptions.EngineOptions); err != nil {
return fmt.Errorf("Error running provisioning: %s", err)
}
}
log.Debug("Reticulating splines...")
return nil
}
开发者ID:hyserver,项目名称:machine,代码行数:55,代码来源:libmachine.go
示例11: TestPreApplyDeploymentJobs
// TestPreApplyDeploymentJobs - setup some information from icsp
//TODO: This test requires a server profile to have been created
func TestPreApplyDeploymentJobs(t *testing.T) {
var (
d *ICSPTest
c *icsp.ICSPClient
serialNumber, macAddr string
)
if os.Getenv("ICSP_TEST_ACCEPTANCE") == "true" {
log.Debug("implements acceptance test for ApplyDeploymentJobs")
d, c = getTestDriverA()
if c == nil {
t.Fatalf("Failed to execute getTestDriver() ")
}
if os.Getenv("ONEVIEW_TEST_PROVISION") != "true" {
log.Info("env ONEVIEW_TEST_PROVISION != true")
log.Info("Skipping FreeBlade testing")
serialNumber = d.Tc.GetTestData(d.Env, "SerialNumber").(string)
macAddr = d.Tc.GetTestData(d.Env, "MacAddr").(string)
} else {
// serialNumber := d.Tc.GetTestData(d.Env, "FreeBladeSerialNumber").(string)
serialNumber = d.Tc.GetTestData(d.Env, "FreeICSPSerialNumber").(string)
macAddr = d.Tc.GetTestData(d.Env, "FreeMacAddr").(string)
}
s, err := c.GetServerBySerialNumber(serialNumber)
assert.NoError(t, err, "GetServerBySerialNumber threw error -> %s, %+v\n", err, s)
pubinet, err := s.GetInterface(1)
assert.NoError(t, err, "GetInterface(1) threw error -> %s, %+v\n", err, s)
assert.Equal(t, macAddr, pubinet.MACAddr, fmt.Sprintf("should get a valid interface -> %+v", pubinet))
s, err = c.PreApplyDeploymentJobs(s, pubinet) // responsible for configuring the Pulbic IP CustomAttributes
assert.NoError(t, err, "ApplyDeploymentJobs threw error -> %+v, %+v", err, s)
s, err = s.ReloadFull(c)
assert.NoError(t, err, "ReloadFull threw error -> %+v, %+v", err, s)
// verify that the server attribute was saved by getting the server again and checking the value
_, testValue2 := s.GetValueItem("public_interface", "server")
// unmarshal the custom attribute
var inet *icsp.Interface
log.Debugf("public_interface value -> %+v", testValue2.Value)
assert.NotEqual(t, "", testValue2.Value,
fmt.Sprintf("public_interface for %s Should have a value", serialNumber))
if testValue2.Value != "" {
err = json.Unmarshal([]byte(testValue2.Value), &inet)
assert.NoError(t, err, "Unmarshal Interface threw error -> %s, %+v\n", err, testValue2.Value)
log.Infof("We got public ip addr -> %s", inet.MACAddr)
assert.Equal(t, macAddr, inet.MACAddr, "Should return the saved custom attribute for mac address")
}
}
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:54,代码来源:icsp_test.go
示例12: Stop
// Stop issues a power off for the virtual machine instance.
func (d *Driver) Stop() error {
if err := d.checkLegacyDriver(true); err != nil {
return err
}
c, err := d.newAzureClient()
if err != nil {
return err
}
log.Info("NOTICE: Stopping an Azure Virtual Machine is just going to power it off, not deallocate.")
log.Info("NOTICE: You should remove the machine if you would like to avoid unexpected costs.")
return c.StopVirtualMachine(d.ResourceGroup, d.naming().VM())
}
开发者ID:bgokden,项目名称:machine,代码行数:14,代码来源:azure.go
示例13: deleteResourceIfExists
// deleteResourceIfExists is an utility method to determine if a resource exists
// from the error returned from its Get response. If so, deletes it. name is
// used only for logging purposes.
func deleteResourceIfExists(resourceType, name string, getFunc func() error, deleteFunc func() (autorest.Response, error)) error {
f := logutil.Fields{"name": name}
log.Debug(fmt.Sprintf("Querying if %s exists.", resourceType), f)
if exists, err := checkResourceExistsFromError(getFunc()); err != nil {
return err
} else if !exists {
log.Info(fmt.Sprintf("%s does not exist. Skipping.", resourceType), f)
return nil
}
log.Info(fmt.Sprintf("Removing %s resource.", resourceType), f)
_, err := deleteFunc()
return err
}
开发者ID:RaulKite,项目名称:machine,代码行数:16,代码来源:azureutil.go
示例14: CreateAvailabilitySetIfNotExists
func (a AzureClient) CreateAvailabilitySetIfNotExists(ctx *DeploymentContext, resourceGroup, name, location string) error {
f := logutil.Fields{"name": name}
if ctx.AvailabilitySetID != "" {
log.Info("Availability Set already exists.", f)
return nil
}
log.Debug("Could not find existing availability set.", f)
log.Info("Creating availability set...", f)
as, err := a.availabilitySetsClient().CreateOrUpdate(resourceGroup, name,
compute.AvailabilitySet{
Location: to.StringPtr(location),
})
ctx.AvailabilitySetID = to.String(as.ID)
return err
}
开发者ID:dweomer,项目名称:docker-machine,代码行数:15,代码来源:azureutil.go
示例15: checkImage
func (d *Driver) checkImage() error {
client, err := d.getClient()
if err != nil {
return err
}
var image *brightbox.Image
if d.Image == "" {
log.Info("No image specified. Looking for default image")
log.Debugf("Brightbox API Call: List of Images")
images, err := client.Images()
if err != nil {
return err
}
image, err = GetDefaultImage(images)
if err != nil {
return err
}
d.Image = image.Id
} else {
log.Debugf("Brightbox API Call: Image Details for %s", d.Image)
image, err = client.Image(d.Image)
if err != nil {
return err
}
}
if image.Arch != "x86_64" {
return fmt.Errorf("Docker requires a 64 bit image. Image %s not suitable", d.Image)
}
if d.SSHUser == "" {
log.Debug("Setting SSH Username from image details")
d.SSHUser = image.Username
}
log.Debugf("Image %s selected. SSH user is %s", d.Image, d.SSHUser)
return nil
}
开发者ID:brightbox,项目名称:docker-machine-driver-brightbox,代码行数:35,代码来源:driver.go
示例16: findStorageAccount
func (a AzureClient) findStorageAccount(resourceGroup, location, prefix string, storageType storage.SkuName) (*storage.AccountProperties, error) {
f := logutil.Fields{
"sku": storageType,
"prefix": prefix,
"location": location}
log.Debug("Querying existing storage accounts.", f)
l, err := a.storageAccountsClient().ListByResourceGroup(resourceGroup)
if err != nil {
return nil, err
}
if l.Value != nil {
for _, v := range *l.Value {
log.Debug("Iterating...", logutil.Fields{
"name": to.String(v.Name),
"sku": storageType,
"location": to.String(v.Location),
})
if to.String(v.Location) == location && v.Sku.Name == storageType && strings.HasPrefix(to.String(v.Name), prefix) {
log.Debug("Found eligible storage account.", logutil.Fields{"name": to.String(v.Name)})
log.Info("Using existing storage account.", logutil.Fields{
"name": to.String(v.Name),
"sku": storageType,
})
return v.Properties, nil
}
}
}
log.Debug("No account matching the pattern is found.", f)
return nil, err
}
开发者ID:flavio,项目名称:machine,代码行数:31,代码来源:azureutil.go
示例17: SubmitDeploymentJobs
// SubmitDeploymentJobs api call to deployment jobs
func (c *ICSPClient) SubmitDeploymentJobs(dj DeploymentJobs) (jt *JobTask, err error) {
log.Info("Applying OS Build plan for ICSP")
var (
uri = "/rest/os-deployment-jobs"
juri ODSUri
)
// refresh login
c.RefreshLogin()
c.SetAuthHeaderOptions(c.GetAuthHeaderMap())
jt = jt.NewJobTask(c)
jt.Reset()
data, err := c.RestAPICall(rest.POST, uri, dj)
if err != nil {
jt.IsDone = true
log.Errorf("Error submitting new build request: %s", err)
return jt, err
}
log.Debugf("Response submit new os build plan job %s", data)
if err := json.Unmarshal([]byte(data), &juri); err != nil {
jt.IsDone = true
jt.JobURI = juri
log.Errorf("Error with task un-marshal: %s", err)
return jt, err
}
jt.JobURI = juri
return jt, err
}
开发者ID:HewlettPackard,项目名称:oneview-golang,代码行数:31,代码来源:deploymentjobs.go
示例18: createStorageAccount
func (a AzureClient) createStorageAccount(resourceGroup, location string, storageType storage.SkuName) (*storage.AccountProperties, error) {
name := randomAzureStorageAccountName() // if it's not random enough, then you're unlucky
f := logutil.Fields{
"name": name,
"location": location,
"sku": storageType,
}
log.Info("Creating storage account.", f)
_, err := a.storageAccountsClient().Create(resourceGroup, name,
storage.AccountCreateParameters{
Location: to.StringPtr(location),
Sku: &storage.Sku{Name: storageType},
}, nil)
if err != nil {
return nil, err
}
s, err := a.storageAccountsClient().GetProperties(resourceGroup, name)
if err != nil {
return nil, err
}
return s.Properties, nil
}
开发者ID:flavio,项目名称:machine,代码行数:25,代码来源:azureutil.go
示例19: CreateInstance
func (c *GenericClient) CreateInstance(d *Driver) (string, error) {
serverOpts := servers.CreateOpts{
Name: d.MachineName,
FlavorRef: d.FlavorId,
ImageRef: d.ImageId,
SecurityGroups: d.SecurityGroups,
AvailabilityZone: d.AvailabilityZone,
}
if d.NetworkId != "" {
serverOpts.Networks = []servers.Network{
{
UUID: d.NetworkId,
},
}
}
log.Info("Creating machine...")
server, err := servers.Create(c.Compute, keypairs.CreateOptsExt{
serverOpts,
d.KeyPairName,
}).Extract()
if err != nil {
return "", err
}
return server.ID, nil
}
开发者ID:rhendric,项目名称:machine,代码行数:27,代码来源:client.go
示例20: Create
func (d *Driver) Create() error {
if err := d.setUserSubscription(); err != nil {
return err
}
log.Info("Creating Azure machine...")
vmConfig, err := vmClient.CreateAzureVMConfiguration(d.MachineName, d.Size, d.Image, d.Location)
if err != nil {
return err
}
log.Debug("Generating certificate for Azure...")
if err := d.generateCertForAzure(); err != nil {
return err
}
log.Debug("Adding Linux provisioning...")
vmConfig, err = vmClient.AddAzureLinuxProvisioningConfig(vmConfig, d.GetSSHUsername(), d.UserPassword, d.azureCertPath(), d.SSHPort)
if err != nil {
return err
}
log.Debug("Authorizing ports...")
if err := d.addDockerEndpoints(vmConfig); err != nil {
return err
}
log.Debug("Creating VM...")
if err := vmClient.CreateAzureVM(vmConfig, d.MachineName, d.Location); err != nil {
return err
}
return nil
}
开发者ID:usmanismail,项目名称:machine,代码行数:34,代码来源:azure.go
注:本文中的github.com/docker/machine/libmachine/log.Info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论