Change in vdsm[master]: (Schema) Change BlockDevicePathInfo so that it needs one les...
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: (Schema) Change BlockDevicePathInfo so that it needs one less redundant enum
......................................................................
(Schema) Change BlockDevicePathInfo so that it needs one less redundant enum
Change-Id: I5ab262a1fbadf89aec0c649822a2a5879823521d
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 6 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/6843/1
--
To view, visit http://gerrit.ovirt.org/6843
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ab262a1fbadf89aec0c649822a2a5879823521d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: (Schema) Replace host\port combos with NetworkAdress
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: (Schema) Replace host\port combos with NetworkAdress
......................................................................
(Schema) Replace host\port combos with NetworkAdress
Change-Id: Iade8796a0168561ea0902ca512a817eb2f44aecb
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 21 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/6964/1
--
To view, visit http://gerrit.ovirt.org/6964
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iade8796a0168561ea0902ca512a817eb2f44aecb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Related to 846307 - Simplifying clientIF._cleanOldFiles().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Related to 846307 - Simplifying clientIF._cleanOldFiles().
......................................................................
Related to 846307 - Simplifying clientIF._cleanOldFiles().
Change-Id: Ifd63a1f4b1c64f84d5734da033a2420b97ce0ada
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=846307
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 15 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/8626/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index e9ca7c9..669c5be 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -1,3 +1,4 @@
+import os.path
#
# Copyright 2011 Red Hat, Inc.
#
@@ -453,24 +454,18 @@
return None
def _cleanOldFiles(self):
- for f in os.listdir(constants.P_VDSM_RUN):
+ for fName in os.listdir(constants.P_VDSM_RUN):
+ if fName in ('vdsmd.pid', 'respawn.pid', 'svdsm.pid',
+ 'svdsm.sock'):
+ continue
try:
- vmId, fileType = f.split(".", 1)
- if fileType in ["guest.socket", "monitor.socket", "pid",
- "stdio.dump", "recovery"]:
- if vmId in self.vmContainer:
- continue
- if f == 'vdsmd.pid':
- continue
- if f == 'respawn.pid':
- continue
- if f == 'svdsm.pid':
- continue
- if f == 'svdsm.sock':
- continue
- else:
- continue
- self.log.debug("removing old file " + f)
- utils.rmFile(constants.P_VDSM_RUN + f)
- except:
- pass
+ vmId, fileType = fName.split('.', 1)
+ except ValueError:
+ pass # fName does not contains '.'
+ if not fileType in ("guest.socket", "monitor.socket", "pid",
+ "stdio.dump", "recovery"):
+ continue
+ if vmId in self.vmContainer:
+ continue
+ self.log.debug("Removing old file %s", fName)
+ utils.rmFile(constants.P_VDSM_RUN + fName)
--
To view, visit http://gerrit.ovirt.org/8626
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd63a1f4b1c64f84d5734da033a2420b97ce0ada
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Extend Image.move to move and copy subchains
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Extend Image.move to move and copy subchains
......................................................................
Extend Image.move to move and copy subchains
The method Image.move was only capable of moving and copying the entire
image chain. Now it's possible to specify an (optional) volUUID to move
or copy a subchain from the base up to volUUID.
Change-Id: Icb11818f830c6f02bcb74d69f1c119efaf100cc2
---
M vdsm/storage/image.py
M vdsm/storage/sp.py
2 files changed, 33 insertions(+), 22 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/3217/1
--
To view, visit http://gerrit.ovirt.org/3217
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb11818f830c6f02bcb74d69f1c119efaf100cc2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: image: unify the getChainTemplate method
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: image: unify the getChainTemplate method
......................................................................
image: unify the getChainTemplate method
Change-Id: I32fedf40e8c05d4ef7d26cb9172c22d7ee6e9086
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/image.py
1 file changed, 11 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/12868/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 92021ff..4c6047e 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -260,7 +260,7 @@
"""
chain = self.getChain(sdUUID, imgUUID, volUUID)
newsize = 0
- template = chain[0].getParentVolume()
+ template = self.getChainTemplate(chain)
if template:
newsize = template.getVolumeSize()
for vol in chain:
@@ -327,27 +327,22 @@
self.log.info("sdUUID=%s imgUUID=%s chain=%s ", sdUUID, imgUUID, chain)
return chain
- def getTemplate(self, sdUUID, imgUUID):
+ def getChainTemplate(self, chain):
"""
- Return template of the image
+ Return the template of a volume chain. None if not present.
"""
- tmpl = None
- # Find all volumes of image (excluding template)
- chain = self.getChain(sdUUID, imgUUID)
- # check if the chain is build above a template, or it is a standalone
- pvol = chain[0].getParentVolume()
- if pvol:
- tmpl = pvol
- elif chain[0].isShared():
- tmpl = chain[0]
+ try:
+ templateVolume = chain[0].getParentVolume()
+ except IndexError:
+ raise se.ImageValidationError("The chain has no volumes")
- return tmpl
+ return templateVolume
def prepare(self, sdUUID, imgUUID, volUUID=None):
chain = self.getChain(sdUUID, imgUUID, volUUID)
# Adding the image template to the chain
- tmplVolume = chain[0].getParentVolume()
+ tmplVolume = self.getChainTemplate(chain)
if tmplVolume:
chain.insert(0, tmplVolume)
@@ -489,7 +484,7 @@
fakeTemplate = False
pimg = volume.BLANK_UUID # standalone chain
# check if the chain is build above a template, or it is a standalone
- pvol = srcChain[0].getParentVolume()
+ pvol = self.getChainTemplate(srcChain)
if pvol:
# find out parent volume parameters
volParams = pvol.getVolumeParams()
@@ -790,7 +785,7 @@
raise se.ImageIsNotLegalChain(imgUUID)
chain = self.getChain(sdUUID, imgUUID)
# check if the chain is build above a template, or it is a standalone
- pvol = chain[0].getParentVolume()
+ pvol = self.getChainTemplate(chain)
if pvol:
if not pvol.isLegal() or pvol.isFake():
raise se.ImageIsNotLegalChain(imgUUID)
--
To view, visit http://gerrit.ovirt.org/12868
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I32fedf40e8c05d4ef7d26cb9172c22d7ee6e9086
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: PARTIAL: explicitly close libvirt connection after use
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: PARTIAL: explicitly close libvirt connection after use
......................................................................
PARTIAL: explicitly close libvirt connection after use
Otherwise, libvirt cries about
: error : virNetSocketReadWire:1184 : End of file while reading data: Input/output error
TODO: fix other usages of libvirtconnection.get().
Change-Id: I2b15f3ab017828a63960ba9311fa2bf6bfab4729
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/tool/dummybr.py
1 file changed, 6 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/17192/1
diff --git a/lib/vdsm/tool/dummybr.py b/lib/vdsm/tool/dummybr.py
index 762e726..68a9568 100644
--- a/lib/vdsm/tool/dummybr.py
+++ b/lib/vdsm/tool/dummybr.py
@@ -20,6 +20,7 @@
import os
+import contextlib
from vdsm.netinfo import DUMMY_BRIDGE
from vdsm import libvirtconnection, utils, constants
@@ -34,11 +35,11 @@
def addBridgeToLibvirt(bridgeName):
- conn = libvirtconnection.get(None, False)
- if bridgeName not in conn.listNetworks():
- conn.networkCreateXML(
- '''<network><name>%s</name><forward mode='bridge'/><bridge '''
- '''name='%s'/></network>''' % (bridgeName, bridgeName))
+ with contextlib.closing(libvirtconnection.get(None, False)) as conn:
+ if bridgeName not in conn.listNetworks():
+ conn.networkCreateXML(
+ '''<network><name>%s</name><forward mode='bridge'/><bridge '''
+ '''name='%s'/></network>''' % (bridgeName, bridgeName))
@expose('dummybr')
def main():
--
To view, visit http://gerrit.ovirt.org/17192
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b15f3ab017828a63960ba9311fa2bf6bfab4729
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: sd: unify lease params
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: sd: unify lease params
......................................................................
sd: unify lease params
Change-Id: Id65d5dd2a0130a19234d7fb699854a09f5748566
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/utils.py
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/sd.py
4 files changed, 25 insertions(+), 53 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/16318/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 538498f..1c714ed 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -912,3 +912,7 @@
logging.error("Panic: %s", msg, exc_info=True)
os.killpg(0, 9)
sys.exit(-3)
+
+
+def getRange(d, begin, end):
+ return dict(e for i, e in enumerate(d.items()) if begin <= i <= end)
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 72b3ef0..e8f162a 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -560,19 +560,11 @@
sd.DMDK_ROLE: sd.REGULAR_DOMAIN,
sd.DMDK_POOLS: [],
sd.DMDK_LOCK_POLICY: '',
- sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC: sd.DEFAULT_LEASE_PARAMS[
- sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC],
- sd.DMDK_LEASE_TIME_SEC: sd.DEFAULT_LEASE_PARAMS[
- sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC],
- sd.DMDK_IO_OP_TIMEOUT_SEC: sd.DEFAULT_LEASE_PARAMS[
- sd.DMDK_IO_OP_TIMEOUT_SEC],
- sd.DMDK_LEASE_RETRIES: sd.DEFAULT_LEASE_PARAMS[
- sd.DMDK_LEASE_RETRIES],
DMDK_VGUUID: vgUUID,
DMDK_LOGBLKSIZE: logBlkSize,
DMDK_PHYBLKSIZE: phyBlkSize,
}
-
+ initialMetadata.update(sd.SUB_DEFAULT_LEASE_PARAMS)
initialMetadata.update(mapping)
md.update(initialMetadata)
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index dcc6baf..daac802 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -214,7 +214,8 @@
# FIXME : This is 99% like the metadata in block SD
# Do we really need to keep the EXPORT_PATH?
# no one uses it
- md.update({
+ meta = {}
+ meta.update({
sd.DMDK_VERSION: version,
sd.DMDK_SDUUID: sdUUID,
sd.DMDK_TYPE: storageType,
@@ -223,16 +224,10 @@
sd.DMDK_ROLE: sd.REGULAR_DOMAIN,
sd.DMDK_POOLS: [],
sd.DMDK_LOCK_POLICY: '',
- sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC:
- sd.DEFAULT_LEASE_PARAMS[sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC],
- sd.DMDK_LEASE_TIME_SEC: sd.DEFAULT_LEASE_PARAMS[
- sd.DMDK_LOCK_RENEWAL_INTERVAL_SEC],
- sd.DMDK_IO_OP_TIMEOUT_SEC:
- sd.DEFAULT_LEASE_PARAMS[sd.DMDK_IO_OP_TIMEOUT_SEC],
- sd.DMDK_LEASE_RETRIES:
- sd.DEFAULT_LEASE_PARAMS[sd.DMDK_LEASE_RETRIES],
REMOTE_PATH: remotePath
})
+ meta.update(sd.SUB_DEFAULT_LEASE_PARAMS)
+ md.update(meta)
def getReadDelay(self):
stats = misc.readspeed(self.metafile, 4096)
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index fd79059..630abad 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -30,7 +30,7 @@
import resourceFactories
from resourceFactories import IMAGE_NAMESPACE, VOLUME_NAMESPACE
import resourceManager as rm
-from vdsm import constants
+from vdsm import constants, utils
import clusterlock
import outOfProcess as oop
from persistentDict import unicodeEncoder, unicodeDecoder
@@ -121,11 +121,14 @@
DMDK_IO_OP_TIMEOUT_SEC = 'IOOPTIMEOUTSEC'
DMDK_LEASE_RETRIES = 'LEASERETRIES'
-DEFAULT_LEASE_PARAMS = {DMDK_LOCK_POLICY: "ON",
- DMDK_LEASE_RETRIES: 3,
+# order is significant - DO NOT CHANGE
+DEFAULT_LEASE_PARAMS = {DMDK_LEASE_RETRIES: 3,
DMDK_LEASE_TIME_SEC: 30,
DMDK_LOCK_RENEWAL_INTERVAL_SEC: 5,
- DMDK_IO_OP_TIMEOUT_SEC: 1}
+ DMDK_IO_OP_TIMEOUT_SEC: 1,
+ DMDK_LOCK_POLICY: "ON"}
+
+SUB_DEFAULT_LEASE_PARAMS = utils.getRange(DEFAULT_LEASE_PARAMS, 0, 3)
MASTER_FS_DIR = 'master'
VMS_DIR = 'vms'
@@ -268,23 +271,13 @@
DMDK_POOLS: (lambda s: s.split(",") if s else [],
lambda poolUUIDs: ",".join(poolUUIDs)),
DMDK_LOCK_POLICY: (str, str),
- DMDK_LOCK_RENEWAL_INTERVAL_SEC: (
- lambda val: intOrDefault(
- DEFAULT_LEASE_PARAMS[DMDK_LOCK_RENEWAL_INTERVAL_SEC], val),
- intEncode),
- DMDK_LEASE_TIME_SEC: (
- lambda val: intOrDefault(
- DEFAULT_LEASE_PARAMS[DMDK_LEASE_TIME_SEC], val),
- intEncode),
- DMDK_IO_OP_TIMEOUT_SEC: (
- lambda val: intOrDefault(
- DEFAULT_LEASE_PARAMS[DMDK_IO_OP_TIMEOUT_SEC], val),
- intEncode),
- DMDK_LEASE_RETRIES: (
- lambda val: intOrDefault(
- DEFAULT_LEASE_PARAMS[DMDK_LEASE_RETRIES], val),
- intEncode),
}
+
+for param in SUB_DEFAULT_LEASE_PARAMS:
+ SD_MD_FIELDS[param] = (
+ lambda val: intOrDefault(
+ DEFAULT_LEASE_PARAMS[param], val),
+ intEncode)
class StorageDomain:
@@ -332,12 +325,7 @@
if not domVersion:
domVersion = self.getVersion()
- leaseParams = (
- DEFAULT_LEASE_PARAMS[DMDK_LOCK_RENEWAL_INTERVAL_SEC],
- DEFAULT_LEASE_PARAMS[DMDK_LEASE_TIME_SEC],
- DEFAULT_LEASE_PARAMS[DMDK_LEASE_RETRIES],
- DEFAULT_LEASE_PARAMS[DMDK_IO_OP_TIMEOUT_SEC],
- )
+ leaseParams = SUB_DEFAULT_LEASE_PARAMS.values()
try:
clusterLockClass = self._clusterLockTable[domVersion][0]
@@ -478,12 +466,7 @@
def acquireClusterLock(self, hostID):
self.refresh()
- self._clusterLock.setParams(
- self.getMetaParam(DMDK_LOCK_RENEWAL_INTERVAL_SEC),
- self.getMetaParam(DMDK_LEASE_TIME_SEC),
- self.getMetaParam(DMDK_LEASE_RETRIES),
- self.getMetaParam(DMDK_IO_OP_TIMEOUT_SEC)
- )
+ self._clusterLock.setParams(*self.getLeaseParams())
self._clusterLock.acquire(hostID)
def releaseClusterLock(self):
@@ -527,10 +510,8 @@
self.setMetaParams(leaseParamPack)
def getLeaseParams(self):
- keys = [DMDK_LOCK_RENEWAL_INTERVAL_SEC, DMDK_LEASE_TIME_SEC,
- DMDK_IO_OP_TIMEOUT_SEC, DMDK_LEASE_RETRIES]
params = {}
- for key in keys:
+ for key in SUB_DEFAULT_LEASE_PARAMS:
params[key] = self.getMetaParam(key)
return params
--
To view, visit http://gerrit.ovirt.org/16318
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id65d5dd2a0130a19234d7fb699854a09f5748566
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Added a support for a guest hibernate command.
by ghammer@redhat.com
Gal Hammer has uploaded a new change for review.
Change subject: Added a support for a guest hibernate command.
......................................................................
Added a support for a guest hibernate command.
Change-Id: I1ad6836e61e9d91ec6f46a599541f61ff12e9737
---
M vdsm/clientIF.py
M vdsm/guestIF.py
M vdsm_cli/vdsClient.py
3 files changed, 32 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/1121/1
--
To view, visit http://gerrit.ovirt.org/1121
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ad6836e61e9d91ec6f46a599541f61ff12e9737
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Gal Hammer <ghammer(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: [WIP] Added gluster geo-replication support
by barumuga@redhat.com
Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/8375
to review the following change.
Change subject: [WIP] Added gluster geo-replication support
......................................................................
[WIP] Added gluster geo-replication support
Below new verbs are added
glusterValidateSshConnection
glusterSetupSshConnection
Change-Id: Ic783abd5f1b63bc5116ce4ff2a3c7be92001a387
Signed-off-by: Bala.FA <barumuga(a)redhat.com>
---
M vdsm.spec.in
M vdsm/gluster/api.py
M vdsm/gluster/exception.py
3 files changed, 137 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/8375/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 22e48fb..020344f 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -352,6 +352,7 @@
Requires: %{name} = %{version}-%{release}
Requires: glusterfs glusterfs-server glusterfs-fuse
+Requires: python-paramiko
%description gluster
Gluster plugin enables VDSM to serve Gluster functionalities.
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index a825de2..338cb06 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -19,11 +19,24 @@
#
from functools import wraps
+import socket
+import paramiko
+import re
from vdsm.define import doneCode
import supervdsm as svdsm
+from vdsm.config import config
+from vdsm import utils
+import exception as ge
_SUCCESS = {'status': doneCode}
+_KEYFILE = config.get('vars', 'trust_store_path') + '/keys/vdsmkey.pem'
+_sshKeyGenCommandPath = utils.CommandPath("ssh-keygen",
+ "/usr/bin/ssh-keygen",
+ )
+_SSH_COPY_ID_CMD = "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; " \
+ "cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorecon && " \
+ "/sbin/restorecon ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)"
def exportAsVerb(func):
@@ -43,6 +56,52 @@
class VolumeStatus():
ONLINE = 'ONLINE'
OFFLINE = 'OFFLINE'
+
+
+class HostKeyMatchException(paramiko.SSHException):
+ def __init__(self, hostname, fingerprint, expected_fingerprint):
+ err = 'Fingerprint of Host key ' \
+ '%s for server %s does not match with %s' % \
+ (fingerprint, hostname, expected_fingerprint)
+ paramiko.SSHException.__init__(self, err)
+ self.hostname = hostname
+ self.fingerprint = fingerprint
+ self.expected_fingerprint = expected_fingerprint
+
+
+class HostKeyMatchPolicy(paramiko.AutoAddPolicy):
+ def __init__(self, expected_fingerprint):
+ self.expected_fingerprint = expected_fingerprint
+
+ def missing_host_key(self, client, hostname, key):
+ s = paramiko.util.hexlify(key.get_fingerprint())
+ fingerprint = ':'.join(re.findall('..', s))
+ if fingerprint == self.expected_fingerprint.upper():
+ paramiko.AutoAddPolicy.missing_host_key(self, client, hostname,
+ key)
+ else:
+ raise HostKeyMatchException(hostname, fingerprint,
+ self.expected_fingerprint)
+
+
+class GlusterSsh(paramiko.SSHClient):
+ def __init__(self, hostname, fingerprint, port=22, username=None,
+ password=None, pkey=None, key_filename=None, timeout=None,
+ allow_agent=True, look_for_keys=True, compress=False):
+ paramiko.SSHClient.__init__(self)
+ key_file_list = [_KEYFILE]
+ if key_filename:
+ key_file_list.append(list(key_filename))
+ self.set_missing_host_key_policy(HostKeyMatchPolicy(fingerprint))
+ try:
+ paramiko.SSHClient.connect(self, hostname, port, username,
+ password, pkey, key_file_list, timeout,
+ allow_agent, look_for_keys, compress)
+ except socket.error, e:
+ err = ['%s: %s' % (hostname, e)]
+ raise ge.GlusterSshConnectionFailedException(err=err)
+ except HostKeyMatchException, e:
+ raise ge.GlusterSshHostKeyMismatchException(err=[e.err])
class GlusterApi(object):
@@ -236,6 +295,47 @@
def volumeProfileStop(self, volumeName, options=None):
self.svdsmProxy.glusterVolumeProfileStop(volumeName)
+ def _validateSshConnection(self, hostname, fingerprint, username):
+ try:
+ ssh = GlusterSsh(hostname,
+ fingerprint,
+ username=username)
+ ssh.close()
+ return True
+ except paramiko.AuthenticationException, e:
+ raise ge.GlusterSshHostKeyAuthException(err=[str(e)])
+
+ @exportAsVerb
+ def validateSshConnection(self, hostname, fingerprint, username):
+ return self._validateSshConnection(hostname, fingerprint, username)
+
+ @exportAsVerb
+ def setupSshConnection(self, hostname, fingerprint, username, password):
+ rc, out, err = utils.execCmd([_sshKeyGenCommandPath.cmd, '-y', '-f',
+ _KEYFILE])
+ if rc != 0:
+ raise ge.GlusterSshPubKeyGenerationFailedException(rc=rc, err=err)
+
+ try:
+ ssh = GlusterSsh(hostname,
+ fingerprint,
+ username=username,
+ password=password)
+ c = ssh.get_transport().open_session()
+ stdin, stdout, stderr = c.exec_command(_SSH_COPY_ID_CMD)
+ stdin.write('\n'.join(out) + '\n')
+ stdin.flush()
+ stdin.close()
+ rc = c.recv_exit_status()
+ ssh.close()
+ if rc != 0:
+ err = stderr.read().splitlines()
+ raise ge.GlusterSshSetupExecFailedException(rc=rc, err=err)
+ except paramiko.AuthenticationException, e:
+ raise ge.GlusterSshHostAuthException(err=[str(e)])
+
+ return self._validateSshConnection(hostname, fingerprint, username)
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 6d94ae3..0143a5e 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -377,3 +377,39 @@
class GlusterHostsListFailedException(GlusterHostException):
code = 4407
message = "Hosts list failed"
+
+
+# Ssh
+class GlusterSshException(GlusterException):
+ code = 4500
+ message = "Gluster ssh exception"
+
+
+class GlusterSshConnectionFailedException(GlusterSshException):
+ code = 4501
+ message = "SSH connection failed"
+
+
+class GlusterSshHostKeyMismatchException(GlusterSshException):
+ code = 4502
+ message = "Host key match failed"
+
+
+class GlusterSshHostKeyAuthException(GlusterSshException):
+ code = 4503
+ message = "SSH host key authentication failed"
+
+
+class GlusterSshHostAuthException(GlusterSshException):
+ code = 4504
+ message = "SSH host authentication failed"
+
+
+class GlusterSshPubKeyGenerationFailedException(GlusterSshException):
+ code = 4505
+ message = "SSH public key generation failed"
+
+
+class GlusterSshSetupExecFailedException(GlusterSshException):
+ code = 4506
+ message = "SSH key setup execution failed"
--
To view, visit http://gerrit.ovirt.org/8375
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic783abd5f1b63bc5116ce4ff2a3c7be92001a387
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
9 years, 5 months
Change in vdsm[master]: Add qemu's memory usage to VM statistics.
by ghammer@redhat.com
Gal Hammer has uploaded a new change for review.
Change subject: Add qemu's memory usage to VM statistics.
......................................................................
Add qemu's memory usage to VM statistics.
Change-Id: Ibeb35759454c4a9b41e1303956267e93ca3545a0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=799285
Signed-off-by: Gal Hammer <ghammer(a)redhat.com>
---
M vdsm/config.py.in
M vdsm/libvirtvm.py
2 files changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/9006/1
diff --git a/vdsm/config.py.in b/vdsm/config.py.in
index df85e7e..ee1627b 100644
--- a/vdsm/config.py.in
+++ b/vdsm/config.py.in
@@ -111,6 +111,8 @@
('vm_sample_net_interval', '5', None),
('vm_sample_net_window', '2', None),
+
+ ('vm_sample_memory_interval', '2', None),
('trust_store_path', '@TRUSTSTORE@',
'Where the certificates and keys are situated.'),
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 86e39a3..f76f35c 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -91,10 +91,13 @@
self._sampleNet,
config.getint('vars', 'vm_sample_net_interval'),
config.getint('vars', 'vm_sample_net_window')))
+ self.sampleMem = (utils.AdvancedStatsFunction(self._sampleMem,
+ config.getint('vars', 'vm_sample_memory_interval')))
self.addStatsFunction(
self.highWrite, self.updateVolumes, self.sampleCpu,
- self.sampleDisk, self.sampleDiskLatency, self.sampleNet)
+ self.sampleDisk, self.sampleDiskLatency, self.sampleNet,
+ self.sampleMem)
def _highWrite(self):
if not self._vm.isDisksStatsCollectionEnabled():
@@ -168,6 +171,14 @@
netSamples[nic.name] = self._vm._dom.interfaceStats(nic.name)
return netSamples
+ def _sampleMem(self):
+ memUsage = {}
+ for line in open('/proc/%d/status' %(self.conf['pid'])):
+ var, value = line.strip().split()[0:2]
+ if var in ('VmSize:', 'VmRSS:', 'VmData:'):
+ memUsage[var[:-1]] = long(value)
+ return memUsage
+
def _diff(self, prev, curr, val):
return prev[val] - curr[val]
--
To view, visit http://gerrit.ovirt.org/9006
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibeb35759454c4a9b41e1303956267e93ca3545a0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Gal Hammer <ghammer(a)redhat.com>
9 years, 5 months