[Libguestfs] [PATCH 3/3] RHEV: Cleanup volumes on unclean shutdown

Richard W.M. Jones rjones at redhat.com
Tue Jun 8 16:00:12 UTC 2010


On Tue, Jun 08, 2010 at 04:43:06PM +0100, Matthew Booth wrote:
> On 08/06/10 16:24, Richard W.M. Jones wrote:
>> (a) I don't think Perl 'rename' function will work if the temporary
>> directory is on a different filesystem from the final destination.
>> You might be better off using the 'mv' shell command (possibly with
>> suitable shell quoting) instead.
>
> This is ok, because the temporary directory is explicitly created on the  
> export storage domain, so it won't cross a filesystem boundary. I do  
> this specifically to avoid an additional data copy.
>
> +    my $root = "$mountdir/$domainuuid";
>
> $root is the top level directory of the export storage domain. Because  
> it's a subdirectory of $mountdir, it's on NFS.
>
> +    unless (defined($tmpdir)) {
> +        my $nfs = Sys::VirtV2V::Target::RHEV::NFSHelper->new(sub {
> +            print tempdir("v2v.XXXXXXXX", DIR => $root);
> +        });
>
> The NFS helper creates a new temporary directory will the given template  
> under $root, so is also on NFS. NFSHelper works with stdout, so it  
> prints the result.
>
> +        my $fromchild = $nfs->{fromchild};
> +        ($tmpdir) = <$fromchild>;
>
> $tmpdir is the first line of output from the child.
>
> +        $nfs->check_exit();
>
> check_exit() will die() with error output if there was any error.

Right, I understand it now.

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list