Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion builder/xenserver/common/step_upload_vdi.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type StepUploadVdi struct {
VdiNameFunc func() string
ImagePathFunc func() string
VdiUuidKey string
PreserveVdi bool
}

func (self *StepUploadVdi) uploadVdi(ctx context.Context, state multistep.StateBag) multistep.StepAction {
Expand Down Expand Up @@ -105,7 +106,7 @@ func (self *StepUploadVdi) Cleanup(state multistep.StateBag) {

vdiName := self.VdiNameFunc()

if config.ShouldKeepVM(state) {
if config.ShouldKeepVM(state) || self.PreserveVdi {
return
}

Expand Down
6 changes: 5 additions & 1 deletion builder/xenserver/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
&xscommon.StepFindOrUploadVdi{
xscommon.StepUploadVdi{
VdiNameFunc: func() string {
if self.config.ISOName != "" {
return self.config.ISOName
}
if len(self.config.ISOUrls) > 0 {
return path.Base(self.config.ISOUrls[0])
}
Expand All @@ -265,7 +268,8 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
}
return ""
},
VdiUuidKey: "iso_vdi_uuid",
VdiUuidKey: "iso_vdi_uuid",
PreserveVdi: self.config.ISOName != "",
},
},
&xscommon.StepFindVdi{
Expand Down