Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: let the user set an ISO image for cloud-init 
configuration
......................................................................

packaging: setup: let the user set an ISO image for cloud-init configuration

cloud-init could be used to configure the engine VM.
With no-cloud datasource, cloud-init simply requires an iso9660 image
with /user-data and /meta-data yaml formatted files without
additional network requirements.
Let the user configure it.

Change-Id: I1a2cce9c47f4e6a6279dcb1657dbbcc9a3e5f04e
Bug-Url: https://bugzilla.redhat.com/1198138
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/vm/boot_cdrom.py
1 file changed, 38 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/50/38350/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/boot_cdrom.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/boot_cdrom.py
index 6a72b90..c83ca4d 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/boot_cdrom.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/boot_cdrom.py
@@ -116,24 +116,39 @@
             ohostedcons.Stages.DIALOG_TITLES_E_VM,
         ),
         condition=lambda self: (
-            self.environment[ohostedcons.VMEnv.BOOT] == 'cdrom' and
+            (
+                self.environment[ohostedcons.VMEnv.BOOT] == 'cdrom' or
+                self.environment[ohostedcons.VMEnv.BOOT] == 'disk'
+            ) and
             not self.environment[ohostedcons.CoreEnv.IS_ADDITIONAL_HOST]
         )
     )
     def _customization(self):
+        mode = 'installation'
+        additional = ''
+        if self.environment[ohostedcons.VMEnv.BOOT] == 'disk':
+            additional = _(
+                'You can configure an optional ISO image '
+                'for cloud-init configuration\n'
+            )
+            mode = 'configuration'
         interactive = self.environment[
             ohostedcons.VMEnv.CDROM
         ] is None
         if not interactive:
-            if not self._check_iso_readable(
-                self.environment[ohostedcons.VMEnv.CDROM]
+            if (
+                    self.environment[ohostedcons.VMEnv.CDROM] and
+                    not self._check_iso_readable(
+                        self.environment[ohostedcons.VMEnv.CDROM]
+                    )
             ):
                 raise RuntimeError(
                     _(
-                        'The specified installation media is not '
+                        'The specified {mode} media is not '
                         'readable. Please ensure that {filepath} '
-                        'could be read by vdsm user or kvm group'
+                        'could be read by qemu user or kvm group'
                     ).format(
+                        mode=mode,
                         filepath=self.environment[
                             ohostedcons.VMEnv.CDROM
                         ]
@@ -147,8 +162,12 @@
                 ] = self.dialog.queryString(
                     name='OVEHOSTED_VMENV_CDROM',
                     note=_(
-                        'Please specify path to installation media '
+                        '{additional}'
+                        'Please specify path to {mode} media '
                         'you would like to use [@DEFAULT@]: '
+                    ).format(
+                        additional=additional,
+                        mode=mode,
                     ),
                     prompt=True,
                     caseSensitive=True,
@@ -156,15 +175,24 @@
                         ohostedcons.VMEnv.CDROM
                     ]),
                 )
-                valid = self._check_iso_readable(
-                    self.environment[ohostedcons.VMEnv.CDROM]
-                )
+                if mode == 'configuration':
+                    if self.environment[
+                        ohostedcons.VMEnv.CDROM
+                    ] == 'None':
+                        self.environment[
+                            ohostedcons.VMEnv.CDROM
+                        ] = False
+                        valid = True
+                if not valid:
+                    valid = self._check_iso_readable(
+                        self.environment[ohostedcons.VMEnv.CDROM]
+                    )
                 if not valid:
                     self.logger.error(
                         _(
                             'The specified installation media is not '
                             'readable. Please ensure that {filepath} '
-                            'could be read by vdsm user or kvm group '
+                            'could be read by qemu user or kvm group '
                             'or specify another installation media.'
                         ).format(
                             filepath=self.environment[


-- 
To view, visit https://gerrit.ovirt.org/38350
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a2cce9c47f4e6a6279dcb1657dbbcc9a3e5f04e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to