summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wolf <will.wolf@rackspace.com>2011-05-06 21:30:31 -0400
committerWilliam Wolf <will.wolf@rackspace.com>2011-05-06 21:30:31 -0400
commit329a409e865d05d753210b4e31b712fcbd22cd38 (patch)
treeb1956d7502be8ec9bbc6e505a64dd2791383c691
parentb5865949d1b690440a268b0cd941b128d74caba7 (diff)
parent1ebf53379769249c56c6249714ae2888195286f2 (diff)
downloadnova-329a409e865d05d753210b4e31b712fcbd22cd38.tar.gz
nova-329a409e865d05d753210b4e31b712fcbd22cd38.tar.xz
nova-329a409e865d05d753210b4e31b712fcbd22cd38.zip
merge from trunk
-rw-r--r--Authors1
-rw-r--r--nova/compute/manager.py3
-rw-r--r--nova/image/local.py2
-rw-r--r--nova/tests/api/openstack/test_images.py12
-rw-r--r--nova/tests/test_cloud.py2
-rw-r--r--nova/virt/fake.py2
6 files changed, 18 insertions, 4 deletions
diff --git a/Authors b/Authors
index 99c07f7cd..0aaf084b5 100644
--- a/Authors
+++ b/Authors
@@ -81,4 +81,5 @@ Vishvananda Ishaya <vishvananda@gmail.com>
William Wolf <throughnothing@gmail.com>
Yoshiaki Tamura <yoshi@midokura.jp>
Youcef Laribi <Youcef.Laribi@eu.citrix.com>
+Yuriy Taraday <yorik.sar@gmail.com>
Zhixue Wu <Zhixue.Wu@citrix.com>
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 1ff78007b..c6f957073 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -749,7 +749,8 @@ class ComputeManager(manager.SchedulerDependentManager):
instance_ref = self.db.instance_get(context, instance_id)
LOG.audit(_("Get console output for instance %s"), instance_id,
context=context)
- return self.driver.get_console_output(instance_ref)
+ output = self.driver.get_console_output(instance_ref)
+ return output.decode('utf-8', 'replace').encode('ascii', 'replace')
@exception.wrap_exception
def get_ajax_console(self, context, instance_id):
diff --git a/nova/image/local.py b/nova/image/local.py
index b6d8f3ba1..918180bae 100644
--- a/nova/image/local.py
+++ b/nova/image/local.py
@@ -102,7 +102,7 @@ class LocalImageService(service.BaseImageService):
image = cantidate
break
if image is None:
- raise exception.ImageNotFound(image_id=image_id)
+ raise exception.ImageNotFound(image_id=name)
return image
def get(self, context, image_id, data):
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py
index e5dd93c3f..2c329f920 100644
--- a/nova/tests/api/openstack/test_images.py
+++ b/nova/tests/api/openstack/test_images.py
@@ -75,6 +75,18 @@ class _BaseImageServiceTests(test.TestCase):
self.context,
'bad image id')
+ def test_create_and_show_non_existing_image_by_name(self):
+ fixture = self._make_fixture('test image')
+ num_images = len(self.service.index(self.context))
+
+ image_id = self.service.create(self.context, fixture)['id']
+
+ self.assertNotEquals(None, image_id)
+ self.assertRaises(exception.ImageNotFound,
+ self.service.show_by_name,
+ self.context,
+ 'bad image id')
+
def test_update(self):
fixture = self._make_fixture('test image')
image_id = self.service.create(self.context, fixture)['id']
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py
index c45bdd12c..f271c03f2 100644
--- a/nova/tests/test_cloud.py
+++ b/nova/tests/test_cloud.py
@@ -290,7 +290,7 @@ class CloudTestCase(test.TestCase):
instance_id = rv['instancesSet'][0]['instanceId']
output = self.cloud.get_console_output(context=self.context,
instance_id=[instance_id])
- self.assertEquals(b64decode(output['output']), 'FAKE CONSOLE OUTPUT')
+ self.assertEquals(b64decode(output['output']), 'FAKE CONSOLE?OUTPUT')
# TODO(soren): We need this until we can stop polling in the rpc code
# for unit tests.
greenthread.sleep(0.3)
diff --git a/nova/virt/fake.py b/nova/virt/fake.py
index 33f37b512..5ac376e46 100644
--- a/nova/virt/fake.py
+++ b/nova/virt/fake.py
@@ -367,7 +367,7 @@ class FakeConnection(driver.ComputeDriver):
return [0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L]
def get_console_output(self, instance):
- return 'FAKE CONSOLE OUTPUT'
+ return 'FAKE CONSOLE\xffOUTPUT'
def get_ajax_console(self, instance):
return {'token': 'FAKETOKEN',