[CentOS-devel] Backporting Hyper-V support to Koji 1.10.1

Thu Oct 6 13:17:20 UTC 2016
Laurentiu Pancescu <lpancescu at gmail.com>

We already upgraded Image Factory some time ago, to be able to generate 
images for Hyper-V.  Unfortunately, we were hold back by the lack of a 
newer stable release of Koji, which passes the right parameters to Image 
Factory.

I tried to backport Ian's changes to Koji 1.10.1 (which I assume we're 
using).  I had to manually fix a few merge conflicts - could someone 
take a look at the attached patches?  I have no possibility of testing 
them here.

Thanks,
Laurențiu
-------------- next part --------------
From d4ee503af1898686df605c58d55fca9b657dbc32 Mon Sep 17 00:00:00 2001
From: Ian McLeod <imcleod at redhat.com>
Date: Wed, 8 Jun 2016 09:10:45 -0500
Subject: [PATCH 1/2] expose Factory hyperv support in builder

---
 builder/kojid | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builder/kojid b/builder/kojid
index 4ea93f2..b529006 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -3063,7 +3063,7 @@ class BaseImageTask(OzImageTask):
         Some image formats require others to be processed first, which is why
         we have to do this. raw files in particular may not be kept.
         """
-        supported = ('raw', 'raw-xz', 'vmdk', 'qcow', 'qcow2', 'vdi', 'rhevm-ova', 'vsphere-ova', 'docker', 'vagrant-virtualbox', 'vagrant-libvirt', 'vagrant-vmware-fusion', 'vpc')
+        supported = ('raw', 'raw-xz', 'vmdk', 'qcow', 'qcow2', 'vdi', 'rhevm-ova', 'vsphere-ova', 'docker', 'vagrant-virtualbox', 'vagrant-libvirt', 'vagrant-vmware-fusion', 'vagrant-hyperv', 'vpc')
         for f in formats:
             if f not in supported:
                 raise koji.ApplianceError('Invalid format: %s' % f)
@@ -3099,6 +3099,7 @@ class BaseImageTask(OzImageTask):
                   'vagrant-virtualbox': self._buildOVA,
                   'vagrant-libvirt':    self._buildOVA,
                   'vagrant-vmware-fusion': self._buildOVA,
+                  'vagrant-hyperv': self._buildOVA,
                   'docker':      self._buildDocker
         }
         # add a handler to the logger so that we capture ImageFactory's logging
@@ -3254,6 +3255,9 @@ class BaseImageTask(OzImageTask):
             # The initial disk image transform for VMWare Fusion/Workstation requires a "standard" VMDK
             # not the stream oriented format used for VirtualBox or regular VMWare OVAs
             img_opts['vsphere_vmdk_format'] = 'standard'
+        if format == 'vagrant-hyperv':
+            format = 'hyperv-ova'
+            img_opts['hyperv_ova_format'] = 'hyperv-vagrant'
         targ = self._do_target_image(self.base_img.base_image.identifier,
             format.replace('-ova', ''), img_opts=img_opts)
         targ2 = self._do_target_image(targ.target_image.identifier, 'OVA',
-- 
2.10.0

-------------- next part --------------
From 3b02b8a72f615fa5748bb9d4f7920f0b413729bc Mon Sep 17 00:00:00 2001
From: Ian McLeod <imcleod at redhat.com>
Date: Wed, 8 Jun 2016 09:11:52 -0500
Subject: [PATCH 2/2] show hyperv support in CLI help

---
 cli/koji | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cli/koji b/cli/koji
index 64c5356..38a6859 100755
--- a/cli/koji
+++ b/cli/koji
@@ -5268,7 +5268,7 @@ def handle_image_build(options, session, args):
     """Create a disk image given an install tree"""
     formats = ('vmdk', 'qcow', 'qcow2', 'vdi', 'vpc', 'rhevm-ova',
                'vsphere-ova', 'vagrant-virtualbox', 'vagrant-libvirt',
-               'vagrant-vmware-fusion', 'docker', 'raw-xz')
+               'vagrant-vmware-fusion', 'vagrant-hyperv', 'docker', 'raw-xz')
     usage = _("usage: %prog image-build [options] <name> <version> " +
               "<target> <install-tree-url> <arch> [<arch>...]")
     usage += _("\n       %prog image-build --config FILE")
-- 
2.10.0