On 5/14/20 11:11 AM, Fabian Ebner wrote:
On 5/12/20 3:45 PM, Mira Limbeck wrote:
For better warnings regarding replicated disks and the ignored target
storage, add the 'is_replicated' field to the migration check result.
This contains the result of the replication checks. The first one
checks if
the VM is replicated, and the second one checks if the VM is
replicated to
the target node.
Signed-off-by: Mira Limbeck <m.limb...@proxmox.com>
---
PVE/API2/Qemu.pm | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index fd51bf3..f88ea6d 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3329,7 +3329,11 @@ __PACKAGE__->register_method({
local_resources => {
type => 'array',
description => "List local resources e.g. pci, usb"
- }
+ },
+ is_replicated => {
+ type => 'boolean',
+ description => 'Indicates if the VM is replicated to the
target node'
+ },
},
},
code => sub {
@@ -3382,6 +3386,14 @@ __PACKAGE__->register_method({
$res->{local_resources} = $local_resources;
+ my $repl_conf = PVE::ReplicationConfig->new();
+ if (defined($target)) {
+ $res->{is_replicated} =
($repl_conf->check_for_existing_jobs($vmid, 1) // 0)
+ && defined($repl_conf->find_local_replication_job($vmid,
$target)) ? 1 : 0;
Nit: the second check should be enough here.
Yes, you're right. The second one is enough as it contains the first one
already.
+ } else {
+ $res->{is_replicated} = 0;
+ }
+
return $res;
_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel