modify a ton of error messages to make them specifically placable. (#10191)
* modify a ton of error messages to make them specifically placable. * remove specific loglines but keep the specialized error messages Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
This commit is contained in:
parent
61b9015415
commit
7a1680df97
|
@ -85,7 +85,7 @@ func (s *StepCloneVM) Run(ctx context.Context, state multistep.StateBag) multist
|
|||
ui.Say("Cloning VM...")
|
||||
template, err := d.FindVM(s.Config.Template)
|
||||
if err != nil {
|
||||
state.Put("error", err)
|
||||
state.Put("error", fmt.Errorf("Error finding vm to clone: %s", err))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ func (d *VCenterDriver) FindDatastore(name string, host string) (Datastore, erro
|
|||
if name == "" {
|
||||
h, err := d.FindHost(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding host for to get datastore: %s", err)
|
||||
}
|
||||
|
||||
i, err := h.Info("datastore")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error getting datastore info from host: %s", err)
|
||||
}
|
||||
|
||||
if len(i.Datastore) > 1 {
|
||||
|
@ -57,14 +57,14 @@ func (d *VCenterDriver) FindDatastore(name string, host string) (Datastore, erro
|
|||
ds := d.NewDatastore(&i.Datastore[0])
|
||||
inf, err := ds.Info("name")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error getting datastore name: %s", err)
|
||||
}
|
||||
name = inf.Name
|
||||
}
|
||||
|
||||
ds, err := d.finder.Datastore(d.ctx, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding datastore with name %s: %s", name, err)
|
||||
}
|
||||
|
||||
return &DatastoreDriver{
|
||||
|
|
|
@ -297,21 +297,21 @@ func (vm *VirtualMachineDriver) FloppyDevices() (object.VirtualDeviceList, error
|
|||
func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig) (VirtualMachine, error) {
|
||||
folder, err := vm.driver.FindFolder(config.Folder)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding filder: %s", err)
|
||||
}
|
||||
|
||||
var relocateSpec types.VirtualMachineRelocateSpec
|
||||
|
||||
pool, err := vm.driver.FindResourcePool(config.Cluster, config.Host, config.ResourcePool)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding resource pool: %s", err)
|
||||
}
|
||||
poolRef := pool.pool.Reference()
|
||||
relocateSpec.Pool = &poolRef
|
||||
|
||||
datastore, err := vm.driver.FindDatastore(config.Datastore, config.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding datastore: %s", err)
|
||||
}
|
||||
datastoreRef := datastore.Reference()
|
||||
relocateSpec.Datastore = &datastoreRef
|
||||
|
@ -325,7 +325,7 @@ func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig)
|
|||
|
||||
tpl, err := vm.Info("snapshot")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error getting snapshot info for vm: %s", err)
|
||||
}
|
||||
if tpl.Snapshot == nil {
|
||||
err = errors.New("`linked_clone=true`, but template has no snapshots")
|
||||
|
@ -344,21 +344,21 @@ func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig)
|
|||
if config.Network != "" {
|
||||
net, err := vm.driver.FindNetwork(config.Network)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding network: %s", err)
|
||||
}
|
||||
backing, err := net.network.EthernetCardBackingInfo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding ethernet card backing info: %s", err)
|
||||
}
|
||||
|
||||
devices, err := vm.vm.Device(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding vm devices: %s", err)
|
||||
}
|
||||
|
||||
adapter, err := findNetworkAdapter(devices)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error finding network adapter: %s", err)
|
||||
}
|
||||
|
||||
current := adapter.GetVirtualEthernetCard()
|
||||
|
@ -375,13 +375,13 @@ func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig)
|
|||
|
||||
vAppConfig, err := vm.updateVAppConfig(ctx, config.VAppProperties)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error updating VAppConfig: %s", err)
|
||||
}
|
||||
configSpec.VAppConfig = vAppConfig
|
||||
|
||||
task, err := vm.vm.Clone(vm.driver.ctx, folder.folder, config.Name, cloneSpec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error calling vm.vm.Clone task: %s", err)
|
||||
}
|
||||
|
||||
info, err := task.WaitForResult(ctx, nil)
|
||||
|
@ -391,7 +391,7 @@ func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error waiting for vm Clone to complete: %s", err)
|
||||
}
|
||||
|
||||
vmRef, ok := info.Result.(types.ManagedObjectReference)
|
||||
|
|
Loading…
Reference in New Issue