[PATCH tck 2/5] Create has_disk_image from code of get_virt_builder_disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Cédric Bosdonnat <cedric.bosdonnat@xxxxxxx>

This function will later be reused to check if a first boot is needed.
---
 lib/Sys/Virt/TCK.pm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index a3d06a2..04bdbf4 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -375,6 +375,19 @@ sub create_sparse_disk {
 }
 
 
+sub has_disk_image {
+    my $self = shift;
+    my $bucket = shift;
+    my $name = shift;
+    my $osname = shift;
+
+    my $dir = $self->bucket_dir($bucket);
+
+    my $target = catfile($dir, $name);
+
+    return -f $target
+}
+
 sub create_virt_builder_disk {
     my $self = shift;
     my $bucket = shift;
@@ -387,7 +400,7 @@ sub create_virt_builder_disk {
 
     my $password = $self->root_password;
 
-    if (-f $target) {
+    if ($self->has_disk_image($bucket, $name, $osname)) {
 	return $target;
     }
 
-- 
2.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]