summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-11 12:14:16 +0000
committerGerrit Code Review <review@openstack.org>2013-04-11 12:14:16 +0000
commit284cc009175f0d87683dc6a98ee997e8476ef87c (patch)
tree3abad2da4a9157f46f04eed5c2b51427dabd8c45
parent6b2af9c084754a1e678f741bfc6b97e13f1cf8a5 (diff)
parent588b5651dc515d642b110f61c41d78860206841c (diff)
downloadnova-284cc009175f0d87683dc6a98ee997e8476ef87c.tar.gz
nova-284cc009175f0d87683dc6a98ee997e8476ef87c.tar.xz
nova-284cc009175f0d87683dc6a98ee997e8476ef87c.zip
Merge "Remove "undefined name" pyflake errors"
-rw-r--r--nova/cmd/baremetal_deploy_helper.py1
-rw-r--r--nova/cmd/baremetal_manage.py1
-rw-r--r--nova/cmd/dhcpbridge.py1
-rw-r--r--nova/tests/test_db_api.py2
-rw-r--r--nova/tests/test_powervm.py43
-rwxr-xr-xtools/run_pep8.sh3
6 files changed, 31 insertions, 20 deletions
diff --git a/nova/cmd/baremetal_deploy_helper.py b/nova/cmd/baremetal_deploy_helper.py
index 5ccd43b56..caa50f20e 100644
--- a/nova/cmd/baremetal_deploy_helper.py
+++ b/nova/cmd/baremetal_deploy_helper.py
@@ -40,6 +40,7 @@ from nova.virt.baremetal import db
QUEUE = Queue.Queue()
+LOG = logging.getLogger(__name__)
# All functions are called from deploy() directly or indirectly.
diff --git a/nova/cmd/baremetal_manage.py b/nova/cmd/baremetal_manage.py
index 881f2f60c..eaf4a8416 100644
--- a/nova/cmd/baremetal_manage.py
+++ b/nova/cmd/baremetal_manage.py
@@ -197,7 +197,6 @@ def main():
cliutils.validate_args(fn, *fn_args, **fn_kwargs)
except cliutils.MissingArgs as e:
print(fn.__doc__)
- parser.print_help()
print(e)
return(1)
try:
diff --git a/nova/cmd/dhcpbridge.py b/nova/cmd/dhcpbridge.py
index c874af51e..108aafcf9 100644
--- a/nova/cmd/dhcpbridge.py
+++ b/nova/cmd/dhcpbridge.py
@@ -41,6 +41,7 @@ from nova.openstack.common import rpc
CONF = cfg.CONF
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('network_manager', 'nova.service')
+LOG = logging.getLogger(__name__)
def add_lease(mac, ip_address):
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index ad295e9a7..93685c359 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -2745,7 +2745,7 @@ class VirtualInterfaceTestCase(test.TestCase, ModelsObjectComparatorMixin):
# NOTE(boris-42): Due to the bug 1156227 this won't work. In havana-1
# it will be fixed.
self.assertRaises(exception.VirtualInterfaceCreateException,
- self._create_virt_interface, {uuid: vif['uuid']})
+ self._create_virt_interface, {"uuid": vif['uuid']})
def test_virtual_interface_get(self):
vifs = [self._create_virt_interface({'address':'a'}),
diff --git a/nova/tests/test_powervm.py b/nova/tests/test_powervm.py
index 572c0f946..a8278f085 100644
--- a/nova/tests/test_powervm.py
+++ b/nova/tests/test_powervm.py
@@ -404,23 +404,6 @@ class PowerVMDriverTestCase(test.TestCase):
context, instance,
dest, instance_type, network_info, block_device_info)
- def test_set_lpar_mac_base_value_command(self):
- inst_name = 'some_instance'
- mac = 'FA:98:64:2B:29:39'
- exp_mac_str = mac[:-2].replace(':', '').lower()
-
- def fake_run_vios_command(cmd, *args, **kwargs):
- exp_cmd = ('chsyscfg -r lpar -i "name=%(inst_name)s, ',
- 'virtual_eth_mac_base_value=%(exp_mac_str)s"' %
- locals())
- assertEqual(exp_cmd, cmd)
-
- self.stubs.Set(self.powervm_connection._powervm._operator,
- 'run_vios_command', fake_run_vios_command)
-
- fake_op = self.powervm_connection._powervm
- fake_op._operator.set_lpar_mac_base_value(inst_name, mac)
-
def test_migrate_build_scp_command(self):
lv_name = 'logical-vol-name'
src_host = 'compute_host_1'
@@ -488,3 +471,29 @@ class PowerVMDriverTestCase(test.TestCase):
self.assertEquals(host_stats['supported_instances'][0][0], "ppc64")
self.assertEquals(host_stats['supported_instances'][0][1], "powervm")
self.assertEquals(host_stats['supported_instances'][0][2], "hvm")
+
+
+class PowerVMDriverLparTestCase(test.TestCase):
+ """Unit tests for PowerVM connection calls."""
+
+ def setUp(self):
+ super(PowerVMDriverLparTestCase, self).setUp()
+ self.stubs.Set(operator.PowerVMOperator, '_update_host_stats',
+ lambda self: None)
+ self.powervm_connection = powervm_driver.PowerVMDriver(None)
+
+ def test_set_lpar_mac_base_value_command(self):
+ inst_name = 'some_instance'
+ mac = 'FA:98:64:2B:29:39'
+ exp_mac_str = mac[:-2].replace(':', '')
+
+ exp_cmd = ('chsyscfg -r lpar -i "name=%(inst_name)s, '
+ 'virtual_eth_mac_base_value=%(exp_mac_str)s"') % locals()
+
+ fake_op = self.powervm_connection._powervm
+ self.mox.StubOutWithMock(fake_op._operator, 'run_vios_command')
+ fake_op._operator.run_vios_command(exp_cmd)
+
+ self.mox.ReplayAll()
+
+ fake_op._operator.set_lpar_mac_base_value(inst_name, mac)
diff --git a/tools/run_pep8.sh b/tools/run_pep8.sh
index 61b5f8985..7c2ec0130 100755
--- a/tools/run_pep8.sh
+++ b/tools/run_pep8.sh
@@ -22,4 +22,5 @@ PLUGINS_PATH=${SCRIPT_ROOT}/plugins/xenserver/xenapi/etc/xapi.d/plugins
PYTHONPATH=${PLUGINS_PATH} ${PEP8} ./plugins/xenserver/xenapi \
`find plugins/xenserver/xenapi/etc/xapi.d/plugins -type f -perm +111`
-! pyflakes nova/ | grep "imported but unused\|redefinition of function"
+! pyflakes nova/ | grep "imported but unused\|redefinition of function\|undefined name '" |
+ grep -v "undefined name '_'"