Merge "VMware: Fix deletion of an instance with no files"
This commit is contained in:
@@ -242,6 +242,10 @@ class ManagedObject(object):
|
||||
"""
|
||||
return self.__getattr__(attr)
|
||||
|
||||
def delete(self, attr):
|
||||
"""Deletes an attribute."""
|
||||
self.propSet = filter(lambda elem: elem.name != attr, self.propSet)
|
||||
|
||||
def __setattr__(self, attr, val):
|
||||
# TODO(hartsocks): this is adds unnecessary complexity to the class
|
||||
for prop in self.propSet:
|
||||
|
||||
@@ -1444,9 +1444,9 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
|
||||
self._check_vm_info(info, power_state.RUNNING)
|
||||
instances = self.conn.list_instances()
|
||||
self.assertEqual(len(instances), 1)
|
||||
# Overwrite the vmPathName
|
||||
# Delete the vmPathName
|
||||
vm = self._get_vm_record()
|
||||
vm.set("config.files.vmPathName", None)
|
||||
vm.delete('config.files.vmPathName')
|
||||
self.conn.destroy(self.context, self.instance, self.network_info)
|
||||
instances = self.conn.list_instances()
|
||||
self.assertEqual(len(instances), 0)
|
||||
|
||||
Reference in New Issue
Block a user