Accepting request 67740 from Virtualization
Accepted submit request 67740 from user coolo OBS-URL: https://build.opensuse.org/request/show/67740 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xen?expand=0&rev=129
This commit is contained in:
commit
454e371509
@ -24,6 +24,7 @@ rc_reset
|
||||
LOCKFILE=/var/lock/subsys/xendomains
|
||||
XENDOM_CONFIG=/etc/sysconfig/xendomains
|
||||
RETCODE_FILE=/tmp/xendomains.rc.$$
|
||||
xm_cmd=xl
|
||||
|
||||
. "$XENDOM_CONFIG"
|
||||
|
||||
@ -127,7 +128,7 @@ parseln()
|
||||
|
||||
xm_list()
|
||||
{
|
||||
TERM=vt100 xm list | grep -v '^Name *ID'
|
||||
TERM=vt100 ${xm_cmd} list | grep -v '^Name *ID'
|
||||
}
|
||||
|
||||
is_cfg_running()
|
||||
@ -163,7 +164,7 @@ start()
|
||||
printed=1
|
||||
for dom in "$XENDOMAINS_SAVE"/*; do
|
||||
echo -n " ${dom##*/}: "
|
||||
xm restore "$dom" >/dev/null 2>&1
|
||||
${xm_cmd} restore "$dom" >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
rc_failed
|
||||
else
|
||||
@ -184,9 +185,9 @@ start()
|
||||
rc_status -s
|
||||
else
|
||||
if grep -q "^name" "$dom";then
|
||||
xm create --quiet --defconfig "$dom"
|
||||
${xm_cmd} create --quiet --defconfig "$dom"
|
||||
elif grep -q "(name .*" "$dom";then
|
||||
xm create --quiet --config "$dom"
|
||||
${xm_cmd} create --quiet --config "$dom"
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
rc_failed
|
||||
@ -224,19 +225,19 @@ any_non_zombies()
|
||||
|
||||
migrate_with_watchdog()
|
||||
{
|
||||
(xm migrate "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
(${xm_cmd} migrate "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
watchdog_xm $!
|
||||
}
|
||||
|
||||
save_with_watchdog()
|
||||
{
|
||||
(xm save "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
(${xm_cmd} save "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
watchdog_xm $!
|
||||
}
|
||||
|
||||
shutdown_with_watchdog()
|
||||
{
|
||||
(xm shutdown -w "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
(${xm_cmd} shutdown -w "$@" ; echo $? > "$RETCODE_FILE") >/dev/null 2>&1 &
|
||||
watchdog_xm $!
|
||||
}
|
||||
|
||||
@ -309,7 +310,7 @@ stop()
|
||||
for sysrq in $XENDOMAINS_SYSRQ; do
|
||||
echo -n " $name: "
|
||||
echo -n "sending sysrq '$sysrq'... "
|
||||
xm sysrq $id $sysrq
|
||||
${xm_cmd} sysrq $id $sysrq
|
||||
if [ $? -ne 0 ]; then
|
||||
rc_failed
|
||||
else
|
||||
@ -323,7 +324,7 @@ stop()
|
||||
if is_zombie_state "$state"; then
|
||||
echo -n " $name: "
|
||||
echo -n "destroying zombie... "
|
||||
xm destroy $id
|
||||
${xm_cmd} destroy $id
|
||||
rc_reset
|
||||
rc_status -v
|
||||
continue
|
||||
|
@ -12,6 +12,7 @@ usage () {
|
||||
exit $R_USAGE
|
||||
}
|
||||
|
||||
xm_cmd=xl
|
||||
######################################################################
|
||||
# change the working direcory and source some common files
|
||||
#
|
||||
@ -94,7 +95,7 @@ parseln()
|
||||
|
||||
xm_list()
|
||||
{
|
||||
TERM=vt100 xm list | grep -v '^Name *ID'
|
||||
TERM=vt100 ${xm_cmd} list | grep -v '^Name *ID'
|
||||
}
|
||||
|
||||
# For the specified vm, return a list of vifs that are connected to $INTERFACE
|
||||
|
34
xen.changes
34
xen.changes
@ -1,3 +1,37 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 11 15:55:04 MDT 2011 - jfehlig@suse.de
|
||||
|
||||
- bnc#685338: Fix porting of xend-domain-lock.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 11 19:33:34 CEST 2011 - ohering@suse.de
|
||||
|
||||
- update scripts to use xl instead of xm:
|
||||
xen-updown.sh, init.xendomains, xmclone.sh
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 11 17:34:46 CEST 2011 - ohering@suse.de
|
||||
|
||||
- disable xend in openSuSE > 11.4
|
||||
the xl command is the replacement for the xm command
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 7 18:16:45 CEST 2011 - ohering@suse.de
|
||||
|
||||
- mark runlevel scripts as config to preserve local changes by
|
||||
admin or dev during package update
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 7 18:11:14 CEST 2011 - ohering@suse.de
|
||||
|
||||
- enable xencommons runlevel script during upgrade if xend was
|
||||
already enabled
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 7 17:50:23 CEST 2011 - ohering@suse.de
|
||||
|
||||
- call /sbin/ldconfig directly in xen-libs post install scripts
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 31 12:41:24 UTC 2011 - coolo@novell.com
|
||||
|
||||
|
109
xen.spec
109
xen.spec
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package xen
|
||||
# spec file for package xen (Version 4.1.0_01)
|
||||
#
|
||||
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
@ -26,6 +26,11 @@ ExclusiveArch: %ix86 x86_64
|
||||
%define xen_build_dir xen-4.1.0-testing
|
||||
%define with_kmp 1
|
||||
%define with_stubdom 0
|
||||
%if %suse_version > 1140
|
||||
%define with_xend 0
|
||||
%else
|
||||
%define with_xend 1
|
||||
%endif
|
||||
BuildRequires: LibVNCServer-devel
|
||||
BuildRequires: SDL-devel
|
||||
BuildRequires: automake
|
||||
@ -75,7 +80,7 @@ BuildRequires: glibc-devel
|
||||
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
|
||||
%endif
|
||||
Version: 4.1.0_01
|
||||
Release: 5
|
||||
Release: 1
|
||||
License: GPLv2+
|
||||
Group: System/Kernel
|
||||
AutoReqProv: on
|
||||
@ -255,7 +260,6 @@ Patch10040: xenpaging.doc.patch
|
||||
Patch99999: tmp_build.patch
|
||||
Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
#%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()")
|
||||
%define pyver %(python -c "import sys; print sys.version[:3]")
|
||||
%if %{?with_kmp}0
|
||||
%suse_kernel_module_package -n xen um xen -f kmp_filelist
|
||||
@ -714,6 +718,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
|
||||
#%patch10040 -p1
|
||||
%patch99999 -p1
|
||||
|
||||
|
||||
%build
|
||||
XEN_EXTRAVERSION=%version-%release
|
||||
XEN_EXTRAVERSION=${XEN_EXTRAVERSION#%{xvers}}
|
||||
@ -726,9 +731,6 @@ make -C xenalyze.hg CC="gcc -I../xen/include" %{?_smp_mflags}
|
||||
make -C tools/include/xen-foreign %{?_smp_mflags}
|
||||
make tools docs %{?_smp_mflags}
|
||||
make -C tools/debugger/gdbsx
|
||||
#### there are code problems that don't pass the 02-check-gcc-output, hence bitbucket
|
||||
###env MAKE="make %{?_smp_mflags}" ./gdbbuild 1>/dev/null 2>/dev/null
|
||||
###cd ../../..
|
||||
%if %{?with_kmp}0
|
||||
# pv driver modules
|
||||
export XL=/usr/src/linux
|
||||
@ -748,9 +750,7 @@ done
|
||||
make -C tools/xen-utils-0.1 XEN_INTREE_BUILD=yes
|
||||
|
||||
%install
|
||||
test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
export RPM_OPT_FLAGS
|
||||
install_xen()
|
||||
{
|
||||
local ext=""
|
||||
@ -776,8 +776,6 @@ make -C xen clean
|
||||
make -C xen install max_phys_cpus=%{max_cpus} pae=%{pae_enabled} debug=n crash_debug=n DESTDIR=$RPM_BUILD_ROOT %{?_smp_mflags}
|
||||
install_xen
|
||||
make -C xen clean
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
export RPM_OPT_FLAGS
|
||||
make -C tools/include/xen-foreign %{?_smp_mflags}
|
||||
# tools
|
||||
export XEN_PYTHON_NATIVE_INSTALL=1
|
||||
@ -812,7 +810,6 @@ make -C stubdom install \
|
||||
DOCDIR=%{_defaultdocdir}/xen INCDIR=%{_includedir}
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/xen
|
||||
%ifarch x86_64
|
||||
ln -s /usr/lib/xen/boot/pv-grub-x86_32.gz $RPM_BUILD_ROOT/usr/lib/xen/boot/pv-grub-x86_32.gz
|
||||
ln -s /usr/lib/xen/bin/stubdom-dm $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdom-dm
|
||||
ln -s /usr/lib/xen/bin/stubdompath.sh $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdompath.sh
|
||||
%endif
|
||||
@ -868,7 +865,6 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/xen/dump
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/xen/xend-db/domain
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/xen/xend-db/migrate
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/xen/xend-db/vnet
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/xen/xenpaging
|
||||
mkdir -p $RPM_BUILD_ROOT/var/log/xen
|
||||
ln -s /var/lib/xen/images $RPM_BUILD_ROOT/etc/xen/images
|
||||
# Bootloader
|
||||
@ -889,7 +885,6 @@ rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-sparc32
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-sparc64
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/xen/qemu/openbios-ppc
|
||||
rm -f $RPM_BUILD_ROOT/usr/sbin/netfix
|
||||
#rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
|
||||
rm -f $RPM_BUILD_ROOT/%{_libdir}/python%{pyver}/site-packages/*.egg-info
|
||||
rm -rf $RPM_BUILD_ROOT/html
|
||||
rm -rf $RPM_BUILD_ROOT/usr/share/doc/xen/README.*
|
||||
@ -919,13 +914,7 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
%files libs
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/fs/
|
||||
%{_libdir}/libblktap.so.*
|
||||
%{_libdir}/libflask.so.*
|
||||
%{_libdir}/libfsimage.so.*
|
||||
%{_libdir}/libxen*.so.*
|
||||
%{_libdir}/libvhd.so.*
|
||||
%{_libdir}/libxlutil.so.*
|
||||
%{_libdir}/libblktapctl.so.*
|
||||
%{_libdir}/*.so.*
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root)
|
||||
@ -990,18 +979,14 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
%dir /var/lib/xen/xend-db/vnet
|
||||
%dir /var/lib/xenstored
|
||||
%dir /var/log/xen
|
||||
/etc/init.d/xend
|
||||
/etc/init.d/xendomains
|
||||
/etc/init.d/xencommons
|
||||
/etc/init.d/xen-watchdog
|
||||
%config /etc/init.d/*
|
||||
%config /etc/logrotate.d/xen
|
||||
%dir %attr(700,root,root) /etc/xen
|
||||
/etc/xen/auto
|
||||
%config /etc/xen/examples
|
||||
/etc/xen/images
|
||||
/etc/xen/scripts
|
||||
/etc/xen/cpupool
|
||||
#/etc/xen/scripts/qemu-ifup
|
||||
%config /etc/xen/cpupool
|
||||
/etc/xen/README*
|
||||
%config /etc/xen/vm
|
||||
%config(noreplace) /etc/xen/*.sxp
|
||||
@ -1032,7 +1017,6 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
%dir %{_datadir}/xen/man/man1
|
||||
%dir %{_datadir}/xen/man/man8
|
||||
%dir %{_datadir}/xen/qemu
|
||||
#%dir %{_datadir}/xen/qemu/keymaps
|
||||
%{_datadir}/xen/*.dtd
|
||||
%{_datadir}/xen/qemu/*
|
||||
%{_datadir}/xen/man/man1/*
|
||||
@ -1055,12 +1039,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
#/usr/lib/xen/bin/xc_kexec
|
||||
%endif
|
||||
/usr/lib/xen/boot/hvmloader
|
||||
#%pysite/xen/*
|
||||
%{_libdir}/python%{pyver}/site-packages/xen/*
|
||||
/usr/lib/xen/boot/domUloader.py
|
||||
#%pysite/grub/*
|
||||
%{_libdir}/python%{pyver}/site-packages/grub/*
|
||||
#%pysite/fsimage.so
|
||||
%{_libdir}/python%{pyver}/site-packages/fsimage.so
|
||||
%if %{?with_stubdom}0
|
||||
/usr/lib/xen/boot/ioemu-stubdom.gz
|
||||
@ -1078,29 +1059,10 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libblktap.a
|
||||
%{_libdir}/libblktap.so
|
||||
%{_libdir}/libflask.a
|
||||
%{_libdir}/libflask.so
|
||||
%{_libdir}/libfsimage.so
|
||||
%{_libdir}/libxen*.a
|
||||
%{_libdir}/libxen*.so
|
||||
%{_libdir}/libvhd.a
|
||||
%{_libdir}/libvhd.so
|
||||
%{_libdir}/libxlutil.a
|
||||
%{_libdir}/libxlutil.so
|
||||
%{_libdir}/libblktapctl.a
|
||||
%{_libdir}/libblktapctl.so
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/*.so
|
||||
/usr/include/*
|
||||
/usr/bin/serial-split
|
||||
/usr/include/blktaplib.h
|
||||
/usr/include/fsimage*
|
||||
/usr/include/xen*.h
|
||||
/usr/include/xen/
|
||||
/usr/include/xs.h
|
||||
/usr/include/xs_lib.h
|
||||
/usr/include/libxl.h
|
||||
/usr/include/_libxl_types.h
|
||||
/usr/include/libxl_uuid.h
|
||||
|
||||
%files doc-html
|
||||
%defattr(-,root,root)
|
||||
@ -1110,12 +1072,36 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
|
||||
%defattr(-,root,root)
|
||||
%{_defaultdocdir}/xen/pdf
|
||||
|
||||
%clean
|
||||
#test ! -z "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
|
||||
#rm -rf $RPM_BUILD_DIR/%xen_build_dir
|
||||
|
||||
%post tools
|
||||
%if %{?with_xend}0
|
||||
# with_xend
|
||||
# enable both xm (xend based) and xl (libxl based)
|
||||
if /bin/ls /etc/init.d/rc3.d/S??xend > /dev/null 2>&1 ; then
|
||||
if ! /bin/ls /etc/init.d/rc3.d/S??xencommons > /dev/null 2>&1 ; then
|
||||
echo "postin %{name}-tools: Forcing insserv xencommons during package upgrade because xend was enabled."
|
||||
echo "postin %{name}-tools: with xend"
|
||||
fi
|
||||
%{fillup_and_insserv -Y -n xencommons xencommons}
|
||||
else
|
||||
%{fillup_and_insserv -y -n xencommons xencommons}
|
||||
fi
|
||||
%{fillup_and_insserv -y -n xend xend}
|
||||
%else
|
||||
# without_xend
|
||||
# disable xm (xend based) and enable only xl (libxl based)
|
||||
if /bin/ls /etc/init.d/rc3.d/S??xend > /dev/null 2>&1 ; then
|
||||
if ! /bin/ls /etc/init.d/rc3.d/S??xencommons > /dev/null 2>&1 ; then
|
||||
echo "postin %{name}-tools: Forcing insserv xencommons during package upgrade because xend was enabled."
|
||||
fi
|
||||
echo "postin %{name}-tools: disabling xend in favor of xencommons. xm command replaced by xl."
|
||||
%{stop_on_removal xend}
|
||||
rm -fv /etc/init.d/rc?.d/???xend || :
|
||||
%{fillup_and_insserv -Y -n xencommons xencommons}
|
||||
else
|
||||
%{fillup_and_insserv -y -n xencommons xencommons}
|
||||
fi
|
||||
%endif
|
||||
#
|
||||
%{fillup_and_insserv -y -n xendomains xendomains}
|
||||
if [ -f /usr/bin/qemu-img ]; then
|
||||
if [ -f /usr/bin/qemu-img-xen ]; then
|
||||
@ -1131,10 +1117,13 @@ if [ -f /usr/bin/qemu-nbd ]; then
|
||||
fi
|
||||
|
||||
%preun tools
|
||||
%{stop_on_removal xendomains xend}
|
||||
%{stop_on_removal xendomains xend xencommons}
|
||||
|
||||
%postun tools
|
||||
%if %{?with_xend}0
|
||||
# with_xend
|
||||
%{restart_on_update xend}
|
||||
%endif
|
||||
%{insserv_cleanup}
|
||||
if [ -f /usr/bin/qemu-img-xen ]; then
|
||||
rm /usr/bin/qemu-img-xen
|
||||
@ -1143,10 +1132,8 @@ if [ -f /usr/bin/qemu-nbd-xen ]; then
|
||||
rm /usr/bin/qemu-nbd-xen
|
||||
fi
|
||||
|
||||
%post libs
|
||||
/sbin/ldconfig
|
||||
%post libs -p /sbin/ldconfig
|
||||
|
||||
%postun libs
|
||||
/sbin/ldconfig
|
||||
%postun libs -p /sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
|
@ -282,3 +282,102 @@ Index: xen-4.1.0-testing/tools/hotplug/Linux/vm-monitor
|
||||
+elif [ $0 = "$basedir/vm-monitor" ]; then
|
||||
+ monitor $*
|
||||
+fi
|
||||
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
|
||||
===================================================================
|
||||
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
|
||||
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
|
||||
@@ -470,6 +470,7 @@ class XendDomainInfo:
|
||||
|
||||
if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED, XEN_API_VM_POWER_STATE_CRASHED):
|
||||
try:
|
||||
+ self.acquire_running_lock();
|
||||
XendTask.log_progress(0, 30, self._constructDomain)
|
||||
XendTask.log_progress(31, 60, self._initDomain)
|
||||
|
||||
@@ -2984,6 +2985,11 @@ class XendDomainInfo:
|
||||
|
||||
self._stateSet(DOM_STATE_HALTED)
|
||||
self.domid = None # Do not push into _stateSet()!
|
||||
+
|
||||
+ try:
|
||||
+ self.release_running_lock()
|
||||
+ except:
|
||||
+ log.exception("Failed to release domain lock.")
|
||||
finally:
|
||||
self.refresh_shutdown_lock.release()
|
||||
|
||||
@@ -4491,6 +4497,74 @@ class XendDomainInfo:
|
||||
def has_device(self, dev_class, dev_uuid):
|
||||
return (dev_uuid in self.info['%s_refs' % dev_class.lower()])
|
||||
|
||||
+ # Return name of host contained in lock file.
|
||||
+ def get_lock_host(self, path):
|
||||
+ fin = os.popen(xoptions.get_xend_domain_lock_utility() + \
|
||||
+ ' -s ' + path, 'r')
|
||||
+ hostname = "unknown"
|
||||
+
|
||||
+ try:
|
||||
+ tokens = fin.readline().split()
|
||||
+ for token in tokens:
|
||||
+ item = token.split('=')
|
||||
+ if item[0] == 'host':
|
||||
+ hostname = item[1]
|
||||
+ return hostname
|
||||
+ finally:
|
||||
+ fin.close()
|
||||
+
|
||||
+ # Acquire a lock for the domain. No-op if domain locking is turned off.
|
||||
+ def acquire_running_lock(self):
|
||||
+ if not xoptions.get_xend_domain_lock():
|
||||
+ return
|
||||
+
|
||||
+ log.debug("Acquiring lock for domain %s" % self.info['name_label'])
|
||||
+ path = xoptions.get_xend_domain_lock_path()
|
||||
+ path = os.path.join(path, self.get_uuid())
|
||||
+
|
||||
+ try:
|
||||
+ if not os.path.exists(path):
|
||||
+ mkdir.parents(path, stat.S_IRWXU)
|
||||
+ except:
|
||||
+ log.exception("%s could not be created." % path)
|
||||
+ raise XendError("%s could not be created." % path)
|
||||
+
|
||||
+ status = os.system('%s -l -p %s -n %s -i %s %s' % \
|
||||
+ (xoptions.get_xend_domain_lock_utility(), \
|
||||
+ XendNode.instance().get_name(), \
|
||||
+ self.info['name_label'], \
|
||||
+ self.info['uuid'], \
|
||||
+ path))
|
||||
+ if status != 0:
|
||||
+ log.debug("Failed to aqcuire lock: status = %d" % status)
|
||||
+ raise XendError("The VM is locked and appears to be running on host %s." % self.get_lock_host(path))
|
||||
+
|
||||
+ # Release lock for domain. No-op if domain locking is turned off.
|
||||
+ def release_running_lock(self, name = None):
|
||||
+ if not xoptions.get_xend_domain_lock():
|
||||
+ return
|
||||
+
|
||||
+ dom_name = self.info['name_label']
|
||||
+ if name:
|
||||
+ dom_name = name
|
||||
+ log.debug("Releasing lock for domain %s" % dom_name)
|
||||
+
|
||||
+ path = xoptions.get_xend_domain_lock_path()
|
||||
+ path = os.path.join(path, self.get_uuid())
|
||||
+ status = os.system('%s -u -p %s -n %s -i %s %s' % \
|
||||
+ (xoptions.get_xend_domain_lock_utility(), \
|
||||
+ XendNode.instance().get_name(), \
|
||||
+ dom_name, \
|
||||
+ self.info['uuid'], \
|
||||
+ path))
|
||||
+ if status != 0:
|
||||
+ log.exception("Failed to release lock: status = %s" % status)
|
||||
+ try:
|
||||
+ if len(os.listdir(path)) == 0:
|
||||
+ shutil.rmtree(path)
|
||||
+ except:
|
||||
+ log.exception("Failed to remove unmanaged directory %s." % path)
|
||||
+
|
||||
def __str__(self):
|
||||
return '<domain id=%s name=%s memory=%s state=%s>' % \
|
||||
(str(self.domid), self.info['name_label'],
|
||||
|
@ -36,6 +36,7 @@ PART=2
|
||||
DOMU_IS_FILE_BASED=
|
||||
DOMU_ROOTDEV=
|
||||
FORCE=no
|
||||
xm_cmd=xl
|
||||
|
||||
|
||||
#
|
||||
@ -481,11 +482,11 @@ fi
|
||||
#
|
||||
# Make sure that the source VM is not running
|
||||
#
|
||||
xmid=`xm domid "$SOURCE" 2>/dev/null`
|
||||
xmid=`${xm_cmd} domid "$SOURCE" 2>/dev/null`
|
||||
if [ $? -eq 0 ] && [ -n "$xmid" ] && [ -z "${xmid//[[:digit:]]/}" ]
|
||||
then
|
||||
echo "domU $SOURCE is currently running on Xen, please shutdown before cloning." >&2
|
||||
echo "The command \"xm shutdown $xmid -w\" will shutdown the domU" >&2
|
||||
echo "The command \"${xm_cmd} shutdown $xmid -w\" will shutdown the domU" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user