Change in vdsm[master]: storage: block: getChildren: Do not count uninit LVs as chil...
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: storage: block: getChildren: Do not count uninit LVs as children
......................................................................
storage: block: getChildren: Do not count uninit LVs as children
Any LV with the tag TAG_VOL_UNINIT is not a real volume yet. It is
either in the process of being created or deleted. It should not appear
in the children list of its parent until the tag is removed.
Change-Id: I03e489df8478de26b01ce34f41e87aecc04512ed
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockVolume.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/44571/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index ee531f3..51f60ea 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -183,7 +183,8 @@
"""
lvs = lvm.lvsByTag(self.sdUUID,
"%s%s" % (TAG_PREFIX_PARENT, self.volUUID))
- return tuple(lv.name for lv in lvs)
+
+ return tuple(lv.name for lv in lvs if TAG_VOL_UNINIT not in lv.tags)
def getImage(self):
"""
--
To view, visit https://gerrit.ovirt.org/44571
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I03e489df8478de26b01ce34f41e87aecc04512ed
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: Garbage volumes are not part of an image
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: Garbage volumes are not part of an image
......................................................................
Garbage volumes are not part of an image
Change-Id: I8776a4b48cc8d16f420426fb28d4696b6f2bf357
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockVolume.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/44830/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 9baa3d2..af11725 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -334,7 +334,7 @@
(template)
"""
lvs = lvm.lvsByTag(sdUUID, "%s%s" % (TAG_PREFIX_IMAGE, imgUUID))
- return [lv.name for lv in lvs]
+ return [lv.name for lv in lvs if TAG_VOL_GARBAGE not in lv.tags]
@logskip("ResourceManager")
def llPrepare(self, rw=False, setrw=False):
--
To view, visit https://gerrit.ovirt.org/44830
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8776a4b48cc8d16f420426fb28d4696b6f2bf357
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: testing: Add support for failure injection
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: testing: Add support for failure injection
......................................................................
testing: Add support for failure injection
Change-Id: I30e562383fb08c4eeeeb91cca33d44a80bbff7f1
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/misc.py
M vdsm/storage/storage_exception.py
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/44831/1
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index b14fd26..c53f46d 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -1007,3 +1007,8 @@
def deprecated(f):
"""Used to mark exported methods as deprecated"""
return f
+
+
+def maybe_fail(chance=0.1):
+ if chance != 0 and random.random() <= chance:
+ raise se.InjectedFailure()
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 3a4d33f..4ca0b56 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1724,3 +1724,8 @@
code = 855
message = ("Could not acquire resource. "
"Probably resource factory threw an exception.")
+
+
+class InjectedFailure(GeneralException):
+ code = 999
+ message = "Injected Failure"
--
To view, visit https://gerrit.ovirt.org/44831
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30e562383fb08c4eeeeb91cca33d44a80bbff7f1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: inject failures into create container
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: inject failures into create container
......................................................................
inject failures into create container
Change-Id: I1fb5f18be6434ee21ac7550fe14c166b5e82b11e
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/sdm.py
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/44832/1
diff --git a/vdsm/storage/sdm.py b/vdsm/storage/sdm.py
index 7a53e04..af4d479 100644
--- a/vdsm/storage/sdm.py
+++ b/vdsm/storage/sdm.py
@@ -31,6 +31,8 @@
from vdsm import qemuimg
+from misc import maybe_fail
+
log = logging.getLogger('sdm')
rmanager = rm.ResourceManager.getInstance()
@@ -43,40 +45,58 @@
def create_volume_container(dom_manifest, img_id, size, vol_format, disk_type,
vol_id, desc, src_img_id, src_vol_id):
+ maybe_fail(0.005)
hostId = get_domain_host_id(dom_manifest.sdUUID)
+ maybe_fail(0.02)
dom_manifest.acquireDomainLock(hostId)
imageResourcesNamespace = sd.getNamespace(dom_manifest.sdUUID,
IMAGE_NAMESPACE)
try:
+ maybe_fail(0.02)
with rmanager.acquireResource(imageResourcesNamespace, img_id,
rm.LockType.exclusive):
+ maybe_fail(0.02)
image_manifest = ImageManifest(dom_manifest.getRepoPath())
+ maybe_fail(0.02)
img_path = image_manifest.create_image_dir(dom_manifest.sdUUID,
img_id)
+ maybe_fail(0.02)
vol_parent_md = None
+ maybe_fail(0.02)
if src_vol_id != volume.BLANK_UUID:
+ maybe_fail(0.02)
# When the src_img_id isn't specified we assume it's the same
# as img_id
if src_img_id == volume.BLANK_UUID:
+ maybe_fail(0.02)
src_img_id = img_id
+ maybe_fail(0.02)
vol_parent_md = dom_manifest.produceVolume(src_img_id,
src_vol_id)
+ maybe_fail(0.02)
size = vol_parent_md.getSize()
+ maybe_fail(0.02)
dom_manifest.create_volume_artifacts(img_id, vol_id, size,
vol_format, disk_type,
desc, src_vol_id)
+ maybe_fail(0.02)
if src_vol_id != volume.BLANK_UUID:
+ maybe_fail(0.02)
_prepare_volume_for_parenthood(vol_parent_md, src_img_id,
src_vol_id, img_id, img_path)
+ maybe_fail(0.02)
# TODO: get actual size from create_volume_artifacts retval
size = volume.VolumeMetadata.adjust_new_volume_size(
dom_manifest, img_id, vol_id, size, vol_format)
+ maybe_fail(0.02)
vol_path = os.path.join(img_path, vol_id)
+ maybe_fail(0.02)
_initialize_volume_contents(img_id, vol_id, vol_path, vol_format,
size, vol_parent_md)
+ maybe_fail(0.02)
dom_manifest.commit_volume_artifacts(img_path, img_id, vol_id)
finally:
dom_manifest.releaseDomainLock()
--
To view, visit https://gerrit.ovirt.org/44832
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fb5f18be6434ee21ac7550fe14c166b5e82b11e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: blockVolume: Add classmethod helper to clear a metadata slot
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: blockVolume: Add classmethod helper to clear a metadata slot
......................................................................
blockVolume: Add classmethod helper to clear a metadata slot
Change-Id: I338f3fe5f232b1e6e7e8a2474efabcf56333e1cc
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockVolume.py
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/44833/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 79061e5..c6c3938 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -296,16 +296,17 @@
# tags
self.setMetaParam(volume.IMAGE, imgUUID)
- def removeMetadata(self, metaId):
- """
- Just wipe meta.
- """
+ @classmethod
+ def clearMetadataSlot(cls, metaId):
try:
- self._putMetadata(metaId, {"NONE": "#" * (sd.METASIZE - 10)})
+ cls._putMetadata(metaId, {"NONE": "#" * (sd.METASIZE - 10)})
except Exception as e:
- self.log.error(e, exc_info=True)
+ cls.log.exception(e)
raise se.VolumeMetadataWriteError("%s: %s" % (metaId, e))
+ def removeMetadata(self, metaId):
+ self.clearMetadataSlot(metaId)
+
@classmethod
def newVolumeLease(cls, metaId, sdUUID, volUUID):
cls.log.debug("Initializing volume lease volUUID=%s sdUUID=%s, "
--
To view, visit https://gerrit.ovirt.org/44833
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I338f3fe5f232b1e6e7e8a2474efabcf56333e1cc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: vm: Cleaner vm stats thread initialization
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: vm: Cleaner vm stats thread initialization
......................................................................
vm: Cleaner vm stats thread initialization
The vm stats thread was initialized too late, leading to unneeded checks
and unclear try except blocks when trying to stop the thread.
This patch changes AdvancedStatsThread so it keeps a thread instance
instead of inheriting from Thread, and initialize it in Vm.__init__, so
it is always available when we access it.
Change-Id: I2917de42b76ee3dc8b27bdc23b33f3c984a7cc68
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/sampling.py
M vdsm/virt/vm.py
2 files changed, 11 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/39299/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 3206b97..848bb36 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -401,7 +401,7 @@
return self._samples.last()
-class AdvancedStatsThread(threading.Thread):
+class AdvancedStatsThread(object):
"""
A thread that runs the registered AdvancedStatsFunction objects
for statistic and monitoring purpose.
@@ -412,9 +412,8 @@
"""
Initialize an AdvancedStatsThread object
"""
- threading.Thread.__init__(self)
self.daemon = daemon
-
+ self._thread = None
self._log = log
self._stopEvent = threading.Event()
self._contEvent = threading.Event()
@@ -426,7 +425,7 @@
"""
Register the functions listed as arguments
"""
- if self.isAlive():
+ if self._thread is not None:
raise RuntimeError("AdvancedStatsThread is started")
for statsFunction in args:
@@ -437,7 +436,9 @@
Start the execution of the thread and exit
"""
self._log.debug("Start statistics collection")
- threading.Thread.start(self)
+ self._thread = threading.Thread(target=self._run)
+ self._thread.daemon = self.daemon
+ self._thread.start()
def stop(self):
"""
@@ -464,7 +465,7 @@
def getLastSampleTime(self):
return self._statsTime
- def run(self):
+ def _run(self):
self._log.debug("Stats thread started")
self._contEvent.set()
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 28054bf..1bc04e7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -779,7 +779,7 @@
self._initTimeRTC = long(self.conf.get('timeOffset', 0))
self._guestEvent = vmstatus.POWERING_UP
self._guestEventTime = 0
- self._vmStats = None
+ self._vmStats = VmStatsThread(self)
self._guestCpuRunning = False
self._guestCpuLock = threading.Lock()
self._startTime = time.time() - \
@@ -1269,7 +1269,7 @@
return
toSave = self.status()
toSave['startTime'] = self._startTime
- if self.lastStatus != vmstatus.DOWN and self._vmStats:
+ if self.lastStatus != vmstatus.DOWN:
guestInfo = self.guestAgent.getGuestInfo()
toSave['username'] = guestInfo['username']
toSave['guestIPs'] = guestInfo['guestIPs']
@@ -1758,7 +1758,7 @@
decStats = {}
try:
- if self._vmStats and self._vmStats.getLastSampleTime() is not None:
+ if self._vmStats.getLastSampleTime() is not None:
decStats = self._vmStats.get()
self._setUnresponsiveIfTimeout(
stats,
@@ -2001,19 +2001,11 @@
return domxml.toxml()
def startVmStats(self):
- self._vmStats = VmStatsThread(self)
self._vmStats.start()
self._guestEventTime = self._startTime
def stopVmStats(self):
- # this is less clean that it could be, but we can get here from
- # many flows and with various locks held
- # (_releaseLock, _shutdownLock)
- # _vmStats may be None already, and we're good with that.
- try:
- self._vmStats.stop()
- except AttributeError:
- pass
+ self._vmStats.stop()
@staticmethod
def _guestSockCleanup(sock):
--
To view, visit https://gerrit.ovirt.org/39299
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2917de42b76ee3dc8b27bdc23b33f3c984a7cc68
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: xmlrpc: retry when flushing socket
by Piotr Kliczewski
Piotr Kliczewski has uploaded a new change for review.
Change subject: xmlrpc: retry when flushing socket
......................................................................
xmlrpc: retry when flushing socket
m2crypto requires retry of write and we need to make sure that we do it once
flushing data before closing a socket. In order to do so we need to move
original implementation to our code base.
Bug-Url: https://bugzilla.redhat.com/1261255
Change-Id: I52dd6ad304a82ff6c8d3dff12a38269684abf055
Signed-off-by: pkliczewski <piotr.kliczewski(a)gmail.com>
---
M vdsm/rpc/bindingxmlrpc.py
1 file changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/47637/2
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index c521cd8..9f77457 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -25,6 +25,7 @@
import libvirt
import threading
import re
+import socket
import sys
from vdsm.password import (ProtectedPassword,
@@ -33,6 +34,7 @@
from vdsm import utils
from vdsm import xmlrpc
from vdsm.define import doneCode, errCode
+from vdsm.m2cutils import SSL
from vdsm.netinfo import getDeviceByIP
import API
from vdsm.exception import VdsmException
@@ -288,7 +290,23 @@
return r
def finish(self):
- xmlrpc.IPXMLRPCRequestHandler.finish(self)
+ if not self.wfile.closed:
+ while True:
+ try:
+ self.wfile.flush()
+ break
+ except socket.error:
+ # An final socket error may have occurred here,
+ # such as the local error ECONNABORTED.
+ break
+ except SSL.SSLError as e:
+ if e.message == 'bad write retry':
+ continue
+ else:
+ break
+
+ self.wfile.close()
+ self.rfile.close()
threadLocal.client = None
threadLocal.server = None
threadLocal.flowID = None
--
To view, visit https://gerrit.ovirt.org/47637
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52dd6ad304a82ff6c8d3dff12a38269684abf055
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: automation(a)ovirt.org
7 years, 8 months
Change in vdsm[master]: virt net: Support VM migration on OVS based networks
by edwardh@redhat.com
Edward Haas has uploaded a new change for review.
Change subject: virt net: Support VM migration on OVS based networks
......................................................................
virt net: Support VM migration on OVS based networks
With the introduction of OVS as a network implementation, the migration
of VM/s betweeni hosts requires special handling.
This patch enables VM/s to migrate between networks of the same king or
mixed.
Change-Id: Ie7d32f9605f9ca99d1e07062108f2567806ac59c
Signed-off-by: Edward Haas <edwardh(a)redhat.com>
---
M vdsm.spec.in
M vdsm/virt/Makefile.am
M vdsm/virt/libvirt-hook.sh
A vdsm/virt/vm_migrate_hook.py
4 files changed, 166 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/59645/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index a99edf8..c1818ba 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -947,6 +947,7 @@
%{_datadir}/%{vdsm_name}/virt/recovery.py*
%{_datadir}/%{vdsm_name}/virt/vmtune.py*
%{_datadir}/%{vdsm_name}/virt/vm.py*
+%{_datadir}/%{vdsm_name}/virt/vm_migrate_hook.py*
%{_datadir}/%{vdsm_name}/virt/vmxml.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/__init__.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/common.py*
@@ -979,6 +980,7 @@
%{_libexecdir}/%{vdsm_name}/ovirt_functions.sh
%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
%{_libexecdir}/%{vdsm_name}/vdsmd_init_common.sh
+%{_libexecdir}/%{vdsm_name}/vm_migrate_hook.py
%{_libexecdir}/%{vdsm_name}/kvm2ovirt
%{_libexecdir}/%{vdsm_name}/wait_for_ipv4s
%{_datadir}/%{vdsm_name}/supervdsm_api/__init__.py*
diff --git a/vdsm/virt/Makefile.am b/vdsm/virt/Makefile.am
index a178fe1..89835af 100644
--- a/vdsm/virt/Makefile.am
+++ b/vdsm/virt/Makefile.am
@@ -29,10 +29,15 @@
migration.py \
recovery.py \
vm.py \
+ vm_migrate_hook.py \
vmtune.py \
vmxml.py \
$(NULL)
+dist_vdsmexec_SCRIPTS = \
+ vm_migrate_hook.py \
+ $(NULL)
+
EXTRA_DIST = \
libvirt-hook.sh \
$(NULL)
diff --git a/vdsm/virt/libvirt-hook.sh b/vdsm/virt/libvirt-hook.sh
index 9a2692a..01daf6e 100644
--- a/vdsm/virt/libvirt-hook.sh
+++ b/vdsm/virt/libvirt-hook.sh
@@ -17,7 +17,9 @@
# Fix VMs migrating to host with libvirt >= 1.2.8
# See https://bugzilla.redhat.com/show_bug.cgi?id=1138340
-if [ -x /usr/libexec/vdsm/ovs_migrate.py ]; then
+if [ -x /usr/libexec/vdsm/vm_migrate_hook.py ]; then
+ sed -e 's|<min_guarantee[^>]*>[0-9 ]*</min_guarantee>||g' | /usr/libexec/vdsm/vm_migrate_hook.py $DOMAIN $EVENT $PHASE
+elif [ -x /usr/libexec/vdsm/ovs_migrate.py ]; then
sed -e 's|<min_guarantee[^>]*>[0-9 ]*</min_guarantee>||g' | /usr/libexec/vdsm/ovs_migrate.py $DOMAIN $EVENT $PHASE
else
sed -e 's|<min_guarantee[^>]*>[0-9 ]*</min_guarantee>||g'
diff --git a/vdsm/virt/vm_migrate_hook.py b/vdsm/virt/vm_migrate_hook.py
new file mode 100755
index 0000000..de4737f
--- /dev/null
+++ b/vdsm/virt/vm_migrate_hook.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+# Copyright 2016 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+from __future__ import print_function
+
+import sys
+import xml.etree.cElementTree as ET
+
+from vdsm import jsonrpcvdscli
+from vdsm.config import config
+from vdsm.network import api as net_api
+
+
+_DEBUG_MODE = False
+
+if _DEBUG_MODE:
+ LOG_FILE = '/tmp/libvirthook_ovs_migrate.log'
+ log = open(LOG_FILE, 'w')
+
+
+def main(domain, event, phase, *args, **kwargs):
+ if event not in ('migrate', 'restore'):
+ sys.exit(0)
+
+ if _DEBUG_MODE:
+ print('Hook input args are: ', domain, event, phase, file=log)
+
+ stdin = kwargs.get('stdin', sys.stdin)
+
+ tree = ET.parse(stdin)
+ _process_domxml(tree)
+
+ stdout = kwargs.get('stdout', sys.stdout)
+ tree.write(stdout)
+
+ if _DEBUG_MODE:
+ tree.write(log)
+ print('\nEnd of hook', file=log)
+
+
+def _process_domxml(tree):
+ root = tree.getroot()
+ vm_uuid = root.find('uuid')
+ devices = root.find('devices')
+
+ target_vm_info, = _vmlist(_vdscli(), vm_id=vm_uuid)
+
+ _set_graphics(devices, target_vm_info)
+
+ target_vm_nets_by_mac = [{dev['macAddr']: dev['network']}
+ for dev in target_vm_info['devices']
+ if dev['type'] == 'interface']
+
+ for interface in devices.findall('interface'):
+ if interface.get('type') == 'bridge':
+ _bind_iface_to_bridge(interface, target_vm_nets_by_mac)
+
+
+def _bind_iface_to_bridge(interface, target_vm_nets_by_mac):
+ elem_macaddr = interface.find('mac')
+ mac_addr = elem_macaddr.get('address')
+
+ target_vm_net = target_vm_nets_by_mac[mac_addr]
+ target_ovs_bridge = net_api.ovs_bridge(target_vm_net)
+ if target_ovs_bridge:
+ _bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net)
+ else:
+ _bind_iface_to_linux_bridge(interface, target_vm_net)
+
+
+def _bind_iface_to_ovs_bridge(interface, target_ovs_bridge, target_vm_net):
+ _set_source_bridge(interface, target_ovs_bridge)
+ _set_virtualport(interface)
+
+ vlan_tag = net_api.net2vlan(target_vm_net)
+ if vlan_tag:
+ _set_vlan(interface, vlan_tag)
+
+
+def _set_vlan(interface, vlan_tag):
+ elem_vlan = interface.find('vlan')
+ if elem_vlan is None:
+ elem_vlan = ET.SubElement(interface, 'vlan')
+ elem_tag = ET.SubElement(elem_vlan, 'tag')
+ elem_tag.set('id', str(vlan_tag))
+
+
+def _set_virtualport(interface):
+ elem_virtualport = interface.find('virtualport')
+ if elem_virtualport is None:
+ elem_virtualport = ET.SubElement(interface, 'virtualport')
+ elem_virtualport.set('type', 'openvswitch')
+ elem_virtualport.tail = ' '
+
+
+def _bind_iface_to_linux_bridge(interface, target_linux_bridge):
+ _set_source_bridge(interface, target_linux_bridge)
+
+ elem_virtualport = interface.find('virtualport')
+ if elem_virtualport is not None:
+ interface.remove(elem_virtualport)
+
+ elem_vlan = interface.find('vlan')
+ if elem_vlan is not None:
+ interface.remove(elem_vlan)
+
+
+def _set_source_bridge(interface, bridge):
+ elem_source = interface.find('source')
+ elem_source.set('bridge', bridge)
+
+
+def _set_graphics(devices, target_vm_info):
+ graphics = devices.find('graphics')
+ graphics_listen = graphics.find('listen')
+
+ target_display_network = target_vm_info['displayNetwork']
+
+ if net_api.ovs_bridge(target_display_network):
+ graphics_listen.set('type', 'address')
+ graphics_listen.set('address', target_vm_info['displayIp'])
+ else:
+ libvirt_network = net_api.netname_o2l(target_display_network)
+ graphics_listen.set('type', 'network')
+ graphics_listen.set('network', libvirt_network)
+
+
+def _vmlist(vdscli, vm_id=None):
+ result = vdscli.fullList(fullStatus=True, vmList=(vm_id,) if vm_id else ())
+ return result['items']
+
+
+def _vdscli():
+ requestQueues = config.get('addresses', 'request_queues')
+ requestQueue = requestQueues.split(",")[0]
+ return jsonrpcvdscli.connect(requestQueue)
+
+
+if __name__ == '__main__':
+ main(*sys.argv[1:])
--
To view, visit https://gerrit.ovirt.org/59645
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7d32f9605f9ca99d1e07062108f2567806ac59c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: fix remove: iterate while del
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: fix remove: iterate while del
......................................................................
fix remove: iterate while del
Change-Id: I594c98cf54ed93d045b76df1c6faa5122277b19e
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/44572/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 74bf82d..832fb8b 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -201,8 +201,8 @@
vols = _getVolsTree(sdUUID)
# Remove volumes awaiting garbage collection from the result
- for vol_id in vols.iterkeys():
- if vols[vol_id].garbage_meta_id is not None:
+ for vol_id, vol_info in vols.items():
+ if vol_info.garbage_meta_id is not None:
del vols[vol_id]
res = {}
--
To view, visit https://gerrit.ovirt.org/44572
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I594c98cf54ed93d045b76df1c6faa5122277b19e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: storage: Do not count garbage volumes as children
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: storage: Do not count garbage volumes as children
......................................................................
storage: Do not count garbage volumes as children
Change-Id: Ice3c70249cbc3577b239bd11d224955f2e29b211
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/blockVolume.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/44573/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 51f60ea..9baa3d2 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -184,7 +184,7 @@
lvs = lvm.lvsByTag(self.sdUUID,
"%s%s" % (TAG_PREFIX_PARENT, self.volUUID))
- return tuple(lv.name for lv in lvs if TAG_VOL_UNINIT not in lv.tags)
+ return tuple(lv.name for lv in lvs if TAG_VOL_GARBAGE not in lv.tags)
def getImage(self):
"""
--
To view, visit https://gerrit.ovirt.org/44573
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice3c70249cbc3577b239bd11d224955f2e29b211
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months