Change in vdsm[ovirt-3.6]: vm: Libvirt quering after disk detach operation addition.
by aaviram@redhat.com
Hello Nir Soffer, Francesco Romani,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/45646
to review the following change.
Change subject: vm: Libvirt quering after disk detach operation addition.
......................................................................
vm: Libvirt quering after disk detach operation addition.
As stated in libvirt documentary, after detaching a device using
virDomainDetachDeviceFlags, we need to verify that this device
has actually been detached.
Currently we use virDomainDetachDevice. However- That function behaves
the same in that matter. (Currently it is not documented at libvirt's
API docs- but after contacting libvirt's guys it turned out that this
is true. Bug 1257280 opened for fixing the documentation.)
Not verifying that the device was detached, as mentioned above, cause
various problems, as hotunplugDisk could return a success result
while it did not actually succeeds to detach the disk.
This patch adds this functionallity to hotunplugDisk, and after some
timeout fails the operation if the disk was not detached.
Change-Id: I393ce55dd761ac825cb96bd499976fd74c366b09
Bug-Url: https://bugzilla.redhat.com/1044466
Signed-off-by: Amit Aviram <aaviram(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/45138
Continuous-Integration: Jenkins CI
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/virt/vm.py
2 files changed, 43 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/45646/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 8f2e519..cc35b9f 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -143,6 +143,9 @@
'command, 30 secs is a nice default. Set to 300 if the vm is '
'expected to freeze during cluster failover.'),
+ ('hotunplug_timeout', '30',
+ 'Time to wait (in seconds) for a VM to detach its disk'),
+
('vm_watermark_interval', '2',
'How often should we sample each vm for statistics (seconds).'),
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 2f245e6..a398fe6 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -29,6 +29,7 @@
import threading
import time
import uuid
+import xml.etree.ElementTree as ET
# 3rd party libs imports
import libvirt
@@ -190,6 +191,10 @@
class StorageUnavailableError(Exception):
+ pass
+
+
+class HotunplugTimeout(Exception):
pass
@@ -2591,6 +2596,10 @@
params=drive.custom)
try:
self._dom.detachDevice(driveXml)
+ self._waitForDriveRemoval(drive)
+ except HotunplugTimeout as e:
+ self.log.error("%s", e)
+ return response.error('hotunplugDisk', "%s" % e)
except libvirt.libvirtError as e:
self.log.exception("Hotunplug failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
@@ -2613,6 +2622,37 @@
return {'status': doneCode, 'vmList': self.status()}
+ def _waitForDriveRemoval(self, drive):
+ """
+ As stated in libvirt documentary, after detaching a device using
+ virDomainDetachDeviceFlags, we need to verify that this device
+ has actually been detached:
+ libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceFlags
+
+ This function waits for the disk device to be detached.
+
+ Currently we use virDomainDetachDevice. However- That function behaves
+ the same in that matter. (Currently it is not documented at libvirt's
+ API docs- but after contacting libvirt's guys it turned out that this
+ is true. Bug 1257280 opened for fixing the documentation.)
+ TODO: remove this comment when the documentation will be fixed.
+
+ :param drive: The drive that should be detached.
+ """
+ self.log.debug("Waiting for hotunplug to finish")
+ with utils.stopwatch("Hotunplug disk %s" % drive.name):
+ deadline = (utils.monotonic_time() +
+ config.getint('vars', 'hotunplug_timeout'))
+ while self._isDriveAttached(drive):
+ time.sleep(1)
+ if utils.monotonic_time() > deadline:
+ raise HotunplugTimeout("Timeout detaching drive %s"
+ % drive.name)
+
+ def _isDriveAttached(self, drive):
+ root = ET.fromstring(self._dom.XMLDesc(0))
+ return bool(root.findall("./devices/disk[serial='%s']" % drive.serial))
+
def _readPauseCode(self):
state, reason = self._dom.state(0)
--
To view, visit https://gerrit.ovirt.org/45646
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I393ce55dd761ac825cb96bd499976fd74c366b09
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Amit Aviram <aaviram(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
8 years, 1 month
Change in vdsm[ovirt-3.6]: v2v: add test for getOvaInfo verb
by shavivi@redhat.com
Shahar Havivi has uploaded a new change for review.
Change subject: v2v: add test for getOvaInfo verb
......................................................................
v2v: add test for getOvaInfo verb
Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5
Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
M tests/v2vTests.py
1 file changed, 53 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/45594/1
diff --git a/tests/v2vTests.py b/tests/v2vTests.py
index 520de61..98a95b6 100644
--- a/tests/v2vTests.py
+++ b/tests/v2vTests.py
@@ -91,6 +91,39 @@
return LibvirtMock()
+def read_ovf(ovf_path):
+ return """<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationS...">
+ <References>
+ <File ovf:href="First-disk1.vmdk" ovf:id="file1" ovf:size="349405696"/>
+ </References>
+ <DiskSection>
+ <Disk ovf:capacity="32" ovf:fileRef="file1"/>
+ </DiskSection>
+ <VirtualSystem ovf:id="First">
+ <Name>First</Name>
+ <VirtualHardwareSection>
+ <Item>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:Connection>VM Network</rasd:Connection>
+ <rasd:ElementName>Ethernet 1</rasd:ElementName>
+ <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </Item>
+ </VirtualHardwareSection>
+ </VirtualSystem>
+</Envelope>"""
+
+
class v2vTests(TestCaseBase):
@MonkeyPatch(libvirtconnection, 'open_connection', hypervisorConnect)
def testGetExternalVMs(self):
@@ -139,3 +172,23 @@
(v2v.DiskProgress(0)),
(v2v.DiskProgress(50)),
(v2v.DiskProgress(100))])
+
+ @MonkeyPatch(v2v, '_read_ovf_from_ova', read_ovf)
+ def testGetOvaInfo(self):
+ ret = v2v.get_ova_info("dummy")
+ vm = ret['vmList']
+ self.assertEquals(vm['vmName'], 'First')
+ self.assertEquals(vm['memSize'], 2048)
+ self.assertEquals(vm['smp'], 1)
+
+ disk = vm['disks'][0]
+ self.assertEquals(disk['allocation'], '349405696')
+ self.assertEquals(disk['capacity'], '34359738368')
+ self.assertEquals(disk['type'], 'disk')
+ self.assertEquals(disk['alias'], 'First-disk1.vmdk')
+
+ network = vm['networks'][0]
+ self.assertEquals(network['bridge'], 'VM Network')
+ self.assertEquals(network['model'], 'E1000')
+ self.assertEquals(network['type'], 'bridge')
+ self.assertEquals(network['dev'], 'Ethernet 1')
--
To view, visit https://gerrit.ovirt.org/45594
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I398943c356a87cf93a3e0557f4d78da0490814c5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Shahar Havivi <shavivi(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: Fix string in diskunmap hook README file
by apahim@redhat.com
Amador Pahim has posted comments on this change.
Change subject: Fix string in diskunmap hook README file
......................................................................
Patch Set 1: Code-Review+1
Thank you Javier. Good catch.
--
To view, visit https://gerrit.ovirt.org/45665
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I33a872a4b05451f235167c99e4ec01da80d0f557
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Javier Coscia <ciudavitacos(a)gmail.com>
Gerrit-Reviewer: Amador Pahim <apahim(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 1 month
Change in vdsm[ovirt-3.6]: schema: add v2vJobs to HostStats
by shavivi@redhat.com
Shahar Havivi has uploaded a new change for review.
Change subject: schema: add v2vJobs to HostStats
......................................................................
schema: add v2vJobs to HostStats
v2vJobs reports via HostStats and needs to be declared in schema
Change-Id: I20b5b44b2b74c0e1326251d6a3b84ef66dac46c7
Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
1 file changed, 35 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/45593/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 4cac5ae..034359a 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1970,6 +1970,36 @@
'score': 'uint'}}
##
+# @V2VJobInfo:
+#
+# Structure for current v2v jobs status
+#
+# @id: An ID that was associated with the job when it was started
+#
+# @status: Indicates jobs status (done, error, aborted, copying_disk,
+# starting)
+#
+# @description: Description for the current status such as error or copying
+# disk description.
+#
+# @progress: Job progress between 0-100
+#
+# Since: 4.17.0
+##
+{'type': 'V2VJobInfo',
+ 'data': {'id': 'UUID', 'status': 'str', 'description': 'str',
+ 'progress': 'uint'}}
+
+##
+# @V2VJobs:
+#
+# A mapping of VM job information indexed by job UUID.
+#
+# Since: 4.17.0
+##
+{'map': 'V2VJobs', 'key': 'UUID', 'value': 'V2VJobInfo'}
+
+##
# @HostStats:
#
# Statistics about this host.
@@ -2065,6 +2095,9 @@
# @outgoingVmMigrations: The number of VMs migrating away from this host
# (new in version 4.17.0)
#
+# @v2vJobs: #optional Current v2v jobs that running/ended on
+# current host (new in version 4.17.0)
+#
# Since: 4.10.0
##
{'type': 'HostStats',
@@ -2086,7 +2119,8 @@
'haStatus': 'HostedEngineStatus', '*bootTime': 'uint',
'numaNodeMemFree': 'NumaNodeMemoryStatsMap',
'cpuStatistics': 'CpuCoreStatsMap',
- 'incomingVmMigrations': 'uint', 'outgoingVmMigrations': 'uint'}}
+ 'incomingVmMigrations': 'uint', 'outgoingVmMigrations': 'uint',
+ '*v2vJobs': ['V2VJobs']}}
##
# @Host.getStats:
--
To view, visit https://gerrit.ovirt.org/45593
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I20b5b44b2b74c0e1326251d6a3b84ef66dac46c7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Shahar Havivi <shavivi(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: Fix string in diskunmap hook README file
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: Fix string in diskunmap hook README file
......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/45665
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I33a872a4b05451f235167c99e4ec01da80d0f557
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Javier Coscia <ciudavitacos(a)gmail.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 1 month
Change in vdsm[master]: vm: Libvirt quering after disk detach operation addition.
by aaviram@redhat.com
Amit Aviram has uploaded a new change for review.
Change subject: vm: Libvirt quering after disk detach operation addition.
......................................................................
vm: Libvirt quering after disk detach operation addition.
As stated in libvirt documentary, after detaching a device using the API
we need to verify that this device has actually been detached.
Not doing so can cause various problems, as hotunplugDisk could return a
success result while it did not actually succeeds to detach the disk.
This patch adds this functionallity to hotunplugDisk, and after some
timeout fails the operation if the disk was not detached.
Change-Id: I393ce55dd761ac825cb96bd499976fd74c366b09
Bug-Url: https://bugzilla.redhat.com/1206696
Signed-off-by: Amit Aviram <aaviram(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/45138/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 5094669..8546226 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -29,6 +29,7 @@
import threading
import time
import uuid
+import datetime
# 3rd party libs imports
import libvirt
@@ -2635,6 +2636,14 @@
params=drive.custom)
try:
self._dom.detachDevice(driveXml)
+ opStarted = datetime.datetime.now()
+ timoutSec = 10
+ while drive.serial in self._dom.XMLDesc(0):
+ self.log.debug("Waiting for hotunplug to finish.")
+ time.sleep(1)
+ if (datetime.datetime.now() - opStarted).seconds > timoutSec:
+ return response.error('hotunplugDisk',
+ "libvirt could not detach the disk.")
except libvirt.libvirtError as e:
self.log.exception("Hotunplug failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
--
To view, visit https://gerrit.ovirt.org/45138
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I393ce55dd761ac825cb96bd499976fd74c366b09
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <aaviram(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: virt: Reset read time counters only on reads with data
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: virt: Reset read time counters only on reads with data
......................................................................
virt: Reset read time counters only on reads with data
Change-Id: I3482cfad92bcb1b832d03f650a28017be12426d5
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/virt/vmchannels.py
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/43772/1
diff --git a/vdsm/virt/vmchannels.py b/vdsm/virt/vmchannels.py
index 45f18bd..787e289 100644
--- a/vdsm/virt/vmchannels.py
+++ b/vdsm/virt/vmchannels.py
@@ -60,15 +60,17 @@
elif (event & select.EPOLLIN):
obj = self._channels.get(fileno, None)
if obj:
- obj['timeout_seen'] = False
- obj['reconnects'] = 0
try:
- if obj['read_cb'](obj['opaque']):
- obj['read_time'] = time.time()
- else:
- reconnect = True
+ read_result = obj['read_cb'](obj['opaque'])
except:
self.log.exception("Exception on read callback.")
+ else:
+ if read_result:
+ obj['read_time'] = time.time()
+ obj['timeout_seen'] = False
+ obj['reconnects'] = 0
+ else:
+ reconnect = True
else:
self.log.debug("Received epoll event %.08X for no longer "
"tracked fd = %d", event, fileno)
--
To view, visit https://gerrit.ovirt.org/43772
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3482cfad92bcb1b832d03f650a28017be12426d5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: net: iproute2, pyroute2: implement rollback
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: net: iproute2, pyroute2: implement rollback
......................................................................
net: iproute2, pyroute2: implement rollback
Change-Id: I3ba8cd7bb1356063abc0df24e65810dbb9235dcd
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm/network/configurators/__init__.py
M vdsm/network/configurators/iproute2.py
2 files changed, 35 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/45238/1
diff --git a/vdsm/network/configurators/__init__.py b/vdsm/network/configurators/__init__.py
index 8cadf1d..fe928c5 100644
--- a/vdsm/network/configurators/__init__.py
+++ b/vdsm/network/configurators/__init__.py
@@ -67,9 +67,7 @@
vdsm.netoconfpersistence.Config object with the not yet rolled back
networks and bonds.
"""
- # self.runningConfig will have all the changes that were applied before
- # we needed to rollback.
- return RunningConfig().diffFrom(self.runningConfig)
+ raise NotImplementedError
def configureBridge(self, bridge, **opts):
raise NotImplementedError
diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py
index 4f58fba..a18ec8b 100644
--- a/vdsm/network/configurators/iproute2.py
+++ b/vdsm/network/configurators/iproute2.py
@@ -20,14 +20,11 @@
from __future__ import absolute_import
import logging
-from vdsm import netinfo
-from vdsm import ipwrapper
from vdsm.constants import EXT_BRCTL
from vdsm.ipwrapper import routeAdd, routeDel, ruleAdd, ruleDel, IPRoute2Error
from vdsm.netconfpersistence import RunningConfig
-from vdsm import sysctl
-from vdsm.utils import CommandPath
-from vdsm.utils import execCmd
+from vdsm.utils import CommandPath, execCmd
+from vdsm import netinfo, ipwrapper, sysctl, vdscli
from . import (Configurator, runDhclient, getEthtoolOpts, libvirt,
wait_for_device)
@@ -52,6 +49,29 @@
return True
+def _get_rollback_changes(init_config, running_config):
+ networks = {}
+ bondings = {}
+ # remove
+ for net in set(running_config.networks) - set(init_config.networks):
+ networks[net] = {'remove': True}
+ for bond in set(running_config.bonds) - set(init_config.bonds):
+ bondings[bond] = {'remove': True}
+ # add
+ for net in set(init_config.networks) - set(running_config.networks):
+ networks[net] = init_config.networks[net]
+ for bond in set(init_config.bonds) - set(running_config.bonds):
+ bondings[bond] = init_config.bonds[bond]
+ # edit
+ for net in set(init_config.networks) & set(running_config.networks):
+ if init_config.networks[net] != running_config.networks[net]:
+ networks[net] = init_config.networks[net]
+ for bond in set(init_config.bonds) & set(running_config.bonds):
+ if init_config.bonds[bond] != running_config.bonds[bond]:
+ bondings[bond] = init_config.bonds[bond]
+ return networks, bondings
+
+
class Iproute2(Configurator):
def __init__(self, inRollback=False):
super(Iproute2, self).__init__(ConfigApplier(), inRollback)
@@ -68,6 +88,15 @@
self.runningConfig.save()
self.runningConfig = None
+ def rollback(self):
+ init_config = RunningConfig()
+ networks, bondings = _get_rollback_changes(init_config,
+ self.runningConfig)
+ c = vdscli.connect()
+ c.setupNetworks(networks, bondings, {'_inRollback': True,
+ 'connectivityCheck': False})
+ return RunningConfig().diffFrom(init_config)
+
def configureBridge(self, bridge, **opts):
self.configApplier.addBridge(bridge)
if bridge.port:
--
To view, visit https://gerrit.ovirt.org/45238
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ba8cd7bb1356063abc0df24e65810dbb9235dcd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: net: synchronous ifup
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: net: synchronous ifup
......................................................................
net: synchronous ifup
Return device only after it's properly created and up.
Change-Id: Id739556e9ebcdd2882d2b055762007204c61cef3
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 48 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/45533/1
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index e1d3e94..cf1ef74 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -18,6 +18,7 @@
#
from __future__ import absolute_import
+from contextlib import contextmanager
import copy
import errno
import glob
@@ -40,6 +41,7 @@
from vdsm import sysctl
from vdsm import utils
from vdsm.netconfpersistence import RunningConfig, PersistentConfig
+from vdsm.netlink import monitor
if utils.isOvirtNode():
from ovirt.node.utils import fs as node_fs
@@ -787,7 +789,20 @@
t.daemon = True
t.start()
else:
- _exec_ifup(iface.name, cgroup)
+ if not iface.master:
+ if iface.ipv4:
+ expected_event = {'label': iface.name, 'family': 'inet',
+ 'scope': 'global'}
+ elif iface.ipv6:
+ expected_event = {'label': iface.name, 'family': 'inet6',
+ 'scope': 'global'}
+ else:
+ expected_event = {'label': iface.name, 'family': 'inet6',
+ 'scope': 'link'}
+ with _wait_for_event(iface, expected_event):
+ _exec_ifup(iface.name, cgroup)
+ else:
+ _exec_ifup(iface.name, cgroup)
def _restore_default_bond_options(bond_name, desired_options):
@@ -916,3 +931,35 @@
ifcfgs.add(ROUTE_PATH % top_level_device)
return ifcfgs
+
+
+def _netmask2prefix(netmask):
+ return sum([bin(int(x)).count('1') for x in netmask.split('.')])
+
+
+def _is_subdict(subdict, superdict):
+ return all(item in frozenset(superdict.items())
+ for item in frozenset(subdict.items()))
+
+
+@contextmanager
+def _wait_for_event(iface, expected_event, timeout=10):
+ with monitor.Monitor(groups=('ipv4-ifaddr', 'ipv6-ifaddr'),
+ timeout=timeout) as mon:
+ try:
+ yield
+ finally:
+ caught_events = []
+ try:
+ for event in mon:
+ caught_events.append(event)
+ if _is_subdict(expected_event, event):
+ mon.stop()
+ except monitor.MonitorError as e:
+ if e[0] == monitor.E_TIMEOUT:
+ logging.warning('Expected event "%s" of interface "%s" '
+ 'was not caught within the given timeout. '
+ 'Caught events: %s', expected_event, iface,
+ caught_events)
+ else:
+ raise
--
To view, visit https://gerrit.ovirt.org/45533
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id739556e9ebcdd2882d2b055762007204c61cef3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
8 years, 1 month
Change in vdsm[master]: vm.py: State saving in hotunplugDisk.
by aaviram@redhat.com
Amit Aviram has uploaded a new change for review.
Change subject: vm.py: State saving in hotunplugDisk.
......................................................................
vm.py: State saving in hotunplugDisk.
VM's state was saved before detatching a disk in hotunplugDisk.
Saving vm's state should be performed only AFTER vdsm is actually detaching
the disk, otherwise the disk will remain in xmlDesc and be calculated in
the vm's hash.
This causes a bug in the engine's VM monitoring: the engine
gets the same hash as before the disk was unplugged, thus does not
update the disk's status.
Change-Id: I2cf18186cbba33d7e74fd15651ffec3149c98e1d
Bug-Url:https://bugzilla.redhat.com/1206696
Bug-Url: https://bugzilla.redhat.com/1044466
Signed-off-by: Amit Aviram <aaviram(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/45077/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 0eff29a..cb354f0 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2631,12 +2631,11 @@
diskDev = dev
break
- self.saveState()
-
hooks.before_disk_hotunplug(driveXml, self.conf,
params=drive.custom)
try:
self._dom.detachDevice(driveXml)
+ self.saveState()
except libvirt.libvirtError as e:
self.log.exception("Hotunplug failed")
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
--
To view, visit https://gerrit.ovirt.org/45077
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cf18186cbba33d7e74fd15651ffec3149c98e1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <aaviram(a)redhat.com>
8 years, 1 month