|
|
|
|
@ -51,7 +51,7 @@ func (s *stepCreateTemplate) Run(_ context.Context, state multistep.StateBag) mu
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.Message("Retrieving the ROOT volume ID...")
|
|
|
|
|
volumeID, err := getRootVolumeID(client, instanceID)
|
|
|
|
|
volumeID, err := getRootVolumeID(client, instanceID, config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
state.Put("error", err)
|
|
|
|
|
ui.Error(err.Error())
|
|
|
|
|
@ -89,13 +89,16 @@ func (s *stepCreateTemplate) Cleanup(state multistep.StateBag) {
|
|
|
|
|
// Nothing to cleanup for this step.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getRootVolumeID(client *cloudstack.CloudStackClient, instanceID string) (string, error) {
|
|
|
|
|
func getRootVolumeID(client *cloudstack.CloudStackClient, instanceID string, config *Config) (string, error) {
|
|
|
|
|
// Retrieve the virtual machine object.
|
|
|
|
|
p := client.Volume.NewListVolumesParams()
|
|
|
|
|
|
|
|
|
|
// Set the type and virtual machine ID
|
|
|
|
|
p.SetType("ROOT")
|
|
|
|
|
p.SetVirtualmachineid(instanceID)
|
|
|
|
|
if config.Project != "" {
|
|
|
|
|
p.SetProjectid(config.Project)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
volumes, err := client.Volume.ListVolumes(p)
|
|
|
|
|
if err != nil {
|
|
|
|
|
|