Browse code

Adding lvm support and fixes to reduce boot time

Change-Id: I1a81326473744236ac2e85147e0e8b0fb97b5c89

dthaluru authored on 2015/09/26 04:07:10
Showing 9 changed files
... ...
@@ -328,7 +328,7 @@ DISTRIB_DESCRIPTION="VMware Photon 1.0 TP2"
328 328
 EOF
329 329
 
330 330
 cat > %{buildroot}/usr/lib/os-release <<- "EOF"
331
-NAME=VMware Photon
331
+NAME="VMware Photon"
332 332
 VERSION="1.0 TP2"
333 333
 ID=photon
334 334
 VERSION_ID=1.0
... ...
@@ -93,7 +93,7 @@ cp -r Documentation/*        %{buildroot}%{_defaultdocdir}/linux-esx-%{version}
93 93
 # TODO: noacpi acpi=off noapic pci=conf1,nodomains pcie_acpm=off pnpacpi=off
94 94
 cat > %{buildroot}/boot/%{name}-%{version}-%{release}.cfg << "EOF"
95 95
 # GRUB Environment Block
96
-photon_cmdline=init=/lib/systemd/systemd tsc=reliable no_timer_check rcupdate.rcu_expedited=1 rootfstype=ext4 rw systemd.show_status=0 elevator=noop quiet nordrand noreplace-smp cpu_init_udelay=0
96
+photon_cmdline=init=/lib/systemd/systemd tsc=reliable no_timer_check rcupdate.rcu_expedited=1 rootfstype=ext4 rw systemd.show_status=0 elevator=noop quiet nordrand noreplace-smp cpu_init_udelay=0  plymouth.enable=0
97 97
 photon_linux=/boot/vmlinuz-esx-%{version}
98 98
 EOF
99 99
 
... ...
@@ -90,7 +90,7 @@ cp -v .config            %{buildroot}/boot/config-%{version}
90 90
 cp -r Documentation/*        %{buildroot}%{_defaultdocdir}/%{name}-%{version}
91 91
 cat > %{buildroot}/boot/%{name}-%{version}-%{release}.cfg << "EOF"
92 92
 # GRUB Environment Block
93
-photon_cmdline=init=/lib/systemd/systemd rootfstype=ext4 ro loglevel=3 quiet
93
+photon_cmdline=init=/lib/systemd/systemd rootfstype=ext4 ro loglevel=3 quiet plymouth.enable=0
94 94
 photon_linux=/boot/vmlinuz-%{version}
95 95
 photon_initrd=/boot/initrd.img-no-kmods
96 96
 EOF
97 97
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+[Unit]
1
+Description=LVM2 activate volume groups
2
+After=systemd-udevd.service
3
+Before=local-fs-pre.target
4
+DefaultDependencies=no
5
+
6
+[Service]
7
+Type=oneshot
8
+ExecStart=/usr/sbin/lvm vgchange -ay
9
+RemainAfterExit=yes
10
+
11
+[Install]
12
+WantedBy=local-fs.target
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Userland logical volume management tools 
2 2
 Name:		lvm2
3 3
 Version:	2.02.116
4
-Release:	1%{?dist}
4
+Release:	2%{?dist}
5 5
 License:	GPLv2
6 6
 Group:		System Environment/Base
7 7
 URL:		http://sources.redhat.com/dm
... ...
@@ -9,6 +9,7 @@ Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0:	ftp://sources.redhat.com/pub/lvm2/releases/LVM2.%{version}.tgz
11 11
 %define sha1 LVM2=5bd2f4c33cdf93e580ea5b8a64bc32cd77be078e
12
+Source1:	lvm2-activate.service
12 13
 Patch0:		lvm2-set-default-preferred_names.patch
13 14
 Patch1:		lvm2-enable-lvmetad-by-default.patch
14 15
 Patch2:		lvm2-remove-mpath-device-handling-from-udev-rules.patch
... ...
@@ -21,6 +22,7 @@ BuildRequires:	systemd
21 21
 BuildRequires:	thin-provisioning-tools
22 22
 Requires:	device-mapper-libs = %{version}-%{release}
23 23
 Requires:	device-mapper-event-libs = %{version}-%{release}
24
+Requires:	device-mapper = %{version}-%{release}
24 25
 
25 26
 %description
26 27
 LVM2 includes all of the support for handling read/write operations on
... ...
@@ -183,9 +185,16 @@ make %{?_smp_mflags}
183 183
 
184 184
 %install
185 185
 make install DESTDIR=%{buildroot}
186
-
186
+make install_system_dirs DESTDIR=%{buildroot}
187
+make install_systemd_units DESTDIR=%{buildroot}
188
+make install_systemd_generators DESTDIR=%{buildroot}
189
+make install_tmpfiles_configuration DESTDIR=%{buildroot}
190
+cp %{SOURCE1} %{buildroot}/lib/systemd/system/lvm2-activate.service
187 191
 %post
188 192
 /sbin/ldconfig
193
+systemctl enable lvm2-lvmetad.service
194
+systemctl enable lvm2-monitor.service
195
+systemctl enable lvm2-activate.service
189 196
 
190 197
 %postun
191 198
 /sbin/ldconfig
... ...
@@ -240,6 +249,8 @@ make install DESTDIR=%{buildroot}
240 240
 %defattr(-,root,root,-)
241 241
 %attr(555, -, -) %{_sbindir}/dmeventd
242 242
 %{_mandir}/man8/dmeventd.8.gz
243
+/lib/systemd/system/dm-event.service
244
+/lib/systemd/system/dm-event.socket
243 245
 
244 246
 %files -n device-mapper-event-libs
245 247
 %defattr(555,root,root,-)
... ...
@@ -358,7 +369,18 @@ make install DESTDIR=%{buildroot}
358 358
 /usr/share/man/man8/vgs.8.gz
359 359
 /usr/share/man/man8/vgscan.8.gz
360 360
 /usr/share/man/man8/vgsplit.8.gz
361
+/lib/systemd/system-generators/lvm2-activation-generator
362
+/lib/systemd/system/blk-availability.service
363
+/lib/systemd/system/lvm2-lvmetad.service
364
+/lib/systemd/system/lvm2-lvmetad.socket
365
+/lib/systemd/system/lvm2-monitor.service
366
+/lib/systemd/system/lvm2-activate.service
367
+/lib/systemd/system/lvm2-pvscan@.service
368
+/usr/lib/tmpfiles.d/lvm2.conf
369
+/usr/share/man/man8/lvm2-activation-generator.8.gz
361 370
 %changelog
371
+* Thu Sep 10 2015 Divya Thaluru <dthaluru@vmware.com> 2.02.116-2
372
+- Packaging systemd service and configuration files
362 373
 * Thu Feb 26 2015 Divya Thaluru <dthaluru@vmware.com> 2.02.116-1
363 374
 - Initial version
364 375
 
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Systemd-216
2 2
 Name:		systemd
3 3
 Version:	216
4
-Release:	10%{?dist}
4
+Release:	11%{?dist}
5 5
 License:	LGPLv2+ and GPLv2+ and MIT
6 6
 URL:		http://www.freedesktop.org/wiki/Software/systemd/
7 7
 Group:		System Environment/Security
... ...
@@ -72,6 +72,7 @@ for tool in runlevel reboot shutdown poweroff halt telinit; do
72 72
 done
73 73
 ln -sfv ../lib/systemd/systemd %{buildroot}/sbin/init
74 74
 rm -f %{buildroot}%{_var}/log/README
75
+mkdir -p %{buildroot}%{_localstatedir}/log/journal
75 76
 
76 77
 #cp %{buildroot}/usr/share/factory/etc/pam.d/system-auth %{buildroot}%{_sysconfdir}/pam.d/system-auth
77 78
 #cp %{buildroot}/usr/share/factory/etc/pam.d/other %{buildroot}%{_sysconfdir}/pam.d/other
... ...
@@ -92,9 +93,12 @@ rm -rf %{buildroot}/*
92 92
 /sbin/*
93 93
 %{_includedir}/*
94 94
 %{_datadir}/*
95
+%dir %{_localstatedir}/log/journal
95 96
 
96 97
 
97 98
 %changelog
99
+*	Fri Sep 18 2015 Divya Thaluru <dthaluru@vmware.com> 216-11
100
+-	Packaging journal log directory
98 101
 *	Tue Sep 10 2015 Alexey Makhalov <amakhalov@vmware.com> 216-10
99 102
 -	Improve enoX renaming in VMware HV case. Patch is added.
100 103
 *	Tue Aug 25 2015 Alexey Makhalov <amakhalov@vmware.com> 216-9
101 104
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+{
1
+    "dracut_configuration" : {
2
+        "add_drivers" : ["tmem","xen-acpi-processor","xen-evtchn","xen-gntalloc","xen-gntdev","xen-privcmd","xen-pciback","xenfs",
3
+				"hv_ballon","hv_utils","hv_vmbus","cn"
4
+			]
5
+    }
6
+}
... ...
@@ -23,6 +23,7 @@ from jsonwrapper import JsonWrapper
23 23
 from progressbar import ProgressBar
24 24
 from window import Window
25 25
 from actionresult import ActionResult
26
+from __builtin__ import isinstance
26 27
 
27 28
 class Installer(object):
28 29
     def __init__(self, install_config, maxy = 0, maxx = 0, iso_installer = False, rpm_path = "../stage/RPMS", log_path = "../stage/LOGS", ks_config = None):
... ...
@@ -298,9 +299,27 @@ class Installer(object):
298 298
 
299 299
             if 'initrd_dir' in self.install_config:
300 300
                 initrd_dir = self.install_config['initrd_dir']
301
-            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, './mkinitramfs', '-n', os.path.join(initrd_dir, initrd_file_name), '-k', version_string],  stdout=self.output)
301
+            self.add_dracut_configuration()
302
+            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, 'dracut', '--force', '--kver', version_string, os.path.join(initrd_dir,initrd_file_name)],  stdout=self.output, stderr=self.output)
302 303
             retval = process.wait()
303 304
 
305
+    def add_dracut_configuration(self):
306
+        if self.install_config.has_key("dracut_configuration"):
307
+            dracut_configuration = []
308
+            
309
+            for key in self.install_config["dracut_configuration"].keys():
310
+                keyValue = self.install_config["dracut_configuration"][key]
311
+                config=key
312
+                if isinstance(keyValue,list):
313
+                    config=config+'+="'+" ".join(keyValue)+'"'
314
+                else:
315
+                    config=config+'="'+keyValue+'"'
316
+                config=config+"\n"
317
+                dracut_configuration.append(config)
318
+            
319
+            f = open(self.photon_root+"/etc/dracut.conf","a")
320
+            f.writelines(dracut_configuration)
321
+        
304 322
 
305 323
     def install_package(self,  package_name):
306 324
         rpm_params = ''
... ...
@@ -353,4 +372,4 @@ class Installer(object):
353 353
         modules.commons.log(modules.commons.LOG_INFO, "Installer: {} ".format(command))
354 354
         process = subprocess.Popen([command], shell=True, stdout=self.output)
355 355
         retval = process.wait()
356
-        return retval
357 356
\ No newline at end of file
357
+        return retval
... ...
@@ -128,6 +128,7 @@ if __name__ == '__main__':
128 128
     parser.add_option("-f", "--force", action="store_true", dest="force", default=False)
129 129
     parser.add_option("-p", "--package-list-file", dest="package_list_file", default="../common/data/build_install_options_all.json")
130 130
     parser.add_option("-m", "--stage-path", dest="stage_path", default="../stage")
131
+    parser.add_option("-c", "--dracut-configuration", dest="dracut_configuration_file", default="../common/data/dracut_configuration.json")
131 132
 
132 133
     (options,  args) = parser.parse_args()
133 134
     if options.iso_path:
... ...
@@ -190,6 +191,12 @@ if __name__ == '__main__':
190 190
 
191 191
     config['packages'] = packages
192 192
 
193
+    if config['iso_system'] == True:
194
+        if os.path.isfile(options.dracut_configuration_file):
195
+            json_wrapper_package_list = JsonWrapper(options.dracut_configuration_file)
196
+            dracut_configuration_list_json = json_wrapper_package_list.read()
197
+            config["dracut_configuration"]=dracut_configuration_list_json["dracut_configuration"]
198
+
193 199
     # Cleanup the working directory
194 200
     if not options.force:
195 201
         proceed = query_yes_no("This will remove everything under {0}. Are you sure?".format(options.working_directory))