[node-patches] Change in ovirt-node[master]: edit-node: add image-minimizer support for added plugins

jboggs at redhat.com jboggs at redhat.com
Sat Sep 8 01:11:09 UTC 2012


Joey Boggs has uploaded a new change for review.

Change subject: edit-node: add image-minimizer support for added plugins
......................................................................

edit-node: add image-minimizer support for added plugins

Change-Id: Iaae9e36023cabe52ea72392ede4dd672e15a3438
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M tools/edit-node
1 file changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/55/7855/1

diff --git a/tools/edit-node b/tools/edit-node
index b2d97bd..e6cce27 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -746,7 +746,7 @@
         # create plugin info
         if options.install or options.plugin or options.install_dup:
             plugin_info_dir =  "%s/etc/ovirt-plugins.d" % self._instroot
-            os.system("mkdir %s" % plugin_info_dir)
+            os.system("mkdir -p %s" % plugin_info_dir)
             # get version-release
             cmd = "rpm -q %s --qf '%%{version}-%%{release}.%%{arch}\n'" % pkg
             f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, \
@@ -922,7 +922,6 @@
         if not self._setup_yum_repo(options):
             return False
         if not self._run_yum_install(options.plugin):
-            logging.error(output)
             self._cleanup_editing()
             return False
         else:
@@ -1070,7 +1069,8 @@
         if options.plugin:
             valid_write_locations = [ "/etc",
                                       "/opt",
-                                      "/usr/share/man" ]
+                                      "/usr/share/man",
+                                      "/usr/lib/python"]
         elif options.install_dup:
             valid_write_locations = [ "/etc/modprobe.d",
                                       "/etc/depmod.d",
@@ -1106,6 +1106,19 @@
                 print "%s" % file
             return False
         return True
+
+    def _minimize(self):
+        print "Running Minimizer"
+        minimizer = "/usr/bin/image-minimizer"
+        if os.path.exists(minimizer):
+            print glob.glob("%s/etc/ovirt-plugins.d/*.minimize" % self._instroot)
+            for f in glob.glob("%s/etc/ovirt-plugins.d/*.minimize" % self._instroot):
+                cmd = "%s -v -i %s %s" % (minimizer, self._instroot, f)
+                print cmd
+                minimize = subprocess.Popen(cmd, shell=True, stdout=PIPE, \
+                                stderr=STDOUT)
+                output, err = minimize.communicate()
+                print output
 
     def _cleanup_editing(self):
         print "Cleaning Up Yum Configuration"
@@ -1473,6 +1486,7 @@
                 editor._change_gid(options)
             if rebuild == 1:
                 editor._update_version(options)
+                editor._minimize()
                 editor._create_manifests(options)
                 print "Editing Complete"
                 editor._configure_bootloader(editor._LiveImageCreatorBase__isodir)


--
To view, visit http://gerrit.ovirt.org/7855
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaae9e36023cabe52ea72392ede4dd672e15a3438
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list