Sandro Bonazzola has uploaded a new change for review.

Change subject: storage: detect localfs storage
......................................................................

storage: detect localfs storage

iso-uploader has been designed thinking only at
NFS storage for iso images uploaded using nfs upload backend.
All other storage types have been delegated to ssh upload backend.
Added a check on localfs explaining that for that storage only
ssh upload is supported.

Change-Id: Iff3313ba69500a7dbbdbe4c0972d747a9ae31b99
Bug-Url: https://bugzilla.redhat.com/1065726
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/__main__.py
1 file changed, 21 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-iso-uploader 
refs/changes/91/27391/1

diff --git a/src/__main__.py b/src/__main__.py
index 7b66f7d..509815b 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -617,10 +617,13 @@
                     _("The %s storage domain supplied is not of type ISO") %
                     isodomain
                 )
-            id = sd.get_id()
+            sd_uuid = sd.get_id()
             storage = sd.get_storage()
             if storage is not None:
-                address = storage.get_address()
+                domain_type = storage.get_type()
+                address = 'localhost'
+                if domain_type not in ('localfs', ):
+                    address = storage.get_address()
                 path = storage.get_path()
             else:
                 raise Exception(
@@ -629,8 +632,10 @@
                         "the %s ISO domain."
                     ) % isodomain
                 )
-            logging.debug('id=%s address=%s path=%s' % (id, address, path))
-            return (id, address, path)
+            logging.debug(
+                'id=%s address=%s path=%s' % (sd_uuid, address, path)
+            )
+            return (sd_uuid, domain_type, address, path)
         else:
             raise Exception(
                 _("An ISO storage domain with a name of %s was not found.") %
@@ -940,9 +945,10 @@
             )
         elif self.configuration.get('iso_domain'):
             # Discover the hostname and path from the ISO domain.
-            (id, address, path) = self.get_host_and_path_from_ISO_domain(
-                self.configuration.get('iso_domain')
-            )
+            (id, domain_type, address, path) = \
+                self.get_host_and_path_from_ISO_domain(
+                    self.configuration.get('iso_domain')
+                )
             remote_path = os.path.join(id, DEFAULT_IMAGES_DIR)
         elif self.configuration.get('nfs_server'):
             mnt = self.configuration.get('nfs_server')
@@ -1063,6 +1069,14 @@
                         _('Error message is "%s"'),
                         str(e).strip()
                     )
+        elif domain_type in ('localfs', ):
+            ExitCodes.exit_code = ExitCodes.UPLOAD_ERR
+            logging.error(
+                _(
+                    'Upload to a local storage domain is supported only '
+                    'through SSH'
+                ),
+            )
         else:
             # NFS support.
             tmpDir = tempfile.mkdtemp()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff3313ba69500a7dbbdbe4c0972d747a9ae31b99
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-iso-uploader
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to