Change in vdsm[master]: Initial commit of the tool for starting VM without the manag...
by Pablo Iranzo Gómez
Pablo Iranzo Gómez has uploaded a new change for review.
Change subject: Initial commit of the tool for starting VM without the manager being available
......................................................................
Initial commit of the tool for starting VM without the manager being available
Change-Id: I9a70b31ce0730194880406701316f219c9f92ceb
Signed-off-by: Pablo <Pablo.Iranzo(a)gmail.com>
---
A contrib/forceVMstart/vdsEmergency-1.0.0.py
1 file changed, 490 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/9473/1
diff --git a/contrib/forceVMstart/vdsEmergency-1.0.0.py b/contrib/forceVMstart/vdsEmergency-1.0.0.py
new file mode 100644
index 0000000..41fe068
--- /dev/null
+++ b/contrib/forceVMstart/vdsEmergency-1.0.0.py
@@ -0,0 +1,490 @@
+#!/usr/bin/env python
+#
+# Copyright 2010 Red Hat, Inc.
+#
+# Licensed to you under 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.
+#
+# Require Packages: python-iniparse
+
+import getopt
+import sys
+import commands
+import os
+import socket
+from xml.dom.minidom import parse, parseString
+
+try:
+ from iniparse import ConfigParser
+except:
+ print "Package python-iniparse is required, please install"
+ print "#yum install python-iniparse -y"
+ sys.exit(1)
+
+
+# Adding vdsm .pyc libraries to python path
+sys.path.append("/usr/share/vdsm")
+
+try:
+ import vdscli
+except:
+ print "Cannot import vdscli, please contact Red Hat support"
+ sys.exit(1)
+
+try:
+ import vdsClient
+except:
+ print "Cannot import vdsClient, please contact Red Hat support"
+ sys.exit(1)
+
+# General Macros
+VERSION = "1.0.0"
+VDSM_PORT = "54321"
+
+#DEBUG MODE
+DEBUG = "False" # True or False
+
+#########################################################################
+
+class vdsmEmergency:
+
+ ##########################################################################
+ # __init__() #
+ # Description: Initialize method #
+ ##########################################################################
+ def __init__(self):
+ sslRet = self.checkSSLvdsm()
+ self.useSSL = sslRet
+ self.truststore = None
+
+ ##########################################################################
+ # do_connect() #
+ # Description: Do a connection with vdsm daemon #
+ ##########################################################################
+ def do_connect(self, server, port):
+ print "Trying to connect to vdsmd host (%s).." % server
+
+ # Connection Validation
+ sk = socket.socket()
+ try:
+ sk.connect((server, int(VDSM_PORT)))
+ except Exception, e:
+ print "Unable to connect %s" % server
+ sk.close()
+ return -1
+
+ self.s = vdscli.connect(server + ':' + port, self.useSSL, self.truststore)
+
+ print "OK, Connected to vdsmd!"
+ return 0
+
+ ##########################################################################
+ # checkRoot() #
+ # Description: check if the user running the script is root #
+ ##########################################################################
+ def checkRoot(self):
+ if os.geteuid() != 0:
+ print "You must be root to run this script."
+ sys.exit(2)
+
+ ##########################################################################
+ # getIpRHEVM() #
+ # Description: get the IP from RHEVM Interface #
+ ##########################################################################
+ def getIpRHEVM(self):
+
+ # TODO: avoid this kind of hack, find a better approach (vdsClient provide the IP of rhevm interface?)
+ strCmd = "ifconfig rhevm | grep \"inet addr\" | cut -d \':\' -f 2 | cut -d \' \' -f 1"
+ retCmd = commands.getstatusoutput(strCmd)
+ if retCmd[0] != 0:
+ print "Error getting IP from rhevm interface"
+ sys.exit(1)
+
+ return retCmd[1]
+ ##########################################################################
+ # checkSSLvdsm() #
+ # Description: check if vdsm is running as SSL or without it #
+ ##########################################################################
+ def checkSSLvdsm(self):
+
+ cfg = ConfigParser()
+ cfg.read('/etc/vdsm/vdsm.conf')
+ cfg.get('vars', 'ssl')
+
+ return cfg.data.vars.ssl
+
+
+ ##########################################################################
+ # checkVmRunning() #
+ # Description: check if the vms are running #
+ ##########################################################################
+ def checkVmRunning(self, otherHostsList, VmsToStart):
+
+ hosts = None
+ vms = None
+ i = 0
+ j = 0
+
+ if otherHostsList == None:
+ return -1
+
+ if VmsToStart == None:
+ return -1
+
+ vms = VmsToStart.split(",")
+ hosts = otherHostsList.split(",")
+
+ # Let's check if all other Hosts are running the VirtualMachine
+ while (i <> len(hosts)):
+ ret = VE.do_connect(hosts[i], VDSM_PORT)
+ if ret < 0:
+ sys.exit(1)
+ response = self.s.list()
+ if response['status']['code'] != 0:
+ print "cannot execute list operation, err:" + response['status']['message']
+
+ # Checking VM status
+ for s in self.s.getAllVmStats()['statsList']:
+ j = 0
+
+ # print all vms in each host
+ while j < len(vms):
+ if DEBUG == "True":
+ print len(vms)
+ print s['vmId']
+ print hosts[i]
+ print vms[j]
+
+ vmIdCurr = self.getVmId(vms[j])
+
+ if DEBUG == "True":
+ print vmIdCurr
+ print s['vmId']
+
+ if s['vmId'] == vmIdCurr and s['status'] == "Up":
+ print "Cannot continue, the VM %s is running in host %s" % (vms[j], hosts[i])
+ sys.exit(1)
+ j = j + 1
+
+ # counter for hosts
+ i = i + 1
+
+ print "OK, the vm(s) specified are not running on the host(s) informed, continuing.."
+
+ ##########################################################################
+ # checkSPM() #
+ # Description: check if the host which is running this script is the SPM #
+ ##########################################################################
+ def checkSPM(self):
+ self.spUUID = None
+ self.spmStatus = None
+
+ ip_rhevm_interface = self.getIpRHEVM()
+ self.do_connect(ip_rhevm_interface, VDSM_PORT)
+
+ try:
+ list = self.s.getConnectedStoragePoolsList()
+ except:
+ print "Cannot execute getConnectedStoragePoolsList()"
+ sys.exit(1)
+
+ for entry in list['poollist']:
+ self.spUUID = entry
+
+ if not self.spUUID:
+ print "Cannot locate Storage Pools List.. aborting!"
+ sys.exit(1)
+
+ try:
+ status = self.s.getSpmStatus(self.spUUID)
+ except:
+ print "Cannot execute getSpmStatus()"
+ sys.exit(1)
+
+ self.spmStatus = status['spm_st']['spmStatus']
+
+ if self.spmStatus <> "SPM":
+ print "This host is not the current SPM, status [%s]" % self.spmStatus
+ sys.exit(1)
+
+
+ ######################################################################
+ # getVmId() #
+ # Description: get the vmId from the vmName used as argument #
+ ######################################################################
+ def getVmId(self, vmName):
+ path = "/rhev/data-center/%s/vms" % (self.spUUID)
+
+ # First verify which domainID contain de XML files
+ try:
+ dirList = os.listdir(path)
+ except:
+ print "Cannot locate the dir with ovf files.. aborting!"
+ sys.exit(1)
+
+ #Read all content of xml(s) file(s)
+ for fname in dirList:
+
+ pathOVF = path + "/" + fname + "/" + fname + ".ovf"
+
+ dom = parse(pathOVF)
+
+ # Getting vmId field
+ i = 0
+ attr = 0
+ for node in dom.getElementsByTagName('Section'):
+ while ( i < len(node.attributes)):
+ attr = node.attributes.items()
+ if attr[i][0] == "ovf:id":
+ vmId = attr[i][1]
+ i = i + 1
+
+ # Getting vmName field
+ for node in dom.getElementsByTagName('Content'):
+ if node.childNodes[0].firstChild <> None:
+ if node.childNodes[0].firstChild.nodeValue == vmName:
+ return vmId
+
+
+
+ def _parseDriveSpec(self, spec):
+ if ',' in spec:
+ d = {}
+ for s in spec.split(','):
+ k, v = s.split(':', 1)
+ if k == 'domain': d['domainID'] = v
+ if k == 'pool': d['poolID'] = v
+ if k == 'image': d['imageID'] = v
+ if k == 'volume': d['volumeID'] = v
+ if k == 'boot': d['boot'] = v
+ if k == 'format': d['format'] = v
+ return d
+ return spec
+
+ ######################################################################
+ # readXML() #
+ # Description: read all xml available pointed to Direcory path and #
+ # parse for specific fields #
+ ######################################################################
+ def readXML(self, VmsStotart, destHostStart):
+
+ # number of Vms found
+ nrmVms = 0
+ cmd = {}
+ # Path to XML files
+ # example default path:
+ # /rhev/data-center/1a516f64-f091-4785-9278-362037513408/vms
+ path = "/rhev/data-center/%s/vms" % (self.spUUID)
+
+ # First verify which domainID contain de XML files
+ try:
+ dirList = os.listdir(path)
+ except:
+ print "Cannot locate the dir with ovf files.. aborting!"
+ sys.exit(1)
+
+ #Read all content of xml(s) file(s)
+ for fname in dirList:
+
+ pathOVF = path + "/" + fname + "/" + fname + ".ovf"
+ cmd['display']="vnc"
+ cmd['kvmEnable']="True"
+ cmd['tabletEnable']="True"
+ cmd['vmEnable']="True"
+ cmd['irqChip']="True"
+ cmd['nice']=0
+ cmd['keyboardLayout']="en-us"
+ cmd['acpiEnable']="True"
+ cmd['tdf']="True"
+
+ dom = parse(pathOVF)
+
+ # Getting vmId field
+ i = 0
+ attr = 0
+ for node in dom.getElementsByTagName('Section'):
+ while ( i < len(node.attributes)):
+ attr = node.attributes.items()
+ if attr[i][0] == "ovf:id":
+ cmd["vmId"] = attr[i][1]
+ i = i + 1
+
+ # Getting vmName field
+ for node in dom.getElementsByTagName('Content'):
+ if node.childNodes[0].firstChild <> None:
+ self.vmName = node.childNodes[0].firstChild.nodeValue
+ cmd['vmName'] = self.vmName
+
+ # Getting image and volume
+ i = 0
+ attr = 0
+ for node in dom.getElementsByTagName('Disk'):
+ while (i <> len(node.attributes)):
+ attr = node.attributes.items()
+ if attr[i][0] == "ovf:fileRef":
+ storage = attr[i][1]
+ data = storage.split("/")
+ image = data[0]
+ volume = data[1]
+ i += 1
+
+ # Getting VM format, boot
+ i = 0
+ attr =0
+ for node in dom.getElementsByTagName('Disk'):
+ while (i <> len(node.attributes)):
+ attr = node.attributes.items()
+ if attr[i][0] == "ovf:volume-format":
+ format = attr[i][1]
+
+ if attr[i][0] == "ovf:boot":
+ vmBoot = attr[i][1]
+
+ if attr[i][0] == "ovf:disk-interface":
+ ifFormat = attr[i][1]
+
+ i += 1
+
+ if format == "COW":
+ vmFormat = ":cow"
+ elif format == "RAW":
+ vmFormat = ":raw"
+
+
+ if ifFormat == "VirtIO":
+ ifDisk = "virtio"
+ elif ifFormat == "IDE":
+ ifDisk = "ide"
+ drives = []
+ # Getting Drive, bridge, memSize, macAddr, smp, smpCoresPerSocket
+ for node in dom.getElementsByTagName('Item'):
+ # Getting Drive
+ if node.childNodes[0].firstChild <> None:
+ str = node.childNodes[0].firstChild.nodeValue
+ if str.find("Drive") > -1:
+
+ tmp = "pool:" + self.spUUID + ",domain:" + node.childNodes[7].firstChild.nodeValue + ",image:" + image + ",volume:" + volume + ",boot:" + vmBoot + ",format" + vmFormat + ",if:" + ifDisk
+ #param,value = tmp.split("=",1)
+ drives += [self._parseDriveSpec(tmp)]
+ cmd['drives'] = drives
+
+ # Getting bridge
+ nicMod = None
+ if node.childNodes[0].firstChild.nodeValue == "Ethernet adapter on rhevm":
+ if node.childNodes[3].firstChild.nodeValue == "3":
+ nicMod = "pv" #VirtIO
+ elif node.childNodes[3].firstChild.nodeValue == "2":
+ nicMod = "e1000" #e1000
+ elif node.childNodes[3].firstChild.nodeValue == "1":
+ nicMod = "rtl8139" #rtl8139
+
+ cmd['nicModel'] = nicMod
+ cmd['bridge'] = node.childNodes[4].firstChild.nodeValue
+
+ # Getting memSize field
+ str = node.childNodes[0].firstChild.nodeValue
+ if str.find("MB of memory") > -1:
+ cmd['memSize'] = node.childNodes[5].firstChild.nodeValue
+
+ # Getting smp and smpCoresPerSocket fields
+ str = node.childNodes[0].firstChild.nodeValue
+ if str.find("virtual cpu") > -1:
+ cmd["smp="] = node.childNodes[4].firstChild.nodeValue
+ cmd["smpCoresPerSocket"] = node.childNodes[5].firstChild.nodeValue
+
+ # Getting macAddr field
+ if node.childNodes[0].firstChild.nodeValue == "Ethernet adapter on rhevm":
+ if len(node.childNodes) > 6:
+ cmd['macAddr'] = node.childNodes[6].firstChild.nodeValue
+
+ # if node.childNodes < 6 it`s a template entry, so ignore
+ if len(node.childNodes) > 6:
+ # print only vms to start
+ try:
+ checkvms = VmsToStart.split(",")
+ except:
+ print "Please use , between vms name, avoid space"
+ self.usage()
+
+ i = 0
+ while (i <> len(checkvms)):
+ if self.vmName == checkvms[i]:
+ nrmVms = nrmVms + 1
+ self.startVM(cmd, destHostStart)
+ i += 1
+
+ print "Total VMs found: %s" % nrmVms
+
+ ######################################################################
+ # startVM() #
+ # Description: start the VM #
+ ######################################################################
+ def startVM(self, cmd, destHostStart):
+
+ self.do_connect(destHostStart, VDSM_PORT)
+ #print cmd
+ #cmd1 = dict(cmd)
+ #print cmd1
+ ret = self.s.create(cmd)
+ #print ret
+ print "Triggered VM [%s]" % self.vmName
+
+ ######################################################################
+ # usage() #
+ # Description: shows the program params #
+ ######################################################################
+ def usage(self):
+ print "Usage: " + sys.argv[0] + " [OPTIONS]"
+ print "\t--destHost \t RHEV-H host which will start the VM"
+ print "\t--otherHostsList\t All RHEV-H hosts"
+ print "\t--vms \t Specify the Names of which VMs to start"
+ print "\t--version \t List version release"
+ print "\t--help \t This help menu\n"
+
+ print "Example:"
+ print "\t" + sys.argv[0] + " --destHost LinuxSrv1 --otherHostsList Megatron,Jerry --vms vm1,vm2,vm3,vm4"
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+
+ otherHostsList = ''
+ VmsToStart = None
+ destHostStart = None
+
+ VE = vdsmEmergency()
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "Vd:ho:v:", ["destHost=", "otherHostsList=", "vms=", "help", "version"])
+ except getopt.GetoptError, err:
+ # print help information and exit:
+ print(err) # will print something like "option -a not recognized"
+ VE.usage()
+ sys.exit(2)
+ for o, a in opts:
+ if o in ("-d", "--destHost"):
+ destHostStart = a
+ print ""
+ elif o in ("-h", "--help"):
+ VE.usage()
+ sys.exit()
+ elif o in ("-o", "--otherHostsList"):
+ otherHostsList = a
+ elif o in ("-v", "--vms"):
+ VmsToStart = a
+ elif o in ("-V", "--version"):
+ print VERSION
+ else:
+ assert False, "unhandled option"
+
+ argc = len(sys.argv)
+ if argc < 2:
+ VE.usage()
+
+ VE.checkSPM()
+
+ # Include the destHost to verify
+ otherHostsList += ",%s" % destHostStart
+ VE.checkVmRunning(otherHostsList, VmsToStart)
+
+ VE.readXML(VmsToStart, destHostStart)
--
To view, visit http://gerrit.ovirt.org/9473
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a70b31ce0730194880406701316f219c9f92ceb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Pablo Iranzo Gómez <Pablo.Iranzo(a)redhat.com>
10 years
Change in vdsm[master]: (Schema) Change ConnectionRef actions to work on a single co...
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: (Schema) Change ConnectionRef actions to work on a single connection
......................................................................
(Schema) Change ConnectionRef actions to work on a single connection
This was the original intention of the API. The reason we started
supporting multiple connections in a single call is because of the
overhead inherent in XML-RPC. The new API can multiplex calls and has
practically no overhead per call.
Also, refID is not an UUID
Change-Id: I5747f2161d039cfaa82c0797e63ff58dbffbe8ac
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 21 insertions(+), 44 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/7148/1
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index e782613..b103b28 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2250,16 +2250,16 @@
{'command': {'class': 'Global', 'name': 'setSafeNetworkConfig'}}
-## Category: @ConnectionRefs ##################################################
+## Category: @ConnectionRef ##################################################
##
-# @ConnectionRefs.init:
+# @ConnectionRef.init:
#
-# Initialize a ConnectionRefs API object.
+# Initialize a ConnectionRef API object.
#
# Since: 4.10.0
# XXX: Extension: object constructors
##
-{'init': 'ConnectionRefs'}
+{'init': 'ConnectionRef'}
##
# @IscsiPortal:
@@ -2444,60 +2444,37 @@
'connectionInfo': 'ConnectionRefParameters'}}
##
-# @ConnectionRefArgsMap:
-#
-# A mapping of connection arguments indexed by ConnectionRef UUID.
-#
-# Since: 4.10.0
-##
-{'map': 'ConnectionRefArgsMap',
- 'key': 'UUID', 'value': 'ConnectionRefArgs'}
-
-##
-# @ConnectionRefArgsStatusMap:
-#
-# A mapping of status codes indexed by ConnectionRef UUID.
-#
-# Since: 4.10.0
-##
-{'map': 'ConnectionRefArgsStatusMap',
- 'key': 'UUID', 'value': 'int'}
-
-##
-# @ConnectionRefs.acquire:
+# @ConnectionRef.acquire:
#
# Acquire one or more new storage connection references.
#
-# @conRefArgs: Connection parameters
+# @refID: The identifier to be assigned to the new connection reference.
+# Users are encouraged to mangle they information into the string
+# to prevent collisions and declare ownership.
+# eg.
+# ENGINE_CONNECTION_3213
#
-# Returns:
-# @results: A dictionary of status codes indexed by the same @UUID values in
-# @conRefArgs.
+# This way managers can tell which connections are owned by whome.
+# @conRefArgs: Connection parameters.
#
# Since: 4.10.0
# XXX: Extension: map data type ['key type', 'val type']
##
-{'command': {'class': 'ConnectionRefs', 'name': 'acquire'},
- 'data': {'conRefArgs': 'ConnectionRefArgsMap'},
- 'returns': {'results': 'ConnectionRefArgsStatusMap'}}
+{'command': {'class': 'ConnectionRef', 'name': 'acquire'},
+ 'data': {'refID', 'str', 'conRefArgs': 'ConnectionRefArgs'}}
##
-# @ConnectionRefs.release:
+# @ConnectionRef.release:
#
# Release one or more storage connection references.
#
-# @refIDs: A list of @UUID values
-#
-# Returns:
-# @results: A dictionary of status codes indexed by the same @UUID values that
-# were passed in @0.
+# @refIDs: A list of string values.
#
# Since: 4.10.0
# XXX: Extension: list data type
##
-{'command': {'class': 'ConnectionRefs', 'name': 'release'},
- 'data': {'refIDs': ['UUID']},
- 'returns': {'results': 'ConnectionRefArgsStatusMap'}}
+{'command': {'class': 'ConnectionRef', 'name': 'release'},
+ 'data': {'refID': 'str'}}
##
# @ConnectionRefMap:
@@ -2507,10 +2484,10 @@
# Since: 4.10.0
##
{'map': 'ConnectionRefMap',
- 'key': 'UUID', 'value': 'ConnectionRef'}
+ 'key': 'str', 'value': 'ConnectionRef'}
##
-# @ConnectionRefs.statuses:
+# @ConnectionRef.statuses:
#
# Get information about all registered storage connection references.
#
@@ -2519,7 +2496,7 @@
#
# Since: 4.10.0
##
-{'command': {'class': 'ConnectionRefs', 'name': 'statuses'},
+{'command': {'class': 'ConnectionRef', 'name': 'statuses'},
'returns': {'connectionslist': 'ConnectionRefMap'}}
## Category: @ISCSIConnection ##################################################
--
To view, visit http://gerrit.ovirt.org/7148
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5747f2161d039cfaa82c0797e63ff58dbffbe8ac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years
Change in vdsm[master]: Logging shouldn't reach the terminal console
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Logging shouldn't reach the terminal console
......................................................................
Logging shouldn't reach the terminal console
In this patch:
* Change the log facility to LOG_DAEMON for SysLogHandler
* Remove the handler_console (it's unused now but we don't want anyone
to start using it)
* Few format cleanups
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: I749a58362db5daec44ed5b0f7f116e14eadd6043
---
M vdsm/logger.conf.in
1 file changed, 6 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/7980/1
diff --git a/vdsm/logger.conf.in b/vdsm/logger.conf.in
index edd4616..f523306 100644
--- a/vdsm/logger.conf.in
+++ b/vdsm/logger.conf.in
@@ -2,7 +2,7 @@
keys=root,vds,Storage,metadata,SuperVdsm
[handlers]
-keys=console,syslog,logfile,metadata
+keys=syslog,logfile,metadata
[formatters]
keys=long,simple,none,sysform
@@ -40,7 +40,7 @@
level=WARNING
class=handlers.SysLogHandler
formatter=sysform
-args=('/dev/log', handlers.SysLogHandler.LOG_USER)
+args=('/dev/log', handlers.SysLogHandler.LOG_DAEMON)
[handler_logfile]
class=logging.handlers.WatchedFileHandler
@@ -55,25 +55,14 @@
level=WARNING
formatter=long
-[handler_console]
-class: StreamHandler
-args: []
-formatter: none
-
[formatter_simple]
-format: %(name)s:%(levelname)s: %(message)s
+format=%(name)s:%(levelname)s: %(message)s
[formatter_none]
-format: %(message)s
+format=%(message)s
[formatter_long]
-format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s
+format=%(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s
[formatter_sysform]
-format= vdsm %(name)s %(levelname)s %(message)s
-datefmt=
-
-
-
-
-
+format=vdsm %(name)s %(levelname)s %(message)s
--
To view, visit http://gerrit.ovirt.org/7980
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I749a58362db5daec44ed5b0f7f116e14eadd6043
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years
Change in vdsm[master]: Related to BZ#845020 - Diffferentiate bad specification from...
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Related to BZ#845020 - Diffferentiate bad specification from not found.
......................................................................
Related to BZ#845020 - Diffferentiate bad specification from not found.
Already agreed that _devices should be a dict instead a list.
Change-Id: Ic5cffdae26cde88a948211d8577370965ecd2d36
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 15 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/7366/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3b7cfc5..7ad5884 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1627,6 +1627,11 @@
if ((device.domainID, device.imageID,
device.volumeID) == tgetDrv):
return device
+ else:
+ self.log.warning("drive dom: %s, img: %s, vol: %s is not in"
+ "vm: %s _devices", drive["domainID"],
+ drive["imageID"], drive["volumeID"], self.id)
+ return None
elif drive.has_key("GUID"):
for device in self._devices[vm.DISK_DEVICES][:]:
@@ -1634,6 +1639,10 @@
continue
if device.GUID == drive["GUID"]:
return device
+ else:
+ self.log.warning("GUID: %s not found in vm: %s _devices",
+ drive["GUID"], self.id)
+ return None
elif drive.has_key("UUID"):
for device in self._devices[vm.DISK_DEVICES][:]:
@@ -1641,8 +1650,13 @@
continue
if device.UUID == drive["UUID"]:
return device
+ else:
+ self.log.warning("UUID: %s not found in vm: %s _devices",
+ drive["UUID"], self.id)
+ return None
- return None
+ else:
+ raise ValueError("drive specification unknown %s" % drive)
def snapshot(self, snapDrives):
"""Live snapshot command"""
--
To view, visit http://gerrit.ovirt.org/7366
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5cffdae26cde88a948211d8577370965ecd2d36
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: Revert "hsm: always check validateNotSPM when disconnecting ...
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Revert "hsm: always check validateNotSPM when disconnecting from a pool"
......................................................................
Revert "hsm: always check validateNotSPM when disconnecting from a pool"
This reverts commit 185872e5e03999ed7376099d1c8b1a4044cfa5bb.
Change-Id: I791f626e31c9929d687d181b2d7fd43e1d2b155d
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/13926/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index ae35b11..f3a702e 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1026,12 +1026,12 @@
self.validateNotSPM(spUUID)
vars.task.getExclusiveLock(STORAGE, spUUID)
- pool = self.getPool(spUUID)
+ self.validateNotSPM(spUUID)
+ pool = self.getPool(spUUID)
return self._disconnectPool(pool, hostID, scsiKey, remove)
def _disconnectPool(self, pool, hostID, scsiKey, remove):
- self.validateNotSPM(pool.spUUID)
res = pool.disconnect()
del self.pools[pool.spUUID]
return res
--
To view, visit http://gerrit.ovirt.org/13926
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I791f626e31c9929d687d181b2d7fd43e1d2b155d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: Revert "pool: ignore refreshStoragePool calls on the SPM"
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Revert "pool: ignore refreshStoragePool calls on the SPM"
......................................................................
Revert "pool: ignore refreshStoragePool calls on the SPM"
This reverts commit 7d8f85547e5f56d3eefc91f330e29458a7b8ac27.
Change-Id: I660b8d01844520b43998b7081ca02ef06a5acd93
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 0 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/13927/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f3a702e..b560ea4 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -788,22 +788,8 @@
se.StoragePoolActionError(
"spUUID=%s, msdUUID=%s, masterVersion=%s" %
(spUUID, msdUUID, masterVersion)))
-
vars.task.getSharedLock(STORAGE, spUUID)
-
- try:
- # The refreshStoragePool command is an HSM command and
- # should not be issued (and executed) on the SPM. At the
- # moment we just ignore it for legacy reasons but in the
- # future vdsm could raise an exception.
- self.validateNotSPM(spUUID)
- except se.IsSpm:
- self.log.info("Ignoring the refreshStoragePool request "
- "(the host is the SPM)")
- return
-
pool = self.getPool(spUUID)
-
try:
self.validateSdUUID(msdUUID)
pool.refresh(msdUUID, masterVersion)
--
To view, visit http://gerrit.ovirt.org/13927
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I660b8d01844520b43998b7081ca02ef06a5acd93
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: Remove force parameter in StoragePool.spmStop()
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Remove force parameter in StoragePool.spmStop()
......................................................................
Remove force parameter in StoragePool.spmStop()
Change-Id: I7eaf8883e62a72445e27f0bc9876fe61a10bcb3f
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 20 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/13929/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ca20f9a..70c5802 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -340,8 +340,8 @@
except Exception as e:
self.log.error("Unexpected error", exc_info=True)
- self.log.error("failed: %s" % str(e))
- self.stopSpm(force=True, __securityOverride=True)
+ self.log.error("failed: spmRole:%s %s", self.spmRole, str(e))
+ self.stopSpm(__securityOverride=True)
raise
@unsecured
@@ -392,44 +392,46 @@
else:
cls.log.debug("master `%s` is not mounted, skipping", master)
- def stopSpm(self, force=False):
+ def stopSpm(self):
with self.lock:
- if not force and self.spmRole == SPM_FREE:
+ if self.spmRole == SPM_FREE:
return True
self._shutDownUpgrade()
self._setUnsafe()
- stopFailed = False
-
+ failedStops = []
try:
self.cleanupMasterMount()
except:
# If unmounting fails the vdsm panics.
- stopFailed = True
+ failedStops.append("cleanupMasterMount")
- try:
- if self.spmMailer:
+ if self.spmMailer:
+ try:
self.spmMailer.stop()
- except:
- # Here we are just begin polite.
- # SPM will also clean this on start up.
- pass
+ except:
+ # Here we are just begin polite.
+ # SPM will also clean this on start up.
+ self.log.debug("fail: spmMailer %s", self.spmMailer)
- if not stopFailed:
+ if not failedStops:
try:
self.setMetaParam(PMDK_SPM_ID, SPM_ID_FREE,
__securityOverride=True)
except:
- pass # The system can handle this inconsistency
+ # The system can handle this inconsistency
+ self.log.debug("fail: reset %s to %s",
+ PMDK_SPM_ID, SPM_ID_FREE)
try:
self.masterDomain.releaseClusterLock()
except:
- stopFailed = True
+ failedStops.append("releaseClusterLock")
- if stopFailed:
- misc.panic("Unrecoverable errors during SPM stop process.")
+ if failedStops:
+ misc.panic("Unrecoverable errors during SPM stop process: %s.",
+ ", ".join(failedStops))
self.spmRole = SPM_FREE
--
To view, visit http://gerrit.ovirt.org/13929
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eaf8883e62a72445e27f0bc9876fe61a10bcb3f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: Stop spm if refresh fail on bad parameters.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Stop spm if refresh fail on bad parameters.
......................................................................
Stop spm if refresh fail on bad parameters.
Change-Id: I0f85c3e731551b6974483cffe38c7ac37281370b
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/13930/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index fd5d7d6..ba59348 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -788,12 +788,16 @@
se.StoragePoolActionError(
"spUUID=%s, msdUUID=%s, masterVersion=%s" %
(spUUID, msdUUID, masterVersion)))
- vars.task.getSharedLock(STORAGE, spUUID)
+ self.getPool(spUUID) # Validate that is the correct pool.
+ vars.task.getExclusiveLock(STORAGE, spUUID)
pool = self.getPool(spUUID)
try:
self.validateSdUUID(msdUUID)
pool.refresh(msdUUID, masterVersion)
- except:
+ except (se.StorageDomainAccessError, se.StorageDomainDoesNotExist,
+ se.StoragePoolWrongMaster):
+ self.log.error("refreshStoragePool failed", exc_info=True)
+ pool.stopSpm()
self._disconnectPool(pool, pool.id, pool.scsiKey, False)
raise
--
To view, visit http://gerrit.ovirt.org/13930
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f85c3e731551b6974483cffe38c7ac37281370b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: hotunplug: Identify a nic according to its alias
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: hotunplug: Identify a nic according to its alias
......................................................................
hotunplug: Identify a nic according to its alias
MAC addresses may change. The "alias" is immutable.
Change-Id: Iae7619c2547d667103e33777180e01b285f4b18d
Bug-Url: https://bugzilla.redhat.com/919356
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/12892/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 39d1b5b..99bf548 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1669,7 +1669,8 @@
# Find NIC object in vm's NICs list
nic = None
for dev in self._devices[vm.NIC_DEVICES][:]:
- if dev.macAddr.lower() == nicParams['macAddr'].lower():
+ if dev.alias == nicParams.get('alias') or \
+ dev.macAddr.lower() == nicParams['macAddr'].lower():
nic = dev
break
--
To view, visit http://gerrit.ovirt.org/12892
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae7619c2547d667103e33777180e01b285f4b18d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years
Change in vdsm[master]: Change mom policy related interface to support multi-policy
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: Change mom policy related interface to support multi-policy
......................................................................
Change mom policy related interface to support multi-policy
Change-Id: I09c40fee74b10d3eb41f4ec3ca18096a9b20dfcd
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M .gitignore
M tests/functional/Makefile.am
R tests/functional/momTests.py.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/momIF.py
M vdsm_cli/vdsClient.py
7 files changed, 56 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/12466/1
diff --git a/.gitignore b/.gitignore
index 41066dd..b9b992c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@
config.status
configure
results.log
+tests/functional/momTests.py
tests/run_tests.sh
tests/run_tests_local.sh
vdsm-*.tar.gz
diff --git a/tests/functional/Makefile.am b/tests/functional/Makefile.am
index 030242b..fe4f276 100644
--- a/tests/functional/Makefile.am
+++ b/tests/functional/Makefile.am
@@ -17,12 +17,21 @@
#
# Refer to the README and COPYING files for full details of the license
#
+include $(top_srcdir)/build-aux/Makefile.subs
vdsmfunctestsdir = ${vdsmtestsdir}/functional
dist_vdsmfunctests_PYTHON = \
- momTests.py \
sosPluginTests.py \
xmlrpcTests.py \
$(NULL)
+nodist_vdsmfunctests_PYTHON = \
+ momTests.py
+
+EXTRA_DIST = \
+ momTests.py.in
+
+CLEANFILES = \
+ $(nodist_vdsmfunctests_PYTHON)
+
diff --git a/tests/functional/momTests.py b/tests/functional/momTests.py.in
similarity index 76%
rename from tests/functional/momTests.py
rename to tests/functional/momTests.py.in
index 1981e05..c54b427 100644
--- a/tests/functional/momTests.py
+++ b/tests/functional/momTests.py.in
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
import imp
+import os
import random
import time
@@ -54,3 +55,17 @@
hostStats = s.getVdsStats()['info']
self.assertEqual(bool(run), hostStats['ksmState'])
self.assertEqual(pages_to_scan, hostStats['ksmPages'])
+
+ @testValidation.ValidateRunningAsRoot
+ def testDefaultPolicy(self):
+ s = vdscli.connect()
+ r = s.getMOMPolicy()
+
+ policy_dir = '@CONFDIR@/mom-policy-dir'
+ names = sorted(os.listdir(policy_dir))
+ for name in names:
+ if name.startswith('.') or not name.endswith('.policy'):
+ fname = os.path.join(policy_dir, name)
+ with open(fname, 'r') as f:
+ policyStr = f.read()
+ self.assertEqual(policyStr, r['policyDict'].get(name))
diff --git a/vdsm/API.py b/vdsm/API.py
index 0046b57..0f02fde 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1379,6 +1379,12 @@
except:
return errCode['momErr']
+ def getMOMPolicy(self):
+ try:
+ return dict(status=doneCode,
+ policyDict=self._cif.mom.getPolicy())
+ except:
+ return errCode['momErr']
# take a rough estimate on how much free mem is available for new vm
# memTotal = memFree + memCached + mem_used_by_non_qemu + resident .
# simply returning (memFree + memCached) is not good enough, as the
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 9a4db12..a540900 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -401,6 +401,10 @@
api = API.Global()
return api.setMOMPolicy(policy)
+ def getMOMPolicy(self):
+ api = API.Global()
+ return api.getMOMPolicy()
+
def domainActivate(self, sdUUID, spUUID, options=None):
domain = API.StorageDomain(sdUUID)
return domain.activate(spUUID)
@@ -807,6 +811,7 @@
(self.fenceNode, 'fenceNode'),
(self.prepareForShutdown, 'prepareForShutdown'),
(self.setLogLevel, 'setLogLevel'),
+ (self.getMOMPolicy, 'getMOMPolicy'),
(self.setMOMPolicy, 'setMOMPolicy'),
(self.vmHotplugDisk, 'hotplugDisk'),
(self.vmHotunplugDisk, 'hotunplugDisk'),
diff --git a/vdsm/momIF.py b/vdsm/momIF.py
index d0f63d1..831b649 100644
--- a/vdsm/momIF.py
+++ b/vdsm/momIF.py
@@ -56,9 +56,16 @@
ret['ksmCpu'] = stats['ksmd_cpu_usage']
return ret
- def setPolicy(self, policyStr):
- # mom.setPolicy will raise an exception on failure.
- self._mom.setPolicy(policyStr)
+ def setPolicy(self, policyParam):
+ if isinstance(policyParam, dict) and len(policyParam) == 1:
+ policy = policyParam.popItem()
+ self._mom.setNamedPolicy(policy[0], policy[1])
+ else:
+ # mom.setPolicy will raise an exception on failure.
+ self._mom.setPolicy(policyParam)
+
+ def getPolicy(self):
+ return self._mom.getNamedPolicies()
def stop(self):
if self._mom is not None:
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index 1da7d5f..1fa0d22 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -1404,6 +1404,12 @@
return stats['status']['code'], stats['status']['message']
return 0, ''
+ def do_getMOMPolicy(self, policyFile):
+ stats = self.s.getMOMPolicy()
+ if stats['status']['code']:
+ return stats['status']['code'], stats['status']['message']
+ return 0, ''
+
def do_setMOMPolicy(self, policyFile):
stats = self.s.setMOMPolicy(policyFile)
if stats['status']['code']:
@@ -2253,6 +2259,9 @@
('<level> [logName][,logName]...', 'set log verbosity'
' level (10=DEBUG, 50=CRITICAL'
)),
+ 'getMOMPolicy': (serv.do_getMOMPolicy,
+ ('', 'get MOM policy')),
+
'setMOMPolicy': (serv.do_setMOMPolicy,
('<policyfile>', 'set MOM policy')),
'deleteImage': (serv.deleteImage,
--
To view, visit http://gerrit.ovirt.org/12466
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09c40fee74b10d3eb41f4ec3ca18096a9b20dfcd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
10 years