Changeset 1580 for trunk/packages/invirt-xen-config
- Timestamp:
- Nov 10, 2008, 3:16:05 AM (16 years ago)
- Location:
- trunk/packages/invirt-xen-config/debian
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-xen-config/debian/changelog
r1459 r1580 1 invirt-xen-config (0.0.13) unstable; urgency=low 2 3 * Use a lock LV when attempting to start sysvms since exclusive LV 4 activation has useless semantics 5 6 -- Evan Broder <broder@mit.edu> Mon, 10 Nov 2008 03:15:31 -0500 7 1 8 invirt-xen-config (0.0.12) unstable; urgency=low 2 9 -
trunk/packages/invirt-xen-config/debian/invirt-xen-config.init
r1471 r1580 27 27 28 28 VM="$1" 29 DISK="/dev/xenvg/${VM}_hda" 29 LV="${VM}_hda" 30 DISK="/dev/xenvg/$LV" 30 31 31 32 # Don't bother trying to start the VM if it's already running 32 if xm list "$ 1" >/dev/null 2>&1; then33 if xm list "$VM" >/dev/null 2>&1; then 33 34 return 1 34 35 fi 35 36 36 if lvchange -a n "$DISK" >/dev/null 2>&1 && lvchange -a ey "$DISK" >/dev/null 2>&1; then 37 # If we can disable and then re-enable the VMs disk, then the 38 # VM can't be running. If the lvchange -a ey succeeds, then we 39 # have an exclusive lock across the cluster on enabling the 40 # disk, which avoids the potential race condition of two hosts 41 # starting a VM at the same time 42 [ "$VERBOSE" != no ] && log_daemon_msg "Starting sysvm $VM" 43 xm create "sysvms/$VM" >/dev/null 44 [ "$VERBOSE" != no ] && log_end_msg $? 45 RET=0 46 else 47 RET=1 37 RET=1 38 # To keep multiple hosts from trying to start a VM at the same 39 # time, lock VM creation at startup-time with a lock LV, since LV 40 # creation is atomic 41 if lvcreate -L 1K -n "lock_${LV}" xenvg >/dev/null 2>&1; then 42 # If we can disable the LV, then the VM isn't already running 43 # somewhere else 44 if lvchange -a n "$DISK" >/dev/null 2>&1; then 45 lvchange -a y "$DISK" >/dev/null 2>&1 46 47 [ "$VERBOSE" != no ] && log_daemon_msg "Starting sysvm $VM" 48 xm create "sysvms/$VM" >/dev/null 49 [ "$VERBOSE" != no ] && log_end_msg $? 50 RET=0 51 fi 52 53 # Regardless of whether we could get the lock or not, the 54 # lvchange -a n probably disabled the LV somewhere; be sure we 55 # clean up 56 lvchange -a y "$DISK" >/dev/null 2>&1 57 58 # Cleanup the lock, regardless of whether we started the LV 59 lvchange -a n "/dev/xenvg/lock_${LV}" 60 lvremove -f "/dev/xenvg/lock_${LV}" 48 61 fi 49 50 # Regardless of whether we could get the lock or not, the51 # lvchange -a n probably disabled the LV somewhere; be sure we52 # clean up53 lvchange -a y "$DISK" >/dev/null 2>&154 62 55 63 return $RET
Note: See TracChangeset
for help on using the changeset viewer.