Provide a way to know which disk image to use for the sandbox depending on the used
source
DockerSource will need to locate the topmost disk image among all the layers images
---
virt-sandbox-image/sources/DockerSource.py | 9 +++++++++
virt-sandbox-image/sources/Source.py | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/virt-sandbox-image/sources/DockerSource.py
b/virt-sandbox-image/sources/DockerSource.py
index 2f4646f..74feb3e 100644
--- a/virt-sandbox-image/sources/DockerSource.py
+++ b/virt-sandbox-image/sources/DockerSource.py
@@ -385,6 +385,15 @@ class DockerSource(Source):
parent = None
imagetagid = parent
+ def get_disk(self,**args):
+ name = args['name']
+ destdir = args['path']
+ imageList = self._get_image_list(name,destdir)
+ toplayer = imageList[0]
+ diskfile = destdir + "/" + toplayer + "/template.qcow2"
+ configfile = destdir + "/" + toplayer + "/template.json"
+ return (diskfile,configfile)
+
def get_command(self,configfile):
configParser = DockerConfParser(configfile)
commandToRun = configParser.getRunCommand()
diff --git a/virt-sandbox-image/sources/Source.py b/virt-sandbox-image/sources/Source.py
index 01f8560..6e2f5fb 100644
--- a/virt-sandbox-image/sources/Source.py
+++ b/virt-sandbox-image/sources/Source.py
@@ -45,3 +45,7 @@ class Source():
@abstractmethod
def get_command(self,**args):
pass
+
+ @abstractmethod
+ def get_disk(self,**args):
+ pass
--
2.1.0