From 6b05300b14548062fb2688bdc86499614ea8da8b Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: May 03 2018 17:25:27 +0000
Subject: [PATCH 1/3] kojid: make install timeout of imagefactory conf configurable


---

diff --git a/builder/kojid b/builder/kojid
index f9f46d2..ff6bec0 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -3519,8 +3519,8 @@ class OzImageTask(BaseTaskHandler):
             #IF specific
             'imgdir': os.path.join(self.workdir, 'scratch_images'),
             'tmpdir': os.path.join(self.workdir, 'oz-tmp'),
-            'verbose' : True,
-            'timeout': 7200,
+            'verbose': True,
+            'timeout': self.options.oz_install_timeout,
             'output': 'log',
             'raw': False,
             'debug': True,
@@ -5666,7 +5666,7 @@ def get_options():
                 'max_retries': 120,
                 'offline_retry': True,
                 'offline_retry_interval': 120,
-                'keepalive' : True,
+                'keepalive': True,
                 'timeout' : None,
                 'no_ssl_verify' : False,
                 'use_fast_upload': True,
@@ -5681,6 +5681,7 @@ def get_options():
                                      'resolver-status.properties *.lastUpdated',
                 'failed_buildroot_lifetime' : 3600 * 4,
                 'rpmbuild_timeout' : 3600 * 24,
+                'oz_install_timeout': None,
                 'cert': None,
                 'ca': '',  # FIXME: Unused, remove in next major release
                 'serverca': None}
@@ -5688,7 +5689,7 @@ def get_options():
         for name, value in config.items('kojid'):
             if name in ['sleeptime', 'maxjobs', 'minspace', 'retry_interval',
                         'max_retries', 'offline_retry_interval', 'failed_buildroot_lifetime',
-                        'timeout', 'rpmbuild_timeout',]:
+                        'timeout', 'rpmbuild_timeout', 'oz_install_timeout',]:
                 try:
                     defaults[name] = int(value)
                 except ValueError:
diff --git a/builder/kojid.conf b/builder/kojid.conf
index 1a49ebe..6e3e0b4 100644
--- a/builder/kojid.conf
+++ b/builder/kojid.conf
@@ -38,6 +38,10 @@
 ; Timeout for build duration (24 hours)
 ; rpmbuild_timeout=86400
 
+; Install timeout(seconds) for image build
+; if it's unset, use the number in /etc/oz/oz.cfg, supported since oz-0.16.0
+; oz_install_timeout=7200
+
 ; The URL for the xmlrpc server
 server=http://hub.example.com/kojihub
 

From c3ef74ff80dc18edf0f8a6948d786cca3f927ddc Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: May 03 2018 17:25:27 +0000
Subject: [PATCH 2/3] add explanation in image_build.rst


---

diff --git a/docs/source/image_build.rst b/docs/source/image_build.rst
index b2bb0dc..f7d8ef2 100644
--- a/docs/source/image_build.rst
+++ b/docs/source/image_build.rst
@@ -660,6 +660,11 @@ ImageFactory/Oz Preparation
     #.  python-psphere => 0.5
     #.  VMDKStream => 0.2
     #.  pykickstart
+#.  Edit ``/etc/kojid/kojid.conf``, and set an second value, eg: 7200 for
+    ``oz_install_timeout``. It's a timeout waiting guest installing. If it's
+    not specified, oz will use its default value. Since ``oz-0.16.0`` it can be
+    configured in ``/etc/oz/oz.cfg`` as ``install`` in the ``[timeouts]``
+    section.
 #.  Edit ``/etc/oz/oz.cfg``, and set the memory value in the ``[libvirt]``
     section to at least 2048. Set ``safe_generation`` under ``[icicle]`` to yes.
 #.  Run: ``mkdir -p ~root/.psphere/templates``, and then copy the following

From a49f3dff127c7f0ef5ded094adcca669fa358672 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: May 03 2018 17:25:27 +0000
Subject: [PATCH 3/3] change default value of oz_install_timeout to 0


---

diff --git a/builder/kojid b/builder/kojid
index ff6bec0..68a04f6 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -3520,7 +3520,7 @@ class OzImageTask(BaseTaskHandler):
             'imgdir': os.path.join(self.workdir, 'scratch_images'),
             'tmpdir': os.path.join(self.workdir, 'oz-tmp'),
             'verbose': True,
-            'timeout': self.options.oz_install_timeout,
+            'timeout': self.options.oz_install_timeout or None,
             'output': 'log',
             'raw': False,
             'debug': True,
@@ -5681,7 +5681,7 @@ def get_options():
                                      'resolver-status.properties *.lastUpdated',
                 'failed_buildroot_lifetime' : 3600 * 4,
                 'rpmbuild_timeout' : 3600 * 24,
-                'oz_install_timeout': None,
+                'oz_install_timeout': 0,
                 'cert': None,
                 'ca': '',  # FIXME: Unused, remove in next major release
                 'serverca': None}
diff --git a/builder/kojid.conf b/builder/kojid.conf
index 6e3e0b4..cdcff9d 100644
--- a/builder/kojid.conf
+++ b/builder/kojid.conf
@@ -39,7 +39,8 @@
 ; rpmbuild_timeout=86400
 
 ; Install timeout(seconds) for image build
-; if it's unset, use the number in /etc/oz/oz.cfg, supported since oz-0.16.0
+; Default value is 0, which means using the number in /etc/oz/oz.cfg,
+; supported since oz-0.16.0
 ; oz_install_timeout=7200
 
 ; The URL for the xmlrpc server
diff --git a/docs/source/image_build.rst b/docs/source/image_build.rst
index f7d8ef2..b44db39 100644
--- a/docs/source/image_build.rst
+++ b/docs/source/image_build.rst
@@ -661,9 +661,9 @@ ImageFactory/Oz Preparation
     #.  VMDKStream => 0.2
     #.  pykickstart
 #.  Edit ``/etc/kojid/kojid.conf``, and set an second value, eg: 7200 for
-    ``oz_install_timeout``. It's a timeout waiting guest installing. If it's
-    not specified, oz will use its default value. Since ``oz-0.16.0`` it can be
-    configured in ``/etc/oz/oz.cfg`` as ``install`` in the ``[timeouts]``
+    ``oz_install_timeout``. It's a timeout waiting guest installing. Default
+    value is 0, that means oz will use its default value. Since ``oz-0.16.0``,
+    it can be configured in ``/etc/oz/oz.cfg`` as ``install`` in ``[timeouts]``
     section.
 #.  Edit ``/etc/oz/oz.cfg``, and set the memory value in the ``[libvirt]``
     section to at least 2048. Set ``safe_generation`` under ``[icicle]`` to yes.

