Removed yet more whitespace, updated documentation and comments to reflect changed goals, minor tweak to convert_to_seq

This commit is contained in:
Jesse Gardner 2021-03-18 15:48:09 -07:00
parent ba3ee00dca
commit 943a1218ec
2 changed files with 19 additions and 20 deletions

View File

@ -28,10 +28,10 @@ requires:
Bash 4.0+
qemu-img
libvirt tools:
libvirt tools:
virt-clone
virt-xml
virt-xml-validate
virt-xml-validate
xmllint (from libxml2)
If you want to easily establish graphical connections to your virtual
@ -413,16 +413,12 @@ are involved. This may be due to apparmor, or it may be an issue with
libvirt. It is unknown how widespread this issue is, but it is the reason
that the default directory storage-qq2clone does not start with '.'
If the UUID of a clone is changed, qq2clone will no longer be able to
track it and will not be able to perform commands on it anymore.
If virsh undefine is run on a clone, qq2clone will not be able to see
it once it is turned off. This limitation will be eliminated or reduced in
the future, when qq2clone moves away from relying on virsh and implements
direct usage of the libvirt API. It could be addressed now by using
transient domains, but that would require qq2clone to do more things
manually instead of just invoking virsh. Since the plan is to
transition to a different approach later, that would be wasted effort. For
now, if you find yourself in this position just use **qq2clone** check.
If the UUID of a clone is changed, qq2clone will no longer be able to
track it and will not be able to perform commands on it anymore. This will
be addressed in the future using custom metadata in the libvirt domain
XML. If the user undefines a domain, this will obviously cause it to
disappear from qq2clone's perspective when it is turned off, creating a
discrepancy in its database. This can be fixed with **qq2clone** **check**.
qq2clone can only produce clones by making qcow2 image files. The backing
file need not be qcow2, but the images produced by qq2clone always will

View File

@ -1461,6 +1461,9 @@ done < <( while read -r uuid; do \
domblklist $uuid --inactive;"; done \
< <( virsh list --all --uuid ) | virsh 2>&1 )
# ^ less complicated version of the same hack in load_template, will also
# be replaced
# We have all the disk files associated with domains, but we still need
# the ones referenced by template XML
declare -a templates
@ -1981,8 +1984,8 @@ read -ra states \
local state m
if (($1)); then
#shellcheck disable=2119
# This is only a (functioning) mock implementation meant as a proof of
# concept for what XML describing qq2clone's current state may be like.
# This is only a (functioning) mock implementation meant as a proof of
# concept for what XML describing qq2clone's current state may be like
# For this feature to be complete, it would: use a defined format, be
# implemented with proper, modular code, and contain all information to
# fully define qq2clone's state except for machine images and domain xml.
@ -2098,8 +2101,8 @@ load_template ()
# This is a hacky way of getting the information we need in a reasonably
# performant manner. It is a bit fragile, but not overly so assuming that
# virsh's output is fairly consistent across versions. This method is
# temporary, as later on qq2clone will include portions in (probably) C
# that use the libvirt API instead of virsh
# temporary, as later on qq2clone will include portions in C that use the
# libvirt API instead of virsh
check_template
unset BAD_CL CL_MAP CL_STATE NAME_MAP
@ -2129,7 +2132,7 @@ temp="$(mktemp -d)" || temp_error
mkfifo "$temp/fifo" &>/dev/null || unexpected_error load_template
exec 4<>"$temp/fifo"
virsh <&3 >&4 2>&4 &
# virsh prepends 5 lines of useless output
# virsh prepends 5 lines of useless output.
local c; for ((c=5;c>0;c--)); do read -r <&4; done
local prompt="virsh #" # In the virsh shell, input lines start with this
@ -2202,7 +2205,7 @@ save_domain ()
# PARAMETERS: $1: Machine number
#=========================================================================#
{
local uuid
local uuid
uuid="${CL_MAP["$1"]}"
virsh managedsave "$uuid" &>/dev/null
return 0
@ -2350,7 +2353,7 @@ for ((i=0;i<${#parts[@]};i++)); do
fi
if ((not)); then
minus=" $minus $p "
minus="$minus $p"
else
plus="$plus $p"
fi
@ -2360,7 +2363,7 @@ done
local n before=0
while read -r n; do
[[ -z "$n" ]] && continue
[[ "$minus" =~ [[:space:]]${n}[[:space:]] ]] && continue
[[ " $minus " =~ [[:space:]]${n}[[:space:]] ]] && continue
((before)) && echo -n " "; before=1
echo -n "$n"
done < <( tr " " "\n" <<<"$plus" | sort -n | uniq )