Change in vdsm[master]: storage: export volume lease state in getVolumeInfo
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: storage: export volume lease state in getVolumeInfo
......................................................................
storage: export volume lease state in getVolumeInfo
In order to support an entity-based polling methodology (ie. in the new
SDM verbs) we must know whether a volume is currently locked by a long
running operation. Extend the getVolumeInfo API to report whether the
lease is free or held.
Change-Id: I55f062a4be15593fdc98518fd0a113976cbe0ae7
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/storage/volume.py
2 files changed, 31 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/38623/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 988ce64..cba1008 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -7897,6 +7897,19 @@
{'enum': 'VolumeStatus', 'data': ['OK', 'INVALID', 'ILLEGAL']}
##
+# @VolumeLeaseState:
+#
+# An enumeration of Volume lease states.
+#
+# @FREE: The lease is free
+#
+# @HELD: The lease is held
+#
+# Since: 4.10.0
+##
+{'enum': 'VolumeLeaseState', 'data': ['FREE', 'HELD']}
+
+##
# @VolumeInfo:
#
# Information about a Volume.
@@ -7937,6 +7950,8 @@
#
# @children: A list of decendent Volumes that depend on this Volume
#
+# @leaseState: #optional The state of the volume lease
+#
# Since: 4.10.0
##
{'type': 'VolumeInfo',
@@ -7946,7 +7961,8 @@
'description': 'str', 'pool': 'UUID', 'domain': 'UUID',
'image': 'UUID', 'ctime': 'int', '*mtime': 'uint',
'legality': 'VolumeLegality', 'apparentsize': 'uint',
- 'truesize': 'uint', 'status': 'VolumeStatus', 'children': ['UUID']}}
+ 'truesize': 'uint', 'status': 'VolumeStatus', 'children': ['UUID'],
+ '*leaseState': 'VolumeLeaseState'}}
##
# @Volume.getInfo:
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 980b6e3..2e16efc 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -33,6 +33,7 @@
import fileUtils
import task
from threadLocal import vars
+from clusterlock import InquireNotSupportedError
import resourceFactories
import resourceManager as rm
rmanager = rm.ResourceManager.getInstance()
@@ -85,6 +86,10 @@
ILLEGAL_VOL = "ILLEGAL"
LEGAL_VOL = "LEGAL"
FAKE_VOL = "FAKE"
+
+# Volume lease states
+LEASE_FREE = "FREE"
+LEASE_HELD = "HELD"
log = logging.getLogger('Storage.Volume')
@@ -839,6 +844,11 @@
cls.createMetadata(metaId, meta)
return meta
+ def getLeaseState(self):
+ ver, owners = sdCache.produce(self.sdUUID).inquireVolumeLease(
+ self.imgUUID, self.volUUID)
+ return LEASE_HELD if owners else LEASE_FREE
+
def getInfo(self):
"""
Get volume info
@@ -857,6 +867,10 @@
info['apparentsize'] = str(vsize)
info['truesize'] = str(avsize)
info['status'] = "OK"
+ try:
+ info['leaseState'] = self.getLeaseState()
+ except InquireNotSupportedError:
+ pass
except se.StorageException as e:
self.log.debug("exception: %s:%s" % (str(e.message), str(e.value)))
info['apparentsize'] = "0"
--
To view, visit https://gerrit.ovirt.org/38623
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I55f062a4be15593fdc98518fd0a113976cbe0ae7
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]: misc: remove cp parameter
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: misc: remove cp parameter
......................................................................
misc: remove cp parameter
All usages of cp parameter have been extinguished.
Therefore, no longer needed.
Change-Id: I0906bfd7dfa128c323aa399810bbd75883618434
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 5 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/45613/1
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index b14fd26..b0146c8 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -449,7 +449,7 @@
return n
-def rotateFiles(directory, prefixName, gen, cp=False, persist=False):
+def rotateFiles(directory, prefixName, gen, persist=False):
log.debug("dir: %s, prefixName: %s, versions: %s" %
(directory, prefixName, gen))
gen = int(gen)
@@ -477,24 +477,16 @@
for key in keys:
oldName = os.path.join(directory, fd[key]['old'])
newName = os.path.join(directory, fd[key]['new'])
- if utils.isOvirtNode() and persist and not cp:
+ if utils.isOvirtNode() and persist:
try:
utils.unpersist(oldName)
utils.unpersist(newName)
except:
pass
- try:
- if cp:
- execCmd([constants.EXT_CP, oldName, newName], sudo=True)
- if (utils.isOvirtNode() and
- persist and not os.path.exists(newName)):
- utils.persist(newName)
- else:
- os.rename(oldName, newName)
- except:
- pass
- if utils.isOvirtNode() and persist and not cp:
+ os.rename(oldName, newName)
+
+ if utils.isOvirtNode() and persist:
try:
utils.persist(newName)
except:
--
To view, visit https://gerrit.ovirt.org/45613
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0906bfd7dfa128c323aa399810bbd75883618434
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: Send vm info report each sampling interval from HostMonitor
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Send vm info report each sampling interval from HostMonitor
......................................................................
Send vm info report each sampling interval from HostMonitor
Change-Id: Ia44f97279e37265deb47ded60557dc98411fb9fc
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/virt/sampling.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/59523/1
diff --git a/lib/vdsm/virt/sampling.py b/lib/vdsm/virt/sampling.py
index caa1e3b..43c18b0 100644
--- a/lib/vdsm/virt/sampling.py
+++ b/lib/vdsm/virt/sampling.py
@@ -552,6 +552,8 @@
if self._cif:
stats = hostapi.get_stats(self._cif, self._samples.stats())
hostapi.report_stats(stats)
+ vmstats = self._cif.getAllVmStats()
+ vmstats.report_stats(vmstats)
second_last = self._samples.last(nth=2)
if second_last is None:
--
To view, visit https://gerrit.ovirt.org/59523
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia44f97279e37265deb47ded60557dc98411fb9fc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: vdsm: removing txRate and rxRate from code
by mmirecki@redhat.com
Marcin Mirecki has uploaded a new change for review.
Change subject: vdsm: removing txRate and rxRate from code
......................................................................
vdsm: removing txRate and rxRate from code
Vdsm should no longer send rxRate and txRate to the engine.
Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Signed-off-by: mirecki <mmirecki(a)redhat.com>
---
M lib/api/vdsm-api.yml
M lib/vdsm/host/stats.py
M lib/vdsm/virt/vmstats.py
M tests/hoststatsTests.py
M tests/vdsmapi_test.py
M tests/vmStatsTests.py
M tests/vmTests.py
M vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
8 files changed, 0 insertions(+), 80 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/59544/1
diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index b537e8e..0b8d27a 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -1591,12 +1591,6 @@
type: string
datatype: uint
- - description: The rate of incoming packets (as a percentage
- of speed)
- name: rxRate
- type: string
- datatype: float
-
- description: The network device name
name: name
type: string
@@ -1623,12 +1617,6 @@
name: txErrors
type: string
datatype: uint
-
- - description: The rate of outgoing packets (as a percentage
- of speed)
- name: txRate
- type: string
- datatype: float
- description: The interface speed (in Megabits/s)
name: speed
@@ -1877,12 +1865,6 @@
name: swapTotal
type: int
- - description: Incoming packet rate (as a percentage of total
- capacity)
- name: rxRate
- type: string
- datatype: float
-
- description: The number of VMs migrating to this host
name: incomingVmMigrations
type: uint
@@ -1905,12 +1887,6 @@
- description: Ratio of CPU time spent idle
name: cpuIdle
- type: string
- datatype: float
-
- - description: Outgoing packet rate (as a percentage of total
- capacity)
- name: txRate
type: string
datatype: float
@@ -4466,12 +4442,6 @@
type: string
datatype: uint
- - description: The rate of incoming packets (as a percentage
- of speed)
- name: rxRate
- type: string
- datatype: float
-
- description: The network device name
name: name
type: string
@@ -4502,12 +4472,6 @@
name: txErrors
type: string
datatype: uint
-
- - description: The rate of outgoing packets (as a percentage
- of speed)
- name: txRate
- type: string
- datatype: float
- description: The interface speed (in Megabits/s)
name: speed
diff --git a/lib/vdsm/host/stats.py b/lib/vdsm/host/stats.py
index 23ce688..61bd5ab 100644
--- a/lib/vdsm/host/stats.py
+++ b/lib/vdsm/host/stats.py
@@ -158,12 +158,6 @@
last_sample.interfaces[ifid].tx -
first_sample.interfaces[ifid].tx
) % NETSTATS_BOUND
- rxRate = 100.0 * thisRx / interval / ifrate / Mbps2Bps
- txRate = 100.0 * thisTx / interval / ifrate / Mbps2Bps
- if txRate > 100 or rxRate > 100:
- txRate = min(txRate, 100.0)
- rxRate = min(rxRate, 100.0)
- logging.debug('Rate above 100%%.')
iface = last_sample.interfaces[ifid]
stats['network'][ifid] = {
'name': ifid, 'speed': str(ifrate),
@@ -172,8 +166,6 @@
'rxErrors': str(iface.rxErrors),
'txErrors': str(iface.txErrors),
'state': iface.operstate,
- 'rxRate': '%.1f' % rxRate,
- 'txRate': '%.1f' % txRate,
'rx': str(iface.rx),
'tx': str(iface.tx),
'sampleTime': last_sample.timestamp,
@@ -185,12 +177,6 @@
total_rate += ifrate
total_bytes_per_sec = (total_rate or 1000) * (10 ** 6) / 8
- stats['rxRate'] = 100.0 * rx / interval / total_bytes_per_sec
- stats['txRate'] = 100.0 * tx / interval / total_bytes_per_sec
- if stats['txRate'] > 100 or stats['rxRate'] > 100:
- stats['txRate'] = min(stats['txRate'], 100.0)
- stats['rxRate'] = min(stats['rxRate'], 100.0)
- logging.debug(stats)
stats['rxDropped'] = rxDropped
stats['txDropped'] = txDropped
@@ -234,8 +220,6 @@
'cpuUser': 0.0,
'cpuSys': 0.0,
'cpuIdle': 100.0,
- 'rxRate': 0.0, # REQUIRED_FOR: engine < 3.6
- 'txRate': 0.0, # REQUIRED_FOR: engine < 3.6
'cpuSysVdsmd': 0.0,
'cpuUserVdsmd': 0.0,
'elapsedTime': _elapsed_time(),
diff --git a/lib/vdsm/virt/vmstats.py b/lib/vdsm/virt/vmstats.py
index 177e2a9..d21b3fd 100644
--- a/lib/vdsm/virt/vmstats.py
+++ b/lib/vdsm/virt/vmstats.py
@@ -251,9 +251,6 @@
(tx_delta % 2 ** 32) /
interval / if_speed / _MBPS_TO_BPS)
- if_stats['rxRate'] = '%.1f' % if_rx_bytes
- if_stats['txRate'] = '%.1f' % if_tx_bytes
-
if_stats['sampleTime'] = monotonic_time()
return if_stats
diff --git a/tests/hoststatsTests.py b/tests/hoststatsTests.py
index e40445f..47932f9 100644
--- a/tests/hoststatsTests.py
+++ b/tests/hoststatsTests.py
@@ -174,8 +174,6 @@
'cpuSysVdsmd': 0.0,
'cpuUser': 0.0,
'cpuUserVdsmd': 0.0,
- 'rxRate': 0.0,
- 'txRate': 0.0,
'elapsedTime': 0,
}
hoststats.start(lambda: 0)
diff --git a/tests/vdsmapi_test.py b/tests/vdsmapi_test.py
index 20cfb31..d91a76c 100644
--- a/tests/vdsmapi_test.py
+++ b/tests/vdsmapi_test.py
@@ -161,14 +161,11 @@
u"memFree": u"13645"}},
u"memShared": 0,
u"thpState": u"madvise",
- u"rxRate": u"0.02",
u"vmCount": 0,
u"memUsed": u"3",
u"storageDomains": {},
u"incomingVmMigrations": 0,
u"network": {u"bond0": {u"rxErrors": u"0",
- u"txRate": u"0.0",
- u"rxRate": u"0.0",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -179,8 +176,6 @@
u"rx": u"0",
u"state": u"down"},
u"ovirtmgmt": {u"rxErrors": u"0",
- u"txRate": u"0.0",
- u"rxRate": u"0.0",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -191,8 +186,6 @@
u"rx": u"2106573",
u"state": u"up"},
u"lo": {u"rxErrors": u"0",
- u"txRate": u"0.1",
- u"rxRate": u"0.1",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -203,8 +196,6 @@
u"rx": u"2308049",
u"state": u"up"},
u";vdsmdummy;": {u"rxErrors": u"0",
- u"txRate": u"0.0",
- u"rxRate": u"0.0",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -215,8 +206,6 @@
u"rx": u"0",
u"state": u"down"},
u"em1": {u"rxErrors": u"0",
- u"txRate": u"0.0",
- u"rxRate": u"0.0",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -227,8 +216,6 @@
u"rx": u"2310757",
u"state": u"up"},
u"wlp1s2": {u"rxErrors": u"0",
- u"txRate": u"0.0",
- u"rxRate": u"0.0",
u"txErrors": u"0",
u"speed": u"1000",
u"rxDropped": u"0",
@@ -256,7 +243,6 @@
u"ksmMergeAcrossNodes": True,
u"ksmCpu": 0,
u"memAvailable": 15226,
- u"txRate": u"0.02",
u"bootTime": u"1456910791",
u"haStats": {u"active": False,
u"configured": False,
@@ -329,10 +315,8 @@
'rxDropped': '1572',
'tx': '0',
'rxErrors': '0',
- 'txRate': '0.0',
'txDropped': '0',
'rx': '90',
- 'rxRate': '0.0',
'txErrors': '0',
'state': 'unknown',
'sampleTime': 4319358.22,
@@ -404,10 +388,8 @@
'rxDropped': '0',
'tx': '7478',
'rxErrors': '0',
- 'txRate': '0.0',
'txDropped': '0',
'rx': '331023',
- 'rxRate': '0.0',
'txErrors': '0',
'state': 'unknown',
'sampleTime': 4319358.22,
diff --git a/tests/vmStatsTests.py b/tests/vmStatsTests.py
index 7c385ba..9827c4e 100644
--- a/tests/vmStatsTests.py
+++ b/tests/vmStatsTests.py
@@ -306,8 +306,6 @@
'rxDropped',
'txErrors',
'txDropped',
- 'rxRate',
- 'txRate',
'rx',
'tx',
'sampleTime',
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 6d38f46..befabf6 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1382,7 +1382,6 @@
'txErrors': '11', 'txDropped': '12',
'macAddr': MAC, 'name': 'vnettest',
'speed': '1000', 'state': 'unknown',
- 'rxRate': '100.0', 'txRate': '33.3',
'rx': '0', 'tx': '625000000',
})
diff --git a/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py b/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
index 9f2002b..1f27b7e 100644
--- a/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
+++ b/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
@@ -131,10 +131,8 @@
# Network:
for net in stats['network'].values():
- net['rxRate'] = '%.1f' % (random.uniform(0, 100))
net['rxDropped'] = str(random.randint(0, 2*31))
net['rxErrors'] = str(random.randint(0, 2*31))
- net['txRate'] = '%.1f' % (random.uniform(0, 100))
net['txDropped'] = str(random.randint(0, 2*31))
net['txErrors'] = str(random.randint(0, 2*31))
--
To view, visit https://gerrit.ovirt.org/59544
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6466de88f0228ac3496b4642d34f5eb7b281afa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Marcin Mirecki <mmirecki(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: gluster:enforce gluster fencing policies
by Ramesh Nachimuthu
Ramesh N has uploaded a new change for review.
Change subject: gluster:enforce gluster fencing policies
......................................................................
gluster:enforce gluster fencing policies
Enforce gluster related fencing policies before fencing
the host.
1. skipFecingIfGlusterBricksUp
Fencing should be skipped any brick is ONLINE in
the host being fenced.
2. skipFecingIfGlusterQuorumNotMet
Fencing should be skipped if any brick is ONLINE
in the host being fenced and quorum will be lost if the
brick is brought down.
Gluster volume info command will be used to get the
volume details and 'volume status' command will be used
to get the brick status from fence proxy host.
Change-Id: I2c18571209a3a7682a43bd2814b9ee3f0a69c55f
Signed-off-by: Ramesh Nachimuthu <rnachimu(a)redhat.com>
---
M vdsm/API.py
1 file changed, 66 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/59600/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 698ac29..fba19ac 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -22,6 +22,7 @@
import os
import logging
+import math
from vdsm.network.errors import ConfigNetworkError
@@ -54,6 +55,7 @@
import caps
from vdsm.config import config
from vdsm.virt import sampling
+from gluster import cli as glustercli
haClient = None # Define here to work around pyflakes issue #13
@@ -1255,8 +1257,72 @@
return False
self.log.debug("Host doesn't have any live lease")
+ return can_fence_gluster_hosts(policy)
+
+ def can_fence_gluster_hosts(policy):
+ skipFecingIfGlusterBricksUp = \
+ policy.get('skipFencingIfGlusterBricksUp') == 'true'
+ skipFecingIfGlusterQuorumNotMet = \
+ policy.get('skipFencingIfGlusterQuorumNotMet') == 'true'
+ hostUuid = policy.get('glusterServerUuid')
+ if skipFecingIfGlusterBricksUp or skipFecingIfGlusterQuorumNotMet:
+ volumesList = glustercli.volumeInfo()
+ for volumeName in volumesList:
+ if 'REPLICATE' in volumesList.get(volumeName).\
+ get('volumeType'):
+ volumeStatus = glustercli.volumeStatus(volumeName)
+ if skipFecingIfGlusterBricksUp:
+ for brick in volumeStatus.get('bricks'):
+ if hostUuid == brick.get('hostuuid') \
+ and brick.get('status') == 'ONLINE':
+ self.log.error("Gluster brick '%s' "
+ "is ONLINE.",
+ brick.get("name"))
+ return False
+ if skipFecingIfGlusterQuorumNotMet:
+ if not is_gluster_quorum_met(
+ volumesList.get(volumeName),
+ volumeStatus, hostUuid):
+ self.log.error("Gluster Quorum not met "
+ "for volume %s", volumeName)
+ return False
return True
+ def is_gluster_quorum_met(volumeInfo, volumeStatus, hostUuid):
+ replicaCount = volumeInfo.get("replicaCount")
+ subVolumes = volumeInfo.get('brickCount')
+ quorumType = volumeInfo.get("options").get("cluster.quorum-type")
+ if quorumType == "fixed":
+ quorumCount = volumeInfo.get("cluster.quorum-count")
+ elif quorumType == "auto":
+ quorumCount = math.ceil(replicaCount/2)
+ else:
+ return True
+ for index in range(0, subVolumes):
+ subVolume = \
+ volumeInfo.get("bricksInfo")[index:index+replicaCount]
+
+ bricksRemainingUp = 0
+ bricksGoingDown = 0
+
+ for brick in subVolume:
+ brick_status = get_brick_status(brick.get('hostUuid'),
+ brick.get("name"),
+ volumeStatus)
+ if brick_status.get('status') == 'ONLINE':
+ if brick.get('hostUuid') == hostUuid:
+ bricksGoingDown += bricksGoingDown
+ else:
+ bricksRemainingUp += bricksRemainingUp
+ if bricksGoingDown > 0 and bricksRemainingUp < quorumCount:
+ return False
+ return True
+
+ def get_brick_status(hostUuid, brickName, volumeStatus):
+ return [brick for brick in volumeStatus.get("bircks")
+ if brick.get("hostuuid") == hostUuid
+ and brick.get("brick") == brickName][0]
+
self.log.debug('fenceNode(addr=%s,port=%s,agent=%s,user=%s,passwd=%s,'
'action=%s,secure=%s,options=%s,policy=%s)',
addr, port, agent, username, password, action, secure,
--
To view, visit https://gerrit.ovirt.org/59600
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c18571209a3a7682a43bd2814b9ee3f0a69c55f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ramesh N <rnachimu(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: freeze: Freeze guest even when creating memory snapshot
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: freeze: Freeze guest even when creating memory snapshot
......................................................................
freeze: Freeze guest even when creating memory snapshot
We used to skip freezing the guest if creating memory snapshot. This was
probably done because qemu is pausing the vm for creating memory
snapshot.
However, this is not consistent with snapshots of external disks such as
network disks, where we always freeze the vm before taking the snapshot.
Also, it is probably safer to freeze even when creating memory snapshot,
giving applications on the guest chance to pause in consistent state.
This patch removes the check for memory snapshot, and freeze the guest
unless it is already frozen.
Change-Id: I8aa7ac0dea8690ca33df8067f84734d788da8bf8
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 3 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/43299/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 332281b..ecbbe1d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3093,9 +3093,6 @@
else:
snapFlags |= libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY
- # When creating memory snapshot libvirt will pause the vm
- should_freeze = not (memoryParams or frozen)
-
snapxml = snap.toprettyxml()
# TODO: this is debug information. For 3.6.x we still need to
# see the XML even with 'info' as default level.
@@ -3109,7 +3106,7 @@
self.stopDisksStatsCollection()
try:
- if should_freeze:
+ if not frozen:
freezed = self.freeze()
try:
self._dom.snapshotCreateXML(snapxml, snapFlags)
@@ -3120,7 +3117,7 @@
# Must always thaw, even if freeze failed; in case the guest
# did freeze the filesystems, but failed to reply in time.
# Libvirt is using same logic (see src/qemu/qemu_driver.c).
- if should_freeze:
+ if not frozen:
self.thaw()
# We are padding the memory volume with block size of zeroes
@@ -3148,7 +3145,7 @@
# Returning quiesce to notify the manager whether the guest agent
# froze and flushed the filesystems or not.
return {'status': doneCode,
- 'quiesce': should_freeze and freezed["status"]["code"] == 0}
+ 'quiesce': not frozen and freezed["status"]["code"] == 0}
def diskReplicateStart(self, srcDisk, dstDisk):
try:
--
To view, visit https://gerrit.ovirt.org/43299
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8aa7ac0dea8690ca33df8067f84734d788da8bf8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: build: we don't use the VERSION file anymore
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: build: we don't use the VERSION file anymore
......................................................................
build: we don't use the VERSION file anymore
Let's get the version from git describe, because
we don't use anymore the VERSION file
Change-Id: I718d88f9ca4089973f5fdab0fa1bae3246480aa0
Backport-To: 4.0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M build-aux/pkg-version
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/59345/1
diff --git a/build-aux/pkg-version b/build-aux/pkg-version
index c290d76..c1aa13f 100755
--- a/build-aux/pkg-version
+++ b/build-aux/pkg-version
@@ -25,7 +25,7 @@
else if (NF == 4) print $2, $3, "git" substr($4, 2)
}'
-PKG_VERSION=`cat VERSION 2> /dev/null || git describe --tags --match "v[0-9]*"`
+PKG_VERSION=`git describe --tags --match "v[0-9]*"`
if test "x$1" = "x--full"; then
echo $PKG_VERSION | tr -d '[:space:]'
--
To view, visit https://gerrit.ovirt.org/59345
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I718d88f9ca4089973f5fdab0fa1bae3246480aa0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: command: Store stdout and stderr to a log file
by Tomas Golembiovsky
Tomas Golembiovsky has uploaded a new change for review.
Change subject: command: Store stdout and stderr to a log file
......................................................................
command: Store stdout and stderr to a log file
Method execCmd() can be used to execute arbitrary command and return
stdout and stderr either as a string, or provide wrapper streams to the
file descriptors in case of asynchronous execution.
This change adds the possibility to store the stdout and stderr to a log
file independently of the execution method used (synchronous or
asynchronous). Redirecting both stdout and stderr into a single file is
also possible for asynchronous processesing.
Change-Id: I5a8b9afaa196729c8ab98f380a39833a9a0840cd
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
M lib/vdsm/commands.py
M tests/commands_test.py
2 files changed, 128 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/59833/1
diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py
index bffec83..de96097 100644
--- a/lib/vdsm/commands.py
+++ b/lib/vdsm/commands.py
@@ -43,7 +43,8 @@
def execCmd(command, sudo=False, cwd=None, data=None, raw=False,
printable=None, env=None, sync=True, nice=None, ioclass=None,
ioclassdata=None, setsid=False, execCmdLogger=logging.root,
- deathSignal=0, resetCpuAffinity=True):
+ deathSignal=0, resetCpuAffinity=True, outLog=None, errLog=None,
+ errToOutLog=False):
"""
Executes an external command, optionally via sudo.
@@ -52,6 +53,14 @@
a temporary thread, spawn a sync=False sub-process, and have the thread
finish, the new subprocess would die immediately.
"""
+ if errToOutLog and sync:
+ # Using errToOutLog together with sync makes not much sense. Since we
+ # do not get messages as they come, all we can do is write all the
+ # stderr after all the stdout.
+ if outLog is None:
+ outLog = errLog
+ else:
+ errLog = outLog
command = cmdutils.wrap_command(command, with_ioclass=ioclass,
ioclassdata=ioclassdata, with_nice=nice,
@@ -70,7 +79,8 @@
p = CPopen(command, close_fds=True, cwd=cwd, env=env,
deathSignal=deathSignal)
if not sync:
- p = AsyncProc(p)
+ p = AsyncProc(p, outLog=outLog, errLog=errLog,
+ errToOutLog=errToOutLog)
if data is not None:
p.stdin.write(data)
p.stdin.flush()
@@ -85,6 +95,24 @@
out = ""
execCmdLogger.debug(cmdutils.retcode_log_line(p.returncode, err=err))
+
+ # Dump stdout
+ try:
+ if outLog is not None:
+ with open(outLog, 'w') as f:
+ f.write(out)
+ except IOError:
+ execCmdLogger.exception(
+ "Failed to dump stdout to log file '%s'" % outLog)
+
+ # Dump stderr
+ try:
+ if errLog is not None:
+ with open(errLog, 'w') as f:
+ f.write(err)
+ except IOError:
+ execCmdLogger.exception(
+ "Failed to dump stderr to log file '%s'" % errLog)
if not raw:
out = out.splitlines(False)
@@ -192,10 +220,15 @@
return len(data)
- def __init__(self, popenToWrap):
+ def __init__(self, popenToWrap, outLog=None, errLog=None,
+ errToOutLog=False):
# this is an ugly hack to let this module load on Python 3, and fail
# later when AsyncProc is used.
from StringIO import StringIO
+
+ if errToOutLog and outLog is None:
+ outLog = errLog
+ errLog = None
self._streamLock = threading.Lock()
self._proc = popenToWrap
@@ -227,6 +260,32 @@
self.stdin = io.BufferedWriter(self._streamWrapper(self,
self._stdin, self._fdin), BUFFSIZE)
+ if outLog is None:
+ self._outLog = None
+ else:
+ try:
+ self._outLog = open(outLog, 'w')
+ except IOError:
+ logging.exception(
+ "Failed to open stdout log file '%s'" % outLog)
+ self._outLog = None
+
+ if errToOutLog:
+ self._errLog = self._outLog
+ elif errLog is not None:
+ try:
+ self._errLog = open(errLog, 'w')
+ except IOError:
+ logging.exception(
+ "Failed to open stderr log file '%s'" % errLog)
+ self._errLog = None
+ else:
+ self._errLog = None
+
+ self._fdMapLog = {fdout: self._outLog,
+ fderr: self._errLog,
+ self._fdin: None}
+
self._returncode = None
self.blocking = False
@@ -249,6 +308,8 @@
for fd, event in pollres:
stream = self._fdMap[fd]
+ log = self._fdMapLog[fd]
+
if event & select.EPOLLOUT and self._stdin.len > 0:
buff = self._stdin.read(BUFFSIZE)
written = os.write(fd, buff)
@@ -263,6 +324,8 @@
stream.pos = stream.len
stream.write(data)
stream.pos = oldpos
+ if log is not None:
+ log.write(data)
elif event & (select.EPOLLHUP | select.EPOLLERR):
self._poller.unregister(fd)
@@ -308,6 +371,19 @@
if cond is not None and cond():
return False
self._processStreams()
+
+ # Finish writing logs
+ while (self._outLog is not None and
+ self.stdout.fileno() not in self._closedfds) or \
+ (self._errLog is not None and
+ self.stderr.fileno() not in self._closedfds):
+ self._processStreams()
+
+ if self._outLog is not None:
+ self._outLog.close()
+ if self._errLog is not None:
+ self._errLog.close()
+
return True
def communicate(self, data=None):
@@ -321,6 +397,10 @@
def __del__(self):
self._poller.close()
+ if self._outLog is not None:
+ self._outLog.close()
+ if self._errLog is not None:
+ self._errLog.close()
def grepCmd(pattern, paths):
diff --git a/tests/commands_test.py b/tests/commands_test.py
index cb7dda2..75e20ae 100644
--- a/tests/commands_test.py
+++ b/tests/commands_test.py
@@ -21,6 +21,7 @@
import os.path
import six
import sys
+import tempfile
import threading
import time
@@ -72,6 +73,50 @@
self.assertEquals(rc, 0)
self.assertEquals(int(out[0].split()[2]), 0)
+ @permutations(CMD_TYPES)
+ def testLog(self, cmd):
+ fdOut, outLog = tempfile.mkstemp()
+ fdErr, errLog = tempfile.mkstemp()
+
+ command = 'echo Hello >&1; echo World >&2'
+
+ def checklog():
+ with open(outLog, 'r') as f:
+ content = f.read()
+ self.assertEquals(content, 'Hello\n')
+
+ with open(errLog, 'r') as f:
+ content = f.read()
+ self.assertEquals(content, 'World\n')
+
+ os.ftruncate(fdOut, 0)
+ os.ftruncate(fdErr, 0)
+
+ # Sync
+ rc, _, _ = commands.execCmd(cmd(('bash', '-c', command)),
+ outLog=outLog,
+ errLog=errLog)
+ self.assertEquals(rc, 0)
+ checklog()
+
+ # Async: wait
+ p = commands.execCmd(cmd(('bash', '-c', command)),
+ sync=False,
+ outLog=outLog,
+ errLog=errLog)
+ p.wait()
+ self.assertEquals(p.returncode, 0)
+ checklog()
+
+ # Async: communicate
+ p = commands.execCmd(cmd(('bash', '-c', command)),
+ sync=False,
+ outLog=outLog,
+ errLog=errLog)
+ p.communicate()
+ self.assertEquals(p.returncode, 0)
+ checklog()
+
class ExecCmdStressTest(TestCaseBase):
--
To view, visit https://gerrit.ovirt.org/59833
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a8b9afaa196729c8ab98f380a39833a9a0840cd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Golembiovsky <tgolembi(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: Revert "NetworkManager: configure to monitor ifcfg/connectio...
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: Revert "NetworkManager: configure to monitor ifcfg/connection files"
......................................................................
Revert "NetworkManager: configure to monitor ifcfg/connection files"
This reverts commit 57617fe62ac797d02b9a19b216b674d9f4f2c7c3 since
monitoring connection files is unadvised by NetworkManager. Instead, we
require an initscript version which notifies NM in case it should no
longer control a device (rhbz#1345919)
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1326798
Change-Id: I392a918112c3a7b5bfee6fccb2a51b038d5a543f
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm.spec.in
D vdsm/90-vdsm-monitor-connection-files.conf
M vdsm/Makefile.am
3 files changed, 1 insertion(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/59260/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index c301082..b066ced 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -206,6 +206,7 @@
Requires: policycoreutils-python
Requires: selinux-policy-targeted >= 3.13.1-16.el7
Requires: systemd >= 219-11.el7
+Requires: initscripts >= 9.49.31-1
%else
Requires: fence-agents-all
Requires: kernel >= 4.1.6
@@ -850,9 +851,6 @@
%systemd_post mom-vdsm.service
%systemd_post ksmtuned.service
-# From VDSM version 4.18 a .conf file is deployed to /etc/NetworkManager/conf.d
-/bin/systemctl reload NetworkManager >/dev/null 2>&1 || :
-
# VDSM installs unit files - daemon-reload will refresh systemd
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
exit 0
@@ -918,8 +916,6 @@
%ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/mnt
%dir %{_libexecdir}/%{vdsm_name}
%dir %{_sysconfdir}/%{vdsm_name}/vdsm.conf.d
-%dir %{_sysconfdir}/NetworkManager
-%dir %{_sysconfdir}/NetworkManager/conf.d
%dir %{_sysconfdir}/%{vdsm_name}
%dir %{_sysconfdir}/%{vdsm_name}/mom.d
%dir %{_datadir}/%{vdsm_name}
@@ -957,7 +953,6 @@
%{_datadir}/%{vdsm_name}/virt/vmdevices/network.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/storage.py*
-%config(noreplace) %{_sysconfdir}/NetworkManager/conf.d/90-vdsm-monitor-connection-files.conf
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/vdsm.conf
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/logger.conf
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/svdsm.logger.conf
diff --git a/vdsm/90-vdsm-monitor-connection-files.conf b/vdsm/90-vdsm-monitor-connection-files.conf
deleted file mode 100644
index 03d77dd..0000000
--- a/vdsm/90-vdsm-monitor-connection-files.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is necessary to let VDSM properly consume connections owned by
-# NetworkManager (to make it unmanage them), primarily on ifcfg systems.
-
-[main]
-monitor-connection-files=true
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index dcd5b4d..6b36001 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -75,7 +75,6 @@
$(nodist_man8_MANS)
EXTRA_DIST = \
- 90-vdsm-monitor-connection-files.conf \
bonding-defaults.json \
bonding-name2numeric.json \
dumpStorageTable.py.in \
@@ -122,7 +121,6 @@
install-data-logger \
install-data-logrotate \
install-data-mom \
- install-data-networkmanager \
install-data-rwtab \
install-data-sudoers \
install-data-sysctl \
@@ -151,7 +149,6 @@
uninstall-data-logger \
uninstall-data-logrotate \
uninstall-data-mom \
- uninstall-data-networkmanager \
uninstall-data-rwtab \
uninstall-data-sudoers \
uninstall-data-sysctl \
@@ -216,14 +213,6 @@
uninstall-data-mom:
$(RM) $(DESTDIR)$(vdsmconfdir)/mom.d/*.policy
$(RM) $(DESTDIR)$(vdsmconfdir)/mom.conf
-
-install-data-networkmanager:
- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/NetworkManager/conf.d
- $(INSTALL_DATA) 90-vdsm-monitor-connection-files.conf \
- $(DESTDIR)$(sysconfdir)/NetworkManager/conf.d
-
-uninstall-data-networkmanager:
- $(RM) $(DESTDIR)$(sysconfdir)/NetworkManager/conf.d/90-vdsm-monitor-connection-files.conf
install-data-sudoers:
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sudoers.d
--
To view, visit https://gerrit.ovirt.org/59260
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I392a918112c3a7b5bfee6fccb2a51b038d5a543f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: log: Use INFO log level as default
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: log: Use INFO log level as default
......................................................................
log: Use INFO log level as default
The current logs are much too verbose which cause trouble for users, and
make us look unprofessional. Mature project should not use debug log by
default.
To debug issues that are not clear enough using INFO logs, the relevant
logger level can be modified on a user machine as needed.
Change-Id: I767dcd9bad7b9fbeebb438e9ef13cb0ec3f042ee
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/logger.conf.in
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/32504/1
diff --git a/vdsm/logger.conf.in b/vdsm/logger.conf.in
index 64b154f..8e963dd 100644
--- a/vdsm/logger.conf.in
+++ b/vdsm/logger.conf.in
@@ -8,18 +8,18 @@
keys=long,simple,none,sysform
[logger_root]
-level=DEBUG
+level=INFO
handlers=syslog,logfile
propagate=0
[logger_vds]
-level=DEBUG
+level=INFO
handlers=syslog,logfile
qualname=vds
propagate=0
[logger_Storage]
-level=DEBUG
+level=INFO
handlers=logfile
qualname=Storage
propagate=0
@@ -31,7 +31,7 @@
propagate=1
[logger_connectivity]
-level=DEBUG
+level=INFO
handlers=connlogfile
qualname=connectivity
propagate=0
--
To view, visit http://gerrit.ovirt.org/32504
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I767dcd9bad7b9fbeebb438e9ef13cb0ec3f042ee
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 9 months