Merge pull request #1305 from svanharmelen/b-provider/cloudstack-template

provider/cloudstack: some small fixes, needed to work with bigger templates
This commit is contained in:
Sander van Harmelen 2015-03-25 22:56:37 +01:00
commit 26fa9b6daa
2 changed files with 11 additions and 11 deletions

View File

@ -84,7 +84,7 @@ func resourceCloudStackDiskCreate(d *schema.ResourceData, meta interface{}) erro
if d.Get("size").(int) != 0 { if d.Get("size").(int) != 0 {
// Set the volume size // Set the volume size
p.SetSize(d.Get("size").(int)) p.SetSize(int64(d.Get("size").(int)))
} }
// Retrieve the zone UUID // Retrieve the zone UUID
@ -141,7 +141,7 @@ func resourceCloudStackDiskRead(d *schema.ResourceData, meta interface{}) error
d.Set("name", v.Name) d.Set("name", v.Name)
d.Set("attach", v.Attached != "") // If attached this will contain a timestamp when attached d.Set("attach", v.Attached != "") // If attached this will contain a timestamp when attached
d.Set("disk_offering", v.Diskofferingname) d.Set("disk_offering", v.Diskofferingname)
d.Set("size", v.Size/(1024*1024*1024)) // Needed to get GB's again d.Set("size", int(v.Size/(1024*1024*1024))) // Needed to get GB's again
d.Set("zone", v.Zonename) d.Set("zone", v.Zonename)
if v.Attached != "" { if v.Attached != "" {
@ -196,7 +196,7 @@ func resourceCloudStackDiskUpdate(d *schema.ResourceData, meta interface{}) erro
if d.Get("size").(int) != 0 { if d.Get("size").(int) != 0 {
// Set the size // Set the size
p.SetSize(d.Get("size").(int)) p.SetSize(int64(d.Get("size").(int)))
} }
// Set the shrink bit // Set the shrink bit
@ -367,7 +367,7 @@ func isAttached(cs *cloudstack.CloudStackClient, id string) (bool, error) {
return v.Attached != "", nil return v.Attached != "", nil
} }
func retrieveDeviceID(device string) int { func retrieveDeviceID(device string) int64 {
switch device { switch device {
case "/dev/xvdb", "D:": case "/dev/xvdb", "D:":
return 1 return 1
@ -402,7 +402,7 @@ func retrieveDeviceID(device string) int {
} }
} }
func retrieveDeviceName(device int, os string) string { func retrieveDeviceName(device int64, os string) string {
switch device { switch device {
case 1: case 1:
if os == "Windows" { if os == "Windows" {

View File

@ -87,11 +87,11 @@ func resourceCloudStackVPNCustomerGatewayCreate(d *schema.ResourceData, meta int
} }
if esplifetime, ok := d.GetOk("esp_lifetime"); ok { if esplifetime, ok := d.GetOk("esp_lifetime"); ok {
p.SetEsplifetime(esplifetime.(int)) p.SetEsplifetime(int64(esplifetime.(int)))
} }
if ikelifetime, ok := d.GetOk("ike_lifetime"); ok { if ikelifetime, ok := d.GetOk("ike_lifetime"); ok {
p.SetIkelifetime(ikelifetime.(int)) p.SetIkelifetime(int64(ikelifetime.(int)))
} }
// Create the new VPN Customer Gateway // Create the new VPN Customer Gateway
@ -128,8 +128,8 @@ func resourceCloudStackVPNCustomerGatewayRead(d *schema.ResourceData, meta inter
d.Set("ike_policy", v.Ikepolicy) d.Set("ike_policy", v.Ikepolicy)
d.Set("ipsec_psk", v.Ipsecpsk) d.Set("ipsec_psk", v.Ipsecpsk)
d.Set("dpd", v.Dpd) d.Set("dpd", v.Dpd)
d.Set("esp_lifetime", v.Esplifetime) d.Set("esp_lifetime", int(v.Esplifetime))
d.Set("ike_lifetime", v.Ikelifetime) d.Set("ike_lifetime", int(v.Ikelifetime))
return nil return nil
} }
@ -154,11 +154,11 @@ func resourceCloudStackVPNCustomerGatewayUpdate(d *schema.ResourceData, meta int
} }
if esplifetime, ok := d.GetOk("esp_lifetime"); ok { if esplifetime, ok := d.GetOk("esp_lifetime"); ok {
p.SetEsplifetime(esplifetime.(int)) p.SetEsplifetime(int64(esplifetime.(int)))
} }
if ikelifetime, ok := d.GetOk("ike_lifetime"); ok { if ikelifetime, ok := d.GetOk("ike_lifetime"); ok {
p.SetIkelifetime(ikelifetime.(int)) p.SetIkelifetime(int64(ikelifetime.(int)))
} }
// Update the VPN Customer Gateway // Update the VPN Customer Gateway