target_put_guest_image target_editfile
target_editfile_cancel
target_editfile_root target_file_exists
+ target_editfile_kvp_replace
target_run_apt
target_install_packages target_install_packages_norec
target_jobdir target_extract_jobdistpath_subdir
if $install;
}
+# Replace a Key=Value style line in a config file.
+#
+# To be used as 3rd argument to target_editfile(_root) as:
+# target_editfile_root($ho, "/path/to/a/file",
+# sub { target_editfile_kvp_replace($key, $value) });
+sub target_editfile_kvp_replace ($$)
+{
+ my ($key,$value) = @_;
+ my $prnow;
+ $prnow= sub {
+ print ::EO "$key=$value\n" or die $!;
+ $prnow= sub { };
+ };
+ while (<::EI>) {
+ print ::EO or die $! unless m/^$key\b/;
+ $prnow->() if m/^#$key/;
+ }
+ print ::EO "\n" or die $!;
+ $prnow->();
+};
+
sub target_editfile_root ($$$;$$) { teditfileex('root',@_); }
sub target_editfile ($$$;$$) { teditfileex('osstest',@_); }
# my $code= pop @_;
});
}
+ target_cmd_root($ho, 'mkdir -p /var/core');
+ target_editfile_root($ho, '/etc/sysctl.conf',
+ sub { target_editfile_kvp_replace(
+ "kernel.core_pattern",
+ # %p==pid,%e==executable name,%t==timestamp
+ "/var/core/%t.%p.%e.core") });
+ target_cmd_root($ho, "sysctl --load /etc/sysctl.conf");
+
target_cmd_root($ho, "update-rc.d osstest-confirm-booted start 99 2 .");
logm('OK: install completed');
inventory_domains();
inventory_processes();
inventory_xenstore();
- inventory_files('/tmp /var/run /var/tmp /var/lib/xen');
+ inventory_files('/tmp /var/run /var/tmp /var/lib/xen /var/core');
}
if (!eval {
/home/osstest/osstest-confirm-booted.log
+ /var/core/*.core
+
)];
if (!try_fetch_logs($ho, $logs)) {
logm("log fetching failed, trying hard host reboot...");
}
die unless defined $trace_config_file;
- my $kvp_replace = sub($$) {
- my ($key,$value) = @_;
- my $prnow;
- $prnow= sub {
- print EO "$key=$value\n" or die $!;
- $prnow= sub { };
- };
- while (<EI>) {
- print EO or die $! unless m/^$key\b/;
- $prnow->() if m/^#$key/;
- }
- print EO "\n" or die $!;
- $prnow->();
- };
-
target_editfile_root($ho, $trace_config_file,
- sub { $kvp_replace->("XENCONSOLED_TRACE", "guest") });
+ sub { target_editfile_kvp_replace("XENCONSOLED_TRACE", "guest") });
target_editfile_root($ho, '/etc/libvirt/libvirtd.conf',
- sub { $kvp_replace->("log_level", "1") })
+ sub { target_editfile_kvp_replace("log_level", "1") })
if toolstack($ho)->{Name} eq "libvirt";
target_cmd_root($ho, 'mkdir -p /var/log/xen/console');