[Pkg-libvirt-commits] [libguestfs] 22/61: sysprep: Remove the --autorelabel (and related) options.

Hilko Bengen bengen at moszumanska.debian.org
Sat Mar 29 14:36:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit aa3bc8b65d56c6d9708b72286d61e459967eb33c
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Mar 21 13:41:31 2014 +0000

    sysprep: Remove the --autorelabel (and related) options.
    
    The customize module includes an --selinux-label option which can run
    'fixfiles restore' (on most SELinux guests) or set /.autorelabel (on
    some older ones).
    
    Commit 49014f81f350484da725f5ee2bc62bb24268a334 renamed the old
    --selinux-label option to --autorelabel, but note this was not
    included in a stable version of libguestfs.
    
    Note this change leaves a bunch of now redundant code for detecting if
    we created a new file in the guest.
---
 sysprep/main.ml          | 33 ++-------------------------------
 sysprep/virt-sysprep.pod | 25 -------------------------
 2 files changed, 2 insertions(+), 56 deletions(-)

diff --git a/sysprep/main.ml b/sysprep/main.ml
index def883c..71abfa7 100644
--- a/sysprep/main.ml
+++ b/sysprep/main.ml
@@ -33,7 +33,7 @@ let prog = Filename.basename Sys.executable_name
 
 let () = Random.self_init ()
 
-let debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose =
+let debug_gc, operations, g, quiet, mount_opts, verbose =
   let debug_gc = ref false in
   let domain = ref None in
   let dryrun = ref false in
@@ -42,7 +42,6 @@ let debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose =
   let quiet = ref false in
   let libvirturi = ref "" in
   let operations = ref None in
-  let autorelabel = ref `Auto in
   let trace = ref false in
   let verbose = ref false in
   let mount_opts = ref "" in
@@ -123,10 +122,6 @@ let debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose =
             exit 1
     ) currentopset ops in
     operations := Some opset
-  and force_autorelabel () =
-    autorelabel := `Force
-  and no_force_autorelabel () =
-    autorelabel := `Never
   and list_operations () =
     Sysprep_operation.list_operations ();
     exit 0
@@ -135,8 +130,6 @@ let debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose =
   let basic_args = [
     "-a",        Arg.String add_file,       s_"file" ^ " " ^ s_"Add disk image file";
     "--add",     Arg.String add_file,       s_"file" ^ " " ^ s_"Add disk image file";
-    "--autorelabel", Arg.Unit force_autorelabel, " " ^ s_"Force SELinux relabel";
-    "--no-autorelabel", Arg.Unit no_force_autorelabel, " " ^ s_"Never do SELinux relabel";
     "-c",        Arg.Set_string libvirturi, s_"uri" ^ " " ^ s_"Set libvirt URI";
     "--connect", Arg.Set_string libvirturi, s_"uri" ^ " " ^ s_"Set libvirt URI";
     "--debug-gc", Arg.Set debug_gc,         " " ^ s_"Debug GC and memory allocations (internal)";
@@ -156,8 +149,6 @@ let debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose =
     "--operations", Arg.String set_operations, " " ^ s_"Enable/disable specific operations";
     "-q",        Arg.Set quiet,             " " ^ s_"Don't print log messages";
     "--quiet",   Arg.Set quiet,             " " ^ s_"Don't print log messages";
-    "--selinux-relabel", Arg.Unit force_autorelabel, " " ^ s_"Use --autorelabel";
-    "--no-selinux-relabel", Arg.Unit no_force_autorelabel, " " ^ s_"Use --no-autorelabel";
     "-v",        Arg.Set verbose,           " " ^ s_"Enable debugging messages";
     "--verbose", Arg.Set verbose,           " " ^ s_"Enable debugging messages";
     "-V",        Arg.Unit display_version,  " " ^ s_"Display version and exit";
@@ -226,7 +217,6 @@ read the man page virt-sysprep(1).
   let dryrun = !dryrun in
   let operations = !operations in
   let quiet = !quiet in
-  let autorelabel = !autorelabel in
   let trace = !trace in
   let verbose = !verbose in
 
@@ -249,7 +239,7 @@ read the man page virt-sysprep(1).
   add g dryrun;
   g#launch ();
 
-  debug_gc, operations, g, autorelabel, quiet, mount_opts, verbose
+  debug_gc, operations, g, quiet, mount_opts, verbose
 
 let do_sysprep () =
   (* Inspection. *)
@@ -281,25 +271,6 @@ let do_sysprep () =
         Sysprep_operation.perform_operations_on_filesystems
           ?operations ~debug:verbose ~quiet g root side_effects;
 
-        (* Check side-effects. *)
-        let created_files = side_effects#get_created_file in
-
-        (* SELinux relabel? *)
-        let relabel =
-          match autorelabel, created_files with
-          | `Force, _ -> true
-          | `Never, _ -> false
-          | `Auto, created_files -> created_files in
-        if relabel then (
-          let typ = g#inspect_get_type root in
-          let distro = g#inspect_get_distro root in
-          match typ, distro with
-          | "linux", ("fedora"|"rhel"|"redhat-based"
-                         |"centos"|"scientificlinux") ->
-            g#touch "/.autorelabel"
-          | _ -> ()
-        );
-
         (* Unmount everything in this guest. *)
         g#umount_all ();
 
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
index f3c18a6..aa570a5 100644
--- a/sysprep/virt-sysprep.pod
+++ b/sysprep/virt-sysprep.pod
@@ -59,16 +59,6 @@ force a particular format use the I<--format> option.
 Add a remote disk.  The URI format is compatible with guestfish.
 See L<guestfish(1)/ADDING REMOTE STORAGE>.
 
-=item B<--autorelabel>
-
-=item B<--no-autorelabel>
-
-I<--autorelabel> forces SELinux relabelling next time the guest
-boots.  I<--no-autorelabel> disables relabelling.
-
-The default is to try to detect if SELinux relabelling is required.
-See L</SELINUX RELABELLING> below for more details.
-
 =item B<-c> URI
 
 =item B<--connect> URI
@@ -516,21 +506,6 @@ module:
  cp template.img newguest.img
  virt-sysprep --enable customize -a newguest.img
 
-=head2 SELINUX RELABELLING
-
-I<(This section applies to Linux guests using SELinux only)>
-
-If any new files are created by virt-sysprep, then virt-sysprep
-touches C</.autorelabel> so that these will be correctly labelled by
-SELinux the next time the guest is booted.  This process interrupts
-boot and can take some time.
-
-You can force relabelling for all guests by supplying the
-I<--autorelabel> option.
-
-You can disable relabelling entirely by supplying the
-I<--no-autorelabel> option.
-
 =head1 WINDOWS 8
 
 Windows 8 "fast startup" can prevent virt-sysprep from working.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list