5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-02-25 17:57:31 +03:00

1839 Commits

Author SHA1 Message Date
Wolfgang Bumiller
27591290c7 use stderr from qemu-img invocation as error
Instead of just using it as a warning and then trying to parse an
empty string as json.

For example, trying to parse unsupported vmdks, previously we'd see
something like this:

  qemu-img: Could not open
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk':
  Unsupported image type 'vsanSparse'
  could not parse qemu-img info command output for
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk'
  - malformed JSON string, neither tag, array, object, number, string
  or atom, at character offset 0 (before "(end of string)") at
  src/PVE/Storage/Plugin.pm line 962, <DATA> line 960.

Now it simply shows:

  qemu-img: Could not open
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk':
  Unsupported image type 'vsanSparse'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-04-04 17:26:59 +02:00
Thomas Lamprecht
d09ed4bf76 esxi: status: mark as active if its mounted
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-28 19:12:06 +01:00
Thomas Lamprecht
73f4faefb3 esxi: drop unused variable and commented out code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-28 19:11:33 +01:00
Thomas Lamprecht
0251b6d814 bump version to 8.1.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-28 17:37:32 +01:00
Thomas Lamprecht
0d8a6f2901 d/control: bump versioned dependency for esxi-import-tool
to ensure new port-related CLI options are available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-28 17:37:26 +01:00
Wolfgang Bumiller
702049157b esxi: add 'port' config parameter
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-28 14:34:24 +01:00
Thomas Lamprecht
a71c404392 bump version to 8.1.3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-27 13:13:57 +01:00
Thomas Lamprecht
897662bac5 esxi: reduce cache invalidation time to 30s
Reduce the time the cache stays valid from 60s to 30s, while this
could double the amount of requests in the worst case, it's still not
that frequent and also halves the maximal time a user has to wait to
see changes on the ESXi side to appear here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-27 13:13:14 +01:00
Aaron Lauterer
b29a8c3596 esxi: use mac address when static, generated and vpx
static -> defined manually
generated -> by ESXi
vpx -> generated by vCenter

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2024-03-27 10:52:07 +01:00
Thomas Lamprecht
291f8c7dbc bump version to 8.1.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-22 16:39:30 +01:00
Thomas Lamprecht
d0e43cfa4b d/control: bump versioned dependency for esxi-import-tool
to ensure new CLI options for dropping privileges are available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-22 16:39:12 +01:00
Wolfgang Bumiller
9bb651effa esxi: have the fuse process drop its privileges
once it's mounted it only needs to make http requests and talk to the
open fuse fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-22 13:24:20 +01:00
Wolfgang Bumiller
06a28968d8 esxi: use listvms.py's stderr as error message
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-22 11:06:56 +01:00
Gabriel Goller
688cc11a29 esxi: detect correct os type in 'other' family
This patch introduces the conversion table for all possible OS Types
that are in the VMWare 'other' family and sets the pve counterpart.
Our default OS Type is 'linux', so including mappings to 'other' makes
sense.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2024-03-22 10:06:22 +01:00
Dominik Csapak
c9bece6986 esxi: only add scsihw if it's defined
otherwise we get `scsihw: null` from the api, which is not a valid
value, so just omit it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-19 18:09:42 +01:00
Dominik Csapak
0f940f10fc esxi: add warning for losing efi state
we cannot import the state of the efivars (e.g. boot order)
so add a warning for that

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: add new warning to return schema ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-19 18:09:29 +01:00
Thomas Lamprecht
85fbbb2f96 bump version to 8.1.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:52 +01:00
Thomas Lamprecht
0a2f75ffd6 esxi: deactivate storage if config gets updated
to ensure that the next access actually uses the updated config for
accessing the remote ESXi, for both manifest API and FUSE mount.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
68f3ec3f8b esxi: clean-up state-dir in deactivate storage
to ensure we always query a new one on quick add-delete-add cycles.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
72418e2f05 esxi: deactivate storage on deletion from config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
2ff6f99c60 esxi: add 'skip-cert-verification' option
following pve-esxi-import-tools's commits:
3ee5c3b ("esxi-folder-fuse: add --insecure option")
c292c67 ("listvms.py: add --insecure parameter, verify cert by
          default")
34c87be ("rename --insecure option to --skip-cert-verification")

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: rename 'insecure' to 'skip-cert-verification' to better convey
   what it means ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Dominik Csapak
4f50a578f4 import: rework plugin api to not need a blessed object
does not really make sense, and if the plugin wants that, it can still
be done, like we do here for the ESXiPlugin

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
c92d810053 import: drop target parameter
since disks are a separate hash now with no associated storage, we
don't need this anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
10b5874078 esxi: add disk capacity to import metadata
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
1128100569 esxi: warn if the guest was running
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
aba709f247 esxi: add helper to get vm from manifest for vmx path
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
99ace9d447 esxi: let manifest file expire after 60s
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: fix wrong comparison with >= and avoid undef warning if file
   does not yet exist at all ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
814bde1958 esxi: drop unused sub methods
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: squash removal of both subs into one commit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
1a94dceb6f api: import-metadata: make warnings structured & merge ignored-volumes
This allows the frontends to translate them and avoids somewhat
duplicated info by having some warnings explicitly (ignored-volumes)
while others are in the warnings array.

By passing along the key and the value the frontend can also show the
warnings in-line, e.g. by marking a disk-entry in a grid as having
potential problems.

Ideally we'd have a central list of known types used for the API
return schema enum and to check when calling the $warn closure, but as
we only got three warnings keep this as is and only add a comment.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
b628964289 api: import-metadata: complete return schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
da513e260c esxi plugin: do not support the images content-type
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Thomas Lamprecht
dde640eda7 esxi plugin: adapt to new libexec path for helpers
and rename the name of the constant for the FUSE tool, as otherwise it
sounds like this was the mountpoint to be used

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
5e934933ec esxi import: deal with serial devices
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
fd16d98451 add source field to import-metadata
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
203d73baf9 add a warnings array to import-metadata
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
a3271a47ca esxi: improve scsihw detection
we should actually keep the scsihw even with eg. linux VMs as they
might not have virtio/... in their initrd and then fail to boot

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
728c08b2f0 esxi: separate disks and network
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
763a2292f3 import: return skipped/ignored volumes in get_create_args
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
e72845efbf api: add storage/{storage}/import-metadata
This will be used for returning the base meta information of a
external VM that is about to be imported into Proxmox VE.

A front-end can use this endpoint to show the proposed configs with
potential override switches to the user, so that they can adapt the
most important options to ensure that import can work.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: add more commit message with some background ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 15:29:35 +01:00
Wolfgang Bumiller
a171036789 add ESXi plugin for import and wire-it up to a new get_guest_import plugin fn
The get_guest_import fn is currently a private/internal API and should
not yet be exposed as a public part of the storage API.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 15:17:55 +01:00
Wolfgang Bumiller
a02056f8df bump pve-common dep to 8.1.1 for PVE::Systemd::unit_is_active
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-13 12:25:43 +01:00
Wolfgang Bumiller
bf453532b0 storage plugins: add 'import' content type
Add a new 'import' content type which will be the corner stone for a
better API and UI integrated way to import virtual guests into Proxmox
VE.

For starters this will be used to implement a ESXi adapter, so that
those VMs can get imported nicely.

Later we want to integrate the OVF/OVA import skeletons we got in
qemu-server to something more usable here.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: add more commit message with some background ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-13 12:25:00 +01:00
Thomas Lamprecht
eaf6995afd bump version to 8.1.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-06 18:26:18 +01:00
Thomas Lamprecht
ee283b6d57 buildsys: cleanup all docs and shell comnpletion artefacts
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-05 11:26:30 +01:00
Thomas Lamprecht
8d060d6749 d/copyright: update years
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-03-01 10:13:24 +01:00
Thomas Lamprecht
71176c2b8c d/control: add dependency relation on libpve-access-control
We actually use it already (partially without perl use statement) and
the use of the new Sys.AccessNetwork privilege should be version
guarded too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-02-28 15:51:25 +01:00
Thomas Lamprecht
17e0b01b7f fix #5254: api: allow usage of download-url with Sys.AccessNetwork
The download-url API endpoint has some implications that admins are
unaware of, namely that it basically allow to scan the whole network
via HTTP URLs, and potentially even download some image that the user
should not have access to and adding to a VM that the user controls.

That's why in addition to the Datastore.AllocateTemplate privilege on
the storage, the Sys.Modify on the whole Cluster was required to use
the API call. That design was chosen as we were not fully sure if a
separate privilege is warranted, but user feedback has shown that the
(not so big) cost of adding such a new privilege is justified.

Change the permission check to allow the combination of
Datastore.AllocateTemplate on the storage and either 'Sys.Modify' on
/, for backwards compatibility, or the newer 'Sys.AccessNetwork' on
the node that handles the download.
Using a node-specific ACL path allows admins to e.g. prepare one
specific node's firewall so that pveproxy can access only a safe set
of hosts via outgoing HTTP (not stemming from valid connection
tracking to the PVE API), and thus even further limit the privileges
of users or tools that are trusted to download images to a storage.

Buglink: https://bugzilla.proxmox.com/show_bug.cgi?id=5254
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-02-28 15:48:44 +01:00
Fiona Ebner
4abb327843 plugin schema: improve description of 'shared' property
It's not clear to users what this property does otherwise. Latest
report from the community forum:

https://forum.proxmox.com/threads/134393

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-30 12:42:36 +01:00
Fiona Ebner
0554c03683 plugin schema: improve description of 'nodes' property
The default description doesn't make it clear what the property is
used for in the context of storages.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-30 10:38:38 +01:00
Fiona Ebner
76aa80fc93 zfs: fix duplicate word typo in error message
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-01-30 10:25:41 +01:00