Show a Shareable checkbox when attaching an existing volume whose
PVC is RWX Block and not provisioned by Longhorn. Checking it sets
disk.shareable and shows a data-corruption warning banner.
Related issue: harvester/harvester#9650
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
* feat(vm): allow Cloud Config for Windows guests
Currently the Cloud Config editor is completely hidden when a VM's
OS Type is set to Windows, and no `cloudinitdisk` volume or secret
is written to the VM spec even if the user has entered content.
This blocks a common Windows-on-Harvester workflow: using
Cloudbase-Init to run first-boot configuration (install VMDP,
enable OpenSSH server, add authorized_keys, join a domain, run
`runcmd` steps, etc.). Users on Windows today have to hand-edit the
VM YAML after creation to attach a cloudinitdisk, which is fragile
and undiscoverable.
Changes:
- Remove the `v-if="!isWindows"` on the CloudConfig component so
the editor is available for every OS type. The Sysprep editor
continues to render only for Windows, so Windows now gets both
panels; Linux is unchanged.
- Drop the `if (!this.isWindows)` guard around the cloudinitdisk
volume serialization so the disk is attached whenever the user
provided user-data or network-data, regardless of OS.
- Drop the `|| this.isWindows` early-return in `saveSecret` so the
cloud-init secret is persisted for Windows VMs too.
- `getInitUserData` now returns a bare `#cloud-config\n` header for
Windows instead of the Linux qemu-guest-agent runcmd template
(which would fail on Cloudbase-Init). VMDP installs the QGA on
Windows as a native service, so the runcmd path is not needed.
The "Install guest agent" checkbox stays disabled for Windows
because it specifically drives the Linux QGA-via-runcmd recipe.
Fixes point 2 of harvester/harvester#11124.
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>
* fix(vm): do not clear cloud-config on isWindows watcher fire
The isWindows watcher runs on every change of the isWindows computed
property, including on mount when editing an existing Windows VM. Setting
this['userScript'] and this['networkScript'] to undefined at that point
wipes the cloud-config data that was just loaded from the existing VM's
cloudinit secret, so the Advanced -> Cloud Config editor shows empty
even though the VM has data on the wire.
Remove the two clears - Cloud Config is now supported for Windows guests
by this PR, so there is no reason to unset the user/network scripts when
the OS type is Windows. sshKey and installAgent remain gated (SSH keys
are injected via cloud-init on Linux only, and the qemu-guest-agent
package install checkbox does not apply to Windows).
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>
Co-authored-by: Volker Theile <vtheile@suse.com>
* refactor(vm): Get CloudInit working for VM templates
- Remove unnecessary osType watcher in cloud config. The watcher (see `pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCloudConfig/DataTemplate.vue`) that cleared the cloud config template for Windows VMs is no longer necessary.
- Automatically strip the CloudInit `User Data` properties `package_update` and `packages` for OS type `Windows`.
Signed-off-by: Volker Theile <vtheile@suse.com>
---------
Signed-off-by: Alejandro Bonilla <abonilla@suse.com>
Signed-off-by: Volker Theile <vtheile@suse.com>
Co-authored-by: Volker Theile <vtheile@suse.com>
* refactor: extract access mode strings to static ACCESS_MODE constant
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: destructure ACCESS_MODE variables in CDISettings.vue accessModeOptions
* refactor: destructure ACCESS_MODE at top level in all consumer files
* fix(lint): reorder imports to top of module in CDISettings, harvesterhci.io.volume, and VirtualMachineVolume
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* fix: regenerate stale cloud-init secret name after VM name change
When creating a VM, the cloud-init/sysprep secret name was generated
once and cached for the component's lifetime (needNewSecret is always
false during create). If a first create attempt was rejected by the
API (e.g. duplicate name) and the user corrected the name and retried,
the VM was created successfully but reused the secret name derived
from the rejected attempt, and any subsequent secret-creation failure
surfaced as a stale error after the VM already existed.
Now the secret name (and Windows sysprep secret name) is regenerated
whenever the VM name prefix used to generate it no longer matches the
current name, and is proactively reset on a failed create attempt so
retries always start fresh.
Fixesharvester/harvester#11174
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: copilot review
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: remove console
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* feat: allow suer give static IP for VM
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add feature flag
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add VM display name annotation support in edit and list views
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: add display name checkbox and input field
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
when implementing the first version pci device passthrough,
we didn't have our own device plugin, then resource name was changed
after upgrade.
Right now, we already have our own device plugin, which we can control
resource name by our ourselves. So, we can remove old mechanism.
Signed-off-by: Jack Yu <jack.yu@suse.com>
* feat: add filesystem tab
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add filesystem tab in create VM page
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: update some wordings
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add support for filesystem feature flag and enable filesystem tab
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: remove unneeded wordings
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add support for filesystem feature flag and update icon button positioning
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: based on copilot review
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: remove wrong feature flag
Signed-off-by: Andy Lee <andy.lee@suse.com>
* fix: vm template
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add filesystem tab
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add filesystem tab in create VM page
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: update some wordings
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add support for filesystem feature flag and enable filesystem tab
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: remove unneeded wordings
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add support for filesystem feature flag and update icon button positioning
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: based on copilot review
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: tab name
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* fix: vGPU / USB enable/disable actions needs to be hidden for read only users
Signed-off-by: Andy Lee <andy.lee@suse.com>
* style: add scoped styles for group actions in DeviceList component
Signed-off-by: Andy Lee <andy.lee@suse.com>
* style: remove width property from group actions in DeviceList components
Signed-off-by: Andy Lee <andy.lee@suse.com>
* fix: update logging type in init function and improve SideNav visibility handling
Signed-off-by: Andy Lee <andy.lee@suse.com>
* fix: ensure canManageGroup only returns true for non-empty rows with updatable permissions
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add generic error for API response 40X
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: fallback error msg
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: update error msg
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: based on comment
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: add banner in PCI Devices page
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: based on copilot review
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add another filter button
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add feature falg to hide vGPU enable/disable actions in PCIDevices page
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: update with conditionally rendering
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add wanring message when disabling a device that haven not been detached in the backend
Signed-off-by: Jack Yu <jack.yu@suse.com>
* fix: remove unused en-us key
Signed-off-by: Jack Yu <jack.yu@suse.com>
---------
Signed-off-by: Jack Yu <jack.yu@suse.com>
* fix: allow edit as yaml in create VM page if empty CPU or memory
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor: remove getCPUMemoryValidation
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add maxCPU and maxMemory
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add hotplug dialog
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add restart message
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: let VM template support cpuMemoryHotplug
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add feature flag
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add max-hotplug-ratio setting
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* chore: disable vmstate-persistence and longhorn-static StorageClasses
Signed-off-by: Nick Chung <nick.chung@suse.com>
* chore: allow internal storage class deletions in image and volumn
Signed-off-by: Nick Chung <nick.chung@suse.com>
* chore: remove deletion tooltips in image and volume pages
Signed-off-by: Nick Chung <nick.chung@suse.com>
* chore: rollback style changes of image and volume lists
Signed-off-by: Nick Chung <nick.chung@suse.com>
---------
Signed-off-by: Nick Chung <nick.chung@suse.com>
* fix error banner can't be dismissed
Signed-off-by: Andy Lee <andy.lee@suse.com>
* update all CruResource
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* reset network / user script when choosing windows
Signed-off-by: Andy Lee <andy.lee@suse.com>
* change OS type from Windows init user and network data
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>
* fix unable to detach PCI & USB device in VM edit page
Signed-off-by: Andy Lee <andy.lee@suse.com>
* refactor based on comment
Signed-off-by: Andy Lee <andy.lee@suse.com>
* using set from shell/utils/object
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Andy Lee <andy.lee@suse.com>