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>
9 years, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
Change in vdsm[master]: remove symlink when connect local storage failed
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: remove symlink when connect local storage failed
......................................................................
remove symlink when connect local storage failed
if connectStorageServer failed for some reason,
symlink remains in /rhev/data-center/mnt,
which makes second failure call connectStorageServer
falsely success, so remove the symlink
Change-Id: I0e44605fb6c6e2512a6aa1acefb3d1d7e09a67aa
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/storage/storageServer.py
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/6140/1
--
To view, visit http://gerrit.ovirt.org/6140
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e44605fb6c6e2512a6aa1acefb3d1d7e09a67aa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 11 months
Change in vdsm[master]: Related to BZ#854151 - Fix disconnect iscsi connections.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Related to BZ#854151 - Fix disconnect iscsi connections.
......................................................................
Related to BZ#854151 - Fix disconnect iscsi connections.
Change-Id: Ic390cf1a63594a87ee03c010df31f68a432ebff4
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=854151
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/storageServer.py
2 files changed, 26 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/8305/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a89274a..330b7c0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2032,10 +2032,11 @@
conObj = storageServer.ConnectionFactory.createConnection(conInfo)
try:
conObj.disconnect()
- status = 0
except Exception as err:
self.log.error("Could not disconnect from storageServer", exc_info=True)
status, _ = self._translateConnectionError(err)
+ else:
+ status = 0
res.append({'id': conDef["id"], 'status': status})
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 269b8eb..963a019 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -282,6 +282,7 @@
return hash(type(self)) ^ hash(self._mountCon)
class IscsiConnection(object):
+ log = logging.getLogger("StorageServer.IscsiConnection")
@property
def target(self):
return self._target
@@ -314,43 +315,48 @@
host = self._target.portal.hostname
try:
ip = socket.gethostbyname(host)
+ except socket.gaierror:
+ return False
+ else:
if ip != portal.hostname:
return False
- except socket.gaierror:
- return False
-
- if self._target.portal.port != portal.port:
+ elif self._target.portal.port != portal.port:
return False
- if self._target.tpgt != None and self._target.tpgt != target.tpgt:
+ elif self._target.tpgt != None and self._target.tpgt != target.tpgt:
return False
- if self._target.iqn != target.iqn:
+ elif self._target.iqn != target.iqn:
return False
- if self._iface.name != iface.name:
+ elif self._iface.name != iface.name:
return False
- if self._cred != cred:
+ elif self._cred != cred:
return False
- return True
+ else:
+ return True
def getSessionInfo(self):
sessions = iscsi.iterateIscsiSessions()
try:
info = iscsi.getSessionInfo(self._lastSessionId)
- sessions = chain(info, sessions)
except Exception:
- pass
+ self.log.warning("Can't get session info, self._lastSessionId %s", self._lastSessionId)
+ else:
+ sessions = chain(info, sessions)
- for session in iscsi.iterateIscsiSessions():
+ self.log.debug("self._target: %s", self._target)
+ for session in sessions:
+ self.log.debug("session %s", session)
if self.isSession(session):
self._lastSessionId = session.id
+ self.log.debug("self._lastSessionId: %s", self._lastSessionId)
return session
-
- raise OSError(errno.ENOENT, "Session not found")
+ else:
+ raise OSError(errno.ENOENT, "Session not found in sessions: %s", sessions)
def isConnected(self):
try:
@@ -362,13 +368,17 @@
raise
def disconnect(self):
+ self.log.debug("Iscsi disconnect called.")
try:
sid = self.getSessionInfo().id
except OSError, e:
if e.errno == errno.ENOENT:
+ self.log.warning("Can't get iscsi session id, ENOENT: %s", e.errno)
return
+ self.log.warning("Cant get iscsi session id, errno: %s", e.errno)
raise
+ self.log.debug("Disconnecting iscsi session id: %s", sid)
iscsi.disconnectiScsiSession(sid)
def __eq__(self, other):
--
To view, visit http://gerrit.ovirt.org/8305
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic390cf1a63594a87ee03c010df31f68a432ebff4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: Make IRS methods bypass API.py
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Make IRS methods bypass API.py
......................................................................
Make IRS methods bypass API.py
Change-Id: Iaf7dc90462e47b9f067959df7325b57cbaa82241
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/BindingXMLRPC.py
1 file changed, 80 insertions(+), 432 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/7227/1
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 0d74af6..2e0dce2 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -33,6 +33,7 @@
import API
from vdsm.exception import VdsmException
import fenceAgent
+from functools import partial
try:
from gluster.api import getGlusterMethods
@@ -388,358 +389,6 @@
api = API.Global()
return api.setMOMPolicy(policy)
- def domainActivate(self, sdUUID, spUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.activate()
-
- def domainAttach(self, sdUUID, spUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.attach(spUUID)
-
- def domainCreate(self, storageType, sdUUID, domainName,
- typeSpecificArg, domClass,
- domVersion=None, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.create(storageType, typeSpecificArg, domainName,
- domClass, domVersion)
-
- def domainDeactivate(self, sdUUID, spUUID, msdUUID, masterVersion,
- options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.deactivate(msdUUID, masterVersion)
-
- def domainDetach(self, sdUUID, spUUID, msdUUID, masterVersion,
- options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.detach(msdUUID, masterVersion, force=False)
-
- def domainDetachForced(self, sdUUID, spUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.detach(None, None, force=True)
-
- def domainExtend(self, sdUUID, spUUID, devlist, options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.extend(devlist)
-
- def domainFormat(self, sdUUID,
- autoDetach=False, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.format(autoDetach)
-
- def domainGetFileList(self, sdUUID, pattern='*', options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.getFileList(pattern)
-
- def domainGetImages(self, sdUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.getImages()
-
- def domainGetInfo(self, sdUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.getInfo()
-
- def domainGetStats(self, sdUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.getStats()
-
- def domainGetVolumes(self, sdUUID, spUUID,
- imgUUID=API.Image.BLANK_UUID):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.getVolumes(imgUUID)
-
- def domainSetDescription(self, sdUUID, description, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.setDescription(description)
-
- def domainUploadVolume(self, sdUUID, spUUID, imgUUID, volUUID,
- srcPath, size, method="rsync", options=None):
- domain = API.StorageDomain(sdUUID, spUUID)
- return domain.uploadVolume(imgUUID, volUUID, srcPath, size, method)
-
- def domainValidate(self, sdUUID, options=None):
- domain = API.StorageDomain(sdUUID, spUUID=None)
- return domain.validate()
-
- def imageDelete(self, sdUUID, spUUID,
- imgUUID, postZero=False, force=False):
- image = API.Image(imgUUID, spUUID, sdUUID)
- return image.delete(postZero, force)
-
- def imageDeleteVolumes(self, sdUUID, spUUID, imgUUID, volumes,
- postZero=False, force=False):
- image = API.Image(imgUUID, spUUID, sdUUID)
- return image.deleteVolumes(volumes, postZero, force)
-
- def imageMergeSnapshots(self, sdUUID, spUUID, vmUUID, imgUUID,
- ancestor, successor, postZero=False):
- image = API.Image(imgUUID, spUUID, sdUUID)
- return image.mergeSnapshots(ancestor, successor, postZero)
-
- def imageMove(self, spUUID, srcDomUUID, dstDomUUID, imgUUID, vmUUID,
- op, postZero=False, force=False):
- image = API.Image(imgUUID, spUUID, srcDomUUID)
- return image.move(dstDomUUID, op, postZero, force)
-
- def poolConnect(self, spUUID, hostID, scsiKey, msdUUID, masterVersion,
- options=None):
- pool = API.StoragePool(spUUID)
- return pool.connect(hostID, scsiKey, msdUUID, masterVersion)
-
- def poolConnectStorageServer(self, domType, spUUID, conList, options=None):
- pool = API.StoragePool(spUUID)
- return pool.connectStorageServer(domType, conList)
-
- def poolCreate(self, poolType, spUUID, poolName, masterDom, domList,
- masterVersion, lockPolicy=None, lockRenewalIntervalSec=None,
- leaseTimeSec=None, ioOpTimeoutSec=None,
- leaseRetries=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.create(poolName, masterDom, masterVersion, domList,
- lockRenewalIntervalSec, leaseTimeSec, ioOpTimeoutSec,
- leaseRetries)
-
- def poolDestroy(self, spUUID, hostID, scsiKey, options=None):
- pool = API.StoragePool(spUUID)
- return pool.destroy(hostID, scsiKey)
-
- def poolDisconnect(self, spUUID, hostID, scsiKey, remove=False,
- options=None):
- pool = API.StoragePool(spUUID)
- return pool.disconnect(hostID, scsiKey, remove)
-
- def poolDisconnectStorageServer(self, domType, spUUID, conList,
- options=None):
- pool = API.StoragePool(spUUID)
- return pool.disconnectStorageServer(domType, conList)
-
- def poolFenceSPMStorage(self, spUUID, lastOwner, lastLver, options=None):
- pool = API.StoragePool(spUUID)
- return pool.fence()
-
- def poolGetBackedUpVmsInfo(self, spUUID, sdUUID,
- vmList=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.getBackedUpVmsInfo(sdUUID, vmList)
-
- def poolGetBackedUpVmsList(self, spUUID, sdUUID=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.getBackedUpVmsList(sdUUID)
-
- def poolGetFloppyList(self, spUUID, options=None):
- pool = API.StoragePool(spUUID)
- return pool.getFloppyList()
-
- def poolGetDomainsContainingImage(self, spUUID, imgUUID, datadomains=True,
- options=None):
- pool = API.StoragePool(spUUID)
- return pool.getDomainsContainingImage(imgUUID, datadomains)
-
- def poolGetIsoList(self, spUUID, extension='iso', options=None):
- pool = API.StoragePool(spUUID)
- return pool.getIsoList(extension)
-
- def poolGetSpmStatus(self, spUUID, options=None):
- pool = API.StoragePool(spUUID)
- return pool.getSpmStatus()
-
- def poolGetInfo(self, spUUID, options=None):
- pool = API.StoragePool(spUUID)
- return pool.getInfo()
-
- def poolMoveMultipleImages(self, spUUID, srcDomUUID, dstDomUUID, imgDict,
- vmUUID, force=False):
- pool = API.StoragePool(spUUID)
- return pool.moveMultipleImages(srcDomUUID, dstDomUUID, imgDict, force)
-
- def poolReconstructMaster(self, spUUID, poolName, masterDom, domDict,
- masterVersion, lockPolicy=None,
- lockRenewalIntervalSec=None, leaseTimeSec=None,
- ioOpTimeoutSec=None, leaseRetries=None,
- hostId=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.reconstructMaster(hostId, poolName, masterDom,
- masterVersion, domDict, lockRenewalIntervalSec, leaseTimeSec,
- ioOpTimeoutSec, leaseRetries)
-
- def poolRefresh(self, spUUID, msdUUID, masterVersion, options=None):
- pool = API.StoragePool(spUUID)
- return pool.refresh(msdUUID, masterVersion)
-
- def poolSetDescription(self, spUUID, description, options=None):
- pool = API.StoragePool(spUUID)
- return pool.setDescription(description)
-
- def poolSpmStart(self, spUUID, prevID, prevLVER, recoveryMode,
- scsiFencing, maxHostID=None,
- domVersion=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.spmStart(prevID, prevLVER, scsiFencing,
- maxHostID, domVersion)
-
- def poolSpmStop(self, spUUID, options=None):
- pool = API.StoragePool(spUUID)
- return pool.spmStop()
-
- def poolUpgrade(self, spUUID, targetDomVersion):
- pool = API.StoragePool(spUUID)
- return pool.upgrade(targetDomVersion)
-
- def poolValidateStorageServerConnection(self, domType, spUUID, conList,
- options=None):
- pool = API.StoragePool(spUUID)
- return pool.validateStorageServerConnection(domType, conList)
-
- def poolUpdateVMs(self, spUUID, vmList, sdUUID=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.updateVMs(vmList, sdUUID)
-
- def poolRemoveVm(self, spUUID, vmUUID, sdUUID=None, options=None):
- pool = API.StoragePool(spUUID)
- return pool.removeVM(vmUUID, sdUUID)
-
- def volumeCopy(self, sdUUID, spUUID, vmUUID, srcImgUUID, srcVolUUID,
- dstImgUUID, dstVolUUID, description='',
- dstSdUUID=API.StorageDomain.BLANK_UUID,
- volType=API.Volume.Roles.SHARED,
- volFormat=API.Volume.Formats.UNKNOWN,
- preallocate=API.Volume.Types.UNKNOWN, postZero=False,
- force=False):
- volume = API.Volume(srcVolUUID, spUUID, sdUUID, srcImgUUID)
- return volume.copy(dstSdUUID, dstImgUUID, dstVolUUID,
- description, volType, volFormat, preallocate, postZero,
- force)
-
- def volumeCreate(self, sdUUID, spUUID, imgUUID, size, volFormat,
- preallocate, diskType, volUUID, desc,
- srcImgUUID=API.Image.BLANK_UUID,
- srcVolUUID=API.Volume.BLANK_UUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.create(size, volFormat, preallocate, diskType,
- desc, srcImgUUID, srcVolUUID)
-
- def volumeExtend(self, sdUUID, spUUID, imgUUID, volUUID, size,
- isShuttingDown=None):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.extend(size, isShuttingDown)
-
- def volumeGetInfo(self, sdUUID, spUUID, imgUUID, volUUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.getInfo()
-
- def volumeGetPath(self, sdUUID, spUUID, imgUUID, volUUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.getPath()
-
- def volumeGetSize(self, sdUUID, spUUID, imgUUID, volUUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.getSize()
-
- def volumePrepare(self, sdUUID, spUUID, imgUUID, volUUID, rw=True):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.prepare(rw)
-
- def volumeRefresh(self, sdUUID, spUUID, imgUUID, volUUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.refresh()
-
- def volumeSetDescription(self, sdUUID, spUUID, imgUUID, volUUID,
- description):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.setDescription(description)
-
- def volumeSetLegality(self, sdUUID, spUUID, imgUUID, volUUID, legality):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.setLegality(legality)
-
- def volumeTearDown(self, sdUUID, spUUID, imgUUID, volUUID):
- volume = API.Volume(volUUID, spUUID, sdUUID, imgUUID)
- return volume.tearDown()
-
- def taskClear(self, taskId):
- task = API.Task(taskId)
- return task.clear()
-
- def taskGetInfo(self, taskId):
- task = API.Task(taskId)
- return task.getInfo()
-
- def taskGetStatus(self, taskId):
- task = API.Task(taskId)
- return task.getStatus()
-
- def taskRevert(self, taskId):
- task = API.Task(taskId)
- return task.revert()
-
- def taskStop(self, taskId):
- task = API.Task(taskId)
- return task.stop()
-
- # Global storage methods
- def tasksGetAllInfo(self):
- api = API.Global()
- return api.getAllTasksInfo()
-
- def tasksGetAllStatuses(self):
- api = API.Global()
- return api.getAllTasksStatuses()
-
- def iscsiDiscoverSendTargets(self, con, options=None):
- iscsiConn = API.ISCSIConnection(con['connection'],
- con['port'], con['user'], con['password'])
- return iscsiConn.discoverSendTargets()
-
- def vgCreate(self, name, devlist, force=False):
- vg = API.LVMVolumeGroup(self.cif)
- return vg.create(name, devlist, force)
-
- def vgGetInfo(self, vgUUID, options=None):
- vg = API.LVMVolumeGroup(vgUUID)
- return vg.getInfo()
-
- def vgRemove(self, vgUUID, options=None):
- vg = API.LVMVolumeGroup(vgUUID)
- return vg.remove()
-
- def domainsGetList(self, spUUID=None, domainClass=None, storageType=None,
- remotePath=None, options=None):
- api = API.Global()
- return api.getStorageDomains(spUUID, domainClass, storageType,
- remotePath)
-
- def poolsGetConnectedList(self, options=None):
- api = API.Global()
- return api.getConnectedStoragePools()
-
- def storageRepoGetStats(self, options=None):
- api = API.Global()
- return api.getStorageRepoStats()
-
- def vgsGetList(self, storageType=None, options=None):
- api = API.Global()
- return api.getLVMVolumeGroups(storageType)
-
- def devicesGetList(self, storageType=None, options=None):
- api = API.Global()
- return api.getDeviceList(storageType)
-
- def devicesGetVisibility(self, guids, options=None):
- api = API.Global()
- return api.getDevicesVisibility(guids)
-
- def deviceGetInfo(self, guid, options=None):
- api = API.Global()
- return api.getDeviceInfo(guid)
-
- def storageServerConnectionRefsAcquire(self, conRefArgs):
- return API.ConnectionRefs().acquire(conRefArgs)
-
- def storageServerConnectionRefsRelease(self, refIDs):
- return API.ConnectionRefs().release(refIDs)
-
- def storageServerConnectionRefsStatuses(self):
- return API.ConnectionRefs().statuses()
-
def getGlobalMethods(self):
return ((self.vmDestroy, 'destroy'),
(self.vmCreate, 'create'),
@@ -785,86 +434,85 @@
(self.vmHotunplugNic, 'hotunplugNic'))
def getIrsMethods(self):
- return ((self.domainActivate, 'activateStorageDomain'),
- (self.domainAttach, 'attachStorageDomain'),
- (self.domainCreate, 'createStorageDomain'),
- (self.domainDeactivate, 'deactivateStorageDomain'),
- (self.domainDetach, 'detachStorageDomain'),
- (self.domainDetachForced, 'forcedDetachStorageDomain'),
- (self.domainExtend, 'extendStorageDomain'),
- (self.domainFormat, 'formatStorageDomain'),
- (self.domainGetFileList, 'getFileList'),
- (self.domainGetImages, 'getImagesList'),
- (self.domainGetInfo, 'getStorageDomainInfo'),
- (self.domainGetStats, 'getStorageDomainStats'),
- (self.domainGetVolumes, 'getVolumesList'),
- (self.domainSetDescription, 'setStorageDomainDescription'),
- (self.domainUploadVolume, 'uploadVolume'),
- (self.domainValidate, 'validateStorageDomain'),
- (self.imageDelete, 'deleteImage'),
- (self.imageDeleteVolumes, 'deleteVolume'),
- (self.imageMergeSnapshots, 'mergeSnapshots'),
- (self.imageMove, 'moveImage'),
- (self.poolConnect, 'connectStoragePool'),
- (self.poolConnectStorageServer, 'connectStorageServer'),
- (self.poolCreate, 'createStoragePool'),
- (self.poolDestroy, 'destroyStoragePool'),
- (self.poolDisconnect, 'disconnectStoragePool'),
- (self.poolDisconnectStorageServer, 'disconnectStorageServer'),
- (self.poolFenceSPMStorage, 'fenceSpmStorage'),
- (self.poolGetBackedUpVmsInfo, 'getVmsInfo'),
- (self.poolGetBackedUpVmsList, 'getVmsList'),
- (self.poolGetFloppyList, 'getFloppyList'),
- (self.poolGetDomainsContainingImage, 'getImageDomainsList'),
- (self.poolGetIsoList, 'getIsoList'),
- (self.poolGetSpmStatus, 'getSpmStatus'),
- (self.poolGetInfo, 'getStoragePoolInfo'),
- (self.poolMoveMultipleImages, 'moveMultipleImages'),
- (self.poolReconstructMaster, 'reconstructMaster'),
- (self.poolRefresh, 'refreshStoragePool'),
- (self.poolSetDescription, 'setStoragePoolDescription'),
- (self.poolSpmStart, 'spmStart'),
- (self.poolSpmStop, 'spmStop'),
- (self.poolUpgrade, 'upgradeStoragePool'),
- (self.poolValidateStorageServerConnection,
- 'validateStorageServerConnection'),
- (self.poolUpdateVMs, 'updateVM'),
- (self.poolRemoveVm, 'removeVM'),
- (self.taskClear, 'clearTask'),
- (self.taskGetInfo, 'getTaskInfo'),
- (self.taskGetStatus, 'getTaskStatus'),
- (self.taskRevert, 'revertTask'),
- (self.taskStop, 'stopTask'),
- (self.volumeCopy, 'copyImage'),
- (self.volumeCreate, 'createVolume'),
- (self.volumeExtend, 'extendVolume'),
- (self.volumeGetInfo, 'getVolumeInfo'),
- (self.volumeGetPath, 'getVolumePath'),
- (self.volumeGetSize, 'getVolumeSize'),
- (self.volumePrepare, 'prepareVolume'),
- (self.volumeRefresh, 'refreshVolume'),
- (self.volumeSetDescription, 'setVolumeDescription'),
- (self.volumeSetLegality, 'setVolumeLegality'),
- (self.volumeTearDown, 'teardownVolume'),
- (self.tasksGetAllInfo, 'getAllTasksInfo'),
- (self.tasksGetAllStatuses, 'getAllTasksStatuses'),
- (self.iscsiDiscoverSendTargets, 'discoverSendTargets'),
- (self.vgCreate, 'createVG'),
- (self.vgGetInfo, 'getVGInfo'),
- (self.vgRemove, 'removeVG'),
- (self.domainsGetList, 'getStorageDomainsList'),
- (self.poolsGetConnectedList, 'getConnectedStoragePoolsList'),
- (self.storageRepoGetStats, 'repoStats'),
- (self.vgsGetList, 'getVGList'),
- (self.devicesGetList, 'getDeviceList'),
- (self.devicesGetVisibility, 'getDevicesVisibility'),
- (self.deviceGetInfo, 'getDeviceInfo'),
- (self.storageServerConnectionRefsAcquire,
- 'storageServer_ConnectionRefs_acquire'),
- (self.storageServerConnectionRefsRelease,
- 'storageServer_ConnectionRefs_release'),
- (self.storageServerConnectionRefsStatuses,
- 'storageServer_ConnectionRefs_statuses'),)
+ passThroughMethods = (
+ 'activateStorageDomain',
+ 'attachStorageDomain',
+ 'createStorageDomain',
+ 'deactivateStorageDomain',
+ 'detachStorageDomain',
+ 'forcedDetachStorageDomain',
+ 'extendStorageDomain',
+ 'formatStorageDomain',
+ 'getFileList',
+ 'getImagesList',
+ 'getStorageDomainInfo',
+ 'getStorageDomainStats',
+ 'getVolumesList',
+ 'setStorageDomainDescription',
+ 'uploadVolume',
+ 'validateStorageDomain',
+ 'deleteImage',
+ 'deleteVolume',
+ 'mergeSnapshots',
+ 'moveImage',
+ 'connectStoragePool',
+ 'connectStorageServer',
+ 'createStoragePool',
+ 'destroyStoragePool',
+ 'disconnectStoragePool',
+ 'disconnectStorageServer',
+ 'fenceSpmStorage',
+ 'getVmsInfo',
+ 'getVmsList',
+ 'getFloppyList',
+ 'getImageDomainsList',
+ 'getIsoList',
+ 'getSpmStatus',
+ 'getStoragePoolInfo',
+ 'moveMultipleImages',
+ 'reconstructMaster',
+ 'refreshStoragePool',
+ 'setStoragePoolDescription',
+ 'spmStart',
+ 'spmStop',
+ 'upgradeStoragePool',
+ 'validateStorageServerConnection',
+ 'updateVM',
+ 'removeVM',
+ 'clearTask',
+ 'getTaskInfo',
+ 'getTaskStatus',
+ 'revertTask',
+ 'stopTask',
+ 'copyImage',
+ 'createVolume',
+ 'extendVolume',
+ 'getVolumeInfo',
+ 'getVolumePath',
+ 'getVolumeSize',
+ 'prepareVolume',
+ 'refreshVolume',
+ 'setVolumeDescription',
+ 'setVolumeLegality',
+ 'teardownVolume',
+ 'getAllTasksInfo',
+ 'getAllTasksStatuses',
+ 'discoverSendTargets',
+ 'createVG',
+ 'getVGInfo',
+ 'removeVG',
+ 'getStorageDomainsList',
+ 'getConnectedStoragePoolsList',
+ 'repoStats',
+ 'getVGList',
+ 'getDeviceList',
+ 'getDevicesVisibility',
+ 'getDeviceInfo',
+ 'storageServer_ConnectionRefs_acquire',
+ 'storageServer_ConnectionRefs_release',
+ 'storageServer_ConnectionRefs_statuses',)
+ return zip(map(partial(getattr, self.cif.irs), passThroughMethods),
+ passThroughMethods)
def wrapApiMethod(f):
--
To view, visit http://gerrit.ovirt.org/7227
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf7dc90462e47b9f067959df7325b57cbaa82241
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: [WIP] Add the base commands to vdsm-tool
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Add the base commands to vdsm-tool
......................................................................
[WIP] Add the base commands to vdsm-tool
Change-Id: Id3f49dc3cbb4dfba86a85ab9348d19684445f40e
---
M vdsm-tool/Makefile.am
A vdsm-tool/base.py
M vdsm.spec.in
3 files changed, 52 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/388/1
--
To view, visit http://gerrit.ovirt.org/388
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3f49dc3cbb4dfba86a85ab9348d19684445f40e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: [WIP] Add the daemon commands to vdsm-tool
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Add the daemon commands to vdsm-tool
......................................................................
[WIP] Add the daemon commands to vdsm-tool
Change-Id: Ieafb9886f3ffb2433478203186dd94005b2a51e8
---
M vdsm-tool/Makefile.am
A vdsm-tool/daemon.py
M vdsm.spec.in
3 files changed, 52 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/389/1
--
To view, visit http://gerrit.ovirt.org/389
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieafb9886f3ffb2433478203186dd94005b2a51e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 11 months