Change in vdsm[master]: [wip] volume: make volume._share idempotent
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [wip] volume: make volume._share idempotent
......................................................................
[wip] volume: make volume._share idempotent
With this patch it will possible to run the volume._share command
multiple times without harm (idempotent) for the image and for the
running VMs.
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: I237e4a8f094ba04dcd4ef7bff418e03f81162d8d
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
M vdsm/storage/volume.py
3 files changed, 39 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/8270/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 38285c1..ee8ba67 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -324,6 +324,7 @@
dstPath = os.path.join(dstImgPath, self.volUUID)
self.log.debug("Share volume %s to %s", self.volUUID, dstImgPath)
+ # TODO: make this idempotent
os.symlink(self.getDevPath(), dstPath)
@classmethod
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 0aa9043..2e76944 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -227,29 +227,49 @@
"""
Share this volume to dstImgPath, including the metadata and the lease
"""
- dstVolPath = os.path.join(dstImgPath, self.volUUID)
- dstMetaPath = self._getMetaVolumePath(dstVolPath)
-
self.log.debug("Share volume %s to %s", self.volUUID, dstImgPath)
- self.oop.fileUtils.safeUnlink(dstVolPath)
- self.oop.os.link(self.getVolumePath(), dstVolPath)
+ dstVolumePath = os.path.join(dstImgPath, self.volUUID)
- self.log.debug("Share volume metadata of %s to %s", self.volUUID,
- dstImgPath)
+ # Format: itemName, srcPath, dstPath, itemRequired
+ itemsList = [
+ ('volume', self.getVolumePath(), dstVolumePath, True),
+ ('metadata', self._getMetaVolumePath(),
+ self._getMetaVolumePath(dstVolumePath), True),
+ ('lease', self._getLeaseVolumePath(),
+ self._getLeaseVolumePath(dstVolumePath),
+ sdCache.produce(self.sdUUID).hasVolumeLeases()),
+ ]
- self.oop.fileUtils.safeUnlink(dstMetaPath)
- self.oop.os.link(self._getMetaVolumePath(), dstMetaPath)
+ for itemName, srcPath, dstPath, itemRequired in itemsList:
+ self.log.debug("Sharing %s %s to %s (required: %s)", itemName,
+ self.volUUID, dstPath, itemRequired)
- # Link the lease file if the domain uses sanlock
- if sdCache.produce(self.sdUUID).hasVolumeLeases():
- dstLeasePath = self._getLeaseVolumePath(dstVolPath)
+ try:
+ srcInfo = self.oop.stat(srcPath)
+ except OSError, e:
+ if e != os.errno.ENOENT or itemRequired:
+ # Source not found
+ self.log.debug("TODO: <message>")
+ raise
- self.log.debug("Share volume lease of %s to %s", self.volUUID,
- dstImgPath)
+ try:
+ dstInfo = self.oop.stat(dstPath)
+ except OSError, e:
+ if e != os.errno.ENOENT:
+ raise
- self.oop.fileUtils.safeUnlink(dstLeasePath)
- self.oop.os.link(self._getLeaseVolumePath(), dstLeasePath)
+ # Destination file not present, linking
+ self.log.debug("TODO: <message>")
+ self.oop.os.link(srcPath, dstPath)
+ else:
+ # If both the source and destination are present and they are
+ # the same file (already linked) then continue.
+ if srcInfo.st_ino == dstInfo.st_ino:
+ self.log.debug("TODO: <message>")
+ else:
+ self.log.debug("TODO: <message>")
+ raise OSError(os.errno.EEXIST, "Destination file exists")
@classmethod
def shareVolumeRollback(cls, taskObj, volPath):
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index b9eb356..7938c6f 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -297,6 +297,8 @@
self._share(dstImgPath)
except Exception, e:
+ self.log.debug("Cannot share volume %s to %s", self.volUUID,
+ dstImgPath, exc_info=True)
raise se.CannotShareVolume(self.getVolumePath(), dstPath, str(e))
def refreshVolume(self):
--
To view, visit http://gerrit.ovirt.org/8270
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I237e4a8f094ba04dcd4ef7bff418e03f81162d8d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years
Change in vdsm[master]: WIP - Avoid creation of fake templates.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: WIP - Avoid creation of fake templates.
......................................................................
WIP - Avoid creation of fake templates.
Change-Id: I7ae6e455757f247bfc3d8e261d8f5cec25f8776a
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/sp.py
2 files changed, 0 insertions(+), 45 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/8280/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index d004046..bb620ef 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -20,7 +20,6 @@
import os
import logging
-import threading
import uuid
from contextlib import contextmanager
@@ -65,7 +64,6 @@
Consist from chain of volumes.
"""
log = logging.getLogger('Storage.Image')
- _fakeTemplateLock = threading.Lock()
@classmethod
def createImageRollback(cls, taskObj, imageDir):
@@ -428,37 +426,6 @@
self.repoPath, destDom.sdUUID, sd.DOMAIN_IMAGES,
templateImage, volUUID), tLink)
- def createFakeTemplate(self, sdUUID, volParams):
- """
- Create fake template (relevant for Backup domain only)
- """
- with self._fakeTemplateLock:
- try:
- destDom = sdCache.produce(sdUUID)
- volclass = destDom.getVolumeClass()
- # Validate that the destination template exists and accessible
- volclass(self.repoPath, sdUUID, volParams['imgUUID'], volParams['volUUID'])
- except (se.VolumeDoesNotExist, se.ImagePathError):
- try:
- # Create fake parent volume
- destDom.createVolume(imgUUID=volParams['imgUUID'], size=volParams['size'],
- volFormat=volume.COW_FORMAT, preallocate=volume.SPARSE_VOL,
- diskType=volParams['disktype'], volUUID=volParams['volUUID'], desc="Fake volume",
- srcImgUUID=volume.BLANK_UUID, srcVolUUID=volume.BLANK_UUID)
-
- vol = destDom.produceVolume(imgUUID=volParams['imgUUID'], volUUID=volParams['volUUID'])
- # Mark fake volume as "FAKE"
- vol.setLegality(volume.FAKE_VOL)
- # Mark fake volume as shared
- vol.setShared()
- # Now we should re-link all hardlinks of this template in all VMs based on it
- self.__templateRelink(destDom, volParams['imgUUID'], volParams['volUUID'])
-
- self.log.debug("Succeeded to create fake image %s in domain %s", volParams['imgUUID'], destDom.sdUUID)
- except Exception:
- self.log.error("Failure to create fake image %s in domain %s", volParams['imgUUID'],
- destDom.sdUUID, exc_info=True)
-
def isLegal(self, sdUUID, imgUUID):
"""
Check correctness of the whole chain (excluding template)
@@ -502,7 +469,6 @@
self.log.error("Unexpected error", exc_info=True)
raise se.SourceImageActionError(imgUUID, srcSdUUID, str(e))
- fakeTemplate = False
pimg = volume.BLANK_UUID # standalone chain
# check if the chain is build above a template, or it is a standalone
pvol = srcChain[0].getParentVolume()
@@ -510,11 +476,6 @@
# find out parent volume parameters
volParams = pvol.getVolumeParams()
pimg = volParams['imgUUID'] # pimg == template image
- if destDom.isBackup():
- # FIXME: This workaround help as copy VM to the backup domain without its template
- # We will create fake template for future VM creation and mark it as FAKE volume
- # This situation is relevant for backup domain only
- fakeTemplate = True
@contextmanager
def justLogIt(img):
@@ -525,9 +486,6 @@
# In destination domain we need to lock image's template if exists
with rmanager.acquireResource(dstImageResourcesNamespace, pimg, rm.LockType.shared) \
if pimg != volume.BLANK_UUID else justLogIt(imgUUID):
- if fakeTemplate:
- self.createFakeTemplate(destDom.sdUUID, volParams)
-
dstChain = []
for srcVol in srcChain:
# Create the dst volume
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 78fbe66..d3b7009 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1828,10 +1828,7 @@
allVols)
else:
# Removing a template with dependencies in backup domain
- # A fake template will be created
img.delete(sdUUID=sdUUID, imgUUID=imgUUID, postZero=postZero, force=True)
- tParams = dom.produceVolume(imgUUID, tName).getVolumeParams()
- img.createFakeTemplate(sdUUID=sdUUID, volParams=tParams)
def mergeSnapshots(self, sdUUID, vmUUID, imgUUID, ancestor, successor, postZero):
"""
--
To view, visit http://gerrit.ovirt.org/8280
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ae6e455757f247bfc3d8e261d8f5cec25f8776a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years
Change in vdsm[master]: check the syntaxs of optional parameters in json schema
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: check the syntaxs of optional parameters in json schema
......................................................................
check the syntaxs of optional parameters in json schema
There are so many syntaxs error of optional parameters define in
json schema
This patch can both check the descrption errors of optional parameters
missing #optional and the define error of optional parameters missing *
Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm_api/process-schema.py
1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/10446/1
diff --git a/vdsm_api/process-schema.py b/vdsm_api/process-schema.py
index 8244995..5db6966 100755
--- a/vdsm_api/process-schema.py
+++ b/vdsm_api/process-schema.py
@@ -22,6 +22,11 @@
import sys
import re
import vdsmapi
+try:
+ from collections import OrderedDict
+ OrderedDict # make pyflakes happy
+except ImportError:
+ from ordereddict import OrderedDict
html_escape_table = {
"&": "&",
@@ -143,6 +148,18 @@
symbol[mode][name] = desc
# Track the name in case there is are multiple lines to append
last_arg = name
+ # check optional parameters
+ if desc.startswith('#optional '):
+ assert ('*' + name in symbol['data'].keys()), \
+ ('Define of %s optional parameter error:\n\t%s should '
+ 'start with *' % (symbol['name'], name))
+ if isinstance(symbol['data'], OrderedDict):
+ if '*' + name in symbol['data'].keys():
+ assert desc.startswith('#optional '), \
+ ('Description of %s optional parameter error:\n\t'
+ 'The description of optional parameter "%s" '
+ 'should start with "#optional"' %
+ (symbol['name'], name))
else:
# Just append it to the last one we added
symbol[mode][last_arg] += ' ' + line
--
To view, visit http://gerrit.ovirt.org/10446
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
10 years
Change in vdsm[master]: [WIP] Add new repository management code
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP] Add new repository management code
......................................................................
[WIP] Add new repository management code
Change-Id: Ib09c89cf982b475f45d26b2428fe05e2f4565dab
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/Makefile.am
A tests/imageMainuplatorTests.py
A tests/repositoryEngineTests.py
A vdsm/storage/imageRepository/engines/__init__.py
A vdsm/storage/imageRepository/engines/localfs/__init__.py
A vdsm/storage/imageRepository/imageManipulator.py
6 files changed, 1,339 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/6247/1
--
To view, visit http://gerrit.ovirt.org/6247
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib09c89cf982b475f45d26b2428fe05e2f4565dab
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: Add create operation to qemu-img
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Add create operation to qemu-img
......................................................................
Add create operation to qemu-img
Change-Id: I078afcb0899792805584fc56832747d36908f18b
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/qemuImg.py
1 file changed, 29 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/6245/1
--
To view, visit http://gerrit.ovirt.org/6245
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I078afcb0899792805584fc56832747d36908f18b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: [WIP] Continue moving VM code to it's own module
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP] Continue moving VM code to it's own module
......................................................................
[WIP] Continue moving VM code to it's own module
Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/API.py
1 file changed, 16 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/7514/1
diff --git a/vdsm/API.py b/vdsm/API.py
index aab69cd..e6a1048 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -136,15 +136,18 @@
for methName in GUEST_AGENT_METHODS:
self.setattr(attrName, partial(guestTrampoline, methName))
+ def _getVmObject(self):
+ return self._cif.vmContainer.get(self._UUID)
+
def _runThinMethod(self, methodName, *args, **kwargs):
- v = self._cif.vmContainer.get(self._UUID)
+ v = self._getVmObject()
if not v:
return errCode['noVM']
return getattr(v, methodName)(*args, **kwargs)
def _runGuestAgentMethod(self, methodName, *args, **kwargs):
- v = self._cif.vmContainer.get(self._UUID)
+ v = self._getVmObject()
if v is None:
return errCode['noVM']
@@ -163,7 +166,7 @@
"""
vmParams['vmId'] = self._UUID
try:
- if self._cif.vmContainer.get(self._UUID) is not None:
+ if self._getVmObject() is not None:
self.log.warning('vm %s already exists' % vmParams['vmId'])
return errCode['exist']
@@ -286,7 +289,7 @@
"""
Obtain statistics of the specified VM
"""
- v = self._cif.vmContainer.get(self._UUID)
+ v = self._getVmObject()
if not v:
return errCode['noVM']
stats = v.getStats().copy()
@@ -364,7 +367,7 @@
"""
params['vmId'] = self._UUID
self.log.debug(params)
- v = self._cif.vmContainer.get(self._UUID)
+ v = self._getVmObject()
if v is None:
return errCode['noVM']
@@ -395,7 +398,7 @@
self.log.debug('Migration create - Failed')
return response
- v = self._cif.vmContainer.get(self._UUID)
+ v = self._getVmObject()
if not v.waitForMigrationDestinationPrepare():
return errCode['createErr']
@@ -921,12 +924,14 @@
return d
else:
return {'vmId': d['vmId'], 'status': d['status']}
- # To improve complexity, convert 'vms' to set(vms)
- vmSet = set(vmList)
+
+ if vmList:
+ vms = (self._cif.vmContainer.get(vm) for vm in vmList)
+ else:
+ vms = self._cif.vmContainer.getVMs()
+
return {'status': doneCode,
- 'vmList': [reportedStatus(v, fullStatus)
- for v in self._cif.vmContainer.getVMs()
- if not vmSet or v.id in vmSet]}
+ 'vmList': [reportedStatus(vm, fullStatus) for vm in vms]}
# Networking-related functions
def setupNetworks(self, networks={}, bondings={}, options={}):
--
To view, visit http://gerrit.ovirt.org/7514
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: [WIP] Added getStorageDevices verb.
by barumuga@redhat.com
Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/3725
to review the following change.
Change subject: [WIP] Added getStorageDevices verb.
......................................................................
[WIP] Added getStorageDevices verb.
This verb is used to get list of storage devices in the node. Return
value is a dictionary, its keys are device names and values are
properties of those devices as dictionary.
{DEVNAME: {'container': CONTAINER_DEVNAME,
'contentType': CONTENT_TYPE_STRING,
'endSize': SIZE_MB,
'flagList': STRING_LIST,
'fsSize': SIZE_MB,
'fsSizeFree': SIZE_MB,
'fsType': STRING,
'fsUuid': UUID,
'members': DEVNAME_LIST,
'model': STRING,
'mountPoint': STRING,
'name': DEVNAME,
'origin': LV_DEVNAME,
'parent': PARENT_DEVNAME,
'partitions': DEVNAME_LIST,
'size': SIZE_MB,
'sizeFree': SIZE_MB,
'startSize': SIZE_MB,
'status': STATUS_STRING,
'tableType': DISK_TABLE_TYPE,
'type': TYPE_STRING,
'uuid': UUID,
'vendor': STRING},...}
here, property dictionary contains
container: If DEVNAME is used by another device eg. LVM PV, MD etc, name
of that device is set
contentType: This is determined by various other properties. Possible
value is one of 'SWAP', 'OS', 'DATA' and 'NA'
endSize: If DEVNAME is a partition, its end boundry is set. The value
is in MB
flagList: If DEVNAME is a partition, its flags(eg. boot,bios_grub etc)
are set as a list of strings
fsSize: If DEVNAME has a file system, its size is set. The value is
in MB
fsSizeFree: If DEVNAME is mounted, its free size is set. The value is in
MB
fsType: If DEVNAME is formatted, its file system type is set
fsUuid': If DEVNAME has file system, its UUID is set
members: If DEVNAME is a MD, LVM VG etc, its member device names are
set as list of strings
model: Model of DEVNAME is set as string
mountPoint: If DEVNAME is mounted, its mount point is set
name: DEVNAME is set here for completion
origin: If DEVNAME is a snapshot of LV, that LV name is set
parent: If DEVNAME is a partition, its disk name is set
partitions: If DEVNAME is a disk, its partition names are set as list of
strings
size: Size of DEVNAME is set. The value is in MB
sizeFree: If DEVNAME is VG, its size of free extents is set. If its a
partitioned disk, its unallocated size is set. The value is
in MB
startSize: If DEVNAME is a partition, its start boundry is set. The
value is in MB
status: This is determined by various other properites of the DEVNAME.
Possible value is one of 'UNINITIALIZED', 'NA', 'UNUSABLE',
'FORMAT_UNSUPPORTED', 'MOUNTED', 'FORMATTED' and 'PARTED'
tableType': If DEVNAME is a disk, its table(label) type is set as a string
type: This is determined value. Possible value is one of 'MD',
'LVM_VG', 'LVM_LV_SNAPSHOT', 'LVM_LV' and 'BLOCK'
uuid: UUID of DEVNAME
vendor: Vendor of DEVNAME is set as string
Change-Id: I2cb217321a7a8dfcd1b507c7cba2888f08612207
Signed-off-by: Bala.FA <barumuga(a)redhat.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/Makefile.am
A vdsm/storage_device_utils.py
M vdsm_cli/vdsClient.py
6 files changed, 505 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/3725/1
--
To view, visit http://gerrit.ovirt.org/3725
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cb217321a7a8dfcd1b507c7cba2888f08612207
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: libvirtvm: use <interface type='network'>
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: libvirtvm: use <interface type='network'>
......................................................................
libvirtvm: use <interface type='network'>
In the future, this would allow us to migrate a VM from a bridge-based
network to funkier types of networks defined in
http://libvirt.org/formatnetwork.html .
Change-Id: If173a6351b1033c3a1c821cbadd05a2cbdf3d76c
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/libvirtvmTests.py
M vdsm/libvirtvm.py
2 files changed, 15 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/9441/1
diff --git a/tests/libvirtvmTests.py b/tests/libvirtvmTests.py
index 4293276..2a0f097 100644
--- a/tests/libvirtvmTests.py
+++ b/tests/libvirtvmTests.py
@@ -261,10 +261,10 @@
def testInterfaceXML(self):
interfaceXML = """
- <interface type="bridge"> <address %s/>
+ <interface type="network"> <address %s/>
<mac address="52:54:00:59:F5:3F"/>
<model type="virtio"/>
- <source bridge="ovirtmgmt"/>
+ <source network="vdsm-ovirtmgmt"/>
<filterref filter="no-mac-spoofing"/>
<boot order="1"/>
<driver name="vhost"/>
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3439dc3..7bbab95 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -982,16 +982,17 @@
"""
Create domxml for network interface.
- <interface type="bridge">
+ <interface type="network">
<mac address="aa:bb:dd:dd:aa:bb"/>
<model type="virtio"/>
- <source bridge="engine"/>
+ <source network="vdsm-engine"/>
[<filterref filter='filter name'/>]
[<tune><sndbuf>0</sndbuf></tune>]
</interface>
"""
doc = xml.dom.minidom.Document()
iface = self.createXmlElem('interface', self.device, ['address'])
+ iface.setAttribute('type', 'network')
m = doc.createElement('mac')
m.setAttribute('address', self.macAddr)
iface.appendChild(m)
@@ -999,7 +1000,7 @@
m.setAttribute('type', self.nicModel)
iface.appendChild(m)
m = doc.createElement('source')
- m.setAttribute('bridge', self.network)
+ m.setAttribute('network', netinfo.LIBVIRT_NET_PREFIX + self.network)
iface.appendChild(m)
if hasattr(self, 'filter'):
m = doc.createElement('filterref')
@@ -2790,10 +2791,15 @@
mac = x.getElementsByTagName('mac')[0].getAttribute('address')
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
model = x.getElementsByTagName('model')[0].getAttribute('type')
- bridge = None
+
+ network = None
source = x.getElementsByTagName('source')
if source:
- bridge = source[0].getAttribute('bridge')
+ network = source[0].getAttribute('bridge')
+ if not network:
+ network = source[0].getAttribute('network')
+ network = network[len(netinfo.LIBVIRT_NET_PREFIX):]
+
# Get nic address
address = self._getUnderlyingDeviceAddress(x)
for nic in self._devices[vm.NIC_DEVICES]:
@@ -2819,8 +2825,8 @@
'address': address,
'alias': alias,
'name': name}
- if bridge:
- nicDev['network'] = bridge
+ if network:
+ nicDev['network'] = network
self.conf['devices'].append(nicDev)
def _setWriteWatermarks(self):
--
To view, visit http://gerrit.ovirt.org/9441
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If173a6351b1033c3a1c821cbadd05a2cbdf3d76c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: Sometimes the FD number can be reused in the child process
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Sometimes the FD number can be reused in the child process
......................................................................
Sometimes the FD number can be reused in the child process
This makes sure that the fd is the file that we expected to be closed child
process
Change-Id: I7044936fba8923297c76d9a2123215ec2b793548
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/betterPopenTests.py
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/9591/1
diff --git a/tests/betterPopenTests.py b/tests/betterPopenTests.py
index 6347460..eb129f4 100644
--- a/tests/betterPopenTests.py
+++ b/tests/betterPopenTests.py
@@ -59,8 +59,9 @@
def testCloseFDs(self):
fds = os.pipe()
+ rpath = os.path.realpath("/proc/%d/fds/%d" % (os.getpid(), fds[1]))
try:
- self._subTest("fds", [str(fds[1])], close_fds=True)
+ self._subTest("fds", [str(fds[1]), rpath], close_fds=True)
finally:
os.close(fds[0])
os.close(fds[1])
@@ -154,11 +155,11 @@
if __name__ == "__main__":
cmd = sys.argv[1]
if cmd == "fds":
- try:
- os.close(int(sys.argv[2]))
- print "False"
- except:
- print "True"
+ fdpath = "/proc/%d/fds/%d" % (os.getpid(), int(sys.argv[2]))
+ if not os.path.exists(fdpath):
+ print True
+ else:
+ print (open(fdpath).read().strip() == sys.argv[3])
elif cmd == "nofds":
try:
--
To view, visit http://gerrit.ovirt.org/9591
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7044936fba8923297c76d9a2123215ec2b793548
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: Misc storage exception class name style
by shuming@linux.vnet.ibm.com
Shu Ming has uploaded a new change for review.
Change subject: Misc storage exception class name style
......................................................................
Misc storage exception class name style
All the misc storage exception class name should
be prefixed with "Misc"
Change-Id: I2f6f279d13b92bbb8f573a0d772d7504860bbbe3
Signed-off-by: Shu Ming <shuming(a)linux.vnet.ibm.com>
---
M vdsm/storage/sp.py
M vdsm/storage/storage_exception.py
2 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/8847/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4aa63c0..7622556 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -220,7 +220,7 @@
.. note::
if the SPM is already started the function will fail silently.
- :raises: :exc:`storage_exception.OperationInProgress` if called during an already running connection attempt.
+ :raises: :exc:`storage_exception.MiscOperationInProgress` if called during an already running connection attempt.
(makes the fact that it fails silently does not matter very much).
"""
with self.lock:
@@ -228,7 +228,7 @@
return True
# Since we added the lock the following should NEVER happen
if self.spmRole == SPM_CONTEND:
- raise se.OperationInProgress("spm start %s" % self.spUUID)
+ raise se.MiscOperationInProgress("spm start %s" % self.spUUID)
self.updateMonitoringThreads()
self.invalidateMetadata()
@@ -1934,7 +1934,7 @@
self.log.error("TODO: Implement")
self._maxHostID
self.spmMailer.setMaxHostID(maxID)
- raise se.NotImplementedException
+ raise se.MiscNotImplementedException
def detachAllDomains(self):
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 54e64e6..a25a588 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -125,7 +125,7 @@
# Misc Exceptions
#################################################
-class NotImplementedException(GeneralException):
+class MiscNotImplementedException(GeneralException):
code = 2000
message = "Method not implemented"
@@ -154,7 +154,7 @@
message = "Internal block device write failure"
-class OperationInProgress(StorageException):
+class MiscOperationInProgress(StorageException):
code = 2005
message = "Operation is already in progress"
--
To view, visit http://gerrit.ovirt.org/8847
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f6f279d13b92bbb8f573a0d772d7504860bbbe3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shu Ming <shuming(a)linux.vnet.ibm.com>
10 years, 2 months