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 {
|
switch c.Format {
|
||||||
case "xva", "vdi_raw", "vdi_vhd", "none":
|
case "xva", "xva_compressed", "vdi_raw", "vdi_vhd", "none":
|
||||||
default:
|
default:
|
||||||
errs = append(errs, errors.New("format must be one of 'xva', 'vdi_raw', 'vdi_vhd', 'none'"))
|
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")
|
ui.Say("Step: export artifact")
|
||||||
|
|
||||||
|
compress_option_xe := "compress=false"
|
||||||
|
compress_option_url := ""
|
||||||
|
|
||||||
switch config.Format {
|
switch config.Format {
|
||||||
case "none":
|
case "none":
|
||||||
ui.Say("Skipping export")
|
ui.Say("Skipping export")
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
|
||||||
|
case "xva_compressed":
|
||||||
|
compress_option_xe = "compress=true"
|
||||||
|
compress_option_url = "use_compression=true&"
|
||||||
|
fallthrough
|
||||||
case "xva":
|
case "xva":
|
||||||
// export the VM
|
// export the VM
|
||||||
|
|
||||||
@ -115,7 +122,7 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
|||||||
"-pw", client.Password,
|
"-pw", client.Password,
|
||||||
"vm-export",
|
"vm-export",
|
||||||
"vm="+instance_uuid,
|
"vm="+instance_uuid,
|
||||||
"compress=true",
|
compress_option_xe,
|
||||||
"filename="+export_filename,
|
"filename="+export_filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -123,8 +130,9 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
|||||||
|
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
} else {
|
} 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,
|
client.Host,
|
||||||
|
compress_option_url,
|
||||||
instance_uuid,
|
instance_uuid,
|
||||||
client.Session.(string),
|
client.Session.(string),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user