Merge lp:~rconradharris/glance/lp723453 into lp:~glance-coresec/glance/cactus-trunk

Proposed by Rick Harris
Status: Merged
Approved by: Jay Pipes
Approved revision: 77
Merged at revision: 76
Proposed branch: lp:~rconradharris/glance/lp723453
Merge into: lp:~glance-coresec/glance/cactus-trunk
Diff against target: 83 lines (+33/-22)
2 files modified
bin/glance-upload (+31/-21)
tests/unit/test_misc.py (+2/-1)
To merge this branch: bzr merge lp:~rconradharris/glance/lp723453
Reviewer Review Type Date Requested Status
Vish Ishaya (community) Approve
Devin Carlen (community) Approve
Jay Pipes (community) Approve
Matt Dietz Pending
Review via email: mp+51181@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

lgtm. please check out my api-image-format merge prop to see where I'm proposing things start moving...

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Vish Ishaya (vishvananda) wrote :

Maybe I'm missing something but why are kernel and ramdisk required? Admittedly I"m not using glance, but If i create an image without a kernel and ramdisk in the objectstore then launch it, tt launches it as a whole disk. There is no need for me to specify the "null_kernel" to get it to boot properly.

review: Needs Information
Revision history for this message
Rick Harris (rconradharris) wrote :

Vish:

I noticed this code in Nova's compute/api.py

        if kernel_id == str(FLAGS.null_kernel):
            kernel_id = None
            ramdisk_id = None
            LOG.debug(_("Creating a raw instance"))

I read this as Nova having a requirement that 'nokernel' be specified when an image is raw (or in my case, VHD).

It sounds like some code paths (maybe all) don't in-practice require this, but for my own sanity, I wanted the theoretical requirement to be mirrored in Glance until it is (hopefully) removed from Nova entirely.

Basically, make the wonkiness consistent, then fix everywhere.

(I wanted to punt on fixing the `null_kernel` issue since it's going to require quite a bit of testing to make sure we don't break any of the multitudinous image-lookup-fetch-store code-paths)

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Yes you can pass in null kernel to force it to boot raw, but I think this is really unnecessary if the image is created properly. It is possible that euca-upload-bundle doesn't allow you to pass an empty kernel and ramdisk, but I think you can.

Vish

On Feb 24, 2011, at 12:14 PM, Rick Harris wrote:

> Vish:
>
> I noticed this code in Nova's compute/api.py
>
> if kernel_id == str(FLAGS.null_kernel):
> kernel_id = None
> ramdisk_id = None
> LOG.debug(_("Creating a raw instance"))
>
> I read this as Nova having a requirement that 'nokernel' be specified when an image is raw (or in my case, VHD).
>
> It sounds like some code paths (maybe all) don't in-practice require this, but for my own sanity, I wanted the theoretical requirement to be mirrored in Glance until it is (hopefully) removed from Nova entirely.
>
> Basically, make the wonkiness consistent, then fix everywhere.
>
> (I wanted to punt on fixing the `null_kernel` issue since it's going to require quite a bit of testing to make sure we don't break any of the multitudinous image-lookup-fetch-store code-paths)
>
>
>
>
>
>
> --
> https://code.launchpad.net/~rconradharris/glance/lp723453/+merge/51181
> You are reviewing the proposed merge of lp:~rconradharris/glance/lp723453 into lp:glance.

Revision history for this message
Rick Harris (rconradharris) wrote :

> Yes you can pass in null kernel to force it to boot raw, but I think this is really unnecessary

Yup, that's why I think barring someone coming forward with a compelling reason, I think we should drop the `null_kernel` concept in Nova.

I'd really hate to see this patch cause *more* confusion, so, I'm going to put this patch on hold while I investigate some alternatives.

Revision history for this message
Rick Harris (rconradharris) wrote :

Per Vish's comments, I've removed the requirement for `kernel` and `ramdisk` in the glance-upload tool.

This patch just updates it to respect the values regardless of `image_type`.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

cool. LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/glance-upload'
2--- bin/glance-upload 2011-02-16 18:55:08 +0000
3+++ bin/glance-upload 2011-02-24 23:09:15 +0000
4@@ -19,19 +19,29 @@
5 """
6 Upload an image into Glance
7
8-Usage:
9-
10-Raw:
11-
12- glance-upload <filename> <name>
13-
14-Kernel-outside:
15-
16- glance-upload --type=kernel <filename> <name>
17- glance-upload --type=ramdisk <filename> <name>
18- glance-upload --type=machine --kernel=KERNEL_ID --ramdisk=RAMDISK_ID \
19- <filename> <name>
20-
21+Usage
22+=====
23+
24+ Machine - Kernel outside of the image
25+ -------------------------------------
26+
27+ glance-upload --type=kernel <filename> <name>
28+ glance-upload --type=ramdisk <filename> <name>
29+ glance-upload --type=machine --kernel=KERNEL_ID --ramdisk=RAMDISK_ID \
30+ <filename> <name>
31+
32+ Raw - Kernel inside, raw image data
33+ -----------------------------------
34+
35+ glance-upload --type=raw --kernel=nokernel --ramdisk=noramdisk \
36+ <filename> <name>
37+
38+
39+ VHD - Kernel inside, data encoded with VHD format
40+ -------------------------------------------------
41+
42+ glance-upload --type=vhd --kernel=nokernel --ramdisk=noramdisk \
43+ <filename> <name>
44 """
45
46 # FIXME(sirp): This can be merged into glance-admin when that becomes
47@@ -70,14 +80,14 @@
48
49 def main():
50 args = parse_args()
51- meta = {'name': args.name, 'type': args.type, 'is_public': True}
52-
53- if args.type == 'machine':
54- if args.kernel and args.ramdisk:
55- meta['properties'] = {'kernel_id': args.kernel,
56- 'ramdisk_id': args.ramdisk}
57- else:
58- die("kernel and ramdisk required for machine image")
59+ meta = {'name': args.name, 'type': args.type, 'is_public': True,
60+ 'properties': {}}
61+
62+ if args.kernel:
63+ meta['properties']['kernel_id'] = args.kernel
64+
65+ if args.ramdisk:
66+ meta['properties']['ramdisk_id'] = args.ramdisk
67
68 client = Client(args.host, args.port)
69 with open(args.filename) as f:
70
71=== modified file 'tests/unit/test_misc.py'
72--- tests/unit/test_misc.py 2011-02-23 20:35:01 +0000
73+++ tests/unit/test_misc.py 2011-02-24 23:09:15 +0000
74@@ -154,7 +154,8 @@
75 "in output: %s" % out)
76
77 cmd = "./bin/glance-upload --port=%(api_port)d "\
78- "--type=invalid %(conf_file_name)s 'my image'" % locals()
79+ "--type=invalid %(conf_file_name)s "\
80+ "'my image'" % locals()
81
82 # Normally, we would simply self.assertRaises() here, but
83 # we also want to check that the Invalid image type is in

Subscribers

People subscribed via source and target branches