1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

fix(instances): the Migrate tab keeps disks of one file name apart

Two disks of a VM with the same file name in different directories
were both offered the same destination pool by default. The form was
sent, and the migration job refused it only then: both copies would
be one file.

The plan now gives each such disk, by default, a pool no earlier disk
of that name is copied into, and says under its choice that another
disk has the file name. A choice that still puts them in one pool is
refused by the job, as before.
This commit is contained in:
catborise 2026-11-02 16:21:45 +03:00
parent 394e659538
commit 9bcc6f714b
4 changed files with 32 additions and 7 deletions

View file

@ -23,6 +23,7 @@
{% endfor %}
{% endif %}
</select>
{% if disk.same_name %}<div class="form-text">{% trans "Another disk of the VM has this file name: copy them to different pools." %}</div>{% endif %}
{% elif disk.refusal %}
<p class="small text-danger mb-0" data-refused>{% blocktrans with reason=disk.refusal %}Cannot be copied: {{ reason }}{% endblocktrans %}</p>
{% elif pools %}

View file

@ -104,7 +104,7 @@ class MigrateJobTestCase(TransactionTestCase):
{"target": "vda", "path": "/i/mig-vm.qcow2", "capacity": 1 << 30, "shared": False, "refusal": None,
"free_pools": ["default", "fast"], "default": "default"},
{"target": "vdb", "path": "/i/data.qcow2", "capacity": 1 << 30, "shared": False, "refusal": None,
"free_pools": ["default"], "default": "default"},
"free_pools": ["default"], "default": "default", "same_name": True},
{"target": "sda", "path": "/i/os.iso", "capacity": 1 << 20, "shared": False,
"refusal": "an image is not copied; eject it first", "free_pools": [], "default": None}],
# the next start's disks the migration does not carry
@ -120,6 +120,7 @@ class MigrateJobTestCase(TransactionTestCase):
self.assertIn('<option value="fast">Copy to fast (8.0\xa0GB free)</option>', page)
self.assertIn('<option value="fast" disabled>fast has a file of this name</option>', page)
self.assertIn("Cannot be copied: an image is not copied; eject it first", page)
self.assertEqual(page.count("Another disk of the VM has this file name: copy them to different pools."), 1)
self.assertIn("A shut-off VM is started paused for a copy", page)
self.assertIn("/nfs/new.qcow2</span>:\n on storage both hosts share", page)
# a disk that cannot go keeps the form from being sent, as does a destination that does not answer