Tomas Jelinek has uploaded a new change for review.
Change subject: [RFE] Integrate Smartcard support
......................................................................
[RFE] Integrate Smartcard support
This patch is a VDSM part of the following BZs:
https://bugzilla.redhat.com/588481
https://bugzilla.redhat.com/802736
This VDSM part integrates the smartcard in
a supported way, not just as an unsupported custom hook.
It also removes the smartcard hook itself.
Change-Id: I7cdaef420c8381d588f6215e66e6a80dd9d2e44b
Signed-off-by: Tomas Jelinek <tjelinek(a)redhat.com>
---
M configure.ac
M vdsm.spec.in
M vdsm/libvirtvm.py
M vdsm_hooks/Makefile.am
M vdsm_hooks/README
D vdsm_hooks/smartcard/Makefile.am
D vdsm_hooks/smartcard/README
D vdsm_hooks/smartcard/before_vm_start.py
8 files changed, 15 insertions(+), 72 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/8450/1
diff --git a/configure.ac b/configure.ac
index 450f714..1136239 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,6 @@
vdsm_hooks/qos/Makefile
vdsm_hooks/qemucmdline/Makefile
vdsm_hooks/scratchpad/Makefile
- vdsm_hooks/smartcard/Makefile
vdsm_hooks/smbios/Makefile
vdsm_hooks/sriov/Makefile
vdsm_hooks/vhostmd/Makefile
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 716489a..536aa4f 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -318,14 +318,6 @@
the disk will be erased when the VM destroyed.
VM cannot be migrated when using scratchpad hook
-%package hook-smartcard
-Summary: Smartcard support for Spice protocol in VDSM
-BuildArch: noarch
-
-%description hook-smartcard
-Smartcard hook add support for spice in VDSM.
-Smartcard hook enable user to use its smartcard inside virtual machines.
-
%package hook-smbios
Summary: Adding custom smbios entries to libvirt domain via VDSM
BuildArch: noarch
@@ -863,10 +855,6 @@
%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_scratchpad
%{_libexecdir}/%{vdsm_name}/hooks/before_vm_migrate_source/50_scratchpad
%{_libexecdir}/%{vdsm_name}/hooks/after_vm_destroy/50_scratchpad
-
-%files hook-smartcard
-%defattr(-, root, root, -)
-%{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_smartcard
%files hook-smbios
%defattr(-, root, root, -)
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 64a3b6b..bd1de6d 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -782,6 +782,18 @@
input.setAttribute('bus', 'ps2')
self._devices.appendChild(input)
+ def appendSmartcard(self):
+ """
+ Add smartcard section to domain xml
+
+ <smartcard mode='passthrough' type='spicevmc'/>
+ """
+ if self.conf['is_smartcard_enabled'] == 'true':
+ card = self.doc.createElement('smartcard')
+ card.setAttribute('mode', 'passthrough')
+ card.setAttribute('type', 'spicevmc')
+ self._devices.appendChild(card)
+
def appendGraphics(self):
"""
Add graphics section to domain xml.
@@ -1240,6 +1252,7 @@
_QEMU_GA_DEVICE_NAME)
domxml.appendInput()
domxml.appendGraphics()
+ domxml.appendSmartcard()
domxml.appendConsole()
for devType in self._devices:
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index e6a8280..56f714f 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -36,7 +36,6 @@
promisc \
qos \
scratchpad \
- smartcard \
smbios \
sriov \
vmdisk
diff --git a/vdsm_hooks/README b/vdsm_hooks/README
index b45b93e..1659610 100644
--- a/vdsm_hooks/README
+++ b/vdsm_hooks/README
@@ -24,7 +24,7 @@
If you want to enable more then one custom hook use the semicolon as
a separator:
- # rhevm-config -s
UserDefinedVMProperties='pincpu=^[0-9]+$;smartcard=^(true|false)$' --cver=3.0
+ # rhevm-config -s
UserDefinedVMProperties='pincpu=^[0-9]+$;sap_agent=^(true|false)$' --cver=3.0
The convention is [hook name]=[value], the value is evaluate with regular expression,
If you find regular expression too complex, you can always use the following command:
@@ -47,7 +47,7 @@
pincpu=1
if you want to use more then on hook and you did enable it with the rhevm-config
tool, you can use the semicolon as a separator:
- pincpu=1;smartcard=true
+ pincpu=1;sap_agent=true
b. Another option is to use "Run Once" dialog which mean that you add a
custom property
only this time to the VM, next time that you run the VM it will run without the
custom property that you provided.
diff --git a/vdsm_hooks/smartcard/Makefile.am b/vdsm_hooks/smartcard/Makefile.am
deleted file mode 100644
index dfefff5..0000000
--- a/vdsm_hooks/smartcard/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2008 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-EXTRA_DIST = \
- before_vm_start.py
-
-install-data-local:
- $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
- $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
- $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_smartcard
-
-uninstall-local:
- $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_smartcard
diff --git a/vdsm_hooks/smartcard/README b/vdsm_hooks/smartcard/README
deleted file mode 100644
index bd376bf..0000000
--- a/vdsm_hooks/smartcard/README
+++ /dev/null
@@ -1,9 +0,0 @@
-smartcard hook:
-===============
-add smartcard support for spice
-
-syntax:
-smartcard: smartcard=true
-
-libvirt xml:
-<smartcard mode='passthrough' type='spicevmc'/>
diff --git a/vdsm_hooks/smartcard/before_vm_start.py
b/vdsm_hooks/smartcard/before_vm_start.py
deleted file mode 100755
index 07e52e7..0000000
--- a/vdsm_hooks/smartcard/before_vm_start.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/python
-
-import os
-import sys
-import hooking
-import traceback
-
-'''
-smartcard vdsm hook
-adding to domain xml
-<smartcard mode='passthrough' type='spicevmc'/>
-'''
-
-if os.environ.has_key('smartcard'):
- try:
- sys.stderr.write('smartcard: adding smartcard support\n')
- domxml = hooking.read_domxml()
-
- devices = domxml.getElementsByTagName('devices')[0]
- card = domxml.createElement('smartcard')
- card.setAttribute('mode', 'passthrough')
- card.setAttribute('type', 'spicevmc')
-
- devices.appendChild(card)
-
- hooking.write_domxml(domxml)
- except:
- sys.stderr.write('smartcard: [unexpected error]: %s\n' %
traceback.format_exc())
- sys.exit(2)
--
To view, visit
http://gerrit.ovirt.org/8450
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cdaef420c8381d588f6215e66e6a80dd9d2e44b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjelinek(a)redhat.com>