[pve-devel] [PATCH] Add copy_disk and change_disk command

Dietmar Maurer dietmar at proxmox.com
Fri May 22 13:18:24 CEST 2015


Well, I don't understand those changes - see comments inline:

> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index fae2872..8fbbe6d 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -20,7 +20,6 @@ use PVE::AccessControl;
>   use PVE::INotify;
>   use PVE::Network;
>   use PVE::API2::Firewall::VM;
> -use PVE::HA::Config;

why?

>    use Data::Dumper; # fixme: remove
>   @@ -688,7 +687,7 @@ __PACKAGE__->register_method({
>   	delete $conf->{snapshots};
>    	if (!$param->{current}) {
> -	    foreach my $opt (keys %{$conf->{pending}}) {
> +	    foreach my $opt (keys $conf->{pending}) {

looks wrong to me.

>   		next if $opt eq 'delete';
>   		my $value = $conf->{pending}->{$opt};
>   		next if ref($value); # just to be sure
> @@ -759,7 +758,7 @@ __PACKAGE__->register_method({
>    	my $res = [];
>   -	foreach my $opt (keys %$conf) {
> +	foreach my $opt (keys $conf) {

why?

>   	    next if ref($conf->{$opt});
>   	    my $item = { key => $opt };
>   	    $item->{value} = $conf->{$opt} if defined($conf->{$opt});
> @@ -768,7 +767,7 @@ __PACKAGE__->register_method({
>   	    push @$res, $item;
>   	}
>   -	foreach my $opt (keys %{$conf->{pending}}) {
> +	foreach my $opt (keys $conf->{pending}) {

why?

>   	    next if $opt eq 'delete';
>   	    next if ref($conf->{pending}->{$opt}); # just to be sure
>   	    next if defined($conf->{$opt});
> @@ -1299,19 +1298,17 @@ __PACKAGE__->register_method({
>   	$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 
> 8192)
>   	    if !$sslcert;
>   -	my ($remip, $family);
> +	my $port = PVE::Tools::next_vnc_port();
> +
> +	my $remip;
>   	my $remcmd = [];
>    	if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
> -	    ($remip, $family) = PVE::Cluster::remote_node_ip($node);
> +	    $remip = PVE::Cluster::remote_node_ip($node);

what is that?

>   	    # NOTE: kvm VNC traffic is already TLS encrypted or is known unsecure
>   	    $remcmd = ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes', $remip];
> -	} else {
> -	    $family = PVE::Tools::get_host_address_family($node);
>   	}
>   -	my $port = PVE::Tools::next_vnc_port($family);
> -
>   	my $timeout = 10;
>    	my $realcmd = sub {
> @@ -1339,7 +1336,7 @@ __PACKAGE__->register_method({
>   		my $qmstr = join(' ', @$qmcmd);
>    		# also redirect stderr (else we get RFB protocol errors)
> -		$cmd = ['/bin/nc6', '-l', '-p', $port, '-w', $timeout, '-e', "$qmstr 
> 2>/dev/null"];
> +		$cmd = ['/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr 
> 2>/dev/null"];
>   	    }
>    	    PVE::Tools::run_command($cmd);
> @@ -1503,6 +1500,16 @@ __PACKAGE__->register_method({
>   	return $res;
>       }});
>   +my $vm_is_ha_managed = sub {
> +    my ($vmid) = @_;
> +
> +    my $cc = PVE::Cluster::cfs_read_file('cluster.conf');
> +    if (PVE::Cluster::cluster_conf_lookup_pvevm($cc, 0, $vmid, 1)) {
> +	return 1;
> +    }
> +    return 0;
> +};
> +

?
...



More information about the pve-devel mailing list