summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2010-12-10 21:09:37 +0000
committerVishvananda Ishaya <vishvananda@gmail.com>2010-12-10 21:09:37 +0000
commit68dbbbba34af234f2770b40c03e4e4bfa5ad78d8 (patch)
treee2185f72880e1d60a883659f6b7215a32145c2a6
parent1a759c3722610d720dd8dabf816db146c1063937 (diff)
downloadnova-68dbbbba34af234f2770b40c03e4e4bfa5ad78d8.tar.gz
nova-68dbbbba34af234f2770b40c03e4e4bfa5ad78d8.tar.xz
nova-68dbbbba34af234f2770b40c03e4e4bfa5ad78d8.zip
Includes kernel and ramdisk on register. Additinally removes a couple lines of cruft
-rw-r--r--nova/objectstore/image.py46
1 files changed, 24 insertions, 22 deletions
diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py
index 7292dbab8..ed0f75cd2 100644
--- a/nova/objectstore/image.py
+++ b/nova/objectstore/image.py
@@ -21,15 +21,12 @@ Take uploaded bucket contents and register them as disk images (AMIs).
Requires decryption using keys in the manifest.
"""
-# TODO(jesse): Got these from Euca2ools, will need to revisit them
-
import binascii
import glob
import json
import os
import shutil
import tarfile
-import tempfile
from xml.etree import ElementTree
from nova import exception
@@ -185,33 +182,38 @@ class Image(object):
manifest = ElementTree.fromstring(bucket_object[manifest_path].read())
image_type = 'machine'
+ info = {
+ 'imageId': image_id,
+ 'imageLocation': image_location,
+ 'imageOwnerId': context.project_id,
+ 'isPublic': False, # FIXME: grab public from manifest
+ 'architecture': 'x86_64',
+ 'imageType': 'machine'
+ }
+
+ manifest = ElementTree.fromstring(bucket_object[manifest_path].read())
+
+ try:
+ architecture = manifest.find("machine_configuration/kernel_id").text
+ info['architecture'] = architecture
+ except:
+ pass
try:
kernel_id = manifest.find("machine_configuration/kernel_id").text
if kernel_id == 'true':
- image_type = 'kernel'
+ info['imageType'] = 'kernel'
+ else:
+ info['kernelId'] = kernel_id
except:
- kernel_id = None
-
+ pass
try:
ramdisk_id = manifest.find("machine_configuration/ramdisk_id").text
if ramdisk_id == 'true':
- image_type = 'ramdisk'
+ info['imageType'] = 'ramdisk'
+ else:
+ info['ramdiskId'] = ramdisk_id
except:
- ramdisk_id = None
-
- info = {
- 'imageId': image_id,
- 'imageLocation': image_location,
- 'imageOwnerId': context.project_id,
- 'isPublic': False, # FIXME: grab public from manifest
- 'architecture': 'x86_64', # FIXME: grab architecture from manifest
- 'imageType': image_type}
-
- if kernel_id:
- info['kernelId'] = kernel_id
-
- if ramdisk_id:
- info['ramdiskId'] = ramdisk_id
+ pass
def write_state(state):
info['imageState'] = state