From 4c9f058d4032d8597e52ed0fca77503d42660278 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Mon, 18 Dec 2017 13:20:08 +0100 Subject: remove dead/unreachable code Signed-off-by: Thomas Hipp --- libvirt/resource_libvirt_domain.go | 14 +------------- libvirt/utils_libvirt.go | 7 ------- 2 files changed, 1 insertion(+), 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) -- cgit v1.2.3