On a debian-11-minimal based qube, I see qvm-move is symbolic linked to qvm-copy:
[user@dotfiles]:~ % whereis qvm-move
qvm-move: /usr/bin/qvm-move
[user@dotfiles]:~ % ls -la /usr/bin/qvm-move
lrwxrwxrwx 1 root root 8 Mar 13 03:14 /usr/bin/qvm-move -> qvm-copy
[user@dotfiles]:~ % whereis qvm-copy
qvm-copy: /usr/bin/qvm-copy /usr/share/man/man1/qvm-copy.1.gz
[user@dotfiles]:~ % ls -la /usr/bin/qvm-copy
-rwxr-xr-x 1 root root 3.0K Mar 13 03:14 /usr/bin/qvm-copy
[user@dotfiles]:~ %
Yet, when I use qvm-move
the subject file doesn’t remain in the source qube. How can qvm-copy act both as “copy” and “move” functions?
SteveC
April 13, 2023, 7:27pm
#2
It’s quite possible that it looks at the value of $0…i.e., the name you called it with on the command line. If $0=“qmv-move” it does a move, otherwise it does a copy.
Doing things this way cuts down on maintenance, since most of the code is common between the two different modes of operation.
3 Likes
I should take a look at the source code for the qvm-move/qvm-copy, but it probably the way you just described.
This is exactly as @SteveC describe :
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
unset PROGRESS_TYPE OPERATION_TYPE TARGET_TYPE MIN_ARGS FILECOPY_TOTAL_SIZE
case ${0##*/} in
(qvm-move) OPERATION_TYPE=move TARGET_TYPE=default MIN_ARGS=1;;
(qvm-copy) OPERATION_TYPE=copy TARGET_TYPE=default MIN_ARGS=1;;
(qvm-copy-to-vm) OPERATION_TYPE=copy TARGET_TYPE=vm MIN_ARGS=2;;
(qvm-move-to-vm) OPERATION_TYPE=move TARGET_TYPE=vm MIN_ARGS=2;;
(*) printf 'Invoked with unrecognized name %s, cannot determine operation to perform\n' "$0"; exit 1;;
esac
usage () {
if [ "$TARGET_TYPE" = "vm" ]; then
echo "usage: $0 [--without-progress] destination_qube_name FILE [FILE ...]"
else
1 Like
adw
April 13, 2023, 11:19pm
#5
A “move” is just a “copy” plus a “delete” afterward.
1 Like
SteveC
April 13, 2023, 11:20pm
#6
Slightly OT but, in the same way that renaming a qube is just a clone (to the new name) followed by a delete.
1 Like