Makes --kernel and --ramdisk required arguments for glance-upload since Nova currently requires them.

The `null_kernel` concept in Nova is slated to be removed, so this is really just a stop gap measure.
This commit is contained in:
Rick Harris
2011-02-25 01:56:56 +00:00
committed by Tarmac
2 changed files with 27 additions and 16 deletions

View File

@@ -19,19 +19,29 @@
""" """
Upload an image into Glance Upload an image into Glance
Usage: Usage
=====
Raw: Machine - Kernel outside of the image
-------------------------------------
glance-upload <filename> <name> glance-upload --type=kernel <filename> <name>
glance-upload --type=ramdisk <filename> <name>
glance-upload --type=machine --kernel=KERNEL_ID --ramdisk=RAMDISK_ID \
<filename> <name>
Kernel-outside: Raw - Kernel inside, raw image data
-----------------------------------
glance-upload --type=kernel <filename> <name> glance-upload --type=raw --kernel=nokernel --ramdisk=noramdisk \
glance-upload --type=ramdisk <filename> <name> <filename> <name>
glance-upload --type=machine --kernel=KERNEL_ID --ramdisk=RAMDISK_ID \
<filename> <name>
VHD - Kernel inside, data encoded with VHD format
-------------------------------------------------
glance-upload --type=vhd --kernel=nokernel --ramdisk=noramdisk \
<filename> <name>
""" """
# FIXME(sirp): This can be merged into glance-admin when that becomes # FIXME(sirp): This can be merged into glance-admin when that becomes
@@ -70,14 +80,14 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
meta = {'name': args.name, 'type': args.type, 'is_public': True} meta = {'name': args.name, 'type': args.type, 'is_public': True,
'properties': {}}
if args.type == 'machine': if args.kernel:
if args.kernel and args.ramdisk: meta['properties']['kernel_id'] = args.kernel
meta['properties'] = {'kernel_id': args.kernel,
'ramdisk_id': args.ramdisk} if args.ramdisk:
else: meta['properties']['ramdisk_id'] = args.ramdisk
die("kernel and ramdisk required for machine image")
client = Client(args.host, args.port) client = Client(args.host, args.port)
with open(args.filename) as f: with open(args.filename) as f:

View File

@@ -154,7 +154,8 @@ sql_idle_timeout = 3600
"in output: %s" % out) "in output: %s" % out)
cmd = "./bin/glance-upload --port=%(api_port)d "\ cmd = "./bin/glance-upload --port=%(api_port)d "\
"--type=invalid %(conf_file_name)s 'my image'" % locals() "--type=invalid %(conf_file_name)s "\
"'my image'" % locals()
# Normally, we would simply self.assertRaises() here, but # Normally, we would simply self.assertRaises() here, but
# we also want to check that the Invalid image type is in # we also want to check that the Invalid image type is in