diff options
author | Thomas Hipp <thipp@suse.de> | 2017-12-18 13:20:08 +0100 |
---|---|---|
committer | Flavio Castelli <fcastelli@suse.com> | 2018-02-19 13:25:29 +0100 |
commit | 4c9f058d4032d8597e52ed0fca77503d42660278 (patch) | |
tree | 4ec528e2894e12567b601c3cc4e96100488b3b4e | |
parent | 474cfb2214f15c076bdef941583d91d06c0180ed (diff) | |
download | terraform-provider-libvirt-4c9f058d4032d8597e52ed0fca77503d42660278.tar terraform-provider-libvirt-4c9f058d4032d8597e52ed0fca77503d42660278.tar.gz |
remove dead/unreachable code
Signed-off-by: Thomas Hipp <thipp@suse.de>
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 14 | ||||
-rw-r--r-- | libvirt/utils_libvirt.go | 7 |
2 files changed, 1 insertions, 20 deletions
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index 75ca25fe..8d9be0e1 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -714,19 +714,7 @@ func resourceLibvirtDomainRead(d *schema.ResourceData, meta interface{}) error { "file": diskDef.Source.File, } } else { - var virVol *libvirt.StorageVol - if len(diskDef.Source.File) > 0 { - virVol, err = virConn.LookupStorageVolByPath(diskDef.Source.File) - } else { - virPool, err := virConn.LookupStoragePoolByName(diskDef.Source.Pool) - if err != nil { - return fmt.Errorf("Error retrieving pool for disk: %s", err) - } - defer virPool.Free() - - virVol, err = virPool.LookupStorageVolByName(diskDef.Source.Volume) - } - + virVol, err := virConn.LookupStorageVolByPath(diskDef.Source.File) if err != nil { return fmt.Errorf("Error retrieving volume for disk: %s", err) } diff --git a/libvirt/utils_libvirt.go b/libvirt/utils_libvirt.go index 0b1da1ef..40d2c5a2 100644 --- a/libvirt/utils_libvirt.go +++ b/libvirt/utils_libvirt.go @@ -32,13 +32,6 @@ func addHost(n *libvirt.Network, ip, mac, name string) error { return n.Update(libvirt.NETWORK_UPDATE_COMMAND_ADD_LAST, libvirt.NETWORK_SECTION_IP_DHCP_HOST, -1, xmlDesc, libvirt.NETWORK_UPDATE_AFFECT_CURRENT) } -// Removes a static host from the network -func removeHost(n *libvirt.Network, ip, mac, name string) error { - xmlDesc := getHostXMLDesc(ip, mac, name) - log.Printf("Removing host with XML:\n%s", xmlDesc) - return n.Update(libvirt.NETWORK_UPDATE_COMMAND_DELETE, libvirt.NETWORK_SECTION_IP_DHCP_HOST, -1, xmlDesc, libvirt.NETWORK_UPDATE_AFFECT_CURRENT) -} - // Update a static host from the network func updateHost(n *libvirt.Network, ip, mac, name string) error { xmlDesc := getHostXMLDesc(ip, mac, name) |