mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Compare commits
4 Commits
f529a1360d
...
96ca2b20ce
Author | SHA1 | Date | |
---|---|---|---|
|
96ca2b20ce | ||
|
a39dd25715 | ||
|
5138dd2478 | ||
|
31f446cf37 |
@ -113,6 +113,28 @@ The following variables are supported:
|
|||||||
this requires guest agent with support for time synchronization
|
this requires guest agent with support for time synchronization
|
||||||
running in the guest. By default, this functionality is turned off.
|
running in the guest. By default, this functionality is turned off.
|
||||||
|
|
||||||
|
- PERSISTENT_ONLY=default
|
||||||
|
|
||||||
|
Defines what type of guest virtual machine ON_SHUTDOWN action is applied to
|
||||||
|
|
||||||
|
* default
|
||||||
|
|
||||||
|
This implements the already existing default behavior.
|
||||||
|
If ON_SHUTDOWN action is shutdown, transient and persistent guest virtual
|
||||||
|
machines are asked to shutdown.
|
||||||
|
If ON_SHUTDOWN action is suspend, only persistent guest virtual machines
|
||||||
|
are asked to suspend.
|
||||||
|
|
||||||
|
* true
|
||||||
|
|
||||||
|
ON_SHUTDOWN action is executed only on persistent guest virtual machines.
|
||||||
|
Transient guest virtual machines are not affected.
|
||||||
|
|
||||||
|
* false
|
||||||
|
|
||||||
|
ON_SHUTDOWN action is executed on persistent and transient guest virtual
|
||||||
|
machines.
|
||||||
|
|
||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
====
|
====
|
||||||
|
@ -2894,9 +2894,9 @@ int
|
|||||||
virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
|
virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
|
||||||
virNodeDevCapSCSITarget *scsi_target)
|
virNodeDevCapSCSITarget *scsi_target)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
g_autofree char *dir = NULL;
|
g_autofree char *dir = NULL;
|
||||||
g_autofree char *rport = NULL;
|
g_autofree char *rport = NULL;
|
||||||
|
g_autofree char *wwpn = NULL;
|
||||||
|
|
||||||
VIR_DEBUG("Checking if '%s' is an FC remote port", scsi_target->name);
|
VIR_DEBUG("Checking if '%s' is an FC remote port", scsi_target->name);
|
||||||
|
|
||||||
@ -2906,28 +2906,21 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
|
|||||||
rport = g_path_get_basename(dir);
|
rport = g_path_get_basename(dir);
|
||||||
|
|
||||||
if (!virFCIsCapableRport(rport))
|
if (!virFCIsCapableRport(rport))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
|
if (virFCReadRportValue(rport, "port_name",
|
||||||
|
&wwpn) < 0) {
|
||||||
|
VIR_WARN("Failed to read port_name for '%s'", rport);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(scsi_target->rport);
|
VIR_FREE(scsi_target->rport);
|
||||||
scsi_target->rport = g_steal_pointer(&rport);
|
scsi_target->rport = g_steal_pointer(&rport);
|
||||||
|
|
||||||
if (virFCReadRportValue(scsi_target->rport, "port_name",
|
VIR_FREE(scsi_target->wwpn);
|
||||||
&scsi_target->wwpn) < 0) {
|
scsi_target->wwpn = g_steal_pointer(&wwpn);
|
||||||
VIR_WARN("Failed to read port_name for '%s'", scsi_target->rport);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_target->flags |= VIR_NODE_DEV_CAP_FLAG_FC_RPORT;
|
scsi_target->flags |= VIR_NODE_DEV_CAP_FLAG_FC_RPORT;
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (ret < 0) {
|
|
||||||
VIR_FREE(scsi_target->rport);
|
|
||||||
VIR_FREE(scsi_target->wwpn);
|
|
||||||
scsi_target->flags &= ~VIR_NODE_DEV_CAP_FLAG_FC_RPORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,9 +429,10 @@ def expand_model(model):
|
|||||||
"""Expand a qemu cpu model description that has its feature split up into
|
"""Expand a qemu cpu model description that has its feature split up into
|
||||||
different fields and may have differing versions into several libvirt-
|
different fields and may have differing versions into several libvirt-
|
||||||
friendly cpu models."""
|
friendly cpu models."""
|
||||||
|
name = model.pop(".name")
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"name": model.pop(".name"),
|
"name": name,
|
||||||
"vendor": translate_vendor(model.pop(".vendor")),
|
"vendor": translate_vendor(model.pop(".vendor")),
|
||||||
"features": set(),
|
"features": set(),
|
||||||
"extra": dict()}
|
"extra": dict()}
|
||||||
@ -454,7 +455,8 @@ def expand_model(model):
|
|||||||
|
|
||||||
for version in versions:
|
for version in versions:
|
||||||
result = copy.deepcopy(result)
|
result = copy.deepcopy(result)
|
||||||
result["name"] = version.pop(".alias", result["name"])
|
version_num = version.pop(".version", '1')
|
||||||
|
result["name"] = name + "-v" + version_num
|
||||||
|
|
||||||
props = version.pop(".props", dict())
|
props = version.pop(".props", dict())
|
||||||
for k, v in props:
|
for k, v in props:
|
||||||
@ -475,6 +477,11 @@ def expand_model(model):
|
|||||||
|
|
||||||
yield result
|
yield result
|
||||||
|
|
||||||
|
alias = version.pop(".alias", None)
|
||||||
|
if alias:
|
||||||
|
result = copy.deepcopy(result)
|
||||||
|
result["name"] = alias
|
||||||
|
yield result
|
||||||
|
|
||||||
def output_model(f, model):
|
def output_model(f, model):
|
||||||
if model["extra"]:
|
if model["extra"]:
|
||||||
|
@ -38,6 +38,7 @@ PARALLEL_SHUTDOWN=0
|
|||||||
START_DELAY=0
|
START_DELAY=0
|
||||||
BYPASS_CACHE=0
|
BYPASS_CACHE=0
|
||||||
SYNC_TIME=0
|
SYNC_TIME=0
|
||||||
|
PERSISTENT_ONLY="default"
|
||||||
|
|
||||||
test -f "$initconfdir"/libvirt-guests &&
|
test -f "$initconfdir"/libvirt-guests &&
|
||||||
. "$initconfdir"/libvirt-guests
|
. "$initconfdir"/libvirt-guests
|
||||||
@ -438,14 +439,16 @@ shutdown_guests_parallel()
|
|||||||
# stop
|
# stop
|
||||||
# Shutdown or save guests on the configured uris
|
# Shutdown or save guests on the configured uris
|
||||||
stop() {
|
stop() {
|
||||||
local suspending="true"
|
|
||||||
local uri=
|
local uri=
|
||||||
|
local action="suspend"
|
||||||
|
local persistent_only="default"
|
||||||
|
|
||||||
|
|
||||||
# last stop was not followed by start
|
# last stop was not followed by start
|
||||||
[ -f "$LISTFILE" ] && return 0
|
[ -f "$LISTFILE" ] && return 0
|
||||||
|
|
||||||
if [ "x$ON_SHUTDOWN" = xshutdown ]; then
|
if [ "x$ON_SHUTDOWN" = xshutdown ]; then
|
||||||
suspending="false"
|
action="shutdown"
|
||||||
if [ $SHUTDOWN_TIMEOUT -lt 0 ]; then
|
if [ $SHUTDOWN_TIMEOUT -lt 0 ]; then
|
||||||
gettext "SHUTDOWN_TIMEOUT must be equal or greater than 0"
|
gettext "SHUTDOWN_TIMEOUT must be equal or greater than 0"
|
||||||
echo
|
echo
|
||||||
@ -454,6 +457,22 @@ stop() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "x$PERSISTENT_ONLY" in
|
||||||
|
xtrue)
|
||||||
|
persistent_only="true"
|
||||||
|
;;
|
||||||
|
xfalse)
|
||||||
|
persistent_only="false"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "x$action" = xshutdown ]; then
|
||||||
|
persistent_only="false"
|
||||||
|
elif [ "x$action" = xsuspend ]; then
|
||||||
|
persistent_only="true"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
: >"$LISTFILE"
|
: >"$LISTFILE"
|
||||||
set -f
|
set -f
|
||||||
for uri in $URIS; do
|
for uri in $URIS; do
|
||||||
@ -478,7 +497,7 @@ stop() {
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if "$suspending"; then
|
if "$persistent_only"; then
|
||||||
local transient="$(list_guests "$uri" "--transient")"
|
local transient="$(list_guests "$uri" "--transient")"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
local empty="true"
|
local empty="true"
|
||||||
@ -486,7 +505,11 @@ stop() {
|
|||||||
|
|
||||||
for uuid in $transient; do
|
for uuid in $transient; do
|
||||||
if "$empty"; then
|
if "$empty"; then
|
||||||
eval_gettext "Not suspending transient guests on URI: \$uri: "
|
if [ "x$action" = xsuspend ]; then
|
||||||
|
eval_gettext "Not suspending transient guests on URI: \$uri: "
|
||||||
|
else
|
||||||
|
eval_gettext "Not shutting down transient guests on URI: \$uri: "
|
||||||
|
fi
|
||||||
empty="false"
|
empty="false"
|
||||||
else
|
else
|
||||||
printf ", "
|
printf ", "
|
||||||
@ -520,19 +543,19 @@ stop() {
|
|||||||
|
|
||||||
if [ -s "$LISTFILE" ]; then
|
if [ -s "$LISTFILE" ]; then
|
||||||
while read uri list; do
|
while read uri list; do
|
||||||
if "$suspending"; then
|
if [ "x$action" = xsuspend ]; then
|
||||||
eval_gettext "Suspending guests on \$uri URI..."; echo
|
eval_gettext "Suspending guests on \$uri URI..."; echo
|
||||||
else
|
else
|
||||||
eval_gettext "Shutting down guests on \$uri URI..."; echo
|
eval_gettext "Shutting down guests on \$uri URI..."; echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PARALLEL_SHUTDOWN" -gt 1 ] &&
|
if [ "$PARALLEL_SHUTDOWN" -gt 1 ] &&
|
||||||
! "$suspending"; then
|
[ "x$action" = xshutdown ]; then
|
||||||
shutdown_guests_parallel "$uri" "$list"
|
shutdown_guests_parallel "$uri" "$list"
|
||||||
else
|
else
|
||||||
local guest=
|
local guest=
|
||||||
for guest in $list; do
|
for guest in $list; do
|
||||||
if "$suspending"; then
|
if [ "x$action" = xsuspend ]; then
|
||||||
suspend_guest "$uri" "$guest"
|
suspend_guest "$uri" "$guest"
|
||||||
else
|
else
|
||||||
shutdown_guest "$uri" "$guest"
|
shutdown_guest "$uri" "$guest"
|
||||||
|
Loading…
Reference in New Issue
Block a user