mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch 'develop' of github.com:saltstack/salt into hotfix/pylint/C0103
This commit is contained in:
commit
9eea488abf
3 changed files with 30 additions and 12 deletions
|
@ -152,7 +152,7 @@ notes=FIXME,XXX,TODO
|
|||
max-line-length=80
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
max-module-lines=3000
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
|
@ -219,7 +219,7 @@ int-import-graph=
|
|||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
max-args=35
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
|
|
|
@ -3,6 +3,14 @@ Support for Gentoolkit
|
|||
|
||||
'''
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Only work on Gentoo systems with gentoolkit installed
|
||||
'''
|
||||
if __grains__['os'] == 'Gentoo' and salt.utils.which('revdep-rebuild'):
|
||||
return 'gentoolkit'
|
||||
return False
|
||||
|
||||
def revdep_rebuild(lib=None):
|
||||
'''
|
||||
Fix up broken reverse dependencies
|
||||
|
|
|
@ -91,6 +91,17 @@ def _libvirt_creds():
|
|||
user = "root"
|
||||
return {'user': user, 'group': group}
|
||||
|
||||
def _get_migrate_command():
|
||||
'''
|
||||
Returns the command shared by the differnt migration types
|
||||
'''
|
||||
return 'virsh migrate --live --persistent --undefinesource '
|
||||
|
||||
def _get_target(target, ssh):
|
||||
proto = 'qemu'
|
||||
if ssh:
|
||||
proto += '+ssh'
|
||||
return ' %s://%s/%s' %(proto, target, 'system')
|
||||
|
||||
def list_vms():
|
||||
'''
|
||||
|
@ -615,7 +626,7 @@ def create_xml_path(path):
|
|||
return create_xml_str(salt.utils.fopen(path, 'r').read())
|
||||
|
||||
|
||||
def migrate_non_shared(vm_, target):
|
||||
def migrate_non_shared(vm_, target, ssh=False):
|
||||
'''
|
||||
Attempt to execute non-shared storage "all" migration
|
||||
|
||||
|
@ -623,15 +634,15 @@ def migrate_non_shared(vm_, target):
|
|||
|
||||
salt '*' virt.migrate_non_shared <vm name> <target hypervisor>
|
||||
'''
|
||||
cmd = 'virsh migrate --live --copy-storage-all ' + vm_\
|
||||
+ ' qemu://' + target + '/system'
|
||||
cmd = _get_migrate_command() + ' --copy-storage-all ' + vm_\
|
||||
+ _get_target(target, ssh)
|
||||
|
||||
return subprocess.Popen(cmd,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
|
||||
|
||||
def migrate_non_shared_inc(vm_, target):
|
||||
def migrate_non_shared_inc(vm_, target, ssh=False):
|
||||
'''
|
||||
Attempt to execute non-shared storage "all" migration
|
||||
|
||||
|
@ -639,15 +650,15 @@ def migrate_non_shared_inc(vm_, target):
|
|||
|
||||
salt '*' virt.migrate_non_shared_inc <vm name> <target hypervisor>
|
||||
'''
|
||||
cmd = 'virsh migrate --live --copy-storage-inc ' + vm_\
|
||||
+ ' qemu://' + target + '/system'
|
||||
cmd = _get_migrate_command() + ' --copy-storage-inc ' + vm_\
|
||||
+ _get_target(target, ssh)
|
||||
|
||||
return subprocess.Popen(cmd,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
|
||||
|
||||
def migrate(vm_, target):
|
||||
def migrate(vm_, target, ssh=False):
|
||||
'''
|
||||
Shared storage migration
|
||||
|
||||
|
@ -655,14 +666,13 @@ def migrate(vm_, target):
|
|||
|
||||
salt '*' virt.migrate <vm name> <target hypervisor>
|
||||
'''
|
||||
cmd = 'virsh migrate --live ' + vm_\
|
||||
+ ' qemu://' + target + '/system'
|
||||
cmd = _get_migrate_command() + ' ' + vm_\
|
||||
+ _get_target(target, ssh)
|
||||
|
||||
return subprocess.Popen(cmd,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
|
||||
|
||||
def seed_non_shared_migrate(disks, force=False):
|
||||
'''
|
||||
Non shared migration requires that the disks be present on the migration
|
||||
|
|
Loading…
Add table
Reference in a new issue