<p dir="ltr">Also note that "colon" (:) only has one "l"...</p>
<br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 31, 2015, 07:48 Alen Grizonic <<a href="mailto:a.grizonic@proxmox.com">a.grizonic@proxmox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/PVE/HA/Tools.pm | 15 +++++++++++----<br>
1 file changed, 11 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/PVE/HA/Tools.pm b/src/PVE/HA/Tools.pm<br>
index 94613de..2b9ca6c 100644<br>
--- a/src/PVE/HA/Tools.pm<br>
+++ b/src/PVE/HA/Tools.pm<br>
@@ -5,6 +5,7 @@ use warnings;<br>
use JSON;<br>
use PVE::JSONSchema;<br>
use PVE::Tools;<br>
+use PVE::Cluster;<br>
<br>
PVE::JSONSchema::register_format('pve-ha-resource-id', \&pve_verify_ha_resource_id);<br>
sub pve_verify_ha_resource_id {<br>
@@ -18,7 +19,7 @@ sub pve_verify_ha_resource_id {<br>
}<br>
<br>
PVE::JSONSchema::register_standard_option('pve-ha-resource-id', {<br>
- description => "HA resource ID. This consists of a resource type followed by a resource specific name, separated with collon (example: vm:100).",<br>
+ description => "HA resource ID. This consists of a resource type followed by a resource specific name, separated with collon (example: vm:100 / ct:100).",<br>
typetext => "<type>:<name>",<br>
type => 'string', format => 'pve-ha-resource-id',<br>
});<br>
@@ -35,7 +36,7 @@ sub pve_verify_ha_resource_or_vm_id {<br>
}<br>
<br>
PVE::JSONSchema::register_standard_option('pve-ha-resource-or-vm-id', {<br>
- description => "HA resource ID. This consists of a resource type followed by a resource specific name, separated with collon (example: vm:100). For virtual machines, you can simply use the VM id as shortcut (example: 100).",<br>
+ description => "HA resource ID. This consists of a resource type followed by a resource specific name, separated with collon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as shortcut (example: 100).",<br>
typetext => "<type>:<name>",<br>
type => 'string', format => 'pve-ha-resource-or-vm-id',<br>
});<br>
@@ -69,8 +70,14 @@ sub parse_sid {<br>
<br>
if ($sid =~ m/^(\d+)$/) {<br>
$name = $1;<br>
- $type ='vm';<br>
- $sid = "vm:$name";<br>
+ my $vmlist = PVE::Cluster::get_vmlist();<br>
+ my $type = $vmlist->{ids}->{$name}->{type};<br>
+ if ($type eq 'lxc') {<br>
+ $type = 'ct';<br>
+ } elsif ($type eq 'qemu') {<br>
+ $type = 'vm';<br>
+ }<br>
+ $sid = "$type:$name";<br>
} elsif ($sid =~m/^(\S+):(\S+)$/) {<br>
$name = $2;<br>
$type = $1;<br>
--<br>
2.1.4<br>
<br>
<br>
_______________________________________________<br>
pve-devel mailing list<br>
<a href="mailto:pve-devel@pve.proxmox.com" target="_blank">pve-devel@pve.proxmox.com</a><br>
<a href="http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel" rel="noreferrer" target="_blank">http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel</a><br>
</blockquote></div>