f71f619bc9
virt-manager-1.2.0.tar.bz2 virtinst-default-xen-to-qcow2-format.patch * OVMF/AAVMF Support (Laszlo Ersek, Giuseppe Scrivano, Cole Robinson) * Improved support for AArch64 qemu/kvm * virt-install: Support –disk type=network parameters * virt-install: Make –disk just work * virt-install: Add –disk sgio= option (Giuseppe Scrivano) * addhardware: default to an existing bus when adding a new disk (Giuseppe Scrivano) * virt-install: Add –input device option * virt-manager: Unify storagebrowser and storage details functionality * virt-manager: allow setting a custom connection row name * virt-install: Support –hostdev scsi passthrough * virt-install: Fill in a bunch of –graphics spice options * Disable spice image compression for new local VMs * virt-manager: big reworking of the migration dialog - Dropped tarball and patches virt-manager-1.1.0.tar.bz2 0b391fe9-Gtk-30.patch 20fe2873-check-for-empty-network-name.patch 24faf867-ignore-error-403-on-directories.patch 65f7017e-createnet-fix.patch activate-default-console.patch ce74cd77-connection-state-tick-updates-lock.patch virtinst-ppc64le.patch virtinst-supported-disk-formats.patch virtinst-support-suse-distros.patch virt-manager-1.1.0.tar.bz2 virtman-default-lxc-uri.patch virtman-stable-os-support.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=226
139 lines
5.7 KiB
Diff
139 lines
5.7 KiB
Diff
Enhancement that gets the hosts installation location from
|
|
install.inf and also collects the repos provided by zypper.
|
|
These locations are then presented as potential installation
|
|
locations when createing a VM.
|
|
Index: virt-manager-1.1.0/virtManager/create.py
|
|
===================================================================
|
|
--- virt-manager-1.1.0.orig/virtManager/create.py
|
|
+++ virt-manager-1.1.0/virtManager/create.py
|
|
@@ -359,7 +359,13 @@ class vmmCreate(vmmGObjectUI):
|
|
self.widget("install-url-options").set_expanded(False)
|
|
urlmodel = self.widget("install-url-box").get_model()
|
|
ksmodel = self.widget("install-ks-box").get_model()
|
|
- self.populate_media_model(urlmodel, self.config.get_media_urls())
|
|
+ urllist = self.config.get_media_urls()
|
|
+ (index, inst_repos) = util.getInstallRepos()
|
|
+ for u in urllist:
|
|
+ if u in inst_repos:
|
|
+ inst_repos.remove(u)
|
|
+ media_urllist = urllist + inst_repos
|
|
+ self.populate_media_model(urlmodel, media_urllist)
|
|
self.populate_media_model(ksmodel, self.config.get_kickstart_urls())
|
|
self.set_distro_labels("-", "-", force=True)
|
|
|
|
Index: virt-manager-1.1.0/virtinst/util.py
|
|
===================================================================
|
|
--- virt-manager-1.1.0.orig/virtinst/util.py
|
|
+++ virt-manager-1.1.0/virtinst/util.py
|
|
@@ -23,11 +23,13 @@ import os
|
|
import random
|
|
import re
|
|
import stat
|
|
+import commands
|
|
|
|
import libvirt
|
|
|
|
|
|
_host_blktap_capable = None
|
|
+_host_repo_url = None
|
|
|
|
|
|
def listify(l):
|
|
@@ -462,3 +464,96 @@ def register_libvirt_error_handler():
|
|
ignore = userdata
|
|
ignore = err
|
|
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
|
|
+
|
|
+def getHostInstallSource():
|
|
+ global _host_repo_url
|
|
+ if _host_repo_url is not None:
|
|
+ return _host_repo_url
|
|
+ if os.geteuid() != 0:
|
|
+ return None
|
|
+
|
|
+ if os.path.exists('/var/lib/YaST2/install.inf'):
|
|
+ server_ip = server_name = server_dir = inst_mode = None
|
|
+ f = open('/var/lib/YaST2/install.inf')
|
|
+ lines = f.readlines()
|
|
+ f.close()
|
|
+ # Newer install.inf files use RepoURL. Older versions require parsing more fields
|
|
+ for line in lines:
|
|
+ if line.startswith('RepoURL:'):
|
|
+ repo_url = line[:-1].split('?', 1)[0]
|
|
+ repo_url = repo_url.split(' ')
|
|
+ if repo_url[1]:
|
|
+ if repo_url[1].startswith('ftp:') or repo_url[1].startswith('http:') or repo_url[1].startswith('smb:') or repo_url[1].startswith('nfs:'):
|
|
+ _host_repo_url = repo_url[1]
|
|
+ return repo_url[1]
|
|
+ return None
|
|
+ elif line.startswith('InstMode:'):
|
|
+ inst_mode = line[:-1].split('?', 1)[0]
|
|
+ inst_mode = inst_mode.split(' ')
|
|
+ inst_mode = inst_mode[1]
|
|
+ if inst_mode != 'ftp' and inst_mode != 'http' and inst_mode != 'smb' and inst_mode != 'nfs':
|
|
+ return None
|
|
+ elif line.startswith('ServerIP:'):
|
|
+ server_ip = line[:-1].split('?', 1)[0]
|
|
+ server_ip = server_ip.split(' ')
|
|
+ server_ip = server_ip[1]
|
|
+ elif line.startswith('ServerName:'):
|
|
+ server_name = line[:-1].split('?', 1)[0]
|
|
+ server_name = server_name.split(' ')
|
|
+ server_name = server_name[1]
|
|
+ elif line.startswith('Serverdir:'):
|
|
+ server_dir = line[:-1].split('?', 1)[0]
|
|
+ server_dir = server_dir.split(' ')
|
|
+ server_dir = server_dir[1]
|
|
+ if inst_mode:
|
|
+ repo_url = inst_mode + "://"
|
|
+ if server_name:
|
|
+ repo_url = repo_url + server_name + "/"
|
|
+ if server_dir:
|
|
+ repo_url = repo_url + server_dir
|
|
+ elif server_ip:
|
|
+ repo_url = repo_url + server_ip + "/"
|
|
+ if server_dir:
|
|
+ repo_url = repo_url + server_dir
|
|
+ _host_repo_url = repo_url
|
|
+ return repo_url
|
|
+ return None
|
|
+
|
|
+def getInstallRepos(enabled_sources_only = True):
|
|
+ if os.geteuid() != 0:
|
|
+ return (0, [])
|
|
+ dom0_inst_source = getHostInstallSource()
|
|
+ locations = commands.getoutput("/usr/bin/zypper lr -u | awk -F'|' '{ print $6 }'")
|
|
+ locations = locations[(locations.rfind('URI')):].split()
|
|
+ index = 0
|
|
+ index_dom0 = -1
|
|
+ number_of_sources = 0
|
|
+ zypper_output = []
|
|
+ # If we only want to list enabled sources
|
|
+ if enabled_sources_only == True:
|
|
+ enabled = commands.getoutput("/usr/bin/zypper lr -u | awk -F'|' '{ print $4 }'")
|
|
+ enabled = enabled[(enabled.rfind('Enabled')):].split()
|
|
+ for e in enabled:
|
|
+ if e == "Yes":
|
|
+ str = locations[index]
|
|
+ if str.startswith('ftp://') or str.startswith('http://') or str.startswith('nfs://') or str.startswith('smb://'):
|
|
+ zypper_output.append(str)
|
|
+ if dom0_inst_source is not None and str == dom0_inst_source:
|
|
+ index_dom0 = number_of_sources
|
|
+ number_of_sources += 1
|
|
+ index += 1
|
|
+ else:
|
|
+ locations.sort()
|
|
+ for l in locations:
|
|
+ str = locations[index]
|
|
+ if str.startswith('ftp://') or str.startswith('http://') or str.startswith('nfs://') or str.startswith('smb://'):
|
|
+ zypper_output.append(str)
|
|
+ if dom0_inst_source is not None and str == dom0_inst_source:
|
|
+ index_dom0 = number_of_sources
|
|
+ number_of_sources += 1
|
|
+ index += 1
|
|
+ if index_dom0 == -1 and dom0_inst_source:
|
|
+ index_dom0 = 0
|
|
+ zypper_output.insert(0, dom0_inst_source)
|
|
+ return (index_dom0, zypper_output)
|
|
+
|