Commit 57ac27dd authored by fv3rdugo's avatar fv3rdugo
Browse files

[#344] To fix remove disk

Now add a new volume works
parent dc5fd9d4
...@@ -242,27 +242,25 @@ sub import_vbox { ...@@ -242,27 +242,25 @@ sub import_vbox {
my $name = <STDIN>; my $name = <STDIN>;
chomp $name; chomp $name;
my $path = $vm->dir_img."/".$name.".qcow2"; my $pool = $vm->dir_img."/".$name.".qcow2";
if ( $name && -e $file_vdi ) { if ( $name && -e $file_vdi ) {
my @cmd = ("qemu-img convert -p -f vdi -O qcow2 $file_vdi $path"); my @cmd = ("qemu-img convert -p -f vdi -O qcow2 $file_vdi $pool");
system(@cmd); system(@cmd);
print "Save image in default storage pool: $path \n"; print "Save image in default storage pool: $pool \n";
#new machine xml change source file #new machine xml change source file
my $id_iso; my $id_iso = 1;
my $id_owner = 2; my $id_owner = 1; #1 root or admin
my $id_base = "NULL";
my $domain = $vm->create_domain( name => $name my $domain = $vm->create_domain( name => $name
, id_iso => $id_iso , id_iso => $id_iso
, file_iso => '<NONE>'
, id_owner => $id_owner , id_owner => $id_owner
, is_base => 0 , iso_file => '<NONE>'
, id_base => $id_base); );
#remove cdrom #remove cdrom
$domain->remove_disks(); $domain->remove_disks();
#add new path #add new path
$domain->add_volume( path => $path ); $domain->add_volume( path => $pool );
exit; exit;
} }
print "Warning: Missing args or no such file! \n"; print "Warning: Missing args or no such file! \n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment