Francesco Romani has uploaded a new change for review.
Change subject: vmxml: export container metadata
......................................................................
vmxml: export container metadata
Add a metadata tags to let Engine specifiy the container
specific parameters, using custom properties.
This way we don't require changes to the Engine UI.
The metadata we add is about:
- container runtime type to use (rkt, runc...).
- mapping between VM drives and container volumes
- the image to run, to let users freely
experiment with the public repositories.
Change-Id: I1ade3c0c7d300c5ce33cb23723c3d0e59e4af664
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vmxml.py
1 file changed, 31 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/60481/1
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index 4b5edd5..cc14770 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -23,13 +23,18 @@
import xml.dom.minidom
import xml.etree.ElementTree as etree
+import six
+
from vdsm import constants
+from vdsm import convirtconnection
from vdsm import cpuarch
from vdsm import utils
+
METADATA_VM_TUNE_URI = 'http://ovirt.org/vm/tune/1.0'
METADATA_VM_TUNE_ELEMENT = 'qos'
METADATA_VM_TUNE_PREFIX = 'ovirt'
+
_BOOT_MENU_TIMEOUT = 10000 # milliseconds
@@ -243,12 +248,26 @@
metadata = Element('metadata')
self._appendMetadataQOS(metadata)
+ self._appendMetadataContainer(metadata)
self.dom.appendChild(metadata)
def _appendMetadataQOS(self, metadata):
qos = Element(METADATA_VM_TUNE_PREFIX + ':' + METADATA_VM_TUNE_ELEMENT)
qos.setAttr('xmlns:' + METADATA_VM_TUNE_PREFIX, METADATA_VM_TUNE_URI)
metadata.appendChild(qos)
+
+ def _appendMetadataContainer(self, metadata):
+ custom = self.conf.get('custom', {})
+ container_type = custom.get('containerType')
+ if not container_type:
+ return
+
+ container_image = custom.get('containerImage')
+ drive_map = find_drive_mapping(self.conf.get('custom', {}))
+
+ convirtconnection.append_metadata(
+ Element, metadata, container_type, container_image, drive_map,
+ )
def appendOs(self, use_serial_console=False):
"""
@@ -554,3 +573,15 @@
def _getMaxVCpus(self):
return self.conf.get('maxVCpus', self._getSmp())
+
+
+def find_drive_mapping(custom):
+ drive_mapping = {}
+ for key, value in six.iteritems(custom):
+ if key.startswith('volume:'):
+ try:
+ tag, name = key.split(':', 1)
+ except ValueError:
+ continue
+ drive_mapping[name.strip()] = value.strip()
+ return drive_mapping
--
To view, visit
https://gerrit.ovirt.org/60481
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ade3c0c7d300c5ce33cb23723c3d0e59e4af664
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>