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+ Bash 4.0+
qemu-img qemu-img
libvirt tools: libvirt tools:
virt-clone virt-clone
virt-xml virt-xml
virt-xml-validate virt-xml-validate
xmllint (from libxml2) xmllint (from libxml2)
If you want to easily establish graphical connections to your virtual 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 libvirt. It is unknown how widespread this issue is, but it is the reason
that the default directory storage-qq2clone does not start with '.' 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 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. track it and will not be able to perform commands on it anymore. This will
If virsh undefine is run on a clone, qq2clone will not be able to see be addressed in the future using custom metadata in the libvirt domain
it once it is turned off. This limitation will be eliminated or reduced in XML. If the user undefines a domain, this will obviously cause it to
the future, when qq2clone moves away from relying on virsh and implements disappear from qq2clone's perspective when it is turned off, creating a
direct usage of the libvirt API. It could be addressed now by using discrepancy in its database. This can be fixed with **qq2clone** **check**.
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.
qq2clone can only produce clones by making qcow2 image files. The backing 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 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 \ domblklist $uuid --inactive;"; done \
< <( virsh list --all --uuid ) | virsh 2>&1 ) < <( 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 # We have all the disk files associated with domains, but we still need
# the ones referenced by template XML # the ones referenced by template XML
declare -a templates declare -a templates
@ -1981,8 +1984,8 @@ read -ra states \
local state m local state m
if (($1)); then if (($1)); then
#shellcheck disable=2119 #shellcheck disable=2119
# This is only a (functioning) mock implementation meant as a proof of # This is only a (functioning) mock implementation meant as a proof of
# concept for what XML describing qq2clone's current state may be like. # 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 # For this feature to be complete, it would: use a defined format, be
# implemented with proper, modular code, and contain all information to # implemented with proper, modular code, and contain all information to
# fully define qq2clone's state except for machine images and domain xml. # 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 # 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 # performant manner. It is a bit fragile, but not overly so assuming that
# virsh's output is fairly consistent across versions. This method is # virsh's output is fairly consistent across versions. This method is
# temporary, as later on qq2clone will include portions in (probably) C # temporary, as later on qq2clone will include portions in C that use the
# that use the libvirt API instead of virsh # libvirt API instead of virsh
check_template check_template
unset BAD_CL CL_MAP CL_STATE NAME_MAP 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 mkfifo "$temp/fifo" &>/dev/null || unexpected_error load_template
exec 4<>"$temp/fifo" exec 4<>"$temp/fifo"
virsh <&3 >&4 2>&4 & 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 c; for ((c=5;c>0;c--)); do read -r <&4; done
local prompt="virsh #" # In the virsh shell, input lines start with this local prompt="virsh #" # In the virsh shell, input lines start with this
@ -2202,7 +2205,7 @@ save_domain ()
# PARAMETERS: $1: Machine number # PARAMETERS: $1: Machine number
#=========================================================================# #=========================================================================#
{ {
local uuid local uuid
uuid="${CL_MAP["$1"]}" uuid="${CL_MAP["$1"]}"
virsh managedsave "$uuid" &>/dev/null virsh managedsave "$uuid" &>/dev/null
return 0 return 0
@ -2350,7 +2353,7 @@ for ((i=0;i<${#parts[@]};i++)); do
fi fi
if ((not)); then if ((not)); then
minus=" $minus $p " minus="$minus $p"
else else
plus="$plus $p" plus="$plus $p"
fi fi
@ -2360,7 +2363,7 @@ done
local n before=0 local n before=0
while read -r n; do while read -r n; do
[[ -z "$n" ]] && continue [[ -z "$n" ]] && continue
[[ "$minus" =~ [[:space:]]${n}[[:space:]] ]] && continue [[ " $minus " =~ [[:space:]]${n}[[:space:]] ]] && continue
((before)) && echo -n " "; before=1 ((before)) && echo -n " "; before=1
echo -n "$n" echo -n "$n"
done < <( tr " " "\n" <<<"$plus" | sort -n | uniq ) done < <( tr " " "\n" <<<"$plus" | sort -n | uniq )