Merge "Remove unused method in VMware driver."
This commit is contained in:
@@ -216,12 +216,6 @@ class VMwareAPIVMTestCase(test.TestCase):
|
||||
instances = self.conn.list_instances()
|
||||
self.assertEquals(len(instances), 1)
|
||||
|
||||
def test_list_interfaces(self):
|
||||
self._create_vm()
|
||||
interfaces = self.conn.list_interfaces(1)
|
||||
self.assertEquals(len(interfaces), 1)
|
||||
self.assertEquals(interfaces[0], 4000)
|
||||
|
||||
def test_spawn(self):
|
||||
self._create_vm()
|
||||
info = self.conn.get_info({'name': 1})
|
||||
|
||||
@@ -329,16 +329,6 @@ class VMwareESXDriver(driver.ComputeDriver):
|
||||
"""Unplug VIFs from networks."""
|
||||
self._vmops.unplug_vifs(instance, network_info)
|
||||
|
||||
def list_interfaces(self, instance_name):
|
||||
"""
|
||||
Return the IDs of all the virtual network interfaces attached to the
|
||||
specified instance, as a list. These IDs are opaque to the caller
|
||||
(they are only useful for giving back to this layer as a parameter to
|
||||
interface_stats). These IDs only need to be unique for a given
|
||||
instance.
|
||||
"""
|
||||
return self._vmops.list_interfaces(instance_name)
|
||||
|
||||
|
||||
class VMwareVCDriver(VMwareESXDriver):
|
||||
"""The ESX host connection object."""
|
||||
|
||||
@@ -1323,28 +1323,3 @@ class VMwareVMOps(object):
|
||||
def unplug_vifs(self, instance, network_info):
|
||||
"""Unplug VIFs from networks."""
|
||||
pass
|
||||
|
||||
def list_interfaces(self, instance_name):
|
||||
"""
|
||||
Return the IDs of all the virtual network interfaces attached to the
|
||||
specified instance, as a list. These IDs are opaque to the caller
|
||||
(they are only useful for giving back to this layer as a parameter to
|
||||
interface_stats). These IDs only need to be unique for a given
|
||||
instance.
|
||||
"""
|
||||
vm_ref = vm_util.get_vm_ref_from_name(self._session, instance_name)
|
||||
if vm_ref is None:
|
||||
raise exception.InstanceNotFound(instance_id=instance_name)
|
||||
|
||||
interfaces = []
|
||||
# Get the virtual network interfaces attached to the VM
|
||||
hardware_devices = self._session._call_method(vim_util,
|
||||
"get_dynamic_property", vm_ref,
|
||||
"VirtualMachine", "config.hardware.device")
|
||||
|
||||
for device in hardware_devices:
|
||||
if device.__class__.__name__ in ["VirtualE1000", "VirtualE1000e",
|
||||
"VirtualPCNet32", "VirtualVmxnet"]:
|
||||
interfaces.append(device.key)
|
||||
|
||||
return interfaces
|
||||
|
||||
Reference in New Issue
Block a user