Change in vdsm[master]: [WIP]add createVm support of cputune
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: [WIP]add createVm support of cputune
......................................................................
[WIP]add createVm support of cputune
allow engine to pass other cputune params through vm create,
createVm now uses nice to config vm share value,
this patch uses 'shares' in vmdef directly (1024 by default)
Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 13 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/8445/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index fd80c69..9b38a36 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -737,10 +737,13 @@
self.dom.appendChild(cpu)
def appendTunable(self):
- #CPU-pinning support
- # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
+ cputune = self.doc.createElement('cputune')
+ cputuneParams = {'shares':1024}
+ if 'cputune' in self.conf:
+ cputuneParam = self.conf['cputune']
if 'cpuPinning' in self.conf:
- cputune = self.doc.createElement('cputune')
+ #CPU-pinning support
+ # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
cpuPinning = self.conf.get('cpuPinning')
try:
emulatorset = cpuPinning.pop('emulator')
@@ -754,7 +757,13 @@
vcpupin.setAttribute('vcpu', cpuPin)
vcpupin.setAttribute('cpuset', cpuPinning[cpuPin])
cputune.appendChild(vcpupin)
- self.dom.appendChild(cputune)
+
+ for item in cputuneParams.keys():
+ m = self.doc.createElement(item)
+ m.appendChild(self.doc.createTextNode(cputuneParams[item]))
+ cputune.appendChild(m)
+
+ self.dom.appendChild(cputune)
def _appendAgentDevice(self, path, name):
"""
@@ -1338,13 +1347,6 @@
if self._initTimePauseCode == 'ENOSPC':
self.cont()
self.conf['pid'] = self._getPid()
-
- nice = int(self.conf.get('nice', '0'))
- nice = max(min(nice, 19), 0)
- try:
- self._dom.setSchedulerParameters({'cpu_shares': (20 - nice) * 51})
- except:
- self.log.warning('failed to set Vm niceness', exc_info=True)
def _run(self):
self.log.info("VM wrapper has started")
--
To view, visit http://gerrit.ovirt.org/8445
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
9 years, 10 months
Change in vdsm[master]: [WIP] Small objects repository file implementation
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Small objects repository file implementation
......................................................................
[WIP] Small objects repository file implementation
Change-Id: I3003f8652a58c68a966bc37e591c1d1d2308c164
---
M vdsm/storage/fileSD.py
M vdsm/storage/hsm.py
M vdsm/storage/outOfProcess.py
M vdsm/storage/sd.py
M vdsm/storage/sp.py
M vdsm_cli/vdsClient.py
6 files changed, 83 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/242/1
--
To view, visit http://gerrit.ovirt.org/242
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3003f8652a58c68a966bc37e591c1d1d2308c164
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]: Add a chown implementation that looks up uid and gid
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Add a chown implementation that looks up uid and gid
......................................................................
Add a chown implementation that looks up uid and gid
We already have a case in vdsm (configNetwork) where we need to use
a chown function that is capable to convert the owner and group names
to uid and gid. Going forward this can be reused for the deployment
utilities and to prepare the paths needed by vdsm (eg: /rhev and
/var/run/vdsm).
Change-Id: Iab6f67ba93a0d9cbac775992623f3bb2ab996555
---
M vdsm/configNetwork.py
M vdsm/utils.py
2 files changed, 21 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/387/1
--
To view, visit http://gerrit.ovirt.org/387
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab6f67ba93a0d9cbac775992623f3bb2ab996555
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]: Move fenceNode out of API.py
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Move fenceNode out of API.py
......................................................................
Move fenceNode out of API.py
The actual details of how the response is mangles is part of the
bindings so API.py really doesn't serve a purpose.
This is the first step in a general trend of moving the logic out of
API.py to dedicated modules and move the response mangling to the
binding wrappers.
Change-Id: Idaba551333a0f289abaff11dc113e09c426d591a
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
2 files changed, 25 insertions(+), 38 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/7191/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 5826d81..4fdc7e7 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -37,7 +37,6 @@
from vdsm.define import doneCode, errCode, Kbytes, Mbytes
import caps
from vdsm.config import config
-import fenceAgent
import supervdsm
@@ -972,40 +971,6 @@
APIBase.__init__(self)
# General Host functions
- def fenceNode(self, addr, port, agent, username, password, action,
- secure=False, options=''):
- """Send a fencing command to a remote node.
-
- agent is one of (rsa, ilo, drac5, ipmilan, etc)
- action can be one of (status, on, off, reboot)."""
-
- self.log.debug('fenceNode(addr=%s,port=%s,agent=%s,user=%s,' +
- 'passwd=%s,action=%s,secure=%s,options=%s)', addr, port, agent,
- username, 'XXXX', action, secure, options)
-
- secure = utils.tobool(secure)
- port = int(port)
-
- if action == "status":
- try:
- power = fenceAgent.getFenceStatus(addr, port, agent, username,
- password, secure, options)
-
- return {'status': doneCode,
- 'power': power}
-
- except fenceAgent.FenceStatusCheckError as e:
- return {'status': {'code': 1, 'message': str(e)}}
-
- try:
- fenceAgent.fenceNode(addr, port, agent, username, password, secure,
- options, self._cif.shutdownEvent)
-
- return {'status': doneCode}
-
- except fenceAgent.UnsupportedFencingAgentError:
- return errCode['fenceAgent']
-
def ping(self):
"Ping the server. Useful for tests"
return {'status': doneCode}
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 48f4723..7eee29e 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -32,6 +32,8 @@
from vdsm.define import doneCode, errCode
import API
from vdsm.exception import VdsmException
+import fenceAgent
+
try:
from gluster.api import getGlusterMethods
_glusterEnabled = True
@@ -355,9 +357,29 @@
def fenceNode(self, addr, port, agent, username, password, action,
secure=False, options=''):
- api = API.Global()
- return api.fenceNode(addr, port, agent, username, password,
- action, secure, options)
+
+ secure = utils.tobool(secure)
+ port = int(port)
+
+ if action == "status":
+ try:
+ power = fenceAgent.getFenceStatus(addr, port, agent, username,
+ password, secure, options)
+
+ return {'status': doneCode,
+ 'power': power}
+
+ except fenceAgent.FenceStatusCheckError as e:
+ return {'status': {'code': 1, 'message': str(e)}}
+
+ try:
+ fenceAgent.fenceNode(addr, port, agent, username, password, secure,
+ options, self.cif.shutdownEvent)
+
+ return {'status': doneCode}
+
+ except fenceAgent.UnsupportedFencingAgentError:
+ return errCode['fenceAgent']
def setLogLevel(self, level):
api = API.Global()
--
To view, visit http://gerrit.ovirt.org/7191
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idaba551333a0f289abaff11dc113e09c426d591a
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]: More safe startSpm().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: More safe startSpm().
......................................................................
More safe startSpm().
Change-Id: I1e6b32bdf1dd8dc36f6633306d4edef89d542e31
---
M vdsm/storage/sp.py
1 file changed, 16 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/451/1
--
To view, visit http://gerrit.ovirt.org/451
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e6b32bdf1dd8dc36f6633306d4edef89d542e31
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 11 months
Change in vdsm[master]: [WIP] Add a releaseHostId option to stop the DomainMonitorTh...
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Add a releaseHostId option to stop the DomainMonitorThread
......................................................................
[WIP] Add a releaseHostId option to stop the DomainMonitorThread
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=851151
Change-Id: I83458fb4146de7e402606916615533da305bd867
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/domainMonitor.py
M vdsm/storage/sp.py
2 files changed, 19 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/7581/1
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 95e2f7b..c1ec5a9 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -84,14 +84,14 @@
# The domain should be added only after it succesfully started
self._domains[sdUUID] = domainThread
- def stopMonitoring(self, sdUUID):
+ def stopMonitoring(self, sdUUID, releaseHostId=False):
# The domain monitor issues events that might become raceful if
# stopMonitoring doesn't stop until the thread exits.
# Eg: when a domain is detached the domain monitor is stopped and
# the host id is released. If the monitor didn't actually exit it
# might respawn a new acquire host id.
try:
- self._domains[sdUUID].stop()
+ self._domains[sdUUID].stop(releaseHostId=releaseHostId)
except KeyError:
return
@@ -100,13 +100,15 @@
def getStatus(self, sdUUID):
return self._domains[sdUUID].getStatus()
- def close(self):
+ def close(self, releaseHostId=False):
for sdUUID in self._domains.keys():
- self.stopMonitoring(sdUUID)
+ self.stopMonitoring(sdUUID, releaseHostId=releaseHostId)
class DomainMonitorThread(object):
log = logging.getLogger('Storage.DomainMonitorThread')
+
+ RELEASE_HOSTID_DEFAULT = False
def __init__(self, sdUUID, hostId, interval):
self.thread = Thread(target=self._monitorLoop)
@@ -121,16 +123,20 @@
self.nextStatus = DomainMonitorStatus()
self.isIsoDomain = None
self.lastRefresh = time()
+ self.releaseHostId = self.RELEASE_HOSTID_DEFAULT
self.refreshTime = \
config.getint("irs", "repo_stats_cache_refresh_timeout")
def start(self):
self.thread.start()
- def stop(self, wait=True):
+ def stop(self, wait=True, releaseHostId):
+ self.releaseHostId = releaseHostId
+
self.stopEvent.set()
if wait:
self.thread.join()
+
self.domain = None
def getStatus(self):
@@ -151,13 +157,17 @@
# If this is an ISO domain we didn't acquire the host id and releasing
# it is superfluous.
- if not self.isIsoDomain:
+ if not self.isIsoDomain and self.releaseHostId:
try:
self.domain.releaseHostId(self.hostId, unused=True)
except:
self.log.debug("Unable to release the host id %s for domain "
"%s", self.hostId, self.sdUUID, exc_info=True)
+ # Resetting the releaseHostId value to its default just to be sure in
+ # case in the future we want to recycle the DomainMonitor objects.
+ self.releaseHostId = self.RELEASE_HOSTID_DEFAULT
+
def _monitorDomain(self):
self.nextStatus.clear()
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 40de20a..e8c59f3 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -647,8 +647,8 @@
@unsecured
- def stopMonitoringDomains(self):
- self.domainMonitor.close()
+ def stopMonitoringDomains(self, releaseHostId=False):
+ self.domainMonitor.close(releaseHostId=releaseHostId)
return True
@@ -675,7 +675,7 @@
if os.path.exists(self.poolPath):
fileUtils.cleanupdir(self.poolPath)
- self.stopMonitoringDomains()
+ self.stopMonitoringDomains(releaseHostId=True)
return True
--
To view, visit http://gerrit.ovirt.org/7581
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I83458fb4146de7e402606916615533da305bd867
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]: 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