[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] v2v: -o rhv-upload: adapt phony ovirtsdk4 module to recent changes



Add the missing objects, methods, variables, and relations among the
various objects.

Followup/fixes commit c49aa4fe01aac82d4776dd2a3524ce16e6deed06, and
commit 8118f28b6ff93c11f92fd65873285c2eba10ea0a.
---
 .../ovirtsdk4/__init__.py                     | 25 +++++++++++++------
 .../ovirtsdk4/types.py                        | 19 ++++++++++----
 2 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
index 2ceb07c0c..09d861d35 100644
--- a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
+++ b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/__init__.py
@@ -32,12 +32,16 @@ class Connection(object):
             ca_file = None,
             log = None,
             insecure = False,
+            debug=True,
     ):
         pass
 
     def close(self):
         pass
 
+    def follow_link(self, objs):
+        return objs
+
     def system_service(self):
         return SystemService()
 
@@ -60,26 +64,31 @@ class SystemService(object):
     def vms_service(self):
         return VmsService()
 
+class ClusterService(object):
+    def get(self):
+        return types.Cluster()
+
 class ClustersService(object):
-    def list(self, search=None, case_sensitive=False):
-        return ["Default"]
+    def cluster_service(self, id):
+        return ClusterService()
 
 class DataCentersService(object):
     def list(self, search=None, case_sensitive=False):
-        return []
+        return [types.DataCenter()]
 
 class DiskService(object):
     def __init__(self, disk_id):
         self._disk_id = disk_id
 
     def get(self):
-        return types.Disk()
+        return types.Disk(id=self._disk_id)
 
     def remove(self):
         pass
 
 class DisksService(object):
     def add(self, disk=None):
+        disk.id = "756d81b0-d5c0-41bc-9bbe-b343c3fa3490"
         return disk
 
     def disk_service(self, disk_id):
@@ -89,6 +98,9 @@ class ImageTransferService(object):
     def __init__(self):
         self._finalized = False
 
+    def cancel(self):
+        pass
+
     def get(self):
         if self._finalized:
             raise NotFoundError
@@ -105,11 +117,8 @@ class ImageTransfersService(object):
     def image_transfer_service(self, id):
         return ImageTransferService()
 
-class StorageDomain(object):
-    id = "ba87af68-b630-4211-a73a-694c1a689405"
-
 class StorageDomainsService(object):
-    def list(self, search=None):
+    def list(self, search=None, case_sensitive=False):
         return [ StorageDomain() ]
 
 class VmsService(object):
diff --git a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
index 60ba541cd..0b165c242 100644
--- a/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
+++ b/v2v/test-v2v-o-rhv-upload-module/ovirtsdk4/types.py
@@ -22,12 +22,13 @@ from enum import Enum
 from ovirtsdk4 import imageio_port
 
 class Cluster(object):
-    def __init__(self, name):
-        pass
+    id = "2e97537b-a783-4706-af9e-75cb2e032dcd"
+    name = "Default"
 
 class Configuration(object):
     def __init__(self, type=None, data=None):
         pass
+
 class ConfigurationType(Enum):
     OVA = 'ova'
     OVF = 'ovf'
@@ -71,9 +72,8 @@ class Disk(object):
             sparse = False,
             storage_domains = None
     ):
-        pass
+        self.id = id
 
-    id = "123"
     status = DiskStatus.OK
 
 class ImageTransferPhase(Enum):
@@ -104,7 +104,7 @@ class ImageTransfer(object):
     ):
         pass
 
-    id = "456"
+    id = "e26ac8ab-7090-4d5e-95ad-e707b511a359"
     phase = ImageTransferPhase.TRANSFERRING
     transfer_url = "http://localhost:"; + str(imageio_port) + "/"
 
@@ -116,6 +116,9 @@ class StorageDomain(object):
     def __init__(self, name = None):
         pass
 
+    id = "ba87af68-b630-4211-a73a-694c1a689405"
+    name = "Storage"
+
 class Vm(object):
     def __init__(
             self,
@@ -123,3 +126,9 @@ class Vm(object):
             initialization = None
     ):
         pass
+
+class DataCenter(object):
+    id = "31d8c73b-554b-4958-bb04-9ce97f0849e1"
+    name = "DC"
+    storage_domains = [StorageDomain()]
+    clusters = [Cluster()]
-- 
2.21.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]