Skip to content

Commit be1540e

Browse files
committed
Fix values updated when updateNetworkOffering is called
1 parent 4eb6d4b commit be1540e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

cloudstack/resource_cloudstack_network_offering.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ func resourceCloudStackNetworkOfferingUpdate(d *schema.ResourceData, meta interf
106106

107107
}
108108

109-
// Check if the display text is changed and if so, update the virtual machine
109+
// Check if the display text is changed and if so, update the network offering
110110
if d.HasChange("display_text") {
111111
log.Printf("[DEBUG] Display text changed for %s, starting update", name)
112112

113113
// Create a new parameter struct
114114
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
115115

116116
// Set the new display text
117-
p.SetName(d.Get("display_text").(string))
117+
p.SetDisplaytext(d.Get("display_text").(string))
118118

119119
// Update the display text
120120
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)
@@ -125,34 +125,34 @@ func resourceCloudStackNetworkOfferingUpdate(d *schema.ResourceData, meta interf
125125

126126
}
127127

128-
// Check if the guest ip type is changed and if so, update the virtual machine
129-
if d.HasChange("guest_ip_type") {
130-
log.Printf("[DEBUG] Guest ip type changed for %s, starting update", name)
128+
// Check if maxconnections is changed and if so, update the network offering
129+
if d.HasChange("max_connections") {
130+
log.Printf("[DEBUG] Max connections changed for %s, starting update", name)
131131

132132
// Create a new parameter struct
133133
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
134134

135-
// Set the new guest ip type
136-
p.SetName(d.Get("guest_ip_type").(string))
135+
// Set the new max connections
136+
p.SetMaxconnections(d.Get("max_connections").(int))
137137

138-
// Update the guest ip type
138+
// Update the max connections
139139
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)
140140
if err != nil {
141141
return fmt.Errorf(
142-
"Error updating the guest ip type for network offering %s: %s", name, err)
142+
"Error updating the max connections for network offering %s: %s", name, err)
143143
}
144144

145145
}
146146

147-
// Check if the traffic type is changed and if so, update the virtual machine
148-
if d.HasChange("traffic_type") {
149-
log.Printf("[DEBUG] Traffic type changed for %s, starting update", name)
147+
// Check if the domain id is changed and if so, update the network offering
148+
if d.HasChange("domain_id") {
149+
log.Printf("[DEBUG] Domain id changed for %s, starting update", name)
150150

151151
// Create a new parameter struct
152152
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
153153

154-
// Set the new traffic type
155-
p.SetName(d.Get("traffic_type").(string))
154+
// Set the new domain id
155+
p.SetDomainid(d.Get("domain_id").(string))
156156

157157
// Update the traffic type
158158
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)

cloudstack/resource_cloudstack_network_offering_test.go

Whitespace-only changes.
39.3 MB
Binary file not shown.

0 commit comments

Comments
 (0)