~ubuntu-branches/ubuntu/quantal/virtinst/quantal-proposed

« back to all changes in this revision

Viewing changes to virtinst/osdict.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-01 15:40:11 UTC
  • mfrom: (1.3.16 experimental)
  • Revision ID: james.westby@ubuntu.com-20110201154011-op0nusgc240xajvb
Tags: 0.500.5-1ubuntu1
* Merge from debian experimental. Remaining changes:
  - debian/patches/9001_Ubuntu.patch:
     + Updated to add maverick and natty to OS list and enable virtio
       for them.
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch. (refreshed)
  - debian/control: added acl package to depends.
  - Demote virt-viewer to Suggests, as it's in universe.
  - Recommends libvirt-bin
* Removed patches:
  - debian/patches/9002-libvirt_disk_format.patch: Upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
    }
112
112
}
113
113
 
114
 
def sort_helper(tosort):
115
 
    """Helps properly sorting os dictionary entires"""
116
 
    key_mappings = {}
117
 
    keys = []
 
114
def sort_helper(tosort, sortpref=None):
 
115
    """
 
116
    Helps properly sorting os dictionary entires
 
117
    """
 
118
    sortby_mappings = {}
 
119
    distro_mappings = {}
118
120
    retlist = []
 
121
    sortpref = sortpref or []
119
122
 
120
 
    for key in tosort.keys():
121
 
        if tosort[key].get("skip"):
 
123
    # Make sure we are sorting by 'sortby' if specified, and group distros
 
124
    # by their 'distro' tag first and foremost
 
125
    for key, osinfo in tosort.items():
 
126
        if osinfo.get("skip"):
122
127
            continue
123
128
 
124
 
        sortby = tosort[key].get("sortby")
 
129
        sortby = osinfo.get("sortby")
125
130
        if not sortby:
126
131
            sortby = key
127
 
        key_mappings[sortby] = key
128
 
        keys.append(sortby)
129
 
 
130
 
    keys.sort()
131
 
    for key in keys:
132
 
        retlist.append(key_mappings[key])
 
132
        sortby_mappings[sortby] = key
 
133
 
 
134
        distro = osinfo.get("distro") or "zzzzzzz"
 
135
        if distro not in distro_mappings:
 
136
            distro_mappings[distro] = []
 
137
        distro_mappings[distro].append(sortby)
 
138
 
 
139
    # We want returned lists to be sorted descending by 'distro', so we get
 
140
    # debian5, debian4, fedora14, fedora13
 
141
    #   rather than
 
142
    # debian4, debian5, fedora13, fedora14
 
143
    for distro_list in distro_mappings.values():
 
144
        distro_list.sort()
 
145
        distro_list.reverse()
 
146
 
 
147
    sorted_distro_list = distro_mappings.keys()
 
148
    sorted_distro_list.sort()
 
149
    sortpref.reverse()
 
150
    for prefer in sortpref:
 
151
        if not prefer in sorted_distro_list:
 
152
            continue
 
153
        sorted_distro_list.remove(prefer)
 
154
        sorted_distro_list.insert(0, prefer)
 
155
 
 
156
    for distro in sorted_distro_list:
 
157
        distro_list = distro_mappings[distro]
 
158
        for key in distro_list:
 
159
            orig_key = sortby_mappings[key]
 
160
            retlist.append(orig_key)
133
161
 
134
162
    return retlist
135
163
 
170
198
    defaults = DEFAULTS[key]
171
199
    dictval = defaults
172
200
    if os_type:
173
 
        if var and OS_TYPES[os_type]["variants"][var].has_key(key):
 
201
        if var and key in OS_TYPES[os_type]["variants"][var]:
174
202
            dictval = OS_TYPES[os_type]["variants"][var][key]
175
 
        elif OS_TYPES[os_type].has_key(key):
 
203
        elif key in OS_TYPES[os_type]:
176
204
            dictval = OS_TYPES[os_type][key]
177
205
 
178
206
    return parse_key_entry(conn, hv_type, dictval, defaults)
184
212
    defaults = DEFAULTS["devices"]
185
213
 
186
214
    for devs in [os_devs, defaults]:
187
 
        if not devs.has_key(device_key):
 
215
        if device_key not in devs:
188
216
            continue
189
217
 
190
218
        return parse_key_entry(conn, hv_type, devs[device_key][param],
213
241
                      "devices" : {
214
242
                        DISK : VIRTIO_DISK,
215
243
                        NET  : VIRTIO_NET,
216
 
                      },},
 
244
                      }, },
217
245
        "rhel6": { "label": "Red Hat Enterprise Linux 6", "distro": "rhel",
218
246
                   "devices" : {
219
247
                        DISK : VIRTIO_DISK,
260
288
                        NET  : VIRTIO_NET,
261
289
                        INPUT: USB_TABLET,
262
290
                     }},
 
291
        "fedora14": { "label": "Fedora 14", "distro": "fedora",
 
292
                      "devices" : {
 
293
                        DISK : VIRTIO_DISK,
 
294
                        NET  : VIRTIO_NET,
 
295
                        INPUT: USB_TABLET,
 
296
                     }},
263
297
 
264
298
        "sles10": { "label": "Suse Linux Enterprise Server",
265
299
                    "distro": "suse" },
290
324
                        NET  : VIRTIO_NET,
291
325
                    },
292
326
                  },
293
 
        "debianetch": { "label": "Debian Etch", "distro": "debian" },
 
327
        "debianetch": { "label": "Debian Etch", "distro": "debian",
 
328
                        "sortby": "debian4" },
294
329
        "debianlenny": { "label": "Debian Lenny", "distro": "debian",
 
330
                         "sortby": "debian5",
295
331
                      "devices" : {
296
332
                        DISK : VIRTIO_DISK,
297
333
                        NET  : VIRTIO_NET,
298
334
                      }},
299
335
        "debiansqueeze": { "label": "Debian Squeeze", "distro": "debian",
 
336
                         "sortby": "debian6",
300
337
                      "devices" : {
301
338
                        DISK : VIRTIO_DISK,
302
339
                        NET  : VIRTIO_NET,
324
361
                            DISK : VIRTIO_DISK,
325
362
                            NET  : VIRTIO_NET,
326
363
                        }},
327
 
        "ubuntulucid": {  "label": "Ubuntu 10.04 (Lucid Lynx)",
328
 
                          "distro": "ubuntu",
329
 
                          "devices" : {
 
364
        "ubuntulucid": { "label": "Ubuntu 10.4 (Lucid Lynx)",
 
365
                         "distro": "ubuntu",
 
366
                         "devices" : {
330
367
                            DISK : VIRTIO_DISK,
331
368
                            NET  : VIRTIO_NET,
332
 
                       }},
333
 
        "ubuntumaverick": { "label": "Ubuntu 10.10 (Maverick Meerkat)",
334
 
                            "distro": "ubuntu",
335
 
                            "devices" : {
336
 
                             DISK : VIRTIO_DISK,
337
 
                             NET  : VIRTIO_NET,
338
 
                          }},
 
369
                        }},
 
370
        "ubuntumaverick": {
 
371
            "label": "Ubuntu 10.10 (Maverick Meerkat)",
 
372
            "distro": "ubuntu",
 
373
            "devices" : {
 
374
                DISK : VIRTIO_DISK,
 
375
                NET  : VIRTIO_NET,
 
376
            }},
 
377
        "ubuntunatty": {
 
378
            "label": "Ubuntu 11.04 (Natty Narwhal)",
 
379
            "distro": "ubuntu",
 
380
            "devices" : {
 
381
                DISK : VIRTIO_DISK,
 
382
                NET  : VIRTIO_NET,
 
383
            }},
339
384
        "generic24": { "label": "Generic 2.4.x kernel" },
340
385
        "generic26": { "label": "Generic 2.6.x kernel" },
341
386
        "virtio26": { "sortby": "genericvirtio26",
357
402
        VIDEO : VGA_VIDEO,
358
403
    },
359
404
    "variants": {
360
 
        "winxp":{ "label": "Microsoft Windows XP (x86)",
 
405
        "winxp": { "label": "Microsoft Windows XP",
 
406
                   "sortby": "mswin5", "distro" : "win",
361
407
                  "acpi": [
362
408
                    (support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False),
363
409
                  ],
365
411
                    (support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False),
366
412
                  ],
367
413
        },
368
 
        "winxp64":{ "label": "Microsoft Windows XP (x86_64)" },
 
414
        "winxp64": { "label": "Microsoft Windows XP (x86_64)",
 
415
                     "sortby": "mswin564", "distro": "win"},
369
416
        "win2k": { "label": "Microsoft Windows 2000",
 
417
                     "sortby" : "mswin4", "distro": "win",
370
418
                  "acpi": [
371
419
                    (support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False),
372
420
                  ],
374
422
                    (support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False),
375
423
                  ],
376
424
        },
377
 
        "win2k3": { "label": "Microsoft Windows 2003" },
378
 
        "win2k8": { "label": "Microsoft Windows 2008" },
379
 
        "vista": { "label": "Microsoft Windows Vista" },
380
 
        "win7": { "label": "Microsoft Windows 7" }
 
425
        "win2k3": { "label": "Microsoft Windows Server 2003",
 
426
                     "sortby" : "mswinserv2003", "distro": "winserv"},
 
427
        "win2k8": { "label": "Microsoft Windows Server 2008",
 
428
                    "sortby": "mswinserv2008", "distro": "winserv" },
 
429
        "vista": { "label": "Microsoft Windows Vista",
 
430
                    "sortby": "mswin6", "distro": "win" },
 
431
        "win7": { "label": "Microsoft Windows 7",
 
432
                  "sortby": "mswin7", "distro": "win"}
381
433
    },
382
434
},
383
435
 
403
455
"unix": {
404
456
    "label": "UNIX",
405
457
    "variants": {
406
 
        "freebsd6": { "label": "Free BSD 6.x" ,
 
458
        "freebsd6": { "label": "FreeBSD 6.x" ,
407
459
                      # http://www.nabble.com/Re%3A-Qemu%3A-bridging-on-FreeBSD-7.0-STABLE-p15919603.html
408
460
                      "devices" : {
409
461
                        NET : { "model" : [ (HV_ALL, "ne2k_pci") ] }
410
462
                      }},
411
 
        "freebsd7": { "label": "Free BSD 7.x" ,
 
463
        "freebsd7": { "label": "FreeBSD 7.x" ,
412
464
                      "devices" : {
413
465
                        NET : { "model" : [ (HV_ALL, "ne2k_pci") ] }
414
466
                      }},
415
 
        "openbsd4": { "label": "Open BSD 4.x" ,
 
467
        "freebsd8": { "label": "FreeBSD 8.x" ,
 
468
                      "devices" : {
 
469
                        NET : { "model" : [ (HV_ALL, "e1000") ] }
 
470
                      }},
 
471
        "openbsd4": { "label": "OpenBSD 4.x" ,
416
472
                      # http://calamari.reverse-dns.net:980/cgi-bin/moin.cgi/OpenbsdOnQemu
417
473
                      # https://www.redhat.com/archives/et-mgmt-tools/2008-June/msg00018.html
418
474
                      "devices" : {
430
486
        "netware6": { "label": "Novell Netware 6", "pv_cdrom_install": True, },
431
487
        "generic": { "label": "Generic" },
432
488
    },
433
 
},}
 
489
}}
434
490
 
435
491
# Back compatibility entries
436
492
solaris_compat = OS_TYPES["unix"]["variants"]