Merge pull request #59 from makunterry/CP-19292
CP-19292: added an option for "format" to export compressed xva
This commit is contained in:
commit
3531171bc4
@ -184,7 +184,7 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig
|
||||
}
|
||||
|
||||
switch c.Format {
|
||||
case "xva", "vdi_raw", "vdi_vhd", "none":
|
||||
case "xva", "xva_compressed", "vdi_raw", "vdi_vhd", "none":
|
||||
default:
|
||||
errs = append(errs, errors.New("format must be one of 'xva', 'vdi_raw', 'vdi_vhd', 'none'"))
|
||||
}
|
||||
|
@ -95,11 +95,18 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
||||
ui.Say("Step: export artifact")
|
||||
|
||||
compress_option_xe := "compress=false"
|
||||
compress_option_url := ""
|
||||
|
||||
switch config.Format {
|
||||
case "none":
|
||||
ui.Say("Skipping export")
|
||||
return multistep.ActionContinue
|
||||
|
||||
case "xva_compressed":
|
||||
compress_option_xe = "compress=true"
|
||||
compress_option_url = "use_compression=true&"
|
||||
fallthrough
|
||||
case "xva":
|
||||
// export the VM
|
||||
|
||||
@ -115,7 +122,7 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
||||
"-pw", client.Password,
|
||||
"vm-export",
|
||||
"vm="+instance_uuid,
|
||||
"compress=true",
|
||||
compress_option_xe,
|
||||
"filename="+export_filename,
|
||||
)
|
||||
|
||||
@ -123,8 +130,9 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
||||
err = cmd.Run()
|
||||
} else {
|
||||
export_url := fmt.Sprintf("https://%s/export?uuid=%s&session_id=%s",
|
||||
export_url := fmt.Sprintf("https://%s/export?%suuid=%s&session_id=%s",
|
||||
client.Host,
|
||||
compress_option_url,
|
||||
instance_uuid,
|
||||
client.Session.(string),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user