Dan Kenigsberg has uploaded a new change for review.
Change subject: ifcfg: include HWADDR line only if NM is around
......................................................................
ifcfg: include HWADDR line only if NM is around
In prehistoric days, our ifcfg files included HWADDR lines for
persistent NIC names on EL5 hosts. Our currently-supported
systems no longer require HWADDR for that, but rather use udev rules.
HWADDRs are still required if NetworkManager is running and needs them
to adhere to our NM_CONTROLLED=no directive.
HWADDR lines in ifcfg files are frowned upon, since they essentially
duplicate information that already exists in udev rules.
Change-Id: Ifc4904251150756594502367d4bea87620dfba58
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M debian/vdsm.install
M vdsm.spec.in
M vdsm/Makefile.am
M vdsm/netconf/ifcfg.py
A vdsm/nm.py
5 files changed, 60 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/22288/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index 165d6e9..4a2d4aa 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -70,6 +70,7 @@
./usr/share/vdsm/netconf/libvirtCfg.py
./usr/share/vdsm/neterrors.py
./usr/share/vdsm/netmodels.py
+./usr/share/vdsm/nm.py
./usr/share/vdsm/parted_utils.py
./usr/share/vdsm/ppc64HardwareInfo.py
./usr/share/vdsm/respawn
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0bd4202..53c06f4 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1005,6 +1005,7 @@
%{_datadir}/%{vdsm_name}/netconf/iproute2.py*
%{_datadir}/%{vdsm_name}/neterrors.py*
%{_datadir}/%{vdsm_name}/netmodels.py*
+%{_datadir}/%{vdsm_name}/nm.py*
%{_datadir}/%{vdsm_name}/respawn
%{_datadir}/%{vdsm_name}/sampling.py*
%{_datadir}/%{vdsm_name}/set-conf-item
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 1044f66..795235c 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -44,6 +44,7 @@
momIF.py \
neterrors.py \
netmodels.py \
+ nm.py \
parted_utils.py \
ppc64HardwareInfo.py \
sampling.py \
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index ac36786..1c33837 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -40,6 +40,12 @@
import dsaversion
import libvirtCfg
import neterrors as ne
+import nm
+
+
+(a)utils.memoized
+def _nm_around():
+ return nm.running()
class Ifcfg(Configurator):
@@ -607,10 +613,12 @@
def addNic(self, nic, **opts):
""" Create ifcfg-* file with proper fields for NIC """
_netinfo = netinfo.NetInfo()
- hwaddr = (_netinfo.nics[nic.name].get('permhwaddr') or
- _netinfo.nics[nic.name]['hwaddr'])
+ conf = ''
+ if _nm_around():
+ hwaddr = (_netinfo.nics[nic.name].get('permhwaddr') or
+ _netinfo.nics[nic.name]['hwaddr'])
- conf = 'HWADDR=%s\n' % pipes.quote(hwaddr)
+ conf += 'HWADDR=%s\n' % pipes.quote(hwaddr)
if nic.bridge:
conf += 'BRIDGE=%s\n' % pipes.quote(nic.bridge.name)
if nic.bond:
diff --git a/vdsm/nm.py b/vdsm/nm.py
new file mode 100644
index 0000000..6e95060
--- /dev/null
+++ b/vdsm/nm.py
@@ -0,0 +1,46 @@
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import errno
+
+from vdsm.utils import execCmd
+from vdsm.utils import CommandPath
+
+_NMCLI_BINARY = CommandPath('nmcli', '/usr/bin/nmcli')
+
+
+class NMcliError(Exception):
+ pass
+
+
+def running():
+ """Return True iff NM is installed and running"""
+
+ try:
+ cmd = [_NMCLI_BINARY.cmd, '-t', '-f', 'RUNNING', 'nm', 'status']
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ return False
+ raise
+
+ rc, out, err = execCmd(cmd, raw=True)
+ if rc:
+ raise NMcliError(rc, err)
+ return out.strip() == 'running'
--
To view, visit http://gerrit.ovirt.org/22288
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc4904251150756594502367d4bea87620dfba58
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Peter V. Saveliev has uploaded a new change for review.
Change subject: [WIP] objectfs integration
......................................................................
[WIP] objectfs integration
Export VM objects as files in runtime.
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I6dd2ca2245f3f5496eca9f8c14bed79d4638c189
---
M vdsm/vm.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/8383/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index d49eef1..cd6c6ca 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -33,6 +33,7 @@
from logUtils import SimpleLogAdapter
import libvirt
from vdsm import vdscli
+from pyvfs.objectfs import export
DEFAULT_BRIDGE = config.get("vars", "default_bridge")
@@ -250,6 +251,12 @@
'Restoring state', 'Saving State',
'Up', 'WaitForLaunch')
+
+@export(blacklist=[
+ "/log",
+ "/MigrationSourceThreadClass",
+ "/cif",
+ ])
class Vm(object):
"""
Used for abstracting communication between various parts of the
--
To view, visit http://gerrit.ovirt.org/8383
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dd2ca2245f3f5496eca9f8c14bed79d4638c189
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
Peter V. Saveliev has uploaded a new change for review.
Change subject: vdsm: catch timeout while starting VM
......................................................................
vdsm: catch timeout while starting VM
If the requested VM does not start within given timeout,
set its status to «down» and throw an exception.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=755528
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I233d3c6cf1e62e46d005b8a6d502a02438100daa
---
M vdsm/vm.py
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/12235/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 8b2bbb6..19e6aa4 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -35,6 +35,7 @@
import libvirt
from vdsm import vdscli
+__timeout__ = 10
DEFAULT_BRIDGE = config.get("vars", "default_bridge")
DISK_DEVICES = 'disk'
@@ -657,6 +658,10 @@
def run(self):
self._creationThread.start()
+ self._creationThread.join(__timeout__)
+ if self._creationThread.is_alive():
+ self.setDownStatus(ERROR, 'timeout while starting vm')
+ raise Exception("timeout exception")
def memCommit(self):
"""
--
To view, visit http://gerrit.ovirt.org/12235
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I233d3c6cf1e62e46d005b8a6d502a02438100daa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
Peter V. Saveliev has uploaded a new change for review.
Change subject: vdsm: cope with I/O errors, getting permissions
......................................................................
vdsm: cope with I/O errors, getting permissions
Treat OSError during floppy image permission check as a
read-only floppy. Later the floppy can be safely "ejected",
if the error persists.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=755528
Change-Id: I1f595a7adc05cd2efbfb831c247233ecb01da05a
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/18371/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 4f80b4c..165670a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1531,10 +1531,15 @@
driverAttrs['error_policy'] = 'stop'
diskelem.appendChildWithArgs('driver', **driverAttrs)
elif self.device == 'floppy':
- if (self.path and
- not utils.getUserPermissions(constants.QEMU_PROCESS_USER,
- self.path)['write']):
- diskelem.appendChildWithArgs('readonly')
+ if self.path:
+ try:
+ wp = utils.getUserPermissions(constants.QEMU_PROCESS_USER,
+ self.path)['write'])
+ except OSError:
+ wp = False
+
+ if not wp:
+ diskelem.appendChildWithArgs('readonly')
if hasattr(self, 'specParams') and 'ioTune' in self.specParams:
self._validateIoTuneParams()
--
To view, visit http://gerrit.ovirt.org/18371
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f595a7adc05cd2efbfb831c247233ecb01da05a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
Assaf Muller has uploaded a new change for review.
Change subject: Add --force option to upgrades
......................................................................
Add --force option to upgrades
The --force option will ignore the existance of upgrade files
in /var/lib/vdsm/upgrade/
Each upgrade will still only run if it thinks it should run.
Change-Id: I2e6b84bdd14b9cd3921cea187b2654be22989334
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M lib/vdsm/tool/unified_persistence.py
M lib/vdsm/tool/upgrade.py
M lib/vdsm/tool/upgrade_300_networks.py
3 files changed, 17 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/22750/1
diff --git a/lib/vdsm/tool/unified_persistence.py b/lib/vdsm/tool/unified_persistence.py
index d1b3d0a..a2d92cf 100644
--- a/lib/vdsm/tool/unified_persistence.py
+++ b/lib/vdsm/tool/unified_persistence.py
@@ -137,7 +137,7 @@
@expose('upgrade-to-unified-persistence')
-def unified_persistence():
+def unified_persistence(*args):
"""
Upgrade host networking persistence from ifcfg to unified if the
persistence model is set as unified in /usr/lib64/python2.X/site-packages/
diff --git a/lib/vdsm/tool/upgrade.py b/lib/vdsm/tool/upgrade.py
index c3e92bc..8c9f57b 100644
--- a/lib/vdsm/tool/upgrade.py
+++ b/lib/vdsm/tool/upgrade.py
@@ -17,6 +17,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import argparse
from functools import wraps
import logging
import logging.config
@@ -116,6 +117,18 @@
self._detachUpgradeLog()
+def _parse_args():
+ parser = argparse.ArgumentParser('vdsm-tool')
+ parser.add_argument(
+ '--force',
+ dest='force',
+ default=False,
+ action='store_true',
+ help='Run the upgrade again, even if it was ran before',
+ )
+ return parser.parse_args(sys.argv[2:])
+
+
def upgrade(upgradeName):
"""
Used as a decorator for upgrades. Runs the upgrade with an Upgrade
@@ -126,7 +139,8 @@
@wraps(f)
def wrapper(*args, **kwargs):
with Upgrade(upgradeName) as upgrade:
- if upgrade.isNeeded():
+ cliArguments = _parse_args()
+ if cliArguments.force or upgrade.isNeeded():
upgrade.log.debug("Running upgrade %s", upgradeName)
try:
f(*args, **kwargs)
diff --git a/lib/vdsm/tool/upgrade_300_networks.py b/lib/vdsm/tool/upgrade_300_networks.py
index 0f754fd..41a49b5 100644
--- a/lib/vdsm/tool/upgrade_300_networks.py
+++ b/lib/vdsm/tool/upgrade_300_networks.py
@@ -55,7 +55,7 @@
@expose('upgrade-3.0.0-networks')
-def upgrade_networks():
+def upgrade_networks(*args):
"""
Since ovirt-3.0, Vdsm uses libvirt networks (with names vdsm-*) to store
its own networks. Older Vdsms did not have those defined, and used only
--
To view, visit http://gerrit.ovirt.org/22750
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e6b84bdd14b9cd3921cea187b2654be22989334
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
Lei Li has uploaded a new change for review.
Change subject: Move uninstall preun section to vdsm-unregister
......................................................................
Move uninstall preun section to vdsm-unregister
The specfile vdsm.spec.in has very long %post and %preun
sections, move the install/uninstall hooks into vdsm-tool.
This patch move unregister to a script which will be
encapsulated into a vdsm-tool function stop-vdsm-service.
Change-Id: I4e7b5dc969dfb51e6880b9bb209a363609f5e123
Signed-off-by: Lei Li <lilei(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/Makefile.am
A vdsm/vdsm-unregister.in
3 files changed, 36 insertions(+), 42 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/4526/1
--
To view, visit http://gerrit.ovirt.org/4526
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e7b5dc969dfb51e6880b9bb209a363609f5e123
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lei Li <lilei(a)linux.vnet.ibm.com>