Change in vdsm[master]: vdsm: vdsm_hooks replace/remove too generic except handlers
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: vdsm_hooks replace/remove too generic except handlers
......................................................................
vdsm: vdsm_hooks replace/remove too generic except handlers
Change-Id: I64d51a8b1150f2dd4f9e7711926e5406228c8355
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm_hooks/checkimages/before_vm_start.py
M vdsm_hooks/directlun/after_vm_destroy.py
M vdsm_hooks/directlun/before_vm_migrate_destination.py
M vdsm_hooks/directlun/before_vm_start.py
M vdsm_hooks/fileinject/before_vm_start.py
M vdsm_hooks/floppy/before_vm_start.py
M vdsm_hooks/hostusb/after_vm_destroy.py
M vdsm_hooks/hostusb/before_vm_start.py
M vdsm_hooks/hugepages/after_vm_destroy.py
M vdsm_hooks/hugepages/before_vm_migrate_destination.py
M vdsm_hooks/hugepages/before_vm_start.py
M vdsm_hooks/isolatedprivatevlan/before_vm_start.py
M vdsm_hooks/numa/before_vm_start.py
M vdsm_hooks/openstacknet/after_device_create.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/pincpu/before_vm_start.py
M vdsm_hooks/promisc/after_vm_start.py
M vdsm_hooks/promisc/before_vm_destroy.py
M vdsm_hooks/qemucmdline/before_vm_start.py
M vdsm_hooks/qos/before_vm_start.py
M vdsm_hooks/scratchpad/after_vm_destroy.py
M vdsm_hooks/scratchpad/before_vm_start.py
M vdsm_hooks/smbios/before_vm_start.py
M vdsm_hooks/sriov/after_vm_destroy.py
M vdsm_hooks/sriov/before_vm_start.py
M vdsm_hooks/vmdisk/before_vm_start.py
M vdsm_hooks/vmfex/before_vm_migrate_destination.py
M vdsm_hooks/vmfex/before_vm_start.py
28 files changed, 28 insertions(+), 28 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/17759/1
diff --git a/vdsm_hooks/checkimages/before_vm_start.py b/vdsm_hooks/checkimages/before_vm_start.py
index 0fb1d85..14f1ae5 100755
--- a/vdsm_hooks/checkimages/before_vm_start.py
+++ b/vdsm_hooks/checkimages/before_vm_start.py
@@ -133,7 +133,7 @@
sys.stderr.write('checkimages: Checking image %s. ' %
disk_image)
checkImage(disk_image, image_timeout)
- except:
+ except Exception:
sys.stderr.write('checkimages [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/directlun/after_vm_destroy.py b/vdsm_hooks/directlun/after_vm_destroy.py
index ce51469..d3a0056 100755
--- a/vdsm_hooks/directlun/after_vm_destroy.py
+++ b/vdsm_hooks/directlun/after_vm_destroy.py
@@ -42,7 +42,7 @@
removeDeviceNode(devpath)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('directlun after_vm_destroy: [unexpected error]: '
'%s\n' % traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/directlun/before_vm_migrate_destination.py b/vdsm_hooks/directlun/before_vm_migrate_destination.py
index b80e60d..1c94559 100755
--- a/vdsm_hooks/directlun/before_vm_migrate_destination.py
+++ b/vdsm_hooks/directlun/before_vm_migrate_destination.py
@@ -99,7 +99,7 @@
cloneDeviceNode(srcpath, devpath)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('directlun before_vm_migration_destination: '
'[unexpected error]: %s\n' % traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/directlun/before_vm_start.py b/vdsm_hooks/directlun/before_vm_start.py
index bde62a2..f7b71fa 100755
--- a/vdsm_hooks/directlun/before_vm_start.py
+++ b/vdsm_hooks/directlun/before_vm_start.py
@@ -161,7 +161,7 @@
devices.appendChild(diskdev)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('directlun: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/fileinject/before_vm_start.py b/vdsm_hooks/fileinject/before_vm_start.py
index 0f571e8..19beab4 100755
--- a/vdsm_hooks/fileinject/before_vm_start.py
+++ b/vdsm_hooks/fileinject/before_vm_start.py
@@ -114,7 +114,7 @@
'path not exists: %s\n' %
os.path.dirname(filepath))
sys.exit(2)
- except:
+ except Exception:
sys.stderr.write('fileinject: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/floppy/before_vm_start.py b/vdsm_hooks/floppy/before_vm_start.py
index 7616ac6..e2846ed 100755
--- a/vdsm_hooks/floppy/before_vm_start.py
+++ b/vdsm_hooks/floppy/before_vm_start.py
@@ -50,7 +50,7 @@
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('floppy: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/hostusb/after_vm_destroy.py b/vdsm_hooks/hostusb/after_vm_destroy.py
index 8c18a53..7ccc516 100755
--- a/vdsm_hooks/hostusb/after_vm_destroy.py
+++ b/vdsm_hooks/hostusb/after_vm_destroy.py
@@ -84,7 +84,7 @@
sys.exit(2)
chown(vendorid, productid)
- except:
+ except Exception:
sys.stderr.write('hostusb after_vm_destroy: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/hostusb/before_vm_start.py b/vdsm_hooks/hostusb/before_vm_start.py
index 266df60..16c6e23 100755
--- a/vdsm_hooks/hostusb/before_vm_start.py
+++ b/vdsm_hooks/hostusb/before_vm_start.py
@@ -132,7 +132,7 @@
chown(vendorid, productid)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('hostusb: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/hugepages/after_vm_destroy.py b/vdsm_hooks/hugepages/after_vm_destroy.py
index 2fb5e85..61584ff 100755
--- a/vdsm_hooks/hugepages/after_vm_destroy.py
+++ b/vdsm_hooks/hugepages/after_vm_destroy.py
@@ -22,7 +22,7 @@
pages = int(os.environ.get('hugepages'))
removeSysHugepages(pages)
- except:
+ except Exception:
sys.stderr.write('hugepages: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/hugepages/before_vm_migrate_destination.py b/vdsm_hooks/hugepages/before_vm_migrate_destination.py
index d076398..69bb55d 100755
--- a/vdsm_hooks/hugepages/before_vm_migrate_destination.py
+++ b/vdsm_hooks/hugepages/before_vm_migrate_destination.py
@@ -51,7 +51,7 @@
pages = int(os.environ.get('hugepages'))
addSysHugepages(pages)
- except:
+ except Exception:
sys.stderr.write('hugepages before_vm_migraton_destination: '
'[unexpected error]: %s\n' % traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/hugepages/before_vm_start.py b/vdsm_hooks/hugepages/before_vm_start.py
index cddf475..1b6c166 100755
--- a/vdsm_hooks/hugepages/before_vm_start.py
+++ b/vdsm_hooks/hugepages/before_vm_start.py
@@ -98,7 +98,7 @@
sys.stderr.write('hugepages: adding hugepages tag\n')
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('hugepages: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/isolatedprivatevlan/before_vm_start.py b/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
index 6f839ed..4ab08c7 100755
--- a/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
+++ b/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
@@ -45,7 +45,7 @@
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('isolated-privatevlan: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/numa/before_vm_start.py b/vdsm_hooks/numa/before_vm_start.py
index cefdb6f..84c8a48 100755
--- a/vdsm_hooks/numa/before_vm_start.py
+++ b/vdsm_hooks/numa/before_vm_start.py
@@ -47,7 +47,7 @@
else:
sys.stderr.write('numa: numa already exists in domain xml')
sys.exit(2)
- except:
+ except Exception:
sys.stderr.write('numa: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/openstacknet/after_device_create.py b/vdsm_hooks/openstacknet/after_device_create.py
index e90d759..df3bdce 100755
--- a/vdsm_hooks/openstacknet/after_device_create.py
+++ b/vdsm_hooks/openstacknet/after_device_create.py
@@ -63,6 +63,6 @@
if __name__ == '__main__':
try:
main()
- except:
+ except Exception:
hooking.exit_hook('openstacknet hook: [unexpected error]: %s\n' %
traceback.format_exc())
diff --git a/vdsm_hooks/openstacknet/before_device_create.py b/vdsm_hooks/openstacknet/before_device_create.py
index 6a9e6d1..dc56073 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -129,6 +129,6 @@
test(useOvs)
else:
main()
- except:
+ except Exception:
hooking.exit_hook('openstacknet hook: [unexpected error]: %s\n' %
traceback.format_exc())
diff --git a/vdsm_hooks/pincpu/before_vm_start.py b/vdsm_hooks/pincpu/before_vm_start.py
index 6ea4528..2a72795 100755
--- a/vdsm_hooks/pincpu/before_vm_start.py
+++ b/vdsm_hooks/pincpu/before_vm_start.py
@@ -28,7 +28,7 @@
else:
sys.stderr.write('pincpu: cpuset attribute is present in vcpu, '
'doing nothing\n')
- except:
+ except Exception:
sys.stderr.write('pincpu: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/promisc/after_vm_start.py b/vdsm_hooks/promisc/after_vm_start.py
index 30f04eb..fbf4097 100755
--- a/vdsm_hooks/promisc/after_vm_start.py
+++ b/vdsm_hooks/promisc/after_vm_start.py
@@ -126,7 +126,7 @@
#the vm interface
captureNetwork(ifaceName, network, mode)
- except:
+ except Exception:
sys.stderr.write('promisc: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/promisc/before_vm_destroy.py b/vdsm_hooks/promisc/before_vm_destroy.py
index d041c19..c9075ba 100755
--- a/vdsm_hooks/promisc/before_vm_destroy.py
+++ b/vdsm_hooks/promisc/before_vm_destroy.py
@@ -44,7 +44,7 @@
'mode %s\n' % (network, mode))
removeMirrorNetwork(network)
- except:
+ except Exception:
sys.stderr.write('promisc: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/qemucmdline/before_vm_start.py b/vdsm_hooks/qemucmdline/before_vm_start.py
index b3b9214..74fb829 100755
--- a/vdsm_hooks/qemucmdline/before_vm_start.py
+++ b/vdsm_hooks/qemucmdline/before_vm_start.py
@@ -74,7 +74,7 @@
injectQemuCmdLine(domxml, qemu_cmdline)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('qemu_cmdline: [unexpected error]: %s\n'
% traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/qos/before_vm_start.py b/vdsm_hooks/qos/before_vm_start.py
index 7cdf46f..0eac730 100755
--- a/vdsm_hooks/qos/before_vm_start.py
+++ b/vdsm_hooks/qos/before_vm_start.py
@@ -87,7 +87,7 @@
update_interface(iface, arr[1], domxml)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('qos hook: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/scratchpad/after_vm_destroy.py b/vdsm_hooks/scratchpad/after_vm_destroy.py
index 474bff5..fb392d9 100755
--- a/vdsm_hooks/scratchpad/after_vm_destroy.py
+++ b/vdsm_hooks/scratchpad/after_vm_destroy.py
@@ -15,7 +15,7 @@
else:
sys.stderr.write('scratchpad after_vm_destroy: '
'cannot find image file %s\n' % arr[1])
- except:
+ except Exception:
sys.stderr.write('scratchpad after_vm_destroy: '
'[unexpected error]: %s\n' % traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/scratchpad/before_vm_start.py b/vdsm_hooks/scratchpad/before_vm_start.py
index 2f2fe3f..47dc0e0 100755
--- a/vdsm_hooks/scratchpad/before_vm_start.py
+++ b/vdsm_hooks/scratchpad/before_vm_start.py
@@ -129,7 +129,7 @@
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('scratchpad: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/smbios/before_vm_start.py b/vdsm_hooks/smbios/before_vm_start.py
index 55635a9..26d68c0 100755
--- a/vdsm_hooks/smbios/before_vm_start.py
+++ b/vdsm_hooks/smbios/before_vm_start.py
@@ -102,7 +102,7 @@
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('smbios: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/sriov/after_vm_destroy.py b/vdsm_hooks/sriov/after_vm_destroy.py
index e82dab0..6cf5120 100755
--- a/vdsm_hooks/sriov/after_vm_destroy.py
+++ b/vdsm_hooks/sriov/after_vm_destroy.py
@@ -35,7 +35,7 @@
'virtual function reservation file of %s'
'that should be at %s\n' % (nic, vfFilePath))
- except:
+ except Exception:
sys.stderr.write('sriov after_vm_destroy: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/sriov/before_vm_start.py b/vdsm_hooks/sriov/before_vm_start.py
index c23797b..41d7df3 100755
--- a/vdsm_hooks/sriov/before_vm_start.py
+++ b/vdsm_hooks/sriov/before_vm_start.py
@@ -154,7 +154,7 @@
sys.exit(2)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('sriov: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/vmdisk/before_vm_start.py b/vdsm_hooks/vmdisk/before_vm_start.py
index 0d3ee0a..8ff0f3d 100755
--- a/vdsm_hooks/vmdisk/before_vm_start.py
+++ b/vdsm_hooks/vmdisk/before_vm_start.py
@@ -90,7 +90,7 @@
devices.appendChild(diskdev)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('vmdisk: [unexpected error]: %s\n' %
traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/vmfex/before_vm_migrate_destination.py b/vdsm_hooks/vmfex/before_vm_migrate_destination.py
index 9ea7c28..0315bb7 100755
--- a/vdsm_hooks/vmfex/before_vm_migrate_destination.py
+++ b/vdsm_hooks/vmfex/before_vm_migrate_destination.py
@@ -133,6 +133,6 @@
conn = libvirtconnection.get()
handleDirectPool(conn)
- except:
+ except Exception:
sys.stderr.write('vmfex: ERROR: %s\n' % traceback.format_exc())
sys.exit(2)
diff --git a/vdsm_hooks/vmfex/before_vm_start.py b/vdsm_hooks/vmfex/before_vm_start.py
index 0e98419..b050626 100755
--- a/vdsm_hooks/vmfex/before_vm_start.py
+++ b/vdsm_hooks/vmfex/before_vm_start.py
@@ -193,6 +193,6 @@
parameters.setAttribute('profileid', profile)
virtualport.appendChild(parameters)
hooking.write_domxml(domxml)
- except:
+ except Exception:
sys.stderr.write('vmfex: ERROR %s\n' % traceback.format_exc())
sys.exit(2)
--
To view, visit http://gerrit.ovirt.org/17759
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64d51a8b1150f2dd4f9e7711926e5406228c8355
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
10 years, 3 months
Change in vdsm[master]: Networking import reordering
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Networking import reordering
......................................................................
Networking import reordering
Apply new ordering for vdsm imports (starting with just networking
code.
The imports will be split into sections:
- __future__
- stdlib
- site-packages
- vdsm package
- relative imports
This, together with absolute imports, will make it very easy and fast
to see what resources the current module makes use of and where those
resources come from.
this:
import glob
import libvirt
import logging
import os
import pipes
import pwd
import re
import selinux
import shutil
import threading
from . import Configurator
from ..neterrors import ConfigNetworkError
from ..netmodels import Nic, Bridge, IpConfig
from ..sourceRoute import DynamicSourceRoute
from vdsm.config import config
from vdsm import constants
from vdsm import netinfo
from vdsm import utils
from vdsm.netconfpersistence import RunningConfig
from .. import dsaversion
from . import libvirtCfg
from .. import neterrors as ne
becomes this: (annotations for explanation purposes, not in actual
code)
# stdlib
import glob
import logging
import os
import pipes
import pwd
import re
import shutil
import threading
# site-packages
import libvirt
import selinux
# vdsm package
from vdsm.config import config
from vdsm import constants
from vdsm import netinfo
from vdsm import utils
from vdsm.netconfpersistence import RunningConfig
# relative imports
from . import Configurator
from . import libvirtCfg
from .. import dsaversion
from .. import neterrors as ne
from ..neterrors import ConfigNetworkError
from ..netmodels import Nic, Bridge, IpConfig
from ..sourceRoute import DynamicSourceRoute
Change-Id: I1ea96f97bf89b10a0cd6e629210374d2cd211fe7
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/netconfpersistence.py
M lib/vdsm/netinfo.py
M vdsm/configNetwork.py
M vdsm/netconf/__init__.py
M vdsm/netconf/ifcfg.py
M vdsm/netconf/libvirtCfg.py
M vdsm/netmodels.py
M vdsm/sourceRouteThread.py
M vdsm/tc.py
M vdsm/vdsm-restore-net-config
10 files changed, 39 insertions(+), 32 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/20662/1
diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py
index 2a72a04..9cfea52 100644
--- a/lib/vdsm/netconfpersistence.py
+++ b/lib/vdsm/netconfpersistence.py
@@ -24,11 +24,10 @@
import logging
import os
-from .config import config
-from .tool.restore_nets import restore
from . import constants
from . import utils
-
+from .config import config
+from .tool.restore_nets import restore
CONF_RUN_DIR = constants.P_VDSM_RUN + 'netconf/'
# The persistent path is inside of an extra "persistence" dir in order to get
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 7e0a07a..0f6b2ef 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -20,25 +20,25 @@
from __future__ import absolute_import
from collections import namedtuple
-import errno
from fnmatch import fnmatch
from glob import iglob
from itertools import chain
+from xml.dom import minidom
+import errno
import logging
import os
import shlex
import socket
import struct
-from xml.dom import minidom
import ethtool
-from .config import config
from . import constants
+from . import libvirtconnection
+from .config import config
+from .ipwrapper import linkShowDev
from .ipwrapper import Route
from .ipwrapper import routeShowAllDefaultGateways
-from . import libvirtconnection
-from .ipwrapper import linkShowDev
NET_CONF_DIR = '/etc/sysconfig/network-scripts/'
# ifcfg persistence directories
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index d5ea840..e9059e7 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -20,29 +20,30 @@
from functools import wraps
import inspect
-import sys
-import os
-import traceback
-import time
import logging
+import os
+import sys
+import time
+import traceback
from vdsm.config import config
from vdsm import constants
+from vdsm import netinfo
from vdsm import utils
from vdsm.utils import execCmd
+
+from . import hooks
from . import neterrors as ne
-from .neterrors import ConfigNetworkError
-from vdsm import netinfo
from .netconf.ifcfg import ConfigWriter
from .netconf.ifcfg import Ifcfg
+from .neterrors import ConfigNetworkError
from .netmodels import Bond
from .netmodels import Bridge
+from .netmodels import IpConfig
from .netmodels import IPv4
from .netmodels import IPv6
-from .netmodels import IpConfig
from .netmodels import Nic
from .netmodels import Vlan
-from . import hooks
CONNECTIVITY_TIMEOUT_DEFAULT = 4
diff --git a/vdsm/netconf/__init__.py b/vdsm/netconf/__init__.py
index 0ce6364..1e20706 100644
--- a/vdsm/netconf/__init__.py
+++ b/vdsm/netconf/__init__.py
@@ -20,12 +20,13 @@
import logging
+from vdsm.config import config
+from vdsm import netinfo
+from vdsm.netconfpersistence import RunningConfig
+
from ..netmodels import Bond, Bridge
from ..sourceRoute import DynamicSourceRoute
from ..sourceRoute import StaticSourceRoute
-from vdsm import netinfo
-from vdsm.config import config
-from vdsm.netconfpersistence import RunningConfig
class Configurator(object):
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index 3f2e092..bc09de8 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -19,28 +19,30 @@
from __future__ import absolute_import
import glob
-import libvirt
import logging
import os
import pipes
import pwd
import re
-import selinux
import shutil
import threading
-from . import Configurator
-from ..neterrors import ConfigNetworkError
-from ..netmodels import Nic, Bridge, IpConfig
-from ..sourceRoute import DynamicSourceRoute
+import libvirt
+import selinux
+
from vdsm.config import config
from vdsm import constants
from vdsm import netinfo
from vdsm import utils
from vdsm.netconfpersistence import RunningConfig
-from .. import dsaversion
+
+from . import Configurator
from . import libvirtCfg
+from .. import dsaversion
from .. import neterrors as ne
+from ..neterrors import ConfigNetworkError
+from ..netmodels import Nic, Bridge, IpConfig
+from ..sourceRoute import DynamicSourceRoute
class Ifcfg(Configurator):
diff --git a/vdsm/netconf/libvirtCfg.py b/vdsm/netconf/libvirtCfg.py
index b81231d..74d9b65 100644
--- a/vdsm/netconf/libvirtCfg.py
+++ b/vdsm/netconf/libvirtCfg.py
@@ -16,10 +16,11 @@
#
# Refer to the README and COPYING files for full details of the license
#
-import libvirt
from xml.dom.minidom import Document
from xml.sax.saxutils import escape
+import libvirt
+
from vdsm import libvirtconnection
from vdsm import netinfo
diff --git a/vdsm/netmodels.py b/vdsm/netmodels.py
index c0347ab..5ea5052 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/netmodels.py
@@ -26,9 +26,10 @@
import socket
import struct
-from .neterrors import ConfigNetworkError
from vdsm import netinfo
+
from . import neterrors as ne
+from .neterrors import ConfigNetworkError
class NetDevice(object):
diff --git a/vdsm/sourceRouteThread.py b/vdsm/sourceRouteThread.py
index c1da9a5..5b686a1 100644
--- a/vdsm/sourceRouteThread.py
+++ b/vdsm/sourceRouteThread.py
@@ -5,9 +5,10 @@
import pyinotify
+from vdsm.constants import P_VDSM_RUN
+
from .netconf.iproute2 import Iproute2
from .sourceRoute import DynamicSourceRoute
-from vdsm.constants import P_VDSM_RUN
SOURCE_ROUTES_FOLDER = P_VDSM_RUN + 'sourceRoutes'
diff --git a/vdsm/tc.py b/vdsm/tc.py
index b47342e..f457176 100644
--- a/vdsm/tc.py
+++ b/vdsm/tc.py
@@ -1,5 +1,5 @@
#
-# Copyright 2012 Red Hat, Inc.
+# Copyright 2012-2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@
import ethtool
-from vdsm.utils import execCmd
from vdsm.constants import EXT_TC
+from vdsm.utils import execCmd
ERR_DEV_NOEXIST = 2
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 2a23ebc..4fff50f 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -23,10 +23,11 @@
import logging
import logging.config
-from .netconf import ifcfg
from vdsm.config import config
from vdsm.netconfpersistence import RunningConfig, PersistentConfig
+
from .configNetwork import setupNetworks
+from .netconf import ifcfg
def ifcfg_restoration():
--
To view, visit http://gerrit.ovirt.org/20662
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ea96f97bf89b10a0cd6e629210374d2cd211fe7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
10 years, 3 months
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, 3 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, 3 months
Change in vdsm[master]: Added network directory
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: Added network directory
......................................................................
Added network directory
To-Do in a follow up patch:
Added a network directory under lib/vdsm, put ipwrapper,
netinfo and netconfpersistence there.
Change-Id: If9c7e8cfc96cc1671ed7549c2f45ca820211c7c1
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M AUTHORS
M Makefile.am
M configure.ac
M debian/vdsm.install
M lib/vdsm/tool/upgrade_300_networks.py
M tests/configNetworkTests.py
M tests/functional/networkTests.py
M tests/netconfTests.py
M tests/netmodelsTests.py
M vdsm.spec.in
M vdsm/API.py
M vdsm/Makefile.am
C vdsm/network/Makefile.am
C vdsm/network/__init__.py
R vdsm/network/addNetwork
R vdsm/network/configNetwork.py
R vdsm/network/delNetwork
R vdsm/network/netconf/Makefile.am
R vdsm/network/netconf/__init__.py
R vdsm/network/netconf/ifcfg.py
R vdsm/network/netconf/iproute2.py
R vdsm/network/netconf/libvirtCfg.py
R vdsm/network/neterrors.py
R vdsm/network/netmodels.py
R vdsm/network/sourceRoute.py
R vdsm/network/sourceRoute.sh
R vdsm/network/sourceRouteThread.py
R vdsm/network/vdsm-restore-net-config
R vdsm/network/vdsm-store-net-config.in
M vdsm/supervdsmServer
30 files changed, 94 insertions(+), 114 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/22694/1
diff --git a/AUTHORS b/AUTHORS
index 1faf4eb..e99f023 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -25,6 +25,7 @@
Adam Litke <agl(a)us.ibm.com>
Igor Lvovsky <ilvovsky(a)redhat.com>
Sanjay Mehrotra <smehrotr(a)redhat.com>
+ Assaf Muller <amuller(a)redhat.com>
Robert Munilla <rmunilla(a)redhat.com>
David Naori <dnaori(a)redhat.com>
Yotam Oron <yoron(a)redhat.com>
diff --git a/Makefile.am b/Makefile.am
index 9b1a3c9..12f939c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,8 @@
vdsm-tool \
vdsm/*.py \
vdsm/*.py.in \
- vdsm/netconf \
+ vdsm/network \
+ vdsm/network/netconf \
vdsm/sos/vdsm.py.in \
vdsm/storage \
vdsm/vdsm \
diff --git a/configure.ac b/configure.ac
index bd44d83..f552b13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,7 +269,8 @@
vdsm-tool/Makefile
vdsm/Makefile
vdsm/gluster/Makefile
- vdsm/netconf/Makefile
+ vdsm/network/Makefile
+ vdsm/network/netconf/Makefile
vdsm/sos/Makefile
vdsm/storage/Makefile
vdsm/storage/imageRepository/Makefile
diff --git a/debian/vdsm.install b/debian/vdsm.install
index c81bdf2..efd4a88 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -42,7 +42,6 @@
./usr/share/vdsm/blkid.py
./usr/share/vdsm/caps.py
./usr/share/vdsm/clientIF.py
-./usr/share/vdsm/configNetwork.py
./usr/share/vdsm/daemonAdapter
./usr/share/vdsm/debugPluginClient.py
./usr/share/vdsm/delNetwork
@@ -65,19 +64,21 @@
./usr/share/vdsm/mk_sysprep_floppy
./usr/share/vdsm/mkimage.py
./usr/share/vdsm/momIF.py
-./usr/share/vdsm/netconf/__init__.py
-./usr/share/vdsm/netconf/ifcfg.py
-./usr/share/vdsm/netconf/iproute2.py
-./usr/share/vdsm/netconf/libvirtCfg.py
-./usr/share/vdsm/neterrors.py
-./usr/share/vdsm/netmodels.py
+./usr/share/vdsm/network/netconf/__init__.py
+./usr/share/vdsm/network/netconf/ifcfg.py
+./usr/share/vdsm/network/netconf/iproute2.py
+./usr/share/vdsm/network/netconf/libvirtCfg.py
+./usr/share/vdsm/network/__init__.py
+./usr/share/vdsm/network/configNetwork.py
+./usr/share/vdsm/network/neterrors.py
+./usr/share/vdsm/network/netmodels.py
+./usr/share/vdsm/network/sourceRoute.py
+./usr/share/vdsm/network/sourceRouteThread.py
./usr/share/vdsm/parted_utils.py
./usr/share/vdsm/ppc64HardwareInfo.py
./usr/share/vdsm/respawn
./usr/share/vdsm/sampling.py
./usr/share/vdsm/set-conf-item
-./usr/share/vdsm/sourceRoute.py
-./usr/share/vdsm/sourceRouteThread.py
./usr/share/vdsm/storage/__init__.py
./usr/share/vdsm/storage/blockSD.py
./usr/share/vdsm/storage/blockVolume.py
diff --git a/lib/vdsm/tool/upgrade_300_networks.py b/lib/vdsm/tool/upgrade_300_networks.py
index 0f754fd..7f1eb66 100644
--- a/lib/vdsm/tool/upgrade_300_networks.py
+++ b/lib/vdsm/tool/upgrade_300_networks.py
@@ -27,7 +27,7 @@
from vdsm.tool.upgrade import upgrade
sys.path.append("/usr/share/vdsm")
-from netconf import ifcfg
+from network.netconf import ifcfg
def isNeeded(networks, bridges):
diff --git a/tests/configNetworkTests.py b/tests/configNetworkTests.py
index a72fe96..1b717a9 100644
--- a/tests/configNetworkTests.py
+++ b/tests/configNetworkTests.py
@@ -20,14 +20,9 @@
# Refer to the README and COPYING files for full details of the license
#
-from netmodels import Bond
-from netmodels import Bridge
-from netmodels import Nic
-from netmodels import Vlan
+from network.netmodels import Bond, Bridge, Nic, Vlan
+from network import configNetwork, netconf, neterrors
from vdsm import netinfo
-import configNetwork
-import netconf
-import neterrors
from testrunner import VdsmTestCase as TestCaseBase
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 6ecced8..dbada07 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -20,7 +20,6 @@
from functools import wraps
import os.path
-import neterrors
from storage.misc import RollbackContext
from hookValidation import ValidatesHook
@@ -32,6 +31,7 @@
import dnsmasq
import dummy
import firewall
+from network import neterrors
import veth
from nose.plugins.skip import SkipTest
from utils import SUCCESS, VdsProxy, cleanupRules
diff --git a/tests/netconfTests.py b/tests/netconfTests.py
index 919a5eb..00d012e 100644
--- a/tests/netconfTests.py
+++ b/tests/netconfTests.py
@@ -20,6 +20,7 @@
# Refer to the README and COPYING files for full details of the license
#
+from nose.plugins.skip import SkipTest
import os
import pwd
import re
@@ -29,12 +30,10 @@
from xml.dom.minidom import parseString
from vdsm import netinfo
-from netconf import ifcfg
-from netconf import libvirtCfg
+from network.netconf import ifcfg, libvirtCfg
from monkeypatch import MonkeyPatch
from monkeypatch import MonkeyPatchScope
-from nose.plugins.skip import SkipTest
from testrunner import VdsmTestCase as TestCaseBase
diff --git a/tests/netmodelsTests.py b/tests/netmodelsTests.py
index 6181a9e..be07a02 100644
--- a/tests/netmodelsTests.py
+++ b/tests/netmodelsTests.py
@@ -21,19 +21,13 @@
#
import os
-from netmodels import Bond
-from netmodels import Bridge
-from netmodels import IPv4
-from netmodels import Nic
-from netmodels import Vlan
-from netmodels import _nicSort
-from vdsm import netinfo
-import neterrors
-
-from testrunner import VdsmTestCase as TestCaseBase
-from testValidation import ValidateRunningAsRoot
from nose.plugins.skip import SkipTest
+from network.netmodels import Bond, Bridge, IPv4, Vlan, Nic, _nicSort
+from vdsm import netinfo
+from network import neterrors
+from testrunner import VdsmTestCase as TestCaseBase
+from testValidation import ValidateRunningAsRoot
from monkeypatch import MonkeyPatch
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0f7f4d4..425cb3d 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -861,7 +861,8 @@
%dir %{_sysconfdir}/%{vdsm_name}
%dir %{_sysconfdir}/%{vdsm_name}/mom.d
%dir %{_datadir}/%{vdsm_name}
-%dir %{_datadir}/%{vdsm_name}/netconf
+%dir %{_datadir}/%{vdsm_name}/network
+%dir %{_datadir}/%{vdsm_name}/network/netconf
%dir %{_datadir}/%{vdsm_name}/storage
%dir %{_datadir}/%{vdsm_name}/storage/imageRepository
%{_datadir}/%{vdsm_name}/alignmentScan.py*
@@ -879,8 +880,8 @@
%{_datadir}/%{vdsm_name}/parted_utils.py*
%{_datadir}/%{vdsm_name}/mkimage.py*
%{_datadir}/%{vdsm_name}/ppc64HardwareInfo.py*
-%{_datadir}/%{vdsm_name}/sourceRoute.py*
-%{_datadir}/%{vdsm_name}/sourceRouteThread.py*
+%{_datadir}/%{vdsm_name}/network/sourceRoute.py*
+%{_datadir}/%{vdsm_name}/network/sourceRouteThread.py*
%{_datadir}/%{vdsm_name}/supervdsm.py*
%{_datadir}/%{vdsm_name}/supervdsmServer
%{_datadir}/%{vdsm_name}/vmChannels.py*
@@ -1013,19 +1014,20 @@
%dir %{_libexecdir}/%{vdsm_name}/hooks/before_network_setup
%dir %{_libexecdir}/%{vdsm_name}/hooks/after_network_setup
%{_datadir}/%{vdsm_name}/addNetwork
-%{_datadir}/%{vdsm_name}/configNetwork.py*
%{_datadir}/%{vdsm_name}/delNetwork
+%{_datadir}/%{vdsm_name}/network/__init__.py*
+%{_datadir}/%{vdsm_name}/network/configNetwork.py*
+%{_datadir}/%{vdsm_name}/network/netconf/__init__.py*
+%{_datadir}/%{vdsm_name}/network/netconf/ifcfg.py*
+%{_datadir}/%{vdsm_name}/network/netconf/libvirtCfg.py*
+%{_datadir}/%{vdsm_name}/network/netconf/iproute2.py*
+%{_datadir}/%{vdsm_name}/network/neterrors.py*
+%{_datadir}/%{vdsm_name}/network/netmodels.py*
%{_datadir}/%{vdsm_name}/dumpStorageTable.py*
%{_datadir}/%{vdsm_name}/get-conf-item
%{_datadir}/%{vdsm_name}/kaxmlrpclib.py*
%{_datadir}/%{vdsm_name}/ksm.py*
%{_datadir}/%{vdsm_name}/momIF.py*
-%{_datadir}/%{vdsm_name}/netconf/__init__.py*
-%{_datadir}/%{vdsm_name}/netconf/ifcfg.py*
-%{_datadir}/%{vdsm_name}/netconf/libvirtCfg.py*
-%{_datadir}/%{vdsm_name}/netconf/iproute2.py*
-%{_datadir}/%{vdsm_name}/neterrors.py*
-%{_datadir}/%{vdsm_name}/netmodels.py*
%{_datadir}/%{vdsm_name}/respawn
%{_datadir}/%{vdsm_name}/sampling.py*
%{_datadir}/%{vdsm_name}/set-conf-item
diff --git a/vdsm/API.py b/vdsm/API.py
index e7a550c..80194c0 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -30,12 +30,11 @@
import threading
import logging
+from network import configNetwork
+from network.netconf import RollbackIncomplete
from vdsm import utils
from clientIF import clientIF
-import configNetwork
-from netmodels import Bond
-from netmodels import Vlan
-from netconf import RollbackIncomplete
+from network.netmodels import Bond, Vlan
from vdsm import netinfo
from vdsm import constants
import storage.misc
@@ -48,7 +47,6 @@
import caps
from vdsm.config import config
import ksm
-
import supervdsm
haClient = None # Define here to work around pyflakes issue #13
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 4bcc6ed..6a13bd9 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-SUBDIRS = netconf sos storage gluster
+SUBDIRS = gluster network sos storage
include $(top_srcdir)/build-aux/Makefile.subs
@@ -29,7 +29,6 @@
blkid.py \
caps.py \
clientIF.py \
- configNetwork.py \
debugPluginClient.py \
dmidecodeUtil.py \
guestIF.py \
@@ -42,13 +41,9 @@
md_utils.py \
mkimage.py \
momIF.py \
- neterrors.py \
- netmodels.py \
parted_utils.py \
ppc64HardwareInfo.py \
sampling.py \
- sourceRoute.py \
- sourceRouteThread.py \
supervdsm.py \
tc.py \
vdsmDebugPlugin.py \
@@ -68,8 +63,7 @@
dumpStorageTable.py
nodist_vdsm_SCRIPTS = \
- mk_sysprep_floppy \
- vdsm-store-net-config
+ mk_sysprep_floppy
nodist_noinst_DATA = \
logger.conf \
@@ -82,13 +76,10 @@
$(NULL)
dist_vdsm_SCRIPTS = \
- addNetwork \
- delNetwork \
get-conf-item \
set-conf-item \
supervdsmServer \
vdsm \
- vdsm-restore-net-config \
$(NULL)
nodist_man8_MANS = \
@@ -115,7 +106,6 @@
mom.d/01-parameters.policy \
mom.d/02-balloon.policy \
mom.d/03-ksm.policy \
- sourceRoute.sh \
sudoers.vdsm.in \
svdsm.logger.conf.in \
upgrade.logger.conf.in \
@@ -126,7 +116,6 @@
vdsm-logrotate \
vdsm-logrotate.conf.in \
vdsm-modules-load.d.conf \
- vdsm-store-net-config.in \
vdsm-sysctl.conf \
vdsm.rwtab.in \
vdsmd.8.in \
@@ -253,7 +242,7 @@
install-data-dhclient-hooks:
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/dhcp/dhclient.d
- $(INSTALL_DATA) sourceRoute.sh \
+ $(INSTALL_DATA) network/sourceRoute.sh \
$(DESTDIR)$(sysconfdir)/dhcp/dhclient.d/sourceRoute.sh
chmod 755 $(DESTDIR)$(sysconfdir)/dhcp/dhclient.d/sourceRoute.sh
diff --git a/vdsm/netconf/Makefile.am b/vdsm/network/Makefile.am
similarity index 68%
copy from vdsm/netconf/Makefile.am
copy to vdsm/network/Makefile.am
index 71ee11c..02d4fb0 100644
--- a/vdsm/netconf/Makefile.am
+++ b/vdsm/network/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright 20013 Red Hat, Inc.
+#
+# Copyright 2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,13 +18,27 @@
# Refer to the README and COPYING files for full details of the license
#
+SUBDIRS = netconf
+
include $(top_srcdir)/build-aux/Makefile.subs
-vdsmnetconfdir = $(vdsmdir)/netconf
-
-dist_vdsmnetconf_PYTHON = \
+vdsmnetworkdir = $(vdsmdir)/network
+dist_vdsmnetwork_PYTHON = \
__init__.py \
- ifcfg.py \
- iproute2.py \
- libvirtCfg.py \
- $(NULL)
+ configNetwork.py \
+ neterrors.py \
+ netmodels.py \
+ sourceRoute.py \
+ sourceRouteThread.py
+
+nodist_vdsm_SCRIPTS = \
+ vdsm-store-net-config
+
+dist_vdsm_SCRIPTS = \
+ addNetwork \
+ delNetwork \
+ vdsm-restore-net-config
+
+EXTRA_DIST = \
+ vdsm-store-net-config.in \
+ sourceRoute.sh
diff --git a/vdsm/netconf/Makefile.am b/vdsm/network/__init__.py
similarity index 77%
copy from vdsm/netconf/Makefile.am
copy to vdsm/network/__init__.py
index 71ee11c..8e88115 100644
--- a/vdsm/netconf/Makefile.am
+++ b/vdsm/network/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 20013 Red Hat, Inc.
+# Copyright 2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,14 +16,3 @@
#
# Refer to the README and COPYING files for full details of the license
#
-
-include $(top_srcdir)/build-aux/Makefile.subs
-
-vdsmnetconfdir = $(vdsmdir)/netconf
-
-dist_vdsmnetconf_PYTHON = \
- __init__.py \
- ifcfg.py \
- iproute2.py \
- libvirtCfg.py \
- $(NULL)
diff --git a/vdsm/addNetwork b/vdsm/network/addNetwork
similarity index 91%
rename from vdsm/addNetwork
rename to vdsm/network/addNetwork
index 2678b94..1c00f09 100755
--- a/vdsm/addNetwork
+++ b/vdsm/network/addNetwork
@@ -45,5 +45,5 @@
shift 4
PYTHONPATH=`dirname $(readlink -f "$0")` \
-/usr/bin/python -m configNetwork add "$bridge" "$vlan" "$bonding" $nics "$@"
+/usr/bin/python -m network.configNetwork add "$bridge" "$vlan" "$bonding" $nics "$@"
diff --git a/vdsm/configNetwork.py b/vdsm/network/configNetwork.py
similarity index 98%
rename from vdsm/configNetwork.py
rename to vdsm/network/configNetwork.py
index 5db2a41..59e1b81 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/network/configNetwork.py
@@ -29,19 +29,13 @@
from vdsm import constants
from vdsm import utils
from storage.misc import execCmd
-import neterrors as ne
from netconf import libvirtCfg
-from neterrors import ConfigNetworkError
+from .neterrors import ConfigNetworkError
from vdsm import netinfo
from netconf.ifcfg import ConfigWriter
from netconf.ifcfg import Ifcfg
-from netmodels import Bond
-from netmodels import Bridge
-from netmodels import IPv4
-from netmodels import IPv6
-from netmodels import IpConfig
-from netmodels import Nic
-from netmodels import Vlan
+import neterrors as ne
+from .netmodels import Bond, Bridge, IPv4, IPv6, IpConfig, Nic, Vlan
import hooks
CONNECTIVITY_TIMEOUT_DEFAULT = 4
diff --git a/vdsm/delNetwork b/vdsm/network/delNetwork
similarity index 86%
rename from vdsm/delNetwork
rename to vdsm/network/delNetwork
index 1b7083f..86e1e42 100755
--- a/vdsm/delNetwork
+++ b/vdsm/network/delNetwork
@@ -26,5 +26,5 @@
shift 4
PYTHONPATH=`dirname $(readlink -f "$0")` \
-/usr/bin/python -m configNetwork del "$bridge" "$vlan" "$bonding" $nics "$@"
+/usr/bin/python -m network.configNetwork del "$bridge" "$vlan" "$bonding" $nics "$@"
diff --git a/vdsm/netconf/Makefile.am b/vdsm/network/netconf/Makefile.am
similarity index 95%
rename from vdsm/netconf/Makefile.am
rename to vdsm/network/netconf/Makefile.am
index 71ee11c..fb83b66 100644
--- a/vdsm/netconf/Makefile.am
+++ b/vdsm/network/netconf/Makefile.am
@@ -19,7 +19,7 @@
include $(top_srcdir)/build-aux/Makefile.subs
-vdsmnetconfdir = $(vdsmdir)/netconf
+vdsmnetconfdir = $(vdsmdir)/network/netconf
dist_vdsmnetconf_PYTHON = \
__init__.py \
diff --git a/vdsm/netconf/__init__.py b/vdsm/network/netconf/__init__.py
similarity index 97%
rename from vdsm/netconf/__init__.py
rename to vdsm/network/netconf/__init__.py
index 7ab63da..9292c3c 100644
--- a/vdsm/netconf/__init__.py
+++ b/vdsm/network/netconf/__init__.py
@@ -20,9 +20,9 @@
import logging
import libvirtCfg
-from netmodels import Bond, Bridge
-from sourceRoute import DynamicSourceRoute
-from sourceRoute import StaticSourceRoute
+from ..netmodels import Bond, Bridge
+from ..sourceRoute import DynamicSourceRoute
+from ..sourceRoute import StaticSourceRoute
from vdsm import netinfo
from vdsm.netconfpersistence import RunningConfig
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/network/netconf/ifcfg.py
similarity index 99%
rename from vdsm/netconf/ifcfg.py
rename to vdsm/network/netconf/ifcfg.py
index 46df9f9..bfae900 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/network/netconf/ifcfg.py
@@ -18,20 +18,21 @@
#
import glob
-import libvirt
import logging
import os
import pipes
import pwd
import re
-import selinux
import shutil
import threading
-from netconf import Configurator
-from neterrors import ConfigNetworkError
-from netmodels import Nic, Bridge, IpConfig
-from sourceRoute import DynamicSourceRoute
+import libvirt
+import selinux
+
+from . import Configurator
+from ..neterrors import ConfigNetworkError
+from ..netmodels import Nic, Bridge, IpConfig
+from ..sourceRoute import DynamicSourceRoute
from vdsm.config import config
from vdsm import constants
from vdsm import netinfo
@@ -39,7 +40,7 @@
from vdsm.netconfpersistence import RunningConfig
import dsaversion
import libvirtCfg
-import neterrors as ne
+from .. import neterrors as ne
class Ifcfg(Configurator):
diff --git a/vdsm/netconf/iproute2.py b/vdsm/network/netconf/iproute2.py
similarity index 98%
rename from vdsm/netconf/iproute2.py
rename to vdsm/network/netconf/iproute2.py
index 8915f48..6e08e3a 100644
--- a/vdsm/netconf/iproute2.py
+++ b/vdsm/network/netconf/iproute2.py
@@ -20,9 +20,9 @@
import logging
import libvirtCfg
-from netconf import Configurator
-from neterrors import ConfigNetworkError, ERR_FAILED_IFUP, ERR_FAILED_IFDOWN
-from netmodels import Nic
+from . import Configurator
+from ..neterrors import ConfigNetworkError, ERR_FAILED_IFUP, ERR_FAILED_IFDOWN
+from ..netmodels import Nic
from vdsm import netinfo
from vdsm import ipwrapper
from vdsm.constants import EXT_BRCTL
diff --git a/vdsm/netconf/libvirtCfg.py b/vdsm/network/netconf/libvirtCfg.py
similarity index 100%
rename from vdsm/netconf/libvirtCfg.py
rename to vdsm/network/netconf/libvirtCfg.py
diff --git a/vdsm/neterrors.py b/vdsm/network/neterrors.py
similarity index 100%
rename from vdsm/neterrors.py
rename to vdsm/network/neterrors.py
diff --git a/vdsm/netmodels.py b/vdsm/network/netmodels.py
similarity index 99%
rename from vdsm/netmodels.py
rename to vdsm/network/netmodels.py
index 5fde4e0..f2b5bdc 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/network/netmodels.py
@@ -24,7 +24,7 @@
import socket
import struct
-from neterrors import ConfigNetworkError
+from .neterrors import ConfigNetworkError
from vdsm import netinfo
import neterrors as ne
diff --git a/vdsm/sourceRoute.py b/vdsm/network/sourceRoute.py
similarity index 100%
rename from vdsm/sourceRoute.py
rename to vdsm/network/sourceRoute.py
diff --git a/vdsm/sourceRoute.sh b/vdsm/network/sourceRoute.sh
similarity index 100%
rename from vdsm/sourceRoute.sh
rename to vdsm/network/sourceRoute.sh
diff --git a/vdsm/sourceRouteThread.py b/vdsm/network/sourceRouteThread.py
similarity index 97%
rename from vdsm/sourceRouteThread.py
rename to vdsm/network/sourceRouteThread.py
index c913220..4550e4b 100644
--- a/vdsm/sourceRouteThread.py
+++ b/vdsm/network/sourceRouteThread.py
@@ -4,7 +4,7 @@
import pyinotify
from netconf.iproute2 import Iproute2
-from sourceRoute import DynamicSourceRoute
+from .sourceRoute import DynamicSourceRoute
from vdsm.constants import P_VDSM_RUN
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/network/vdsm-restore-net-config
similarity index 96%
rename from vdsm/vdsm-restore-net-config
rename to vdsm/network/vdsm-restore-net-config
index 4227e4e..b27ecde 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/network/vdsm-restore-net-config
@@ -22,10 +22,10 @@
import logging
import logging.config
-from netconf import ifcfg
+from network.netconf import ifcfg
from vdsm.config import config
from vdsm.netconfpersistence import RunningConfig, PersistentConfig
-from configNetwork import setupNetworks
+from network.configNetwork import setupNetworks
def ifcfg_restoration():
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/network/vdsm-store-net-config.in
similarity index 100%
rename from vdsm/vdsm-store-net-config.in
rename to vdsm/network/vdsm-store-net-config.in
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 59df478..ad27e4a 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -17,6 +17,7 @@
#
# Refer to the README and COPYING files for full details of the license
#
+
from pwd import getpwnam
import platform
import sys
@@ -64,13 +65,12 @@
from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, \
DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER
from storage.devicemapper import _removeMapping, _getPathsStatus
-import configNetwork
+from network import configNetwork, sourceRouteThread
from vdsm.config import config
import tc
import ksm
import mkimage
from storage.multipath import MPATH_CONF
-import sourceRouteThread
_UDEV_RULE_FILE_DIR = "/etc/udev/rules.d/"
_UDEV_RULE_FILE_PREFIX = "99-vdsm-"
--
To view, visit http://gerrit.ovirt.org/22694
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If9c7e8cfc96cc1671ed7549c2f45ca820211c7c1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
10 years, 3 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, 3 months
Change in vdsm[master]: stats: report detailed VM down status
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: stats: report detailed VM down status
......................................................................
stats: report detailed VM down status
When a VM goes down it reports exitCode == 1 (ERROR), and the
exitMessage is passed verbarim to the VM log.
In order to have translatable messages, a more detailed
error code is needed.
This patch introduces a new explicit errorCode value, to be
filled with the detailed status code.
The new detailed value is added separately for backward
compatibility with the existing interface.
Change-Id: I8d7064fe79d1cd34499fbb32ed0644757cbe05dd
Bug-Url: https://bugzilla.redhat.com/557125
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/define.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 50 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/22631/1
diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py
index df8bbf4..50b65c3 100644
--- a/lib/vdsm/define.py
+++ b/lib/vdsm/define.py
@@ -145,3 +145,10 @@
#exitCodes
ERROR = 1
NORMAL = 0
+
+
+class VMDownErrorCode:
+ Success = 0
+ GenericError = 1
+ LostQEMUConnection = 2
+ LibvirtStartFailed = 3
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 534705d..c34c47c 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -43,7 +43,7 @@
from vdsm import utils
from vdsm import vdscli
from vdsm.config import config
-from vdsm.define import ERROR, NORMAL, doneCode, errCode
+from vdsm.define import ERROR, NORMAL, doneCode, errCode, VMDownErrorCode
from vdsm.netinfo import DUMMY_BRIDGE
from storage import outOfProcess as oop
from storage import sd
@@ -2116,7 +2116,7 @@
def _startUnderlyingVm(self):
self.log.debug("Start")
try:
- self.memCommit()
+ self.memCommit() # can raise: ValueError, ConfigParser.Error
self._ongoingCreations.acquire()
self.log.debug("_ongoingCreations acquired")
self._vmCreationEvent.set()
@@ -2162,7 +2162,7 @@
self.log.info("Skipping errors on recovery", exc_info=True)
else:
self.log.error("The vm start process failed", exc_info=True)
- self.setDownStatus(ERROR, str(e))
+ self.setDownStatus(ERROR, str(e), VMDownErrorCode.GenericError)
def _incomingMigrationPending(self):
return 'migrationDest' in self.conf or 'restoreState' in self.conf
@@ -2184,6 +2184,7 @@
# A destroy request has been issued, exit early
break
drive['path'] = self.cif.prepareVolumePath(drive, self.id)
+ # can raise: VolumeError
if drive['device'] == 'disk' and isVdsmImage(drive):
domains.append(drive['domainID'])
else:
@@ -2206,7 +2207,8 @@
elif self.user_destroy:
self.setDownStatus(NORMAL, 'User shut down')
else:
- self.setDownStatus(ERROR, "Lost connection with qemu process")
+ self.setDownStatus(ERROR, "Lost connection with qemu process",
+ VMDownErrorCode.LostQEMUConnection)
def _loadCorrectedTimeout(self, base, doubler=20, load=None):
"""
@@ -2604,7 +2606,8 @@
utils.rmFile(self._guestSocketFile)
- def setDownStatus(self, code, reason):
+ def setDownStatus(self, code, reason,
+ errorCode=VMDownErrorCode.GenericError):
try:
self.lastStatus = 'Down'
with self._confLock:
@@ -2614,6 +2617,8 @@
"Wake up from hibernation failed")
else:
self.conf['exitMessage'] = reason
+ if code == ERROR:
+ self.conf['errorCode'] = errorCode
self.log.debug("Changed state to Down: " + reason)
except DoubleDownError:
pass
@@ -2662,6 +2667,8 @@
stats['exitMessage'] = self.conf['exitMessage']
if 'timeOffset' in self.conf:
stats['timeOffset'] = self.conf['timeOffset']
+ if 'errorCode' in self.conf:
+ stats['errorCode'] = self.conf['errorCode']
return stats
stats = {
@@ -2970,9 +2977,10 @@
self.log.info("VM wrapper has started")
self.conf['smp'] = self.conf.get('smp', '1')
devices = self.buildConfDevices()
+ # can raise: ValueError, RuntimeError, ConfigParser.Error
if not 'recover' in self.conf:
- self.preparePaths(devices[DISK_DEVICES])
+ self.preparePaths(devices[DISK_DEVICES]) # can raise: VolumeError
self._prepareTransientDisks(devices[DISK_DEVICES])
# Update self.conf with updated devices
# For old type vmParams, new 'devices' key will be
@@ -2988,7 +2996,7 @@
# saving we will fail in inconsistent state during recovery.
# So, to get proper device objects during VM recovery flow
# we must to have updated conf before VM run
- self.saveState()
+ self.saveState() # can raise: OSError, IOError
else:
for drive in devices[DISK_DEVICES]:
if drive['device'] == 'disk' and isVdsmImage(drive):
@@ -3006,13 +3014,14 @@
return
if not 'recover' in self.conf:
domxml = hooks.before_vm_start(self._buildCmdLine(), self.conf)
+ # can raise: HookError
self.log.debug(domxml)
if 'recover' in self.conf:
self._dom = NotifyingVirDomain(
self._connection.lookupByUUIDString(self.id),
self._timeoutExperienced)
# Reinitialize the merge statuses
- self._checkMerge()
+ self._checkMerge() # can raise: OSError, IOError
elif 'restoreState' in self.conf:
fromSnapshot = self.conf.get('restoreFromSnapshot', False)
srcDomXML = self.conf.pop('_srcDomXML')
@@ -3020,6 +3029,7 @@
srcDomXML = self._correctDiskVolumes(srcDomXML)
hooks.before_vm_dehibernate(srcDomXML, self.conf,
{'FROM_SNAPSHOT': str(fromSnapshot)})
+ # can raise: HookError
fname = self.cif.prepareVolumePath(self.conf['restoreState'])
try:
@@ -3050,7 +3060,8 @@
dev.custom)
if not self._dom:
- self.setDownStatus(ERROR, 'failed to start libvirt vm')
+ self.setDownStatus(ERROR, 'failed to start libvirt vm',
+ VMDownErrorCode.LibvirtStartFailed)
return
self._domDependentInit()
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 77ca409..8a1ee8a 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -5220,6 +5220,25 @@
{'enum': 'VmExitCode', 'data': ['NORMAL', 'ERROR']}
##
+# @VmErrorCode:
+#
+# An enumeration of VM error codes if VM exit status code is ERROR.
+#
+# @success: The VM has exited gracefully
+#
+# @generic error: Unspecified error code.
+#
+# @lost qemu connection: The VM has lost the connection with QEMU
+#
+# @libvirt start failed: The VM failed to start thorugh libvirt
+#
+# Since: 4.13.0
+##
+{'enum': 'VmErrorCode',
+ 'data': ['success', 'generic error',
+ 'lost qemu connection', 'libvirt start failed']}
+
+##
# @ExitedVmStats:
#
# Statistics about a VM that no longer running.
@@ -5232,11 +5251,14 @@
#
# @timeOffset: #optional The time difference from host to the VM in seconds
#
+# @errorCode: #optional The specific error code if the VM is exited
+# with error (new in version 4.13.0)
+#
# Since: 4.10.0
##
{'type': 'ExitedVmStats',
'data': {'exitCode': 'VmExitCode', 'status': 'VmStatus', 'exitMessage': 'str',
- '*timeOffset': 'int'}}
+ '*timeOffset': 'int', '*errorCode': 'VmErrorCode'}}
##
# @VmDiskStats:
--
To view, visit http://gerrit.ovirt.org/22631
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d7064fe79d1cd34499fbb32ed0644757cbe05dd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years, 3 months
Change in vdsm[master]: net tests: more combinations mtu combinations
by Dan Kenigsberg
Hello Mark Wu,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/19230
to review the following change.
Change subject: net tests: more combinations mtu combinations
......................................................................
net tests: more combinations mtu combinations
The tests were splitted from the former functional fix in order to
expedite the merge of the latter one.
Change-Id: Id7a1f5b628261ae4ebf400494bcdb2939a9cd535
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 114 insertions(+), 25 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/19230/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 3825bf5..dff7ce2 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1024,48 +1024,62 @@
{})
self.assertEquals(status, SUCCESS, msg)
+ def _createBondedNetAndCheck(self, netNum, bondDict, bridged,
+ **networkOpts):
+ netName = NETWORK_NAME + str(netNum)
+ networks = {netName: dict(bonding=BONDING_NAME, bridged=bridged,
+ vlan=str(int(VLAN_ID) + netNum),
+ **networkOpts)}
+ status, msg = self.vdsm_net.setupNetworks(networks,
+ {BONDING_NAME: bondDict},
+ {})
+ self.assertEquals(status, SUCCESS, msg)
+ self.vdsm_net.networkExists(netName, bridged=bridged)
+ self.vdsm_net.bondExists(BONDING_NAME, bondDict['nics'])
+ if 'mtu' in networkOpts:
+ self.assertEquals(networkOpts['mtu'],
+ self.vdsm_net.getMtu(netName))
+
@cleanupNet
@permutations([[True], [False]])
@RequireDummyMod
@ValidateRunningAsRoot
def testSetupNetworksStableBond(self, bridged):
- def createBondedNetAndCheck(netNum, bondDict):
- netName = NETWORK_NAME + str(netNum)
- networks = {netName: dict(bonding=BONDING_NAME, bridged=bridged,
- vlan=str(int(VLAN_ID) + netNum))}
- status, msg = self.vdsm_net.setupNetworks(networks,
- {BONDING_NAME: bondDict},
- {})
- self.assertEquals(status, SUCCESS, msg)
- self.vdsm_net.networkExists(netName, bridged=bridged)
- self.vdsm_net.bondExists(BONDING_NAME, bondDict['nics'])
-
with dummyIf(3) as nics:
with self.vdsm_net.pinger():
# Add initial vlanned net over bond
- createBondedNetAndCheck(0, {'nics': nics[:2],
- 'options': 'mode=3 miimon=250'})
+ self._createBondedNetAndCheck(0, {'nics': nics[:2],
+ 'options': 'mode=3 miimon=250'},
+ bridged)
with nonChangingOperstate(BONDING_NAME):
# Add additional vlanned net over the bond
- createBondedNetAndCheck(1,
- {'nics': nics[:2],
- 'options': 'mode=3 miimon=250'})
+ self._createBondedNetAndCheck(1,
+ {'nics': nics[:2],
+ 'options':
+ 'mode=3 miimon=250'},
+ bridged)
# Add additional vlanned net over the increasing bond
- createBondedNetAndCheck(2,
- {'nics': nics,
- 'options': 'mode=3 miimon=250'})
+ self._createBondedNetAndCheck(2,
+ {'nics': nics,
+ 'options':
+ 'mode=3 miimon=250'},
+ bridged)
# Add additional vlanned net over the changing bond
- createBondedNetAndCheck(3,
- {'nics': nics[1:],
- 'options': 'mode=3 miimon=250'})
+ self._createBondedNetAndCheck(3,
+ {'nics': nics[1:],
+ 'options':
+ 'mode=3 miimon=250'},
+ bridged)
# Add a network changing bond options
with self.assertRaises(OperStateChangedError):
with nonChangingOperstate(BONDING_NAME):
- createBondedNetAndCheck(4,
- {'nics': nics[1:],
- 'options': 'mode=4 miimon=9'})
+ self._createBondedNetAndCheck(4,
+ {'nics': nics[1:],
+ 'options':
+ 'mode=4 miimon=9'},
+ bridged)
# cleanup
networks = dict((NETWORK_NAME + str(num), {'remove': True}) for
@@ -1078,6 +1092,81 @@
@cleanupNet
@permutations([[True], [False]])
+ @RequireDummyMod
+ @ValidateRunningAsRoot
+ def testSetupNetworksMultiMTUsOverBond(self, bridged):
+ with dummyIf(2) as nics:
+ with self.vdsm_net.pinger():
+ # Add initial vlanned net over bond
+ self._createBondedNetAndCheck(0, {'nics': nics}, bridged,
+ mtu='1500')
+ self.assertEquals('1500',
+ self.vdsm_net.getMtu(BONDING_NAME))
+
+ with nonChangingOperstate(BONDING_NAME):
+ # Add a network with MTU smaller than existing network
+ self._createBondedNetAndCheck(1, {'nics': nics},
+ bridged, mtu='1400')
+ self.assertEquals('1500',
+ self.vdsm_net.getMtu(BONDING_NAME))
+
+ # Add a network with MTU bigger than existing network
+ self._createBondedNetAndCheck(2, {'nics': nics},
+ bridged, mtu='1600')
+ self.assertEquals('1600',
+ self.vdsm_net.getMtu(BONDING_NAME))
+
+ # cleanup
+ networks = dict((NETWORK_NAME + str(num), {'remove': True}) for
+ num in range(3))
+ status, msg = self.vdsm_net.setupNetworks(networks,
+ {BONDING_NAME:
+ dict(remove=True)},
+ {})
+ self.assertEquals(status, SUCCESS, msg)
+
+ def _createVlanedNetOverNicAndCheck(self, netNum, bridged, **networkOpts):
+ netName = NETWORK_NAME + str(netNum)
+ networks = {netName: dict(bridged=bridged,
+ vlan=str(int(VLAN_ID) + netNum),
+ **networkOpts)}
+ status, msg = self.vdsm_net.setupNetworks(networks, {}, {})
+ self.assertEquals(status, SUCCESS, msg)
+ self.vdsm_net.networkExists(netName, bridged=bridged)
+ if 'mtu' in networkOpts:
+ self.assertEquals(networkOpts['mtu'],
+ self.vdsm_net.getMtu(netName))
+
+ @cleanupNet
+ @permutations([[True], [False]])
+ @RequireDummyMod
+ @ValidateRunningAsRoot
+ def testSetupNetworksMultiMTUsOverNic(self, bridged):
+ with dummyIf(1) as nics:
+ nic, = nics
+ with self.vdsm_net.pinger():
+ # Add initial vlanned net over bond
+ self._createVlanedNetOverNicAndCheck(0, bridged, nic=nic,
+ mtu='1500')
+ self.assertEquals('1500', self.vdsm_net.getMtu(nic))
+
+ # Add a network with MTU smaller than existing network
+ self._createVlanedNetOverNicAndCheck(1, bridged, nic=nic,
+ mtu='1400')
+ self.assertEquals('1500', self.vdsm_net.getMtu(nic))
+
+ # Add a network with MTU bigger than existing network
+ self._createVlanedNetOverNicAndCheck(2, bridged, nic=nic,
+ mtu='1600')
+ self.assertEquals('1600', self.vdsm_net.getMtu(nic))
+
+ # cleanup
+ networks = dict((NETWORK_NAME + str(num), {'remove': True}) for
+ num in range(3))
+ status, msg = self.vdsm_net.setupNetworks(networks, {}, {})
+ self.assertEquals(status, SUCCESS, msg)
+
+ @permutations([[True], [False]])
def testSetupNetworksAddBadParams(self, bridged):
attrs = dict(vlan=VLAN_ID, bridged=bridged)
status, msg = self.vdsm_net.setupNetworks({NETWORK_NAME: attrs},
--
To view, visit http://gerrit.ovirt.org/19230
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7a1f5b628261ae4ebf400494bcdb2939a9cd535
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw(a)linux.vnet.ibm.com>
10 years, 3 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, 4 months
Change in vdsm[master]: netconf: Make default rollback nullify runningConfig
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: netconf: Make default rollback nullify runningConfig
......................................................................
netconf: Make default rollback nullify runningConfig
It should be possible for a unified configurator to perform
several transactions. In order to do this, it is responsibility
of the rollback method to nullify the running configuration it
had, since any modification there was to it will be rolled back
by the system as part of the leftovers.
Change-Id: Ia7d6503db2a3911d7cb5f429adf2b2022d6c5c2b
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/netconf/__init__.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/22337/1
diff --git a/vdsm/netconf/__init__.py b/vdsm/netconf/__init__.py
index 7c6fe2a..bc1abe5 100644
--- a/vdsm/netconf/__init__.py
+++ b/vdsm/netconf/__init__.py
@@ -66,7 +66,9 @@
"""
# self.runningConfig will have all the changes that were applied before
# we needed to rollback.
- return RunningConfig().diffFrom(self.runningConfig)
+ leftover = RunningConfig().diffFrom(self.runningConfig)
+ self.runningConfig = None
+ return leftover
def configureBridge(self, bridge, **opts):
raise NotImplementedError
--
To view, visit http://gerrit.ovirt.org/22337
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7d6503db2a3911d7cb5f429adf2b2022d6c5c2b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
10 years, 4 months