Why is qvm-move symlink'ed to qvm-copy?

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?

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.


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 :

1 Like

A “move” is just a “copy” plus a “delete” afterward.

1 Like

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