passing projectid to getRootVolumeID rather than the whole config struct

This commit is contained in:
Sergio Millan Rodriguez 2018-07-16 11:38:14 +02:00
parent a41a4658ee
commit e729b21212
1 changed files with 4 additions and 4 deletions

View File

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