mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Include the "pool" parameter when cloning a VM with the proxmox salt-cloud driver
Fixes #62521
This commit is contained in:
parent
0121e725bb
commit
a83504cb34
3 changed files with 29 additions and 0 deletions
1
changelog/62521.fixed
Normal file
1
changelog/62521.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Fixed the omitted "pool" parameter when cloning a VM with the proxmox salt-cloud driver
|
|
@ -1034,6 +1034,8 @@ def create_node(vm_, newid):
|
|||
if "clone" in vm_ and vm_["clone"] is True and vm_["technology"] == "qemu":
|
||||
postParams = {}
|
||||
postParams["newid"] = newnode["vmid"]
|
||||
if "pool" in vm_:
|
||||
postParams["pool"] = vm_["pool"]
|
||||
|
||||
for prop in "description", "format", "full", "name":
|
||||
if (
|
||||
|
|
|
@ -6,6 +6,7 @@ import io
|
|||
import textwrap
|
||||
|
||||
import requests
|
||||
|
||||
from salt import config
|
||||
from salt.cloud.clouds import proxmox
|
||||
from tests.support.helpers import TstSuiteLoggingHandler
|
||||
|
@ -162,6 +163,31 @@ class ProxmoxTest(TestCase, LoaderModuleMockMixin):
|
|||
)
|
||||
assert result == {}
|
||||
|
||||
def test_clone_pool(self):
|
||||
"""
|
||||
Test that cloning a VM passes the pool parameter if present
|
||||
"""
|
||||
mock_query = MagicMock(return_value="")
|
||||
with patch(
|
||||
"salt.cloud.clouds.proxmox._get_properties", MagicMock(return_value=[])
|
||||
), patch("salt.cloud.clouds.proxmox.query", mock_query):
|
||||
vm_ = {
|
||||
"technology": "qemu",
|
||||
"name": "new2",
|
||||
"host": "myhost",
|
||||
"clone": True,
|
||||
"clone_from": 123,
|
||||
"pool": "mypool",
|
||||
}
|
||||
|
||||
result = proxmox.create_node(vm_, ANY)
|
||||
mock_query.assert_called_once_with(
|
||||
"post",
|
||||
"nodes/myhost/qemu/123/clone",
|
||||
{"newid": ANY, "pool": "mypool"},
|
||||
)
|
||||
assert result == {}
|
||||
|
||||
def test_find_agent_ips(self):
|
||||
"""
|
||||
Test find_agent_ip will return an IP
|
||||
|
|
Loading…
Add table
Reference in a new issue