1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
|
diff --git a/man/virt-install.pod b/man/virt-install.pod
index a1229c8..4c7b0e3 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -357,36 +357,6 @@ Mount the ISO and probe the directory. This requires running virt-install as roo
=back
-Some distro specific url samples:
-
-=over 4
-
-=item Fedora/Red Hat Based
-
-http://download.fedoraproject.org/pub/fedora/linux/releases/21/Server/x86_64/os
-
-=item Debian
-
-http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/
-
-=item Ubuntu
-
-http://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/
-
-=item Suse
-
-http://download.opensuse.org/distribution/11.0/repo/oss/
-
-=item Mandriva
-
-ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2009.0/i586/
-
-=item Mageia
-
-ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/1
-
-=back
-
=item B<--pxe>
Use the PXE boot protocol to load the initial ramdisk and kernel for starting
@@ -421,21 +391,6 @@ file:
--initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks"
-=item B<--os-variant> OS_VARIANT
-
-Optimize the guest configuration for a specific operating system (ex.
-'fedora18', 'rhel7', 'winxp'). While not required, specifying this
-options is HIGHLY RECOMMENDED, as it can greatly increase performance
-by specifying virtio among other guest tweaks.
-
-By default, virt-install will attempt to auto detect this value from
-the install media (currently only supported for URL installs). Autodetection
-can be disabled with the special value 'none'. Autodetection can be
-forced with the special value 'auto'.
-
-Use the command "osinfo-query os" to get the list of the accepted OS
-variants.
-
=item B<--boot> BOOTOPTS
Optionally specify the post-install VM boot configuration. This option allows
@@ -592,7 +547,7 @@ bus types.
=item B<removable>
-Sets the removable flag (/sys/block/$dev/removable on Linux). Only
+Sets the removable flag (/sys/block/$dev/removable on GNU/Linux). Only
used with QEMU and bus=usb. Value can be 'on' or 'off'.
=item B<readonly>
@@ -672,7 +627,7 @@ How guest should react if a write error is encountered. Can be one of
=item B<serial>
-Serial number of the emulated disk device. This is used in linux guests
+Serial number of the emulated disk device. This is used in GNU/Linux guests
to set /dev/disk/by-id symlinks. An example serial number might be:
WD-WMAP9A966149
@@ -695,7 +650,7 @@ invocation is:
--filesystem /source/on/host,/target/point/in/guest
-Which will work for recent QEMU and linux guest OS or LXC containers. For
+Which will work for recent QEMU and GNU/Linux guest OS or LXC Linux containers. For
QEMU, the target point is just a mounting hint in sysfs, so will not be
automatically mounted.
@@ -1635,45 +1590,6 @@ C<~/.cache/virt-manager/virt-install.log> even if this parameter is omitted.
=head1 EXAMPLES
-Install a Fedora 20 KVM guest with virtio accelerated disk/network,
-creating a new 10GiB qcow2 file, installing from media in the hosts
-CDROM drive. This will use Spice graphics by default, and launch autolaunch
-a graphical client.
-
- # virt-install \
- --connect qemu:///system \
- --virt-type kvm \
- --name demo \
- --memory 500 \
- --disk size=10 \
- --cdrom /dev/cdrom \
- --os-variant fedora13
-
-Install a Fedora 9 plain QEMU guest, using LVM partition, virtual networking,
-booting from PXE, using VNC server/viewer, with virtio-scsi disk
-
- # virt-install \
- --connect qemu:///system \
- --name demo \
- --memory 500 \
- --disk path=/dev/HostVG/DemoVM,bus=scsi \
- --controller virtio-scsi \
- --network network=default \
- --virt-type qemu
- --graphics vnc \
- --os-variant fedora9
-
-Run a Live CD image under Xen fullyvirt, in diskless environment
-
- # virt-install \
- --hvm \
- --name demo \
- --memory 500 \
- --disk none \
- --livecd \
- --graphics vnc \
- --cdrom /root/fedora7live.iso
-
Run /usr/bin/httpd in a linux container guest (LXC). Resource usage is capped
at 512 MiB of ram and 2 host cpus:
@@ -1699,7 +1615,7 @@ The host dir "/home/test" will be mounted at
--init /bin/sh
Install a paravirtualized Xen guest, 500 MiB of RAM, a 5 GiB of disk, and
-Fedora Core 6 from a web server, in text-only mode, with old style --file
+Parabola from a web server, in text-only mode, with old style --file
options:
# virt-install \
@@ -1708,7 +1624,7 @@ options:
--memory 500 \
--disk /var/lib/xen/images/demo.img,size=6 \
--graphics none \
- --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
+ --location https://repo.parabola.nu/iso/latest/
Create a guest from an existing disk image 'mydisk.img' using defaults for
the rest of the options.
diff --git a/man/virt-xml.pod b/man/virt-xml.pod
index 3a684f4..aef814f 100644
--- a/man/virt-xml.pod
+++ b/man/virt-xml.pod
@@ -286,53 +286,10 @@ Clear the previous <cpu> definition of domain 'winxp', change it to 'host-model'
# virt-xml winxp --edit --cpu host-model,clearxml=yes --confirm
-Change the second sound card to model=ich6 on 'fedora19', but only output the diff:
-
- # virt-xml fedora19 --edit 2 --sound model=ich6 --print-diff
-
-Update the every graphics device password to 'foo' of the running VM 'rhel6':
-
- # virt-xml rhel6 --edit all --graphics password=foo --update
-
-Remove the disk path from disk device hdc:
-
- # virt-xml rhel6 --edit target=hdc --disk path=
-
Change all disk devices of type 'disk' to use cache=none, using XML from stdin, printing the new XML to stdout.
# cat <xmlfile> | virt-xml --edit device=disk --disk cache=none
-Change disk 'hda' IO to native and use startup policy as 'optional'.
-
- # virt-xml fedora20 --edit target=hda \
- --disk io=native,startup_policy=optional
-
-Change all host devices to use driver_name=vfio for VM 'fedora20' on the remote connection
-
- # virt-xml --connect qemu+ssh://remotehost/system \
- fedora20 --edit all --hostdev driver_name=vfio
-
-Hotplug host USB device 001.003 to running domain 'fedora19':
-
- # virt-xml fedora19 --update --add-device --hostdev 001.003
-
-Add a spicevmc channel to the domain 'winxp', that will be available after the next VM shutdown.
-
- # virt-xml winxp --add-device --channel spicevmc
-
-Create a 10G qcow2 disk image and attach it to 'fedora18' for the next VM startup:
-
- # virt-xml fedora18 --add-device \
- --disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
-
-Hotunplug the disk vdb from the running domain 'rhel7':
-
- # virt-xml rhel7 --update --remove-device --disk target=vdb
-
-Remove all graphics devices from the VM 'rhel7' after the next shutdown:
-
- # virt-xml rhel7 --remove-device --graphics all
-
Generate XML for a virtio console device and print it to stdout:
# virt-xml --build-xml --console pty,target_type=virtio
diff --git a/setup.py b/setup.py
index 89916b5..cff1031 100755
--- a/setup.py
+++ b/setup.py
@@ -338,7 +338,6 @@ class configure(distutils.core.Command):
self.libvirt_package_names = None
self.kvm_package_names = None
self.askpass_package_names = None
- self.preferred_distros = None
self.stable_defaults = None
self.default_graphics = None
self.default_hvs = None
@@ -356,8 +355,6 @@ class configure(distutils.core.Command):
template += "hv_packages = %s\n" % self.kvm_package_names
if self.askpass_package_names is not None:
template += "askpass_packages = %s\n" % self.askpass_package_names
- if self.preferred_distros is not None:
- template += "preferred_distros = %s\n" % self.preferred_distros
if self.stable_defaults is not None:
template += ("stable_defaults = %s\n" %
self.stable_defaults)
diff --git a/virt-manager.spec b/virt-manager.spec
index 2dfe413..2bb07e4 100644
--- a/virt-manager.spec
+++ b/virt-manager.spec
@@ -7,14 +7,8 @@
%global qemu_user "qemu"
%global libvirt_packages "libvirt-daemon-kvm,libvirt-daemon-config-network"
%global kvm_packages ""
-%global preferred_distros "fedora,rhel"
%global default_hvs "qemu,xen,lxc"
-%if 0%{?rhel}
-%global preferred_distros "rhel,fedora"
-%global stable_defaults 1
-%endif
-
# End local config
@@ -49,9 +43,6 @@ Requires: vte291
Requires: gtk-vnc2
Requires: spice-gtk3
-%if 0%{?rhel} == 7
-Requires: gnome-icon-theme
-%endif
BuildRequires: python
@@ -116,10 +107,6 @@ machine).
%global _kvm_packages --kvm-package-names=%{kvm_packages}
%endif
-%if %{preferred_distros}
-%global _preferred_distros --preferred-distros=%{preferred_distros}
-%endif
-
%if %{libvirt_packages}
%global _libvirt_packages --libvirt-package-names=%{libvirt_packages}
%endif
@@ -141,7 +128,6 @@ python setup.py configure \
%{?_kvm_packages} \
%{?_libvirt_packages} \
%{?_askpass_package} \
- %{?_preferred_distros} \
%{?_stable_defaults} \
%{?_default_hvs}
diff --git a/virt-manager.spec.in b/virt-manager.spec.in
index 8c4a811..6497f52 100644
--- a/virt-manager.spec.in
+++ b/virt-manager.spec.in
@@ -7,14 +7,8 @@
%global qemu_user "qemu"
%global libvirt_packages "libvirt-daemon-kvm,libvirt-daemon-config-network"
%global kvm_packages ""
-%global preferred_distros "fedora,rhel"
%global default_hvs "qemu,xen,lxc"
-%if 0%{?rhel}
-%global preferred_distros "rhel,fedora"
-%global stable_defaults 1
-%endif
-
# End local config
@@ -49,10 +43,6 @@ Requires: vte291
Requires: gtk-vnc2
Requires: spice-gtk3
-%if 0%{?rhel} == 7
-Requires: gnome-icon-theme
-%endif
-
BuildRequires: python
BuildRequires: intltool
@@ -116,10 +106,6 @@ machine).
%global _kvm_packages --kvm-package-names=%{kvm_packages}
%endif
-%if %{preferred_distros}
-%global _preferred_distros --preferred-distros=%{preferred_distros}
-%endif
-
%if %{libvirt_packages}
%global _libvirt_packages --libvirt-package-names=%{libvirt_packages}
%endif
@@ -141,7 +127,6 @@ python setup.py configure \
%{?_kvm_packages} \
%{?_libvirt_packages} \
%{?_askpass_package} \
- %{?_preferred_distros} \
%{?_stable_defaults} \
%{?_default_hvs}
diff --git a/virtManager/config.py b/virtManager/config.py
index 5b04013..b52f121 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -170,7 +170,6 @@ class vmmConfig(object):
self.keyring = None
self.default_qemu_user = CLIConfig.default_qemu_user
- self.preferred_distros = CLIConfig.preferred_distros
self.hv_packages = CLIConfig.hv_packages
self.libvirt_packages = CLIConfig.libvirt_packages
self.askpass_package = CLIConfig.askpass_package
diff --git a/virtManager/connection.py b/virtManager/connection.py
index 6cb9cc0..21de8cf 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -642,8 +642,8 @@ class vmmConnection(vmmGObject):
continue
if (devtype == "usb_device" and
- (("Linux Foundation" in str(xmlobj.vendor_name) or
- ("Linux" in str(xmlobj.vendor_name) and
+ (("Free Software Foundation" in str(xmlobj.vendor_name) or
+ ("GNU/Linux" in str(xmlobj.vendor_name) and
xmlobj.vendor_id == "0x1d6b")) and
("root hub" in str(xmlobj.product_name) or
("host controller" in str(xmlobj.product_name).lower() and
diff --git a/virtManager/create.py b/virtManager/create.py
index 737c1fa..4c34585 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -931,9 +931,7 @@ class vmmCreate(vmmGObjectUI):
model = widget.get_model()
model.clear()
- # Kind of a hack, just show linux + windows by default since
- # that's all 98% of people care about
- supportl = ["generic", "linux", "windows"]
+ supportl = ["generic"]
# Move 'generic' to the front of the list
types = virtinst.OSDB.list_types()
@@ -959,17 +957,12 @@ class vmmCreate(vmmGObjectUI):
model = widget.get_model()
model.clear()
- preferred = self.config.preferred_distros
- variants = virtinst.OSDB.list_os(typename=_type, sortpref=preferred)
- supportl = virtinst.OSDB.list_os(typename=_type, sortpref=preferred,
- only_supported=True)
-
for v in variants:
supported = v in supportl or v.name == "generic"
self._add_os_row(model, v.name, v.label, supported)
- self._add_os_row(model, sep=True)
- self._add_os_row(model, label=_("Show all OS options"), action=True)
+ self._add_os_row(model, sep=False)
+ self._add_os_row(model, label=_("Show all OS options"), action=False)
widget.set_active(0)
@@ -1075,17 +1068,7 @@ class vmmCreate(vmmGObjectUI):
install = _("Operating system container")
osstr = ""
- have_os = True
- if self._guest.os.is_container():
- osstr = _("Linux")
- elif not distro:
- osstr = _("Generic")
- have_os = False
- elif not version:
- osstr = _("Generic") + " " + dlabel
- have_os = False
- else:
- osstr = vlabel
+ have_os = False
self.widget("finish-warn-os").set_visible(not have_os)
self.widget("summary-os").set_text(osstr)
diff --git a/virtcli/cliconfig.py b/virtcli/cliconfig.py
index ef66ba4..da077df 100644
--- a/virtcli/cliconfig.py
+++ b/virtcli/cliconfig.py
@@ -79,8 +79,6 @@ class _CLIConfig(object):
self.default_qemu_user = _get_param("default_qemu_user", "root")
self.stable_defaults = bool(int(_get_param("stable_defaults", "0")))
- self.preferred_distros = _split_list(
- _get_param("preferred_distros", ""))
self.hv_packages = _split_list(_get_param("hv_packages", ""))
self.askpass_package = _split_list(_get_param("askpass_packages", ""))
self.libvirt_packages = _split_list(_get_param("libvirt_packages", ""))
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 6a42536..985a73e 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -608,7 +608,6 @@ class Guest(XMLBuilder):
return
if (self.conn.is_qemu() and
- self._os_object.supports_qemu_ga() and
self.conn.check_support(self.conn.SUPPORT_CONN_AUTOSOCKET)):
dev = VirtualChannelDevice(self.conn)
dev.type = "unix"
@@ -653,8 +652,7 @@ class Guest(XMLBuilder):
# But only if we are installing windows which has a multi stage
# install.
if (dev.is_cdrom() and
- getattr(dev, "installer_media", False) and
- not self._os_object.is_windows()):
+ getattr(dev, "installer_media", False)):
dev.path = None
def _set_defaults(self):
@@ -741,10 +739,8 @@ class Guest(XMLBuilder):
hpet.present = False
hv_clock = self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK)
- hv_clock_rhel = self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK_RHEL)
- if (self._os_object.is_windows() and self._hv_supported() and
- (hv_clock or (self.stable_defaults() and hv_clock_rhel))):
+ if (self._hv_supported() and (hv_clock or self.stable_defaults())):
hyperv = self.clock.add_timer()
hyperv.name = "hypervclock"
hyperv.present = True
@@ -785,8 +781,6 @@ class Guest(XMLBuilder):
return
self.cpu.set_special_mode(self.x86_cpu_default)
- if self._os_object.broken_x2apic():
- self.cpu.add_feature("x2apic", policy="disable")
def _hv_supported(self):
@@ -847,8 +841,7 @@ class Guest(XMLBuilder):
self.conn.check_support(self.conn.SUPPORT_CONN_VMPORT)):
self.features.vmport = False
- if (self._os_object.is_windows() and
- self._hv_supported() and
+ if (self._hv_supported() and
self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_VAPIC)):
if self.features.hyperv_relaxed is None:
self.features.hyperv_relaxed = True
diff --git a/virtinst/initrdinject.py b/virtinst/initrdinject.py
index eb5f419..726264a 100644
--- a/virtinst/initrdinject.py
+++ b/virtinst/initrdinject.py
@@ -24,61 +24,6 @@ import subprocess
import tempfile
-def _rhel4_initrd_inject(initrd, injections):
- try:
- file_proc = subprocess.Popen(["file", "-z", initrd],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- if "ext2 filesystem" not in file_proc.communicate()[0]:
- return False
- except:
- logging.exception("Failed to file command for rhel4 initrd detection")
- return False
-
- logging.debug("Is RHEL4 initrd")
-
- # Uncompress the initrd
- newinitrd = file(initrd + ".new", "wb")
- gzip_proc = subprocess.Popen(["gzip", "-d", "-f", "-c", initrd],
- stdout=newinitrd,
- stderr=subprocess.PIPE)
- gzip_proc.wait()
- newinitrd.close()
-
- debugfserr = ""
- for filename in injections:
- # We have an ext2 filesystem, use debugfs to inject files
- cmd = ["debugfs", "-w", "-R",
- "write %s %s" % (filename, os.path.basename(filename)),
- newinitrd.name]
- logging.debug("Copying %s to the initrd with cmd=%s", filename, cmd)
-
- debugfs_proc = subprocess.Popen(cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- debugfs_proc.wait()
- debugfserr += debugfs_proc.stderr.read() or ""
-
- gziperr = gzip_proc.stderr.read()
- if gziperr:
- logging.debug("gzip stderr=%s", gziperr)
- if debugfserr:
- logging.debug("debugfs stderr=%s", debugfserr)
-
- # Recompress the initrd
- gzip_proc = subprocess.Popen(["gzip"],
- stdin=file(newinitrd.name, "rb"),
- stdout=file(initrd, "wb"),
- stderr=subprocess.PIPE)
- gzip_proc.wait()
- gziperr = gzip_proc.stderr.read()
- if gziperr:
- logging.debug("gzip stderr=%s", gziperr)
- os.unlink(newinitrd.name)
-
- return True
-
-
def perform_initrd_injections(initrd, injections, scratchdir):
"""
Insert files into the root directory of the initial ram disk
@@ -86,9 +31,6 @@ def perform_initrd_injections(initrd, injections, scratchdir):
if not injections:
return
- if _rhel4_initrd_inject(initrd, injections):
- return
-
tempdir = tempfile.mkdtemp(dir=scratchdir)
os.chmod(tempdir, 0775)
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index e8c1487..2b2ba31 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -39,10 +39,6 @@ def _remove_older_point_releases(distro_list):
return int(osobj.name.rsplit(".", 1)[-1])
def _find_latest(prefix):
- """
- Given a prefix like 'rhel4', find the latest 'rhel4.X',
- and remove the rest from the os list
- """
latest_os = None
first_id = None
for osobj in ret[:]:
@@ -61,12 +57,6 @@ def _remove_older_point_releases(distro_list):
if latest_os:
ret.insert(first_id, latest_os)
- _find_latest("rhel4")
- _find_latest("rhel5")
- _find_latest("rhel6")
- _find_latest("rhel7")
- _find_latest("freebsd9")
- _find_latest("freebsd10")
return ret
@@ -134,49 +124,7 @@ class _OSDB(object):
# This is only for back compatibility with pre-libosinfo support.
# This should never change.
_aliases = {
- "altlinux" : "altlinux1.0",
- "debianetch" : "debian4",
- "debianlenny" : "debian5",
- "debiansqueeze" : "debian6",
- "debianwheezy" : "debian7",
- "freebsd10" : "freebsd10.0",
- "freebsd6" : "freebsd6.0",
- "freebsd7" : "freebsd7.0",
- "freebsd8" : "freebsd8.0",
- "freebsd9" : "freebsd9.0",
- "mandriva2009" : "mandriva2009.0",
- "mandriva2010" : "mandriva2010.0",
- "mbs1" : "mbs1.0",
- "msdos" : "msdos6.22",
- "openbsd4" : "openbsd4.2",
- "opensolaris" : "opensolaris2009.06",
- "opensuse11" : "opensuse11.4",
- "opensuse12" : "opensuse12.3",
- "rhel4" : "rhel4.0",
- "rhel5" : "rhel5.0",
- "rhel6" : "rhel6.0",
- "rhel7" : "rhel7.0",
- "ubuntuhardy" : "ubuntu8.04",
- "ubuntuintrepid" : "ubuntu8.10",
- "ubuntujaunty" : "ubuntu9.04",
- "ubuntukarmic" : "ubuntu9.10",
- "ubuntulucid" : "ubuntu10.04",
- "ubuntumaverick" : "ubuntu10.10",
- "ubuntunatty" : "ubuntu11.04",
- "ubuntuoneiric" : "ubuntu11.10",
- "ubuntuprecise" : "ubuntu12.04",
- "ubuntuquantal" : "ubuntu12.10",
- "ubunturaring" : "ubuntu13.04",
- "ubuntusaucy" : "ubuntu13.10",
- "virtio26": "fedora10",
- "vista" : "winvista",
- "winxp64" : "winxp",
-
# Old --os-type values
- "linux" : "generic",
- "windows" : "winxp",
- "solaris" : "solaris10",
- "unix": "freebsd9.0",
"other": "generic",
}
@@ -232,17 +180,11 @@ class _OSDB(object):
return None
osname = ret[0].get_short_id()
- if osname == "fedora-unknown":
- osname = self.latest_fedora_version()
- logging.debug("Detected location=%s as os=fedora-unknown. "
- "Converting that to the latest fedora OS version=%s",
- location, osname)
return osname
def list_types(self):
- approved_types = ["linux", "windows", "unix",
- "solaris", "other", "generic"]
+ approved_types = ["generic"]
return approved_types
def list_os(self, typename=None, only_supported=False, sortpref=None):
@@ -265,13 +207,6 @@ class _OSDB(object):
return _sort(sortmap, sortpref=sortpref,
limit_point_releases=only_supported)
- def latest_fedora_version(self):
- for osinfo in self.list_os():
- if (osinfo.name.startswith("fedora") and
- "unknown" not in osinfo.name):
- # First fedora* occurrence should be the newest
- return osinfo.name
-
#####################
# OsVariant classes #
@@ -287,7 +222,6 @@ class _OsVariant(object):
self.codename = self._os and self._os.get_codename() or ""
self.sortby = self._get_sortby()
- self.urldistro = self._get_urldistro()
self._supported = None
@@ -363,34 +297,6 @@ class _OsVariant(object):
return (datetime.datetime.strptime(eol_date, "%Y-%m-%d") >
datetime.datetime.now())
- if self.name == "fedora-unknown":
- return False
-
- # As of libosinfo 2.11, many clearly EOL distros don't have an
- # EOL date. So assume None == EOL, add some manual work arounds.
- # We should fix this in a new libosinfo version, and then drop
- # this hack
- if self._is_related_to(["fedora20", "rhel7.0", "debian6",
- "ubuntu13.04", "win8", "win2k12"],
- check_clones=False, check_derives=False):
- return True
- return False
-
- def _get_urldistro(self):
- if not self._os:
- return None
- urldistro = self._os.get_distro()
- remap = {
- "opensuse" : "suse",
- "sles" : "suse",
- "mes" : "mandriva"
- }
-
- if remap.get(urldistro):
- return remap[urldistro]
-
- return urldistro
-
###############
# Public APIs #
@@ -408,39 +314,12 @@ class _OsVariant(object):
if not self._os:
return "generic"
- if self._family in ['linux']:
- return "linux"
-
- if self._family in ['win9x', 'winnt', 'win16']:
- return "windows"
-
- if self._family in ['solaris']:
- return "solaris"
-
- if self._family in ['openbsd', 'freebsd', 'netbsd']:
- return "unix"
-
- return "other"
-
- def is_windows(self):
- return self.get_typename() == "windows"
-
- def need_old_xen_disable_acpi(self):
- return self._is_related_to(["winxp", "win2k"], check_upgrades=False)
-
- def broken_x2apic(self):
- # x2apic breaks networking in solaris10
- # https://bugs.launchpad.net/bugs/1395217
- return self.name in ('solaris10', 'solaris11')
+ return None
def get_clock(self):
- if self.is_windows() or self._family in ['solaris']:
- return "localtime"
+ return "localtime"
return "utc"
- def supports_virtiommio(self):
- return self._is_related_to(["fedora19"])
-
def default_netmodel(self):
"""
Default non-virtio net-model, since we check for that separately
@@ -499,37 +378,16 @@ class _OsVariant(object):
return False
- def supports_qemu_ga(self):
- return self._is_related_to(["fedora18", "rhel6.0", "sles11sp4"])
-
def default_videomodel(self, guest):
if guest.os.is_pseries():
return "vga"
- # Marc Deslauriers of canonical had previously patched us
- # to use vmvga for ubuntu, see fb76c4e5. And Fedora users report
- # issues with ubuntu + qxl for as late as 14.04, so carry the vmvga
- # default forward until someone says otherwise. In 2014-09 I contacted
- # Marc offlist and he said this was fine for now.
- #
- # But in my testing ubuntu-15.04 works _better_ with qxl (installer
- # resolution is huge with vmvga but reasonable with qxl), and given
- # that the qemu vmvga code is not supposed to be of high quality,
- # let's use qxl for newer ubuntu
- if (self._os and
- self._os.get_distro() == "ubuntu" and
- not self._is_related_to("ubuntu15.04")):
- return "vmvga"
-
if guest.has_spice() and guest.os.is_x86():
if guest.has_gl():
return "virtio"
else:
return "qxl"
- if self.is_windows():
- return "vga"
-
return None
def get_recommended_resources(self, guest):
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index 692a297..58c1724 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -382,96 +382,6 @@ def _grabTreeinfo(fetcher):
return treeinfo
-def _distroFromSUSEContent(fetcher, arch, vmtype=None):
- # Parse content file for the 'LABEL' field containing the distribution name
- # None if no content, GenericDistro if unknown label type.
- try:
- cbuf = fetcher.acquireFileContent("content")
- except ValueError:
- return None
-
- distribution = None
- distro_version = None
- distro_summary = None
- distro_distro = None
- distro_arch = None
-
- lines = cbuf.splitlines()[1:]
- for line in lines:
- if line.startswith("LABEL "):
- distribution = line.split(' ', 1)
- elif line.startswith("DISTRO "):
- distro_distro = line.rsplit(',', 1)
- elif line.startswith("VERSION "):
- distro_version = line.split(' ', 1)
- if len(distro_version) > 1:
- d_version = distro_version[1].split('-', 1)
- if len(d_version) > 1:
- distro_version[1] = d_version[0]
- elif line.startswith("SUMMARY "):
- distro_summary = line.split(' ', 1)
- elif line.startswith("BASEARCHS "):
- distro_arch = line.split(' ', 1)
- elif line.startswith("DEFAULTBASE "):
- distro_arch = line.split(' ', 1)
- elif line.startswith("REPOID "):
- distro_arch = line.rsplit('/', 1)
- if distribution and distro_version and distro_arch:
- break
-
- if not distribution:
- if distro_summary:
- distribution = distro_summary
- elif distro_distro:
- distribution = distro_distro
- if distro_arch:
- arch = distro_arch[1].strip()
- # Fix for 13.2 official oss repo
- if arch.find("i586-x86_64") != -1:
- arch = "x86_64"
- else:
- if cbuf.find("x86_64") != -1:
- arch = "x86_64"
- elif cbuf.find("i586") != -1:
- arch = "i586"
- elif cbuf.find("s390x") != -1:
- arch = "s390x"
-
- def _parse_sle_distribution(d):
- sle_version = d[1].strip().rsplit(' ')[4]
- if len(d[1].strip().rsplit(' ')) > 5:
- sle_version = sle_version + '.' + d[1].strip().rsplit(' ')[5][2]
- return ['VERSION', sle_version]
-
- dclass = GenericDistro
- if distribution:
- if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
- re.match(".*SUSE SLES*", distribution[1]):
- dclass = SLESDistro
- if distro_version is None:
- distro_version = _parse_sle_distribution(distribution)
- elif re.match(".*SUSE Linux Enterprise Desktop*", distribution[1]):
- dclass = SLEDDistro
- if distro_version is None:
- distro_version = _parse_sle_distribution(distribution)
- elif re.match(".*openSUSE.*", distribution[1]):
- dclass = OpensuseDistro
- if distro_version is None:
- distro_version = ['VERSION', distribution[0].strip().rsplit(':')[4]]
-
- if distro_version is None:
- return None
-
- ob = dclass(fetcher, arch, vmtype)
- if dclass != GenericDistro:
- ob.version_from_content = distro_version
-
- # Explictly call this, so we populate os_type/variant info
- ob.isValidStore()
-
- return ob
-
-
def getDistroStore(guest, fetcher):
stores = []
logging.debug("Finding distro store for location=%s", fetcher.location)
@@ -755,513 +665,6 @@ class GenericDistro(Distro):
return self.fetcher.acquireFile(self._valid_iso_path)
-class RedHatDistro(Distro):
- """
- Base image store for any Red Hat related distros which have
- a common layout
- """
- uses_treeinfo = True
- _version_number = None
-
- _boot_iso_paths = ["images/boot.iso"]
- _hvm_kernel_paths = [("images/pxeboot/vmlinuz",
- "images/pxeboot/initrd.img")]
- _xen_kernel_paths = [("images/xen/vmlinuz",
- "images/xen/initrd.img")]
-
- def isValidStore(self):
- raise NotImplementedError()
-
- def _get_method_arg(self):
- if (self._version_number is not None and
- ((self.urldistro is "rhel" and self._version_number >= 7) or
- (self.urldistro is "fedora" and self._version_number >= 19))):
- return "inst.repo"
- return "method"
-
-
-# Fedora distro check
-class FedoraDistro(RedHatDistro):
- name = "Fedora"
- urldistro = "fedora"
-
- def isValidStore(self):
- if not self.treeinfo:
- return self.fetcher.hasFile("Fedora")
-
- if not re.match(".*Fedora.*", self.treeinfo.get("general", "family")):
- return False
-
- ver = self.treeinfo.get("general", "version")
- if not ver:
- logging.debug("No version found in .treeinfo")
- return False
- logging.debug("Found treeinfo version=%s", ver)
-
- latest_variant = OSDB.latest_fedora_version()
- if re.match("fedora[0-9]+", latest_variant):
- latest_vernum = int(latest_variant[6:])
- else:
- logging.debug("Failed to parse version number from latest "
- "fedora variant=%s. Using safe default 22", latest_variant)
- latest_vernum = 22
-
- # rawhide trees changed to use version=Rawhide in Apr 2016
- if ver in ["development", "rawhide", "Rawhide"]:
- self._version_number = latest_vernum
- self.os_variant = latest_variant
- return True
-
- # Dev versions can be like '23_Alpha'
- if "_" in ver:
- ver = ver.split("_")[0]
-
- # Typical versions are like 'fedora-23'
- vernum = str(ver).split("-")[0]
- if vernum.isdigit():
- vernum = int(vernum)
- else:
- logging.debug("Failed to parse version number from treeinfo "
- "version=%s, using vernum=latest=%s", ver, latest_vernum)
- vernum = latest_vernum
-
- if vernum > latest_vernum:
- self.os_variant = latest_variant
- else:
- self.os_variant = "fedora" + str(vernum)
-
- self._version_number = vernum
- return True
-
-
-# Red Hat Enterprise Linux distro check
-class RHELDistro(RedHatDistro):
- name = "Red Hat Enterprise Linux"
- urldistro = "rhel"
-
- def isValidStore(self):
- if self.treeinfo:
- # Matches:
- # Red Hat Enterprise Linux
- # RHEL Atomic Host
- m = re.match(".*(Red Hat Enterprise Linux|RHEL).*",
- self.treeinfo.get("general", "family"))
- ret = (m is not None)
-
- if ret:
- self._variantFromVersion()
- return ret
-
- if (self.fetcher.hasFile("Server") or
- self.fetcher.hasFile("Client")):
- self.os_variant = "rhel5"
- return True
- return self.fetcher.hasFile("RedHat")
-
-
- ################################
- # osdict autodetection helpers #
- ################################
-
- def _parseTreeinfoVersion(self, verstr):
- def _safeint(c):
- try:
- val = int(c)
- except:
- val = 0
- return val
-
- version = _safeint(verstr[0])
- update = 0
-
- # RHEL has version=5.4, scientific linux=54
- updinfo = verstr.split(".")
- if len(updinfo) > 1:
- update = _safeint(updinfo[1])
- elif len(verstr) > 1:
- update = _safeint(verstr[1])
-
- return version, update
-
- def _variantFromVersion(self):
- ver = self.treeinfo.get("general", "version")
- name = None
- if self.treeinfo.has_option("general", "name"):
- name = self.treeinfo.get("general", "name")
- if not ver:
- return
-
- if name and name.startswith("Red Hat Enterprise Linux Server for ARM"):
- # Kind of a hack, but good enough for the time being
- version = 7
- update = 0
- else:
- version, update = self._parseTreeinfoVersion(ver)
-
- self._version_number = version
- self._setRHELVariant(version, update)
-
- def _setRHELVariant(self, version, update):
- base = "rhel" + str(version)
- if update < 0:
- update = 0
-
- ret = None
- while update >= 0:
- tryvar = base + ".%s" % update
- if not self._check_osvariant_valid(tryvar):
- update -= 1
- continue
-
- ret = tryvar
- break
-
- if not ret:
- # Try plain rhel5, rhel6, whatev
- if self._check_osvariant_valid(base):
- ret = base
-
- if ret:
- self.os_variant = ret
-
-
-# CentOS distro check
-class CentOSDistro(RHELDistro):
- name = "CentOS"
- urldistro = "centos"
-
- def isValidStore(self):
- if not self.treeinfo:
- return self.fetcher.hasFile("CentOS")
-
- m = re.match(".*CentOS.*", self.treeinfo.get("general", "family"))
- ret = (m is not None)
- if ret:
- self._variantFromVersion()
- if self.os_variant:
- new_variant = self.os_variant.replace("rhel", "centos")
- if self._check_osvariant_valid(new_variant):
- self.os_variant = new_variant
- return ret
-
-
-# Scientific Linux distro check
-class SLDistro(RHELDistro):
- name = "Scientific Linux"
- urldistro = None
-
- _boot_iso_paths = RHELDistro._boot_iso_paths + ["images/SL/boot.iso"]
- _hvm_kernel_paths = RHELDistro._hvm_kernel_paths + [
- ("images/SL/pxeboot/vmlinuz", "images/SL/pxeboot/initrd.img")]
-
- def isValidStore(self):
- if self.treeinfo:
- m = re.match(".*Scientific.*",
- self.treeinfo.get("general", "family"))
- ret = (m is not None)
-
- if ret:
- self._variantFromVersion()
- return ret
-
- return self.fetcher.hasFile("SL")
-
-
-class SuseDistro(Distro):
- name = "SUSE"
-
- _boot_iso_paths = ["boot/boot.iso"]
-
- def __init__(self, *args, **kwargs):
- Distro.__init__(self, *args, **kwargs)
- if re.match(r'i[4-9]86', self.arch):
- self.arch = 'i386'
-
- oldkern = "linux"
- oldinit = "initrd"
- if self.arch == "x86_64":
- oldkern += "64"
- oldinit += "64"
-
- if self.arch == "s390x":
- self._hvm_kernel_paths = [("boot/%s/linux" % self.arch,
- "boot/%s/initrd" % self.arch)]
- # No Xen on s390x
- self._xen_kernel_paths = []
- else:
- # Tested with Opensuse >= 10.2, 11, and sles 10
- self._hvm_kernel_paths = [("boot/%s/loader/linux" % self.arch,
- "boot/%s/loader/initrd" % self.arch)]
- # Tested with Opensuse 10.0
- self._hvm_kernel_paths.append(("boot/loader/%s" % oldkern,
- "boot/loader/%s" % oldinit))
- # Tested with SLES 12 for ppc64le
- self._hvm_kernel_paths.append(("boot/%s/linux" % self.arch,
- "boot/%s/initrd" % self.arch))
-
- # Matches Opensuse > 10.2 and sles 10
- self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch,
- "boot/%s/initrd-xen" % self.arch)]
-
- def _variantFromVersion(self):
- distro_version = self.version_from_content[1].strip()
- version = distro_version.split('.', 1)[0].strip()
- self.os_variant = self.urldistro
- if int(version) >= 10:
- if self.os_variant.startswith(("sles", "sled")):
- sp_version = None
- if len(distro_version.split('.', 1)) == 2:
- sp_version = 'sp' + distro_version.split('.', 1)[1].strip()
- self.os_variant += version
- if sp_version:
- self.os_variant += sp_version
- else:
- # Tumbleweed 8 digit date
- if len(version) == 8:
- self.os_variant += "tumbleweed"
- else:
- self.os_variant += distro_version
- else:
- self.os_variant += "9"
-
- def isValidStore(self):
- # self.version_from_content is the VERSION line from the contents file
- if (not self.version_from_content or
- self.version_from_content[1] is None):
- return False
-
- self._variantFromVersion()
-
- self.os_variant = self._detect_osdict_from_url()
-
- # Reset kernel name for sle11 source on s390x
- if self.arch == "s390x":
- if self.os_variant == "sles11" or self.os_variant == "sled11":
- self._hvm_kernel_paths = [("boot/%s/vmrdr.ikr" % self.arch,
- "boot/%s/initrd" % self.arch)]
-
- return True
-
- def _get_method_arg(self):
- return "install"
-
- ################################
- # osdict autodetection helpers #
- ################################
-
- def _detect_osdict_from_url(self):
- root = "opensuse"
- oses = [n for n in OSDB.list_os() if n.name.startswith(root)]
-
- for osobj in oses:
- codename = osobj.name[len(root):]
- if re.search("/%s/" % codename, self.uri):
- return osobj.name
- return self.os_variant
-
-
-class SLESDistro(SuseDistro):
- urldistro = "sles"
-
-
-class SLEDDistro(SuseDistro):
- urldistro = "sled"
-
-
-# Suse image store is harder - we fetch the kernel RPM and a helper
-# RPM and then munge bits together to generate a initrd
-class OpensuseDistro(SuseDistro):
- urldistro = "opensuse"
-
-
-class DebianDistro(Distro):
- # ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/
- # daily builds: http://d-i.debian.org/daily-images/amd64/
- name = "Debian"
- urldistro = "debian"
-
- def __init__(self, *args, **kwargs):
- Distro.__init__(self, *args, **kwargs)
-
- # Pull the tree's arch out of the URL text
- self._treeArch = "i386"
- for pattern in ["^.*/installer-(\w+)/?$",
- "^.*/daily-images/(\w+)/?$"]:
- arch = re.findall(pattern, self.uri)
- if arch:
- self._treeArch = arch[0]
- break
-
- self._url_prefix = 'current/images'
- self._installer_dirname = self.name.lower() + "-installer"
- self._set_media_paths()
-
- def _set_media_paths(self):
- self._boot_iso_paths = ["%s/netboot/mini.iso" % self._url_prefix]
-
- hvmroot = "%s/netboot/%s/%s/" % (self._url_prefix,
- self._installer_dirname,
- self._treeArch)
- initrd_basename = "initrd.gz"
- kernel_basename = "linux"
- if self._treeArch in ["ppc64el"]:
- kernel_basename = "vmlinux"
- self._hvm_kernel_paths = [
- (hvmroot + kernel_basename, hvmroot + initrd_basename)]
-
- xenroot = "%s/netboot/xen/" % self._url_prefix
- self._xen_kernel_paths = [(xenroot + "vmlinuz", xenroot + "initrd.gz")]
-
- def isValidStore(self):
- if self.fetcher.hasFile("%s/MANIFEST" % self._url_prefix):
- # For regular trees
- pass
- elif self.fetcher.hasFile("daily/MANIFEST"):
- # For daily trees
- self._url_prefix = "daily"
- self._set_media_paths()
- else:
- return False
-
- filename = "%s/MANIFEST" % self._url_prefix
- regex = ".*%s.*" % self._installer_dirname
- if not self._fetchAndMatchRegex(filename, regex):
- logging.debug("Regex didn't match, not a %s distro", self.name)
- return False
-
- self.os_variant = self._detect_debian_osdict_from_url()
- return True
-
-
- ################################
- # osdict autodetection helpers #
- ################################
-
- def _detect_debian_osdict_from_url(self):
- root = self.name.lower()
- oses = [n for n in OSDB.list_os() if n.name.startswith(root)]
-
- if self._url_prefix == "daily":
- logging.debug("Appears to be debian 'daily' URL, using latest "
- "debian OS")
- return oses[0].name
-
- for osobj in oses:
- if osobj.codename:
- # Ubuntu codenames look like 'Warty Warthog'
- codename = osobj.codename.split()[0].lower()
- else:
- if " " not in osobj.label:
- continue
- # Debian labels look like 'Debian Sarge'
- codename = osobj.label.split()[1].lower()
-
- if ("/%s/" % codename) in self.uri:
- logging.debug("Found codename=%s in the URL string", codename)
- return osobj.name
-
- logging.debug("Didn't find any known codename in the URL string")
- return self.os_variant
-
-
-class UbuntuDistro(DebianDistro):
- # http://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/
- name = "Ubuntu"
- urldistro = "ubuntu"
-
- def isValidStore(self):
- if self.fetcher.hasFile("%s/MANIFEST" % self._url_prefix):
- # For regular trees
- filename = "%s/MANIFEST" % self._url_prefix
- regex = ".*%s.*" % self._installer_dirname
- elif self.fetcher.hasFile("install/netboot/version.info"):
- # For trees based on ISO's
- self._url_prefix = "install"
- self._set_media_paths()
- filename = "%s/netboot/version.info" % self._url_prefix
- regex = "%s*" % self.name
- elif self.fetcher.hasFile(".disk/info") and self.arch == "s390x":
- self._hvm_kernel_paths += [("boot/kernel.ubuntu", "boot/initrd.ubuntu")]
- self._xen_kernel_paths += [("boot/kernel.ubuntu", "boot/initrd.ubuntu")]
- filename = ".disk/info"
- regex = "%s*" % self.name
- else:
- return False
-
- if not self._fetchAndMatchRegex(filename, regex):
- logging.debug("Regex didn't match, not a %s distro", self.name)
- return False
-
- self.os_variant = self._detect_debian_osdict_from_url()
- return True
-
-
-class MandrivaDistro(Distro):
- # ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2007.1/x86_64/
- name = "Mandriva/Mageia"
- urldistro = "mandriva"
-
- _boot_iso_paths = ["install/images/boot.iso"]
- _xen_kernel_paths = []
-
- def __init__(self, *args, **kwargs):
- Distro.__init__(self, *args, **kwargs)
- self._hvm_kernel_paths = []
-
- # At least Mageia 5 uses arch in the names
- self._hvm_kernel_paths += [
- ("isolinux/%s/vmlinuz" % self.arch,
- "isolinux/%s/all.rdz" % self.arch)]
-
- # Kernels for HVM: valid for releases 2007.1, 2008.*, 2009.0
- self._hvm_kernel_paths += [
- ("isolinux/alt0/vmlinuz", "isolinux/alt0/all.rdz")]
-
-
- def isValidStore(self):
- # Don't support any paravirt installs
- if self.type is not None and self.type != "hvm":
- return False
-
- # Mandriva websites / media appear to have a VERSION
- # file in top level which we can use as our 'magic'
- # check for validity
- if not self.fetcher.hasFile("VERSION"):
- return False
-
- for name in ["Mandriva", "Mageia"]:
- if self._fetchAndMatchRegex("VERSION", ".*%s.*" % name):
- return True
-
- logging.debug("Regex didn't match, not a %s distro", self.name)
- return False
-
-
-class ALTLinuxDistro(Distro):
- # altlinux doesn't have installable URLs, so this is just for a
- # mounted ISO
- name = "ALT Linux"
- urldistro = "altlinux"
-
- _boot_iso_paths = [("altinst", "live")]
- _hvm_kernel_paths = [("syslinux/alt0/vmlinuz", "syslinux/alt0/full.cz")]
- _xen_kernel_paths = []
-
- def isValidStore(self):
- # Don't support any paravirt installs
- if self.type is not None and self.type != "hvm":
- return False
-
- if not self.fetcher.hasFile(".disk/info"):
- return False
-
- if self._fetchAndMatchRegex(".disk/info", ".*%s.*" % self.name):
- return True
-
- logging.debug("Regex didn't match, not a %s distro", self.name)
- return False
-
-
# Build list of all *Distro classes
def _build_distro_list():
allstores = []
|