[libvirt] [sandbox PATCH 2/3] Only create the destination path if it does not exist.

Daniel P. Berrange berrange at redhat.com
Mon Apr 22 16:46:05 UTC 2013


On Mon, Apr 22, 2013 at 12:26:30PM -0400, dwalsh at redhat.com wrote:
> From: Dan Walsh <dwalsh at redhat.com>
> 
> OpenShift will be creating the path within its management layer.
> ---
>  bin/virt-sandbox-service | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
> index 31aa6a1..dd30993 100755
> --- a/bin/virt-sandbox-service
> +++ b/bin/virt-sandbox-service
> @@ -272,7 +272,8 @@ class Container:
>      def create(self):
>          self.connect()
>          self.config.set_shell(True)
> -        os.mkdir(self.dest)
> +        if not os.path.exists(self.dest):
> +            os.mkdir(self.dest)
>  
>      def connect(self):
>          if not self.conn:

ACK to this chunk.

> @@ -331,6 +332,9 @@ class GenericContainer(Container):
>          self.save_config()
>  
>      def create(self):
> +        config_path = self.get_config_path()
> +        if os.path.exists(config_path):
> +            raise ValueError([_("%s already exists") % config_path ])

This appears to be unrelated to the subject of this patch. Please move
it to a separate commit.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list