Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'maint-4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
gholms committed Aug 25, 2016
2 parents 3aa3b55 + 6484869 commit 278af0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
12 changes: 1 addition & 11 deletions tools/connect_iscsitarget_main.pl
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,7 @@ sub setup_virsh_secret {
$secret .= " </usage>\n";
$secret .= "</secret>\n";
$secret_path = $euca_home."/var/lib/eucalyptus/virsh_ceph_secret.xml";
if (open SECRET_FH, ">$secret_path") {
print SECRET_FH "$secret";
close SECRET_FH;
} else {
print STDERR "Unable to create $secret_path.\n";
do_exit(1);
}
run_cmd(1, 1, "virsh secret-define --file $secret_path");
run_cmd(1, 1, "virsh secret-define --file /dev/stdin", $secret);
run_cmd(1, 1, "virsh secret-set-value $uuid --base64 $ceph_key");
run_cmd(1, 0, "rm -f $secret_path");
}
Expand Down
14 changes: 11 additions & 3 deletions tools/iscsitarget_common.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
# IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
# NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.

use IPC::Open2;

$SK_TARGET = "target";
$SK_PORTAL = "portal"; # current portal
$SK_PPORTAL = "pportal"; # persistent portal
Expand Down Expand Up @@ -94,8 +96,15 @@ sub sanitize_path {
}

sub run_cmd {
my ($print_on_error, $exit_on_error, $command) = @_;
my @outlines = qx($command 2>&1);
my ($print_on_error, $exit_on_error, $command, $input) = @_;
my $pid = open2(\*OUTPUT, \*INPUT, $command . " 2>&1");
if (defined $input) {
print INPUT $input;
}
INPUT->autoflush();
close INPUT;
my @outlines = <OUTPUT>;
waitpid($pid, 0);
if ($? != 0) {
check_and_log_fault($command, @outlines);
$print_on_error and print STDERR "Failed to run '$command': @outlines";
Expand Down Expand Up @@ -319,4 +328,3 @@ sub get_disk_by_id_path {
return "";
}
}

0 comments on commit 278af0d

Please sign in to comment.