296 (c5339030e64781bf8f0d80ab7c5044b5547df79b) 296 (b6aed193e5ecca32bb07e062f58f0daca06e7009)
1#!/usr/bin/env python3
2# group: rw
3#
4# Test case for encryption key management versus image sharing
5#
6# Copyright (C) 2019 Red Hat, Inc.
7#
8# This program is free software; you can redistribute it and/or modify

--- 47 unchanged lines hidden (view full) ---

56 self.vm1 = iotests.VM(path_suffix = 'VM1')
57 self.vm2 = iotests.VM(path_suffix = 'VM2')
58 self.vm1.launch()
59 self.vm2.launch()
60
61 # create the secrets and load 'em into the VMs
62 self.secrets = [ Secret(i) for i in range(0, 4) ]
63 for secret in self.secrets:
1#!/usr/bin/env python3
2# group: rw
3#
4# Test case for encryption key management versus image sharing
5#
6# Copyright (C) 2019 Red Hat, Inc.
7#
8# This program is free software; you can redistribute it and/or modify

--- 47 unchanged lines hidden (view full) ---

56 self.vm1 = iotests.VM(path_suffix = 'VM1')
57 self.vm2 = iotests.VM(path_suffix = 'VM2')
58 self.vm1.launch()
59 self.vm2.launch()
60
61 # create the secrets and load 'em into the VMs
62 self.secrets = [ Secret(i) for i in range(0, 4) ]
63 for secret in self.secrets:
64 result = self.vm1.qmp("object-add", secret.to_qmp_object())
65 self.assert_qmp(result, 'return', {})
66 result = self.vm2.qmp("object-add", secret.to_qmp_object())
67 self.assert_qmp(result, 'return', {})
64 self.vm1.cmd("object-add", secret.to_qmp_object())
65 self.vm2.cmd("object-add", secret.to_qmp_object())
68
69 # test case shutdown
70 def tearDown(self):
71 # stop the VM
72 self.vm1.shutdown()
73 self.vm2.shutdown()
74
75 ###########################################################################

--- 51 unchanged lines hidden (view full) ---

127 'key-secret' : secret.id(),
128 'file': {
129 'driver': 'file',
130 'filename': test_img,
131 }
132 }
133
134 if reOpen:
66
67 # test case shutdown
68 def tearDown(self):
69 # stop the VM
70 self.vm1.shutdown()
71 self.vm2.shutdown()
72
73 ###########################################################################

--- 51 unchanged lines hidden (view full) ---

125 'key-secret' : secret.id(),
126 'file': {
127 'driver': 'file',
128 'filename': test_img,
129 }
130 }
131
132 if reOpen:
135 result = vm.qmp(command, options=[opts])
136 self.assert_qmp(result, 'return', {})
133 vm.cmd(command, options=[opts])
137 else:
134 else:
138 result = vm.qmp(command, opts)
139 self.assert_qmp(result, 'return', {})
135 vm.cmd(command, opts)
140
141
142 ###########################################################################
143 # add virtio-blk consumer for a block device
144 def addImageUser(self, vm, id, disk_id, share_rw=False):
145 result = vm.qmp('device_add', {
146 'driver': 'virtio-blk',
147 'id': id,
148 'drive': disk_id,
149 'share-rw' : share_rw
150 }
151 )
152
153 iotests.log(result)
154
155 # close the encrypted block device
156 def closeImageQmp(self, vm, id):
136
137
138 ###########################################################################
139 # add virtio-blk consumer for a block device
140 def addImageUser(self, vm, id, disk_id, share_rw=False):
141 result = vm.qmp('device_add', {
142 'driver': 'virtio-blk',
143 'id': id,
144 'drive': disk_id,
145 'share-rw' : share_rw
146 }
147 )
148
149 iotests.log(result)
150
151 # close the encrypted block device
152 def closeImageQmp(self, vm, id):
157 result = vm.qmp('blockdev-del', {'node-name': id})
158 self.assert_qmp(result, 'return', {})
153 vm.cmd('blockdev-del', {'node-name': id})
159
160 ###########################################################################
161
162 # add a key to an encrypted block device
163 def addKeyQmp(self, vm, id, new_secret):
164
165 args = {
166 'node-name': id,

--- 118 unchanged lines hidden ---
154
155 ###########################################################################
156
157 # add a key to an encrypted block device
158 def addKeyQmp(self, vm, id, new_secret):
159
160 args = {
161 'node-name': id,

--- 118 unchanged lines hidden ---