Skip to content

Commit 3531171

Browse files
authored
Merge pull request #59 from makunterry/CP-19292
CP-19292: added an option for "format" to export compressed xva
2 parents ee5af0d + b51f3e3 commit 3531171

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

builder/xenserver/common/common_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig
184184
}
185185

186186
switch c.Format {
187-
case "xva", "vdi_raw", "vdi_vhd", "none":
187+
case "xva", "xva_compressed", "vdi_raw", "vdi_vhd", "none":
188188
default:
189189
errs = append(errs, errors.New("format must be one of 'xva', 'vdi_raw', 'vdi_vhd', 'none'"))
190190
}

builder/xenserver/common/step_export.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
9595

9696
ui.Say("Step: export artifact")
9797

98+
compress_option_xe := "compress=false"
99+
compress_option_url := ""
100+
98101
switch config.Format {
99102
case "none":
100103
ui.Say("Skipping export")
101104
return multistep.ActionContinue
102105

106+
case "xva_compressed":
107+
compress_option_xe = "compress=true"
108+
compress_option_url = "use_compression=true&"
109+
fallthrough
103110
case "xva":
104111
// export the VM
105112

@@ -115,16 +122,17 @@ func (StepExport) Run(state multistep.StateBag) multistep.StepAction {
115122
"-pw", client.Password,
116123
"vm-export",
117124
"vm="+instance_uuid,
118-
"compress=true",
125+
compress_option_xe,
119126
"filename="+export_filename,
120127
)
121128

122129
ui.Say(fmt.Sprintf("Getting XVA %+v %+v", cmd.Path, cmd.Args))
123130

124131
err = cmd.Run()
125132
} else {
126-
export_url := fmt.Sprintf("https://%s/export?uuid=%s&session_id=%s",
133+
export_url := fmt.Sprintf("https://%s/export?%suuid=%s&session_id=%s",
127134
client.Host,
135+
compress_option_url,
128136
instance_uuid,
129137
client.Session.(string),
130138
)

0 commit comments

Comments
 (0)