]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Storage/Scan.pm
test: also pass format for backing base image
[pve-storage.git] / PVE / API2 / Storage / Scan.pm
index bd6c264923ef10414697721b4092ab04704ff0fb..d7a87431feeeacea93c56cf1bbd5c8b00f41f524 100644 (file)
@@ -47,7 +47,7 @@ __PACKAGE__->register_method({
            { method => 'iscsi' },
            { method => 'lvm' },
            { method => 'nfs' },
-           { method => 'usb' },
+           { method => 'pbs' },
            { method => 'zfs' },
        ];
 
@@ -174,6 +174,71 @@ __PACKAGE__->register_method({
        return $data;
     }});
 
+__PACKAGE__->register_method({
+    name => 'pbsscan',
+    path => 'pbs',
+    method => 'GET',
+    description => "Scan remote Proxmox Backup Server.",
+    protected => 1,
+    proxyto => "node",
+    permissions => {
+       check => ['perm', '/storage', ['Datastore.Allocate']],
+    },
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+           server => {
+               description => "The server address (name or IP).",
+               type => 'string', format => 'pve-storage-server',
+           },
+           username => {
+               description => "User-name or API token-ID.",
+               type => 'string',
+           },
+           password => {
+               description => "User password or API token secret.",
+               type => 'string',
+           },
+           fingerprint => get_standard_option('fingerprint-sha256', {
+               optional => 1,
+           }),
+           port => {
+               description => "Optional port.",
+               type => 'integer',
+               minimum => 1,
+               maximum => 65535,
+               default => 8007,
+               optional => 1,
+           },
+       },
+    },
+    returns => {
+       type => 'array',
+       items => {
+           type => "object",
+           properties => {
+               store => {
+                   description => "The datastore name.",
+                   type => 'string',
+               },
+               comment => {
+                   description => "Comment from server.",
+                   type => 'string',
+                   optional => 1,
+               },
+           },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $password = delete $param->{password};
+
+       return PVE::Storage::PBSPlugin::scan_datastores($param, $password);
+    }
+});
+
 # Note: GlusterFS currently does not have an equivalent of showmount.
 # As workaround, we simply use nfs showmount.
 # see http://www.gluster.org/category/volumes/
@@ -381,46 +446,4 @@ __PACKAGE__->register_method({
        return PVE::Storage::scan_zfs();
     }});
 
-__PACKAGE__->register_method({
-    name => 'usbscan',
-    path => 'usb',
-    method => 'GET',
-    description => "List local USB devices.",
-    protected => 1,
-    proxyto => "node",
-    permissions => {
-       check => ['perm', '/', ['Sys.Modify']],
-    },
-    parameters => {
-       additionalProperties => 0,
-       properties => {
-           node => get_standard_option('pve-node'),
-       },
-    },
-    returns => {
-       type => 'array',
-       items => {
-           type => "object",
-           properties => {
-               busnum => { type => 'integer'},
-               class => { type => 'integer'},
-               devnum => { type => 'integer'},
-               level => { type => 'integer'},
-               manufacturer => { type => 'string', optional => 1 },
-               port => { type => 'integer'},
-               prodid => { type => 'string'},
-               product => { type => 'string', optional => 1 },
-               serial => { type => 'string', optional => 1 },
-               speed => { type => 'string'},
-               usbpath => { type => 'string', optional => 1},
-               vendid => { type => 'string'},
-           },
-       },
-    },
-    code => sub {
-       my ($param) = @_;
-
-       return PVE::SysFSTools::scan_usb();
-    }});
-
 1;