Skip to content

Commit b3c8784

Browse files
committed
Add details about winrm for hyperv
1 parent 358a655 commit b3c8784

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

source/adminguide/extensions/builtin_extensions.rst

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ After installing or upgrading Cloudstack, these extensions will show up as disab
3030
Proxmox
3131
^^^^^^^^
3232

33-
The Proxmox Cloudstack extension is written in shell script and communicates with a Proxmox cluster using the `Proxmox VE API`_.
33+
The Proxmox Cloudstack extension is written in shell script and communicates with a Proxmox cluster using the `Proxmox VE API`_ over HTTPS.
3434

35-
Before using the Proxmox extension, ensure that the Proxmox cluster is configured correctly and accessible to CloudStack.
35+
Before using the Proxmox extension, ensure that the Proxmox datacenter is configured correctly and accessible to CloudStack.
3636

3737
Get the Api Token-Secret from Proxmox
3838
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -57,9 +57,11 @@ To set up the Proxmox extension, follow these steps in CloudStack:
5757

5858
#. **Add Host.** Add a host to the newly created cluster with the following details:
5959

60+
If the Proxmox nodes use a shared API endpoint or credentials, the `url`, `user`, `token`, and `secret` can be set in the Extension's `Configuration Details` instead of per host. However, `node` and `network_bridge` must still be specified individually for each host.
61+
6062
|proxmox-add-host.png|
6163

62-
If the Proxmox nodes use a shared API endpoint or credentials, the `url`, `user`, `token`, and `secret` can be set in the Extension's `Configuration Details` instead of per host. However, `node` and `network_bridge` must still be specified individually for each host.
64+
**Note**: If the TLS certificate cannot be verified when cloudstack connects to the Proxmox node, add the detail **verify_tls_certificate** and set it to **false** to skip certificate verification.
6365

6466
#. **Create Template.** A Template in CloudStack can map to either a `Template` or an `ISO` in Proxmox.
6567
Provide a dummy `url` and template name. Select `External` as the hypervisor and `Proxmox` as the extension. Under `External Details`, specify:
@@ -103,9 +105,37 @@ firewall rules, port forwarding, and other networking features seamlessly throug
103105
Hyper-V
104106
^^^^^^
105107

106-
The Hyper-V CloudStack extension is a python script connects to the Hyper-V server using SSH and executes powershell commands to manage the VMs.
107-
Each Hyper-V host maps to a CloudStack host.
108-
Before using the Proxmox extension, ensure that the Proxmox cluster is configured correctly and accessible to CloudStack.
108+
The Hyper-V CloudStack extension is a Python-based script that communicates with the Hyper-V host using WinRM (Windows Remote Management) over HTTPS,
109+
using NTLM authentication for secure remote execution of PowerShell commands that manage the full lifecycle of virtual machines.
110+
111+
Each Hyper-V host maps to a CloudStack host. Before using the Hyper-V extension, ensure that the Hyper-V host is accessible to the CloudStack Management Server via WinRM over HTTPS.
112+
113+
Configuring WinRM over HTTPS
114+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115+
116+
**Windows Remote Management (WinRM)** is a protocol developed by Microsoft for securely managing Windows machines remotely using **WS-Management (Web Services for Management)**.
117+
It allows remote execution of PowerShell commands over HTTP or HTTPS and is widely used in automation tools such as **Ansible**, **Terraform**, and **Packer** for managing Windows infrastructure.
118+
119+
To enable WinRM over HTTPS on the Hyper-V host, ensure the following:
120+
121+
- WinRM is enabled and configured to listen on port 5986 (HTTPS).
122+
- A valid TLS certificate is installed and bound to the WinRM listener. You may use a certificate from a trusted Certificate Authority (CA) or a self-signed certificate.
123+
- The firewall on the Hyper-V host allows inbound connections on TCP port 5986.
124+
- The CloudStack Management Server has network access to the Hyper-V host on port 5986.
125+
- The Hyper-V host has a local or domain user account with appropriate permissions for managing virtual machines (e.g., creating, deleting, configuring VMs).
126+
127+
Sample powershell script to configure WinRM over HTTPS with self-signed TLS certificate is given below:
128+
129+
.. code-block:: powershell
130+
131+
Enable-PSRemoting -Force
132+
$cert = New-SelfSignedCertificate -DnsName "$env:COMPUTERNAME" -CertStoreLocation Cert:\LocalMachine\My
133+
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbprint $cert.Thumbprint -Force
134+
New-NetFirewallRule -DisplayName "WinRM HTTPS" -Name "WinRM-HTTPS" -Protocol TCP -LocalPort 5986 -Direction Inbound -Action Allow
135+
136+
Install pywinrm on CloudStack Management Server
137+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138+
**pywinrm** is a Python library that acts as a client to remotely execute commands on Windows machines via the WinRM protocol. Install it using ``pip3 install pywinrm``.
109139

110140
Host Details
111141
~~~~~~~~~~~~
@@ -115,6 +145,7 @@ Apart from the `url`, `username` and `password`, the following details are requi
115145
* **network_bridge**: Name of the network bridge to use for VM networking. This bridge must be configured on the Hyper-V host and connected to the appropriate network interface as explained in the `Configuring Networking` section below.
116146
* **vhd_path**: Path to the storage location where VM disks will be created.
117147
* **vm_path**: Path to the storage location where VM configuration files and metadata will be stored.
148+
* **verify_tls_certificate**: Set to `false` to skip TLS certificate verification for self-signed certificates.
118149

119150

120151
Adding Hyper-V to CloudStack

source/adminguide/extensions/developer.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Sample Invocation:
4747

4848
.. code-block:: bash
4949
50-
/usr/share/cloudstack-management/extensions/myext/myext.py /var/lib/cloudstack/management/extensions/myext/162345.json 60
50+
/usr/share/cloudstack-management/extensions/myext/myext.py deploy /var/lib/cloudstack/management/extensions/myext/162345.json 60
5151
5252
Input Format (Payload)
5353
^^^^^^^^^^^^^^^^^^^^^^
@@ -82,7 +82,8 @@ Your extension should write a response JSON to ``stdout``. Example:
8282
"message": "Deployment completed"
8383
}
8484
85-
For custom actions, CloudStack may use the response to show it in the UI.
85+
For custom actions, CloudStack will display the ``message`` in the UI if the output JSON includes ``"print_message": "true"``.
86+
The ``message`` field can be a string, a JSON object or a JSON array.
8687

8788
Action Lifecycle
8889
^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)