edit
This commit is contained in:
parent
d617e8f225
commit
f4454ea0b0
10
pve_ssh.py
10
pve_ssh.py
@ -1,11 +1,11 @@
|
|||||||
import paramiko
|
import paramiko
|
||||||
import config
|
import config
|
||||||
|
|
||||||
ssh_user = config.SSH_USER
|
ssh_user = config.PVE_SSH_USER
|
||||||
ssh_password = config.SSH_PASS
|
ssh_password = config.PVE_SSH_PASS
|
||||||
|
|
||||||
vmid = '101'
|
vmid = '210'
|
||||||
node_ip = '192.168.1.101'
|
node_ip = '192.168.1.103'
|
||||||
pci_device = 'hostpci0'
|
pci_device = 'hostpci0'
|
||||||
|
|
||||||
def unmount_pci_and_shutdown(node_ip, vmid, pci_device):
|
def unmount_pci_and_shutdown(node_ip, vmid, pci_device):
|
||||||
@ -20,7 +20,7 @@ def unmount_pci_and_shutdown(node_ip, vmid, pci_device):
|
|||||||
# print(stderr.read().decode())
|
# print(stderr.read().decode())
|
||||||
|
|
||||||
print(f"Unmounted {pci_device} from VM {vmid}, shutting down node {node_ip}...")
|
print(f"Unmounted {pci_device} from VM {vmid}, shutting down node {node_ip}...")
|
||||||
ssh.exec_command('sudo shutdown -h now')
|
ssh.exec_command('shutdown -h now')
|
||||||
ssh.close()
|
ssh.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error: {e}")
|
print(f"Error: {e}")
|
||||||
|
Loading…
Reference in New Issue
Block a user