Remove the ability to pass freeform parameters to Sys::Virt->new.
We don't use it, it makes the code more complex to modify, and
indeed there are no other args that Sys::Virt->new supports so
this would never be used.
Also change $readwrite to $rw to match parameter name.
have to call C<$g-E<gt>launch ()>.
The optional C<address> parameter can be added to specify the libvirt
have to call C<$g-E<gt>launch ()>.
The optional C<address> parameter can be added to specify the libvirt
-URI. In addition, L<Sys::Virt(3)> lists other parameters which are
-passed through to C<Sys::Virt-E<gt>new> unchanged.
The implicit libvirt handle is closed after this function, I<unless>
you call the function in C<wantarray> context, in which case the
The implicit libvirt handle is closed after this function, I<unless>
you call the function in C<wantarray> context, in which case the
my $first = shift;
my %params = @_;
my $first = shift;
my %params = @_;
- my $readwrite = $params{rw};
+ my $rw = $params{rw};
+ my $address = $params{address};
my @images = ();
if (ref ($first) eq "ARRAY") {
my @images = ();
if (ref ($first) eq "ARRAY") {
die __"open_guest: too many domains listed on command line"
if @images > 1;
die __"open_guest: too many domains listed on command line"
if @images > 1;
- $conn = Sys::Virt->new (readonly => 1, @_);
+ my @libvirt_args = ();
+ push @libvirt_args, address => $address if defined $address;
+
+ $conn = Sys::Virt->new (readonly => 1, @libvirt_args);
die __"open_guest: cannot connect to libvirt" unless $conn;
my @doms = $conn->list_defined_domains ();
my $isitinactive = 1;
die __"open_guest: cannot connect to libvirt" unless $conn;
my @doms = $conn->list_defined_domains ();
my $isitinactive = 1;
# In the case where we want read-only access to a domain,
# allow the user to specify an active domain too.
push @doms, $conn->list_domains ();
# In the case where we want read-only access to a domain,
# allow the user to specify an active domain too.
push @doms, $conn->list_domains ();
# We've now got the list of @images, so feed them to libguestfs.
my $g = Sys::Guestfs->new ();
foreach (@images) {
# We've now got the list of @images, so feed them to libguestfs.
my $g = Sys::Guestfs->new ();
foreach (@images) {
$g->add_drive ($_);
} else {
$g->add_drive_ro ($_);
$g->add_drive ($_);
} else {
$g->add_drive_ro ($_);