Change in vdsm[master]: DomainMonitor should use use real domains (no proxy)
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: DomainMonitor should use use real domains (no proxy)
......................................................................
DomainMonitor should use use real domains (no proxy)
In this patch:
* produce the domain when refreshing
* remove the remaining getRealDomain (DomainProxy) calls
* fix manuallyRemoveDomain for non-existent domains
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: Ibbf67fc050658e3418aa666e8fcef1e1244571e9
---
M vdsm/storage/domainMonitor.py
M vdsm/storage/sdc.py
M vdsm/storage/sp.py
3 files changed, 32 insertions(+), 26 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/7294/1
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 80b6ed3..0272cb1 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -75,13 +75,14 @@
def monitoredDomains(self):
return self._domains.keys()
- def startMonitoring(self, domain, hostId):
- if domain.sdUUID in self._domains:
+ def startMonitoring(self, sdUUID, hostId):
+ if sdUUID in self._domains:
return
- self._domains[domain.sdUUID] = DomainMonitorThread(
- domain, hostId, self._interval)
- self._domains[domain.sdUUID].start()
+ domainThread = DomainMonitorThread(sdUUID, hostId, self._interval)
+ domainThread.start()
+ # The domain should be added only after it succesfully started
+ self._domains[sdUUID] = domainThread
def stopMonitoring(self, sdUUID):
# The domain monitor issues events that might become raceful if
@@ -107,22 +108,25 @@
class DomainMonitorThread(object):
log = logging.getLogger('Storage.DomainMonitorThread')
- def __init__(self, domain, hostId, interval):
+ def __init__(self, sdUUID, hostId, interval):
self.thread = Thread(target=self._monitorLoop)
self.thread.setDaemon(True)
self.stopEvent = Event()
- self.domain = domain
+ self.domain = None
+ self.sdUUID = sdUUID
self.hostId = hostId
self.interval = interval
self.status = DomainMonitorStatus()
self.nextStatus = DomainMonitorStatus()
- self.isIsoDomain = domain.isISO()
+ self.isIsoDomain = None
self.lastRefresh = time()
self.refreshTime = \
config.getint("irs", "repo_stats_cache_refresh_timeout")
def start(self):
+ self.domain = sdCache.produce(self.sdUUID)
+ self.isIsoDomain = self.domain.isISO()
self.thread.start()
def stop(self, wait=True):
@@ -134,17 +138,17 @@
return self.status.copy()
def _monitorLoop(self):
- self.log.debug("Starting domain monitor for %s", self.domain.sdUUID)
+ self.log.debug("Starting domain monitor for %s", self.sdUUID)
while not self.stopEvent.is_set():
try:
self._monitorDomain()
except:
self.log.error("The domain monitor for %s failed unexpectedly",
- self.domain.sdUUID, exc_info=True)
+ self.sdUUID, exc_info=True)
self.stopEvent.wait(self.interval)
- self.log.debug("Stopping domain monitor for %s", self.domain.sdUUID)
+ self.log.debug("Stopping domain monitor for %s", self.sdUUID)
# If this is an ISO domain we didn't acquire the host id and releasing
# it is superfluous.
@@ -153,16 +157,17 @@
self.domain.releaseHostId(self.hostId, unused=True)
except:
self.log.debug("Unable to release the host id %s for domain "
- "%s", self.hostId, self.domain.sdUUID, exc_info=True)
+ "%s", self.hostId, self.sdUUID, exc_info=True)
def _monitorDomain(self):
self.nextStatus.clear()
- # Refreshing the domain object in order to pick up changes as,
- # for example, the domain upgrade.
if time() - self.lastRefresh > self.refreshTime:
- self.log.debug("Refreshing domain %s", self.domain.sdUUID)
- sdCache.manuallyRemoveDomain(self.domain.sdUUID)
+ # Refreshing the domain object in order to pick up changes as,
+ # for example, the domain upgrade.
+ self.log.debug("Refreshing domain %s", self.sdUUID)
+ sdCache.manuallyRemoveDomain(self.sdUUID)
+ self.domain = sdCache.produce(self.sdUUID)
self.lastRefresh = time()
try:
@@ -188,20 +193,19 @@
except Exception, e:
self.log.error("Error while collecting domain %s monitoring "
- "information", self.domain.sdUUID, exc_info=True)
+ "information", self.sdUUID, exc_info=True)
self.nextStatus.error = e
self.nextStatus.lastCheck = time()
self.nextStatus.valid = (self.nextStatus.error is None)
if self.status.valid != self.nextStatus.valid:
- self.log.debug("Domain %s changed its status to %s",
- self.domain.sdUUID,
+ self.log.debug("Domain %s changed its status to %s", self.sdUUID,
"Valid" if self.nextStatus.valid else "Invalid")
try:
self.onDomainConnectivityStateChange.emit(
- self.domain.sdUUID, self.nextStatus.valid)
+ self.sdUUID, self.nextStatus.valid)
except:
self.log.warn("Could not emit domain state change event",
exc_info=True)
@@ -213,7 +217,7 @@
self.domain.acquireHostId(self.hostId, async=True)
except:
self.log.debug("Unable to issue the acquire host id %s "
- "request for domain %s", self.hostId, self.domain.sdUUID,
+ "request for domain %s", self.hostId, self.sdUUID,
exc_info=True)
self.status.update(self.nextStatus)
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index 9a7d09d..eee8d73 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -137,7 +137,10 @@
def manuallyRemoveDomain(self, sdUUID):
with self._syncroot:
- del self.__cache[sdUUID]
+ try:
+ del self.__cache[sdUUID]
+ except KeyError:
+ pass
storage_repository = config.get('irs', 'repository')
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ed2b893..da403d9 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1022,8 +1022,8 @@
if targetFormat is None:
targetFormat = self.getFormat()
- self._formatConverter.convert(repoPath, self.id, domain.getRealDomain(),
- isMsd, targetFormat)
+ self._formatConverter.convert(repoPath, self.id, domain, isMsd,
+ targetFormat)
sdCache.manuallyRemoveDomain(sdUUID)
@unsecured
@@ -1557,8 +1557,7 @@
for sdUUID in activeDomains:
if sdUUID not in monitoredDomains:
try:
- self.domainMonitor \
- .startMonitoring(sdCache.produce(sdUUID), self.id)
+ self.domainMonitor.startMonitoring(sdUUID, self.id)
self.log.debug("Storage Pool `%s` started monitoring "
"domain `%s`", self.spUUID, sdUUID)
except se.StorageException:
--
To view, visit http://gerrit.ovirt.org/7294
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbf67fc050658e3418aa666e8fcef1e1244571e9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Revert "BZ#842631 Use domain proxies instead of actual domai...
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Revert "BZ#842631 Use domain proxies instead of actual domain references"
......................................................................
Revert "BZ#842631 Use domain proxies instead of actual domain references"
This reverts commit 942c2dc8d317b6180529ed7df4eee98fbf1b9836.
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: Id4b1e0600948ab24e144df94f8d02a101a87627a
---
M vdsm/storage/sdc.py
1 file changed, 11 insertions(+), 40 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/7293/1
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index 2e8a6ff..9a7d09d 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -36,21 +36,6 @@
DEFAULT_REFRESH_INTERVAL = 300
-class DomainProxy(object):
- """Keeps domain references valid even when underlying domain object changes
- (due to format conversion for example"""
- def __init__(self, cache, sdUUID):
- self._sdUUID = sdUUID
- self._cache = cache
-
- def __getattr__(self, attrName):
- dom = self.getRealDomain()
- return getattr(dom, attrName)
-
- def getRealDomain(self):
- return self._cache._realProduce(self._sdUUID)
-
-
class StorageDomainCache:
"""
Storage Domain List keeps track of all the storage domains accessible by
@@ -59,9 +44,9 @@
log = logging.getLogger('Storage.StorageDomainCache')
def __init__(self, storage_repo):
- self._syncroot = threading.RLock()
- self.__proxyCache = {}
- self.__domainCache = {}
+ self._syncroot = threading.Lock()
+ self.__cache = {}
+ self.__weakCache = {}
self.storage_repo = storage_repo
self.storageStale = True
@@ -79,14 +64,14 @@
if self.storageStale == True:
return None
try:
- return self.__proxyCache[sdUUID]()
+ return self.__weakCache[sdUUID]()
except KeyError:
return None
def _cleanStaleWeakrefs(self):
- for sdUUID, ref in self.__proxyCache.items():
+ for sdUUID, ref in self.__weakCache.items():
if ref() is None:
- del self.__proxyCache[sdUUID]
+ del self.__weakCache[sdUUID]
def produce(self, sdUUID):
dom = self._getDomainFromCache(sdUUID)
@@ -103,25 +88,11 @@
self._cleanStaleWeakrefs()
- dom = DomainProxy(self, sdUUID)
- # This is needed to preserve the semantic where if the domain was
- # absent from the cache and the domain cannot be found the
- # operation would fail
- dom.getRealDomain()
- self.__proxyCache[sdUUID] = weakref.ref(dom)
- return dom
-
- def _realProduce(self, sdUUID):
- with self._syncroot:
- try:
- return self.__domainCache[sdUUID]
- except KeyError:
- pass
-
# _findDomain will raise StorageDomainDoesNotExist if sdUUID is not
# found in storage.
dom = self._findDomain(sdUUID)
- self.__domainCache[sdUUID] = dom
+ self.__cache[sdUUID] = dom
+ self.__weakCache[sdUUID] = weakref.ref(dom)
return dom
def _findDomain(self, sdUUID):
@@ -158,15 +129,15 @@
def refresh(self):
self.invalidateStorage()
- self.__domainCache.clear()
+ self.__cache.clear()
def manuallyAddDomain(self, dom):
with self._syncroot:
- self.__domainCache[dom.sdUUID] = dom
+ self.__cache[dom.sdUUID] = dom
def manuallyRemoveDomain(self, sdUUID):
with self._syncroot:
- del self.__domainCache[sdUUID]
+ del self.__cache[sdUUID]
storage_repository = config.get('irs', 'repository')
--
To view, visit http://gerrit.ovirt.org/7293
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4b1e0600948ab24e144df94f8d02a101a87627a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Rename volumeCopy API to volumeCollapse
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Rename volumeCopy API to volumeCollapse
......................................................................
Rename volumeCopy API to volumeCollapse
copyImage (the internal call used by the former volumeCopy) creates
a new template/volume collapsing the whole chain (base->volUUID).
This is not just a nomenclature problem since we need to implement
the real volumeCopy.
Change-Id: Ide39bb54d2a97b3ba8d4712750ff10a67c5764f2
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
2 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/2968/1
--
To view, visit http://gerrit.ovirt.org/2968
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide39bb54d2a97b3ba8d4712750ff10a67c5764f2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Extend the range of Vm's niceness to allow increasing cpu sh...
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Extend the range of Vm's niceness to allow increasing cpu shares
......................................................................
Extend the range of Vm's niceness to allow increasing cpu shares
The current range of Vm's niceness is [0, 19], and the default value 0
represnts the biggest cpu shares. So if we want to assign more cpu shares
to one vm, we have to give a higher niceness to other vms.This patch extends
the range to [-19, 19], which makes the default value 0 be the middle of it.
It's more flexible for client to set Vm's niceness.
Change-Id: I5ae55daa5655dbd10c200dfd81ba80d8e71abfb5
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/6289/1
--
To view, visit http://gerrit.ovirt.org/6289
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ae55daa5655dbd10c200dfd81ba80d8e71abfb5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: Replace calling setSchedulerParameters() with filling its XM...
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Replace calling setSchedulerParameters() with filling its XML description.
......................................................................
Replace calling setSchedulerParameters() with filling its XML description.
This patch changes to fill cgroup cpu.share into its XML description to set
Vm's niceness instead of calling setSchedulerParameters(). It can save us a
libvirt call on VM statup.
Change-Id: I211e191022f5a18fa7d97d5a8fb42e10729ddd06
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/6290/1
--
To view, visit http://gerrit.ovirt.org/6290
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I211e191022f5a18fa7d97d5a8fb42e10729ddd06
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: Add simple text-based console in vdsClient
by Xu He Jie
Xu He Jie has uploaded a new change for review.
Change subject: Add simple text-based console in vdsClient
......................................................................
Add simple text-based console in vdsClient
Add new command 'openConsole' in vdsClient. This command
invoke 'virsh console' directly. This is easy implement for text-based
console. It means we can have a vdsm text console right now.
We can improve text console in futrue.
Change-Id: I368dbcbc2e180161f256f3fb450c344acb6a6c8a
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm_cli/vdsClient.py
1 file changed, 13 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/8041/1
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index fe2f083..e49e66a 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -24,6 +24,7 @@
import re
import socket
import pprint as pp
+import subprocess
from vdsm import vdscli
try:
@@ -122,8 +123,10 @@
def __init__(self):
self.useSSL = False
self.truststore = None
+ self.server = "0"
def do_connect(self, server, port):
+ self.server = server
self.s = vdscli.connect(server + ':' + port,
self.useSSL, self.truststore)
@@ -1607,6 +1610,13 @@
return status['status']['code'], status['status']['message']
+ def openVmConsole(self, args):
+ protocol = "tls" if self.useSSL else "tcp"
+ conn = "qemu+" + protocol + "://" + self.server + "/system"
+ p = subprocess.Popen(["virsh", "-c", conn, "console", args[0]])
+ p.wait()
+
+
if __name__ == '__main__':
if _glusterEnabled:
serv = ge.GlusterService()
@@ -2265,6 +2275,9 @@
('<vmId> <sdUUID> <imgUUID> <baseVolUUID> <volUUID>',
"Take a live snapshot"
)),
+ 'openConsole': (serv.openVmConsole,
+ ("<vmName>",
+ "open pty console for vm")),
}
if _glusterEnabled:
commands.update(ge.getGlusterCmdDict(serv))
--
To view, visit http://gerrit.ovirt.org/8041
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I368dbcbc2e180161f256f3fb450c344acb6a6c8a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: Add synchronous mode for udevTrigger
by Xu He Jie
Xu He Jie has uploaded a new change for review.
Change subject: Add synchronous mode for udevTrigger
......................................................................
Add synchronous mode for udevTrigger
udevadm trigger was asynchronous. Execute udevadm settle after
udevadm trigger, then it can works as synchronous.
Change-Id: I731c3ef6fe945c7c0278d638bf4cc8164345fd01
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm/storage/hsm.py
M vdsm/supervdsmServer.py
2 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/6916/1
--
To view, visit http://gerrit.ovirt.org/6916
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I731c3ef6fe945c7c0278d638bf4cc8164345fd01
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: iscsi: fix update discoverydb with wrong key
by Xu He Jie
Xu He Jie has uploaded a new change for review.
Change subject: iscsi: fix update discoverydb with wrong key
......................................................................
iscsi: fix update discoverydb with wrong key
When execute discoverSendTargets will get errror message:
Thread-15::DEBUG::2012-07-10 10:44:32,384::__init__::1249::Storage.Misc.excCmd::(_log) '/usr/bin/sudo -n /usr/sbin/iscsiadm -m discoverydb -t sendtargets -I default -p 192.168.122.89:3260 -n node.startup -v manual --op=update' (cwd None)
Thread-15::DEBUG::2012-07-10 10:44:32,404::__init__::1249::Storage.Misc.excCmd::(_log) FAILED: <err> = 'iscsiadm: Cannot modify node.startup. Invalid param name.\n'; <rc> = 7
We should set discovery.startup when discover targets.
Change-Id: Ic561c3a69d2f3ec8b5f83b1837e0d126cb5a314a
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm/storage/iscsi.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/6092/1
--
To view, visit http://gerrit.ovirt.org/6092
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic561c3a69d2f3ec8b5f83b1837e0d126cb5a314a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: BZ#809497: connectStroragServer will fail if iscsi session a...
by Xu He Jie
Xu He Jie has uploaded a new change for review.
Change subject: BZ#809497: connectStroragServer will fail if iscsi session already exists
......................................................................
BZ#809497: connectStroragServer will fail if iscsi session already exists
Add check for connection. If iscsi session existed, will not add
iscsi node.
Change-Id: I3e012e69b5b27841e6f29cce0e1864b8acf332c2
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M vdsm/storage/storageServer.py
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/5957/1
--
To view, visit http://gerrit.ovirt.org/5957
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e012e69b5b27841e6f29cce0e1864b8acf332c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: add hack for regenerate vdsm.spec with configure param from ...
by Xu He Jie
Xu He Jie has uploaded a new change for review.
Change subject: add hack for regenerate vdsm.spec with configure param from vdsm.spec
......................................................................
add hack for regenerate vdsm.spec with configure param from vdsm.spec
Because vdsm.spec was generated before rpm build, @marco@
wasn't generated with configure params from vdsm.spec. This hack
will fix this problem.
Change-Id: I2fdf228f79f6f626f4faa9c6a7f342a2c60d4f54
Signed-off-by: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
---
M Makefile.am
M autobuild.sh
2 files changed, 15 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/5790/1
--
To view, visit http://gerrit.ovirt.org/5790
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fdf228f79f6f626f4faa9c6a7f342a2c60d4f54
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj(a)linux.vnet.ibm.com>
11 years, 2 months