diff options
| author | Hisaharu Ishii <ishii.hisaharu@lab.ntt.co.jp> | 2011-08-24 10:47:46 -0700 |
|---|---|---|
| committer | Hisaharu Ishii <ishii.hisaharu@lab.ntt.co.jp> | 2011-08-24 10:47:46 -0700 |
| commit | d3112780748d647a34ec7178835a17a37bbc07ea (patch) | |
| tree | 5077345b5ac26875d3b4bb47c275f0baee806401 | |
| parent | 5ab769daf354033f5044c88d4f899d56effd998e (diff) | |
| parent | 4a99c3f134e20445eb1f6bdabf0f0c53ff9c39c5 (diff) | |
Merged from trunk
| -rw-r--r-- | nova/compute/api.py | 6 | ||||
| -rw-r--r-- | nova/tests/test_compute.py | 5 | ||||
| -rw-r--r-- | nova/volume/driver.py | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 06f09f9a6..60a13631a 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -55,15 +55,15 @@ def generate_default_hostname(instance): """Default function to generate a hostname given an instance reference.""" display_name = instance['display_name'] if display_name is None: - return 'server_%d' % (instance['id'],) + return 'server-%d' % (instance['id'],) table = '' deletions = '' for i in xrange(256): c = chr(i) if ('a' <= c <= 'z') or ('0' <= c <= '9') or (c == '-'): table += c - elif c == ' ': - table += '_' + elif c in " _": + table += '-' elif ('A' <= c <= 'Z'): table += c.lower() else: diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 0523d73b6..6659b81eb 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -175,8 +175,9 @@ class ComputeTestCase(test.TestCase): db.instance_destroy(self.context, instance_id) def test_default_hostname_generator(self): - cases = [(None, 'server_1'), ('Hello, Server!', 'hello_server'), - ('<}\x1fh\x10e\x08l\x02l\x05o\x12!{>', 'hello')] + cases = [(None, 'server-1'), ('Hello, Server!', 'hello-server'), + ('<}\x1fh\x10e\x08l\x02l\x05o\x12!{>', 'hello'), + ('hello_server', 'hello-server')] for display_name, hostname in cases: ref = self.compute_api.create(self.context, instance_types.get_default_instance_type(), None, diff --git a/nova/volume/driver.py b/nova/volume/driver.py index c99534c07..7d2fb45d4 100644 --- a/nova/volume/driver.py +++ b/nova/volume/driver.py @@ -495,7 +495,7 @@ class ISCSIDriver(VolumeDriver): (out, err) = self._execute('iscsiadm', '-m', 'node', '-T', iscsi_properties['target_iqn'], '-p', iscsi_properties['target_portal'], - iscsi_command, run_as_root=True) + *iscsi_command, run_as_root=True) LOG.debug("iscsiadm %s: stdout=%s stderr=%s" % (iscsi_command, out, err)) return (out, err) |
