[pve-devel] [PATCH] Make qm clone working with devices.
Daniel Hunsaker
danhunsaker at gmail.com
Sun Oct 26 02:13:25 CEST 2014
Wouldn't this cause issues with multiple systems attempting to control the
same device simultaneously?
On Oct 25, 2014 12:07 PM, "Jasmin Jessich" <jasmin at anw.at> wrote:
> Signed-off-by: Jasmin Jessich <jasmin at anw.at>
> ---
> PVE/API2/Qemu.pm | 5 ++++-
> PVE/QemuServer.pm | 8 ++++++++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index a0fcd28..32ee6de 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -71,6 +71,7 @@ my $check_storage_access_clone = sub {
> my ($ds, $drive) = @_;
>
> my $isCDROM = PVE::QemuServer::drive_is_cdrom($drive);
> + my $isDEVICE = PVE::QemuServer::drive_is_device($drive);
>
> my $volid = $drive->{file};
>
> @@ -86,7 +87,7 @@ my $check_storage_access_clone = sub {
> $sharedvm = 0 if !$scfg->{shared};
>
> }
> - } else {
> + } elsif (!$isDEVICE) {
> my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
> my $scfg = PVE::Storage::storage_config($storecfg, $sid);
> $sharedvm = 0 if !$scfg->{shared};
> @@ -2260,6 +2261,8 @@ __PACKAGE__->register_method({
> die "unable to parse drive options for '$opt'\n" if
> !$drive;
> if (PVE::QemuServer::drive_is_cdrom($drive)) {
> $newconf->{$opt} = $value; # simply copy
> configuration
> + } elsif (PVE::QemuServer::drive_is_device($drive)) {
> + $newconf->{$opt} = $value; # simply copy
> configuration
> } else {
> if ($param->{full}) {
> die "Full clone feature is not available"
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 98264d1..49fbffa 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -1272,6 +1272,14 @@ sub drive_is_cdrom {
>
> }
>
> +sub drive_is_device {
> + my ($drive) = @_;
> +
> + my $volid = $drive->{file};
> +
> + return $volid && $volid =~ m/^\/dev\//;
> +}
> +
> sub parse_hostpci {
> my ($value) = @_;
>
> --
> 1.8.3.2
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20141025/2d95a2b7/attachment.htm>
More information about the pve-devel
mailing list