diff --git a/driver/datastore.go b/driver/datastore.go index 36f976fcd..7f4b3b1dc 100644 --- a/driver/datastore.go +++ b/driver/datastore.go @@ -81,9 +81,14 @@ func (ds *Datastore) ResolvePath(path string) string { return ds.ds.Path(path) } -func (ds *Datastore) UploadFile(src, dst string) error { +func (ds *Datastore) UploadFile(src, dst string, host string) error { p := soap.DefaultUpload - return ds.ds.UploadFile(ds.driver.ctx, src, dst, &p) + h, err := ds.driver.FindHost(host) + if err != nil { + return err + } + ctx := ds.ds.HostContext(ds.driver.ctx, h.host) + return ds.ds.UploadFile(ctx, src, dst, &p) } func (ds *Datastore) Delete(path string) error { diff --git a/iso/step_add_floppy.go b/iso/step_add_floppy.go index 5c67631a9..fd9f9ac27 100644 --- a/iso/step_add_floppy.go +++ b/iso/step_add_floppy.go @@ -40,7 +40,7 @@ func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multist } uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) - if err := ds.UploadFile(floppyPath.(string), uploadPath); err != nil { + if err := ds.UploadFile(floppyPath.(string), uploadPath, s.Host); err != nil { state.Put("error", err) return multistep.ActionHalt }