From 041cce36b47244eccee798002e28921ef6fc03ab Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Wed, 25 Mar 2015 22:48:44 +0100 Subject: [PATCH] Some small fixes, needed to work with bigger templates --- .../providers/cloudstack/resource_cloudstack_disk.go | 10 +++++----- .../resource_cloudstack_vpn_customer_gateway.go | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/builtin/providers/cloudstack/resource_cloudstack_disk.go b/builtin/providers/cloudstack/resource_cloudstack_disk.go index 88ddff59e..382cd2876 100644 --- a/builtin/providers/cloudstack/resource_cloudstack_disk.go +++ b/builtin/providers/cloudstack/resource_cloudstack_disk.go @@ -84,7 +84,7 @@ func resourceCloudStackDiskCreate(d *schema.ResourceData, meta interface{}) erro if d.Get("size").(int) != 0 { // Set the volume size - p.SetSize(d.Get("size").(int)) + p.SetSize(int64(d.Get("size").(int))) } // Retrieve the zone UUID @@ -141,7 +141,7 @@ func resourceCloudStackDiskRead(d *schema.ResourceData, meta interface{}) error d.Set("name", v.Name) d.Set("attach", v.Attached != "") // If attached this will contain a timestamp when attached 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) if v.Attached != "" { @@ -196,7 +196,7 @@ func resourceCloudStackDiskUpdate(d *schema.ResourceData, meta interface{}) erro if d.Get("size").(int) != 0 { // Set the size - p.SetSize(d.Get("size").(int)) + p.SetSize(int64(d.Get("size").(int))) } // Set the shrink bit @@ -367,7 +367,7 @@ func isAttached(cs *cloudstack.CloudStackClient, id string) (bool, error) { return v.Attached != "", nil } -func retrieveDeviceID(device string) int { +func retrieveDeviceID(device string) int64 { switch device { case "/dev/xvdb", "D:": 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 { case 1: if os == "Windows" { diff --git a/builtin/providers/cloudstack/resource_cloudstack_vpn_customer_gateway.go b/builtin/providers/cloudstack/resource_cloudstack_vpn_customer_gateway.go index 90a03aeb0..f27e28d38 100644 --- a/builtin/providers/cloudstack/resource_cloudstack_vpn_customer_gateway.go +++ b/builtin/providers/cloudstack/resource_cloudstack_vpn_customer_gateway.go @@ -87,11 +87,11 @@ func resourceCloudStackVPNCustomerGatewayCreate(d *schema.ResourceData, meta int } 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 { - p.SetIkelifetime(ikelifetime.(int)) + p.SetIkelifetime(int64(ikelifetime.(int))) } // 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("ipsec_psk", v.Ipsecpsk) d.Set("dpd", v.Dpd) - d.Set("esp_lifetime", v.Esplifetime) - d.Set("ike_lifetime", v.Ikelifetime) + d.Set("esp_lifetime", int(v.Esplifetime)) + d.Set("ike_lifetime", int(v.Ikelifetime)) return nil } @@ -154,11 +154,11 @@ func resourceCloudStackVPNCustomerGatewayUpdate(d *schema.ResourceData, meta int } 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 { - p.SetIkelifetime(ikelifetime.(int)) + p.SetIkelifetime(int64(ikelifetime.(int))) } // Update the VPN Customer Gateway