Skip to content

Commit dd638ff

Browse files
committed
vsphere: reconnect call
1 parent 5ebfd57 commit dd638ff

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

extras/vsphere_reconnect.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from kvirt.config import Kconfig
2+
3+
client = None
4+
5+
config = Kconfig(client)
6+
config.k.reconnect_hosts()

kvirt/providers/vsphere/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -1838,3 +1838,11 @@ def set_macs(self, name, macs):
18381838
confspec.deviceChange = devconfspec
18391839
t = vm.Reconfigure(confspec)
18401840
waitForMe(t)
1841+
1842+
def reconnect_hosts(self):
1843+
si = self.si
1844+
rootFolder = self.rootFolder
1845+
view = si.content.viewManager.CreateContainerView(rootFolder, [vim.HostSystem], True)
1846+
for host in view.view:
1847+
pprint(f"Reconnecting Host {host.name}")
1848+
host.Reconnect()

0 commit comments

Comments
 (0)