Actually run pep8 against TUI, fix the fallout
This commit is contained in:
parent
326e0f6a81
commit
25f5bc90a7
|
@ -95,4 +95,3 @@ if __name__ == "__main__":
|
|||
except Exception, error:
|
||||
logging.exception(error)
|
||||
_show_startup_error(str(error), "".join(traceback.format_exc()))
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ def setup_i18n(gettext_app, gettext_dir):
|
|||
def check_virtinst_version(virtinst_str):
|
||||
# Make sure we have a sufficiently new virtinst version, since we are
|
||||
# very closely tied to the lib
|
||||
virtinst_version = tuple([ int(num) for num in virtinst_str.split('.')])
|
||||
virtinst_version = tuple([int(num) for num in virtinst_str.split('.')])
|
||||
|
||||
msg = ("virt-manager requires the python-virtinst library version " +
|
||||
virtinst_str + " or greater. This can be downloaded at:"
|
||||
|
|
|
@ -27,15 +27,15 @@ from domainconfig import DomainConfig
|
|||
|
||||
from virtinst import Guest
|
||||
|
||||
VM_DETAILS_PAGE = 1
|
||||
LOCAL_INSTALL_PAGE = 2
|
||||
SELECT_CDROM_PAGE = 3
|
||||
SELECT_ISO_PAGE = 4
|
||||
NETWORK_INSTALL_PAGE = 5
|
||||
OS_TYPE_PAGE = 6
|
||||
OS_VARIANT_PAGE = 7
|
||||
RAM_CPU_PAGE = 8
|
||||
ENABLE_STORAGE_PAGE = 9
|
||||
VM_DETAILS_PAGE = 1
|
||||
LOCAL_INSTALL_PAGE = 2
|
||||
SELECT_CDROM_PAGE = 3
|
||||
SELECT_ISO_PAGE = 4
|
||||
NETWORK_INSTALL_PAGE = 5
|
||||
OS_TYPE_PAGE = 6
|
||||
OS_VARIANT_PAGE = 7
|
||||
RAM_CPU_PAGE = 8
|
||||
ENABLE_STORAGE_PAGE = 9
|
||||
LOCAL_STORAGE_PAGE = 10
|
||||
SELECT_POOL_PAGE = 11
|
||||
SELECT_VOLUME_PAGE = 12
|
||||
|
@ -364,11 +364,10 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
DomainConfig.PXE_INSTALL,
|
||||
self.__config.is_install_type(DomainConfig.PXE_INSTALL))))
|
||||
grid = snack.Grid(2, 3)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__guest_name, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Choose how you would like to install the operating system"), 1, 1,
|
||||
anchorLeft = 1, anchorTop = 1)
|
||||
grid.setField(self.__install_type, 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__guest_name, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Choose how you would like to install the operating system"), 1, 1, anchorLeft=1, anchorTop=1)
|
||||
grid.setField(self.__install_type, 1, 2, anchorLeft=1)
|
||||
return [snack.Label("Enter your machine details"),
|
||||
grid]
|
||||
|
||||
|
@ -380,7 +379,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
DomainConfig.INSTALL_SOURCE_ISO,
|
||||
self.__config.get_use_cdrom_source() is False)))
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__install_source, 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__install_source, 0, 0, anchorLeft=1)
|
||||
return [snack.Label("Locate your install media"),
|
||||
grid]
|
||||
|
||||
|
@ -399,8 +398,8 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
ignore = screen
|
||||
self.__iso_path = snack.Entry(50, self.__config.get_iso_path())
|
||||
grid = snack.Grid(1, 2)
|
||||
grid.setField(snack.Label("Enter ISO path:"), 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__iso_path, 0, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Enter ISO path:"), 0, 0, anchorLeft=1)
|
||||
grid.setField(self.__iso_path, 0, 1, anchorLeft=1)
|
||||
return [snack.Label("Enter the full path to an install ISO"),
|
||||
grid]
|
||||
|
||||
|
@ -410,12 +409,12 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
self.__kickstart_url = snack.Entry(50, self.__config.get_kickstart_url())
|
||||
self.__kernel_options = snack.Entry(50, self.__config.get_kernel_options())
|
||||
grid = snack.Grid(2, 3)
|
||||
grid.setField(snack.Label("URL:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__install_url, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Kickstart URL:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Kernel Options:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("URL:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__install_url, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Kickstart URL:"), 0, 1, anchorRight=1)
|
||||
grid.setField(self.__kickstart_url, 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Kernel Options:"), 0, 2, anchorRight=1)
|
||||
grid.setField(self.__kernel_options, 1, 2, anchorLeft=1)
|
||||
return [snack.Label("Provide the operating system URL"),
|
||||
grid]
|
||||
|
||||
|
@ -425,7 +424,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
types.append([Guest.get_os_type_label(typ), typ, self.__config.is_os_type(typ)])
|
||||
self.__os_types = snack.RadioBar(screen, types)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__os_types, 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__os_types, 0, 0, anchorLeft=1)
|
||||
return [snack.Label("Choose the operating system type"),
|
||||
grid]
|
||||
|
||||
|
@ -436,7 +435,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
variants.append([Guest.get_os_variant_label(typ, variant), variant, self.__config.is_os_variant(variant)])
|
||||
self.__os_variants = snack.RadioBar(screen, variants)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__os_variants, 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__os_variants, 0, 0, anchorLeft=1)
|
||||
return [snack.Label("Choose the operating system version"),
|
||||
grid]
|
||||
|
||||
|
@ -445,24 +444,24 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
self.__memory = snack.Entry(10, str(self.__config.get_memory()))
|
||||
self.__cpus = snack.Entry(10, str(self.__config.get_cpus()))
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Memory (RAM):"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__memory, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__cpus, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Memory (RAM):"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__memory, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 1, anchorRight=1)
|
||||
grid.setField(self.__cpus, 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Choose memory and CPU settings"),
|
||||
grid]
|
||||
|
||||
def get_enable_storage_page(self, screen):
|
||||
self.__enable_storage = snack.Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage())
|
||||
self.__storage_type = snack.RadioBar(screen,((["Create a disk image on the computer's hard disk",
|
||||
self.__storage_type = snack.RadioBar(screen, ((["Create a disk image on the computer's hard disk",
|
||||
DomainConfig.NEW_STORAGE,
|
||||
self.__config.get_use_local_storage()]),
|
||||
(["Select managed or other existing storage",
|
||||
DomainConfig.EXISTING_STORAGE,
|
||||
self.__config.get_use_local_storage() is False])))
|
||||
grid = snack.Grid(1, 2)
|
||||
grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__storage_type, 0, 1, anchorLeft = 1)
|
||||
grid.setField(self.__enable_storage, 0, 0, anchorLeft=1)
|
||||
grid.setField(self.__storage_type, 0, 1, anchorLeft=1)
|
||||
return [snack.Label("Configure storage"),
|
||||
grid]
|
||||
|
||||
|
@ -471,8 +470,8 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
self.__storage_size = snack.Entry(6, str(self.__config.get_storage_size()))
|
||||
self.__allocate_storage = snack.Checkbox("Allocate entire disk now", self.__config.get_allocate_storage())
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(self.__allocate_storage, 0, 0, growx = 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Storage size (GB):"), 0, 1, anchorLeft = 1)
|
||||
grid.setField(self.__allocate_storage, 0, 0, growx=1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Storage size (GB):"), 0, 1, anchorLeft=1)
|
||||
grid.setField(self.__storage_size, 1, 1)
|
||||
return [snack.Label("Configure local storage"),
|
||||
grid]
|
||||
|
@ -484,7 +483,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
if len(pools) > 0:
|
||||
self.__storage_pool = snack.RadioBar(screen, (pools))
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Storage pool:"), 0, 0, anchorTop = 1)
|
||||
grid.setField(snack.Label("Storage pool:"), 0, 0, anchorTop=1)
|
||||
grid.setField(self.__storage_pool, 1, 0)
|
||||
self.__has_pools = True
|
||||
else:
|
||||
|
@ -500,7 +499,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
if len(volumes) > 0:
|
||||
self.__storage_volume = snack.RadioBar(screen, (volumes))
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Storage volumes:"), 0, 0, anchorTop = 1)
|
||||
grid.setField(snack.Label("Storage volumes:"), 0, 0, anchorTop=1)
|
||||
grid.setField(self.__storage_volume, 1, 0)
|
||||
self.__has_volumes = True
|
||||
else:
|
||||
|
@ -532,31 +531,31 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
|||
archs.append([arch, arch, self.__config.is_architecture(arch)])
|
||||
self.__architectures = snack.RadioBar(screen, (archs))
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__virt_types, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__architectures, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Virt Type:"), 0, 0, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__virt_types, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Architecture:"), 0, 1, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__architectures, 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Configure virtualization details"),
|
||||
grid]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
ignore = screen
|
||||
grid = snack.Grid(2, 6)
|
||||
grid.setField(snack.Label("OS:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label("OS:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label(Guest.get_os_variant_label(self.__config.get_os_type(),
|
||||
self.__config.get_os_variant())), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Install:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Memory:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Storage:"), 0, 4, anchorRight = 1)
|
||||
self.__config.get_os_variant())), 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Install:"), 0, 1, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_install_type_text()), 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Memory:"), 0, 2, anchorRight=1)
|
||||
grid.setField(snack.Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 3, anchorRight=1)
|
||||
grid.setField(snack.Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft=1)
|
||||
grid.setField(snack.Label("Storage:"), 0, 4, anchorRight=1)
|
||||
grid.setField(snack.Label("%s (on %s)" % (self.__config.get_storage_volume(),
|
||||
self.__config.get_storage_pool())),
|
||||
1, 4, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Network:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1)
|
||||
1, 4, anchorLeft=1)
|
||||
grid.setField(snack.Label("Network:"), 0, 5, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_network_bridge()), 1, 5, anchorLeft=1)
|
||||
return [snack.Label("Ready to begin installation of %s" % self.__config.get_guest_name()),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -115,14 +115,14 @@ class AddHostConfigScreen(VmmTuiConfigScreen):
|
|||
self.__autoconnect = snack.Checkbox("Autoconnect on Startup")
|
||||
self.__configured = True
|
||||
grid = snack.Grid(2, 4)
|
||||
grid.setField(snack.Label("Hypervisor:"), 0, 0, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__hypervisor, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Connection:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__connection, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__hostname, 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label(""), 0, 3, anchorRight = 1)
|
||||
grid.setField(self.__autoconnect, 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Hypervisor:"), 0, 0, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__hypervisor, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Connection:"), 0, 1, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__connection, 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight=1)
|
||||
grid.setField(self.__hostname, 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label(""), 0, 3, anchorRight=1)
|
||||
grid.setField(self.__autoconnect, 1, 3, anchorLeft=1)
|
||||
return [snack.Label("Add Connection"),
|
||||
grid]
|
||||
|
||||
|
@ -130,21 +130,21 @@ class AddHostConfigScreen(VmmTuiConfigScreen):
|
|||
ignore = screen
|
||||
|
||||
grid = snack.Grid(2, 4)
|
||||
grid.setField(snack.Label("Hypervisor:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(HYPERVISORS[self.__hypervisor.getSelection()]), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Connection:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(CONNECTIONS[self.__connection.getSelection()]), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Hypervisor:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label(HYPERVISORS[self.__hypervisor.getSelection()]), 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Connection:"), 0, 1, anchorRight=1)
|
||||
grid.setField(snack.Label(CONNECTIONS[self.__connection.getSelection()]), 1, 1, anchorLeft=1)
|
||||
if self.__connection.getSelection() is not CONNECTION_LOCAL:
|
||||
hostname = self.__hostname.value()
|
||||
else:
|
||||
hostname = "local"
|
||||
grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label(hostname), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Autoconnect on Startup:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight=1)
|
||||
grid.setField(snack.Label(hostname), 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label("Autoconnect on Startup:"), 0, 3, anchorRight=1)
|
||||
label = "Yes"
|
||||
if not self.__autoconnect.value():
|
||||
label = "No"
|
||||
grid.setField(snack.Label(label), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label(label), 1, 3, anchorLeft=1)
|
||||
return [snack.Label("Confirm Connection"),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class AddStoragePoolConfigScreen(VmmTuiConfigScreen):
|
|||
if self.__config.needs_build_pool():
|
||||
self.__config.set_build_pool(self.__build_pool.value())
|
||||
elif page is CONFIRM_PAGE:
|
||||
self.get_libvirt().define_storage_pool(self.__config.get_name(), config = self.__config)
|
||||
self.get_libvirt().define_storage_pool(self.__config.get_name(), config=self.__config)
|
||||
self.get_libvirt().create_storage_pool(self.__config.get_name())
|
||||
self.set_finished()
|
||||
|
||||
|
@ -127,10 +127,10 @@ class AddStoragePoolConfigScreen(VmmTuiConfigScreen):
|
|||
self.__config.get_type() is pooltype])
|
||||
self.__type = snack.RadioBar(screen, pooltypes)
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__name, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Type:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__type, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__name, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Type:"), 0, 1, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__type, 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Add Storage Pool"),
|
||||
grid]
|
||||
|
||||
|
@ -159,24 +159,24 @@ class AddStoragePoolConfigScreen(VmmTuiConfigScreen):
|
|||
grid = snack.Grid(2, rows)
|
||||
currentrow = 0
|
||||
if self.__config.needs_target_path():
|
||||
grid.setField(snack.Label("Target Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__target_path, 1, currentrow, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Target Path:"), 0, currentrow, anchorRight=1)
|
||||
grid.setField(self.__target_path, 1, currentrow, anchorLeft=1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_format():
|
||||
grid.setField(snack.Label("Format:"), 0, currentrow, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__formats, 1, currentrow, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Format:"), 0, currentrow, anchorRight=1, anchorTop=1)
|
||||
grid.setField(self.__formats, 1, currentrow, anchorLeft=1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_hostname():
|
||||
grid.setField(snack.Label("Host Name:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__hostname, 1, currentrow, anchorRight = 1)
|
||||
grid.setField(snack.Label("Host Name:"), 0, currentrow, anchorRight=1)
|
||||
grid.setField(self.__hostname, 1, currentrow, anchorRight=1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_source_path():
|
||||
grid.setField(snack.Label("Source Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__source_path, 1, currentrow, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Source Path:"), 0, currentrow, anchorRight=1)
|
||||
grid.setField(self.__source_path, 1, currentrow, anchorLeft=1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_build_pool():
|
||||
grid.setField(snack.Label(" "), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__build_pool, 1, currentrow, anchorLeft = 1)
|
||||
grid.setField(snack.Label(" "), 0, currentrow, anchorRight=1)
|
||||
grid.setField(self.__build_pool, 1, currentrow, anchorLeft=1)
|
||||
currentrow += 1
|
||||
return [snack.Label("Specify a storage location to be later split into virtual machine storage"),
|
||||
grid]
|
||||
|
@ -184,10 +184,10 @@ class AddStoragePoolConfigScreen(VmmTuiConfigScreen):
|
|||
def get_confirm_page(self, screen):
|
||||
ignore = screen
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Target Path:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_target_path()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Target Path:"), 0, 1, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_target_path()), 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Confirm Pool Details"),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
|||
capacity = int(self.__capacity.value())
|
||||
allocation = int(self.__allocation.value())
|
||||
if capacity > 0:
|
||||
if capacity <= self.__config.get_pool().info()[3] / 1024**2:
|
||||
if capacity <= self.__config.get_pool().info()[3] / (1024 ** 2):
|
||||
if allocation >= 0:
|
||||
if allocation <= capacity:
|
||||
return True
|
||||
|
@ -143,8 +143,8 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
|||
ignore = screen
|
||||
self.__name = snack.Entry(50, self.__config.get_name())
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__name, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__name, 1, 0, anchorLeft=1)
|
||||
return [snack.Label("New Storage Volume"),
|
||||
grid,
|
||||
snack.Label("Name of the volume to create. File extension may be appended.")]
|
||||
|
@ -164,10 +164,10 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
|||
self.__capacity = snack.Entry(6, str(self.__config.get_max_capacity()))
|
||||
self.__allocation = snack.Entry(6, str(self.__config.get_allocation()))
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Max. Capacity (MB):"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__capacity, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Allocation (MB):"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__allocation, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Max. Capacity (MB):"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__capacity, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Allocation (MB):"), 0, 1, anchorRight=1)
|
||||
grid.setField(self.__allocation, 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Storage Volume Quota"),
|
||||
snack.Label("%s's available space: %s" % (self.__config.get_pool().name(),
|
||||
utils.size_as_mb_or_gb(self.__config.get_pool().info()[3]))),
|
||||
|
@ -176,16 +176,16 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
|||
def get_confirm_page(self, screen):
|
||||
ignore = screen
|
||||
grid = snack.Grid(2, 5)
|
||||
grid.setField(snack.Label("Volume Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s (%s)" % (self.__config.get_name(), self.__config.get_pool().name())), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Volume Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label("%s (%s)" % (self.__config.get_name(), self.__config.get_pool().name())), 1, 0, anchorLeft=1)
|
||||
if self.__config.needs_format():
|
||||
grid.setField(snack.Label("Format:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_format()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Format:"), 0, 1, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_format()), 1, 1, anchorLeft=1)
|
||||
# NOTE: here we multiply the sizes by 1024^2 since the size_as_mb_or_gb is expect bytes
|
||||
grid.setField(snack.Label("Max. Capacity:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s" % (utils.size_as_mb_or_gb(self.__config.get_max_capacity() * 1024**2))), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Allocation:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s" % (utils.size_as_mb_or_gb(self.__config.get_allocation() * 1024**2))), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Max. Capacity:"), 0, 2, anchorRight=1)
|
||||
grid.setField(snack.Label("%s" % (utils.size_as_mb_or_gb(self.__config.get_max_capacity() * (1024 ** 2)))), 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label("Allocation:"), 0, 3, anchorRight=1)
|
||||
grid.setField(snack.Label("%s" % (utils.size_as_mb_or_gb(self.__config.get_allocation() * (1024 ** 2)))), 1, 3, anchorLeft=1)
|
||||
return [snack.Label("Ready To Allocation New Storage Volume"),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ import urlgrabber.progress as progress
|
|||
import logging
|
||||
|
||||
class CreateMeter(progress.BaseMeter):
|
||||
def _do_start(self, now = None):
|
||||
def _do_start(self, now=None):
|
||||
logging.info("Starting...")
|
||||
|
||||
def _do_end(self, amount_read, now = None):
|
||||
def _do_end(self, amount_read, now=None):
|
||||
logging.info("Ending: read=%d" % amount_read)
|
||||
|
||||
def _do_update(self, amount_read, now = None):
|
||||
def _do_update(self, amount_read, now=None):
|
||||
logging.info("Update: read=%d" % amount_read)
|
||||
|
|
|
@ -83,18 +83,18 @@ class CreateUserConfigScreen(ConfigScreen):
|
|||
|
||||
if self.__username is None:
|
||||
self.__username = snack.Entry(50, "")
|
||||
self.__password = snack.Entry(50, "", password = 1)
|
||||
self.__confirm = snack.Entry(50, "", password = 1)
|
||||
self.__password = snack.Entry(50, "", password=1)
|
||||
self.__confirm = snack.Entry(50, "", password=1)
|
||||
self.__adminuser = snack.Checkbox("This user is an administrator", False)
|
||||
grid = snack.Grid(2, 4)
|
||||
grid.setField(snack.Label("Username:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__username, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Password:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__password, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Confirm password:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__confirm, 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Username:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__username, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Password:"), 0, 1, anchorRight=1)
|
||||
grid.setField(self.__password, 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Confirm password:"), 0, 2, anchorRight=1)
|
||||
grid.setField(self.__confirm, 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label(" "), 0, 3)
|
||||
grid.setField(self.__adminuser, 1, 3, anchorLeft = 1)
|
||||
grid.setField(self.__adminuser, 1, 3, anchorLeft=1)
|
||||
return [snack.Label("Enter The User Details"),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -170,8 +170,8 @@ class DefineNetworkConfigScreen(VmmTuiConfigScreen):
|
|||
ignore = screen
|
||||
self.__ipv4_address = snack.Entry(18, self.__config.get_ipv4_address())
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__ipv4_address, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__ipv4_address, 1, 0, anchorLeft=1)
|
||||
return [snack.Label("You will need to choose an IPv4 address space for the virtual network:"),
|
||||
grid,
|
||||
snack.Label("HINT: The network should be chosen from"),
|
||||
|
@ -181,26 +181,26 @@ class DefineNetworkConfigScreen(VmmTuiConfigScreen):
|
|||
def get_network_details_page(self, screen):
|
||||
ignore = screen
|
||||
grid = snack.Grid(2, 6)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Netmask:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Broadcast:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_broadcast()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Gateway:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Size:"), 0, 4, anchorRight = 1)
|
||||
grid.setField(snack.Label("%d addresses" % self.__config.get_ipv4_max_addresses()), 1, 4, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Type:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_network_type()), 1, 5, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Netmask:"), 0, 1, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Broadcast:"), 0, 2, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_broadcast()), 1, 2, anchorLeft=1)
|
||||
grid.setField(snack.Label("Gateway:"), 0, 3, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 3, anchorLeft=1)
|
||||
grid.setField(snack.Label("Size:"), 0, 4, anchorRight=1)
|
||||
grid.setField(snack.Label("%d addresses" % self.__config.get_ipv4_max_addresses()), 1, 4, anchorLeft=1)
|
||||
grid.setField(snack.Label("Type:"), 0, 5, anchorRight=1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_network_type()), 1, 5, anchorLeft=1)
|
||||
return [snack.Label("Network Details"),
|
||||
grid]
|
||||
|
||||
def get_public_network_alert_page(self, screen):
|
||||
ignore = screen
|
||||
grid = snack.Grid(1, 2)
|
||||
grid.setField(snack.Label("The network should normally use a private IPv4 address."), 0, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Use this non-private address anyway?"), 0, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("The network should normally use a private IPv4 address."), 0, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Use this non-private address anyway?"), 0, 1, anchorLeft=1)
|
||||
return [snack.Label("Check Network Address"),
|
||||
grid]
|
||||
|
||||
|
@ -209,10 +209,10 @@ class DefineNetworkConfigScreen(VmmTuiConfigScreen):
|
|||
self.__start_address = snack.Entry(15, self.__config.get_ipv4_start_address())
|
||||
self.__end_address = snack.Entry(15, self.__config.get_ipv4_end_address())
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Start:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__start_address, 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("End:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__end_address, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Start:"), 0, 0, anchorRight=1)
|
||||
grid.setField(self.__start_address, 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("End:"), 0, 1, anchorRight=1)
|
||||
grid.setField(self.__end_address, 1, 1, anchorLeft=1)
|
||||
return [snack.Label("Selecting The DHCP Range"),
|
||||
grid,
|
||||
snack.Label("TIP: Unless you wish to reserve some addresses to allow static network"),
|
||||
|
@ -224,8 +224,8 @@ class DefineNetworkConfigScreen(VmmTuiConfigScreen):
|
|||
self.__isolated_network = snack.Checkbox("Isolated virtual network",
|
||||
self.__config.is_isolated_network())
|
||||
grid = snack.Grid(1, 3)
|
||||
grid.setField(snack.Label("Please indicate whether this virtual network should be"), 0, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("connected to the physical network."), 0, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Please indicate whether this virtual network should be"), 0, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("connected to the physical network."), 0, 1, anchorLeft=1)
|
||||
grid.setField(self.__isolated_network, 0, 2)
|
||||
return [snack.Label("Connecting To Physical Network"),
|
||||
grid]
|
||||
|
@ -246,29 +246,29 @@ class DefineNetworkConfigScreen(VmmTuiConfigScreen):
|
|||
def get_summary_page(self, screen):
|
||||
ignore = screen
|
||||
grid1 = snack.Grid(2, 1)
|
||||
grid1.setField(snack.Label("Network name:"), 0, 0, anchorRight = 1)
|
||||
grid1.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
grid1.setField(snack.Label("Network name:"), 0, 0, anchorRight=1)
|
||||
grid1.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft=1)
|
||||
|
||||
grid2 = snack.Grid(2, 3)
|
||||
grid2.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid2.setField(snack.Label("Gateway:"), 0, 1, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 1, anchorLeft = 1)
|
||||
grid2.setField(snack.Label("Netmask:"), 0, 2, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 2, anchorLeft = 1)
|
||||
grid2.setField(snack.Label("Network:"), 0, 0, anchorRight=1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft=1)
|
||||
grid2.setField(snack.Label("Gateway:"), 0, 1, anchorRight=1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 1, anchorLeft=1)
|
||||
grid2.setField(snack.Label("Netmask:"), 0, 2, anchorRight=1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 2, anchorLeft=1)
|
||||
|
||||
grid3 = snack.Grid(2, 2)
|
||||
grid3.setField(snack.Label("Start address:"), 0, 0, anchorRight = 1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_start_address()), 1, 0, anchorLeft = 1)
|
||||
grid3.setField(snack.Label("End address:"), 0, 1, anchorRight = 1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_end_address()), 1, 1, anchorLeft = 1)
|
||||
grid3.setField(snack.Label("Start address:"), 0, 0, anchorRight=1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_start_address()), 1, 0, anchorLeft=1)
|
||||
grid3.setField(snack.Label("End address:"), 0, 1, anchorRight=1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_end_address()), 1, 1, anchorLeft=1)
|
||||
|
||||
grid4 = snack.Grid(2, 1)
|
||||
grid4.setField(snack.Label("Connectivity:"), 0, 0, anchorRight = 1)
|
||||
grid4.setField(snack.Label("Connectivity:"), 0, 0, anchorRight=1)
|
||||
if self.__config.is_isolated_network():
|
||||
grid4.setField(snack.Label("Isolated virtual network"), 1, 0, anchorLeft = 1)
|
||||
grid4.setField(snack.Label("Isolated virtual network"), 1, 0, anchorLeft=1)
|
||||
else:
|
||||
grid4.setField(snack.Label("NAT to %s" % self.__config.get_physical_device_text()), 1, 0, anchorLeft = 1)
|
||||
grid4.setField(snack.Label("NAT to %s" % self.__config.get_physical_device_text()), 1, 0, anchorLeft=1)
|
||||
|
||||
return [snack.Label("Ready To Create Network"),
|
||||
snack.Label("Summary"),
|
||||
|
|
|
@ -54,4 +54,3 @@ class DomainListConfigScreen(VmmTuiConfigScreen):
|
|||
|
||||
def has_selectable_domains(self):
|
||||
return self.__has_domains
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class VirtManagerConfig:
|
|||
|
||||
class LibvirtWorker:
|
||||
'''Provides utilities for interfacing with libvirt.'''
|
||||
def __init__(self, url = None):
|
||||
def __init__(self, url=None):
|
||||
if url is None:
|
||||
url = get_default_url()
|
||||
logging.info("Connecting to libvirt: %s" % url)
|
||||
|
@ -88,9 +88,9 @@ class LibvirtWorker:
|
|||
self.open_connection(url)
|
||||
|
||||
self.__capabilities = self.__vmmconn.get_capabilities()
|
||||
self.__net = virtinst.VirtualNetworkInterface(conn = self.__conn)
|
||||
self.__net = virtinst.VirtualNetworkInterface(conn=self.__conn)
|
||||
self.__net.setup(self.__conn)
|
||||
(self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn = self.__conn)
|
||||
(self.__new_guest, self.__new_domain) = virtinst.CapabilitiesParser.guest_lookup(conn=self.__conn)
|
||||
|
||||
def get_connection(self):
|
||||
'''Returns the underlying connection.'''
|
||||
|
@ -122,7 +122,7 @@ class LibvirtWorker:
|
|||
'''Returns the capabilities for this libvirt host.'''
|
||||
return self.__capabilities
|
||||
|
||||
def list_domains(self, defined = True, created = True):
|
||||
def list_domains(self, defined=True, created=True):
|
||||
'''Lists all domains.'''
|
||||
self.__vmmconn.tick()
|
||||
uuids = self.__vmmconn.list_vm_uuids()
|
||||
|
@ -162,7 +162,7 @@ class LibvirtWorker:
|
|||
virtmachine = self.get_domain(name)
|
||||
virtmachine.migrate(target_conn, libvirt.VIR_MIGRATE_LIVE, None, None, 0)
|
||||
|
||||
def list_networks(self, defined = True, started = True):
|
||||
def list_networks(self, defined=True, started=True):
|
||||
'''Lists all networks that meet the given criteria.
|
||||
|
||||
Keyword arguments:
|
||||
|
@ -266,17 +266,17 @@ class LibvirtWorker:
|
|||
|
||||
def create_storage_pool(self, name):
|
||||
'''Starts the named storage pool if it is not currently started.'''
|
||||
if name not in self.list_storage_pools(defined = False):
|
||||
if name not in self.list_storage_pools(defined=False):
|
||||
pool = self.get_storage_pool(name)
|
||||
pool.create(0)
|
||||
|
||||
def destroy_storage_pool(self, name):
|
||||
'''Stops the specified storage pool.'''
|
||||
if name in self.list_storage_pools(defined = False):
|
||||
if name in self.list_storage_pools(defined=False):
|
||||
pool = self.get_storage_pool(name)
|
||||
pool.destroy()
|
||||
|
||||
def define_storage_pool(self, name, config = None, meter = None):
|
||||
def define_storage_pool(self, name, config=None, meter=None):
|
||||
'''Defines a storage pool with the given name.'''
|
||||
if config is None:
|
||||
pool = virtinst.Storage.DirectoryPool(conn=self.__conn,
|
||||
|
@ -318,7 +318,7 @@ class LibvirtWorker:
|
|||
'''Defines a new storage volume.'''
|
||||
self.create_storage_pool(config.get_pool().name())
|
||||
volume = config.create_volume()
|
||||
volume.install(meter = meter)
|
||||
volume.install(meter=meter)
|
||||
|
||||
def remove_storage_volume(self, poolname, volumename):
|
||||
'''Removes the specified storage volume.'''
|
||||
|
@ -445,9 +445,9 @@ class LibvirtWorker:
|
|||
elif config.get_install_type() == DomainConfig.PXE_INSTALL:
|
||||
iclass = virtinst.PXEInstaller
|
||||
|
||||
installer = iclass(conn = self.__conn,
|
||||
type = self.get_hypervisor(config.get_virt_type()),
|
||||
os_type = self.get_os_type(config.get_virt_type()))
|
||||
installer = iclass(conn=self.__conn,
|
||||
type=self.get_hypervisor(config.get_virt_type()),
|
||||
os_type=self.get_os_type(config.get_virt_type()))
|
||||
self.__guest = installer.guest_from_installer()
|
||||
self.__guest.name = config.get_guest_name()
|
||||
self.__guest.vcpus = config.get_cpus()
|
||||
|
@ -472,22 +472,22 @@ class LibvirtWorker:
|
|||
if config.get_os_variant() != "generic":
|
||||
self.__guest.os_variant = config.get_os_variant()
|
||||
|
||||
self.__guest._graphics_dev = virtinst.VirtualGraphics(type = virtinst.VirtualGraphics.TYPE_VNC)
|
||||
self.__guest._graphics_dev = virtinst.VirtualGraphics(type=virtinst.VirtualGraphics.TYPE_VNC)
|
||||
self.__guest.sound_devs = []
|
||||
self.__guest.sound_devs.append(virtinst.VirtualAudio(model = "es1370"))
|
||||
self.__guest.sound_devs.append(virtinst.VirtualAudio(model="es1370"))
|
||||
|
||||
self._setup_nics(config)
|
||||
self._setup_disks(config)
|
||||
|
||||
self.__guest.conn = self.__conn
|
||||
self.__domain = self.__guest.start_install(False, meter = meter)
|
||||
self.__domain = self.__guest.start_install(False, meter=meter)
|
||||
|
||||
def _setup_nics(self, config):
|
||||
self.__guest.nics = []
|
||||
nic = virtinst.VirtualNetworkInterface(type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL,
|
||||
bridge = config.get_network_bridge(),
|
||||
network = config.get_network_bridge(),
|
||||
macaddr = config.get_mac_address())
|
||||
nic = virtinst.VirtualNetworkInterface(type=virtinst.VirtualNetworkInterface.TYPE_VIRTUAL,
|
||||
bridge=config.get_network_bridge(),
|
||||
network=config.get_network_bridge(),
|
||||
macaddr=config.get_mac_address())
|
||||
self.__guest.nics.append(nic)
|
||||
# ensure the network is running
|
||||
if config.get_network_bridge() not in self.__conn.listNetworks():
|
||||
|
@ -503,8 +503,8 @@ class LibvirtWorker:
|
|||
self.define_storage_pool("default")
|
||||
pool = self.__conn.storagePoolLookupByName("default")
|
||||
path = virtinst.Storage.StorageVolume.find_free_name(config.get_guest_name(),
|
||||
pool_object = pool,
|
||||
suffix = ".img")
|
||||
pool_object=pool,
|
||||
suffix=".img")
|
||||
path = os.path.join(DEFAULT_POOL_TARGET_PATH, path)
|
||||
else:
|
||||
volume = self.get_storage_volume(config.get_storage_pool(),
|
||||
|
@ -512,8 +512,8 @@ class LibvirtWorker:
|
|||
path = volume.path()
|
||||
|
||||
if path is not None:
|
||||
storage = virtinst.VirtualDisk(conn = self.__conn,
|
||||
path = path,
|
||||
size = config.get_storage_size())
|
||||
storage = virtinst.VirtualDisk(conn=self.__conn,
|
||||
path=path,
|
||||
size=config.get_storage_size())
|
||||
self.__guest.disks.append(storage)
|
||||
self.__guest.conn = self.__conn
|
||||
|
|
|
@ -90,8 +90,8 @@ class ListDomainsConfigScreen(DomainListConfigScreen):
|
|||
row = 0
|
||||
for field in fields:
|
||||
if field[1] is not None:
|
||||
grid.setField(snack.Label("%s : " % field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft = 1)
|
||||
grid.setField(snack.Label("%s : " % field[0]), 0, row, anchorRight=1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft=1)
|
||||
else:
|
||||
grid.setField(snack.Label("%s" % field[0]), 1, row)
|
||||
row += 1
|
||||
|
|
|
@ -70,8 +70,8 @@ class ListNetworksConfigScreen(NetworkListConfigScreen):
|
|||
row = 0
|
||||
for field in fields:
|
||||
if field[1] is not None:
|
||||
grid.setField(snack.Label("%s : "% field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft = 1)
|
||||
grid.setField(snack.Label("%s : " % field[0]), 0, row, anchorRight=1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft=1)
|
||||
else:
|
||||
grid.setField(snack.Label(field[0]), 1, row)
|
||||
row += 1
|
||||
|
|
|
@ -53,15 +53,15 @@ class ListStoragePoolsConfigScreen(StorageListConfigScreen):
|
|||
volume = pool.storageVolLookupByName(name)
|
||||
volumes.append("%s (%s)" % (name, utils.size_as_mb_or_gb(volume.info()[1])), name)
|
||||
grid = snack.Grid(2, 3)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(pool.name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Volumes:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(volumes, 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Autostart:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
|
||||
grid.setField(snack.Label(pool.name()), 1, 0, anchorLeft=1)
|
||||
grid.setField(snack.Label("Volumes:"), 0, 1, anchorRight=1)
|
||||
grid.setField(volumes, 1, 1, anchorLeft=1)
|
||||
grid.setField(snack.Label("Autostart:"), 0, 2, anchorRight=1)
|
||||
label = "No"
|
||||
if pool.autostart():
|
||||
label = "Yes"
|
||||
grid.setField(snack.Label(label), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label(label), 1, 2, anchorLeft=1)
|
||||
return [snack.Label("Details For Storage Pool: %s" % self.get_selected_pool()),
|
||||
grid]
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ from netmenu import NetworkMenu
|
|||
from storagemenu import StoragePoolMenu
|
||||
from hostmenu import HostMenu
|
||||
|
||||
NODE_MENU = 1
|
||||
NETWORK_MENU = 2
|
||||
STORAGE_MENU = 3
|
||||
HOST_MENU = 4
|
||||
NODE_MENU = 1
|
||||
NETWORK_MENU = 2
|
||||
STORAGE_MENU = 3
|
||||
HOST_MENU = 4
|
||||
EXIT_CONSOLE = 99
|
||||
|
||||
class MainMenuScreen(MenuScreen):
|
||||
|
|
|
@ -54,4 +54,3 @@ class NetworkListConfigScreen(VmmTuiConfigScreen):
|
|||
|
||||
def has_selectable_networks(self):
|
||||
return self.__has_networks
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class PauseDomainConfigScreen(DomainListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is self.LIST_PAGE:
|
||||
return self.get_domain_list_page(screen, defined = False)
|
||||
return self.get_domain_list_page(screen, defined=False)
|
||||
elif page is self.STOP_PAGE:
|
||||
return self.get_stop_page(screen)
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ class PoolConfig:
|
|||
self.__build_pool = True
|
||||
# create pool
|
||||
pool_class = Storage.StoragePool.get_pool_class(self.__type)
|
||||
self.__pool = pool_class(name = self.__name,
|
||||
conn = self.__libvirt.get_connection())
|
||||
self.__pool = pool_class(name=self.__name,
|
||||
conn=self.__libvirt.get_connection())
|
||||
if self.__needs_format:
|
||||
self.__format = self.__pool.formats[0]
|
||||
else:
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
# setup.py - Copyright (C) 2009 Red Hat, Inc.
|
||||
# Written by Darryl L. Pierce <dpierce@redhat.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(name = "nodeadmin",
|
||||
version = "1.9.3",
|
||||
package_dir = {'nodeadmin': 'nodeadmin'},
|
||||
packages = find_packages('.'),
|
||||
entry_points = {
|
||||
'console_scripts': [
|
||||
'nodeadmin = nodeadmin.nodeadmin:NodeAdmin',
|
||||
'addvm = nodeadmin.adddomain:AddDomain',
|
||||
'startvm = nodeadmin.startdomain:StartDomain',
|
||||
'stopvm = nodeadmin.stopdomain:StopDomain',
|
||||
'pausevm = nodeadmin.pausdomain:PauseDomain',
|
||||
'rmvm = nodeadmin.removedomain:RemoveDomain',
|
||||
'migratevm = nodeadmin.migratedomain:MigradeDomain',
|
||||
'createuser = nodeadmin.createuser:CreateUser',
|
||||
'listvms = nodeadmin.listdomains:ListDomains',
|
||||
'definenet = nodeadmin.definenet:DefineNetwork',
|
||||
'createnet = nodeadmin.createnetwork:CreateNetwork',
|
||||
'destroynet = nodeadmin.destroynetwork:DestroyNetwork',
|
||||
'undefinenet = nodeadmin.undefinenetwork:UndefineNetwork',
|
||||
'listnets = nodeadmin.listnetworks:ListNetworks',
|
||||
'addpool = nodeadmin.addpool:AddStoragePool',
|
||||
'rmpool = nodeadmin.removepool:RemoveStoragePool',
|
||||
'startpool = nodeadmin.startpool:StartStoragePool',
|
||||
'stoppool = nodeadmin.stoppool:StopStoragePool',
|
||||
'addvolume = nodeadmin.addvolume:AddStorageVolume',
|
||||
'rmvolume = nodeadmin.removevolume:RemoveStorageVolume',
|
||||
'listpools = nodeadmin.listpools:ListPools']
|
||||
})
|
|
@ -31,7 +31,7 @@ class StartDomainConfigScreen(DomainListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is self.LIST_PAGE:
|
||||
return self.get_domain_list_page(screen, created = False)
|
||||
return self.get_domain_list_page(screen, created=False)
|
||||
elif page is self.START_PAGE:
|
||||
return self.get_start_domain_page(screen)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class StartNetworkConfigScreen(NetworkListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is LIST_PAGE:
|
||||
return self.get_network_list_page(screen, started = False)
|
||||
return self.get_network_list_page(screen, started=False)
|
||||
elif page is START_PAGE:
|
||||
return self.get_start_network_page(screen)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class StartStoragePoolConfigScreen(StorageListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is LIST_POOLS_PAGE:
|
||||
return self.get_storage_pool_list_page(screen, created = False)
|
||||
return self.get_storage_pool_list_page(screen, created=False)
|
||||
elif page is FINAL_PAGE:
|
||||
return self.get_final_page(screen)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class StopDomainConfigScreen(DomainListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is self.LIST_PAGE:
|
||||
return self.get_domain_list_page(screen, defined = False)
|
||||
return self.get_domain_list_page(screen, defined=False)
|
||||
elif page is self.STOP_PAGE:
|
||||
return self.get_stop_page(screen)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class StopNetworkConfigScreen(NetworkListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is LIST_PAGE:
|
||||
return self.get_network_list_page(screen, defined = False)
|
||||
return self.get_network_list_page(screen, defined=False)
|
||||
elif page is STOP_PAGE:
|
||||
return self.get_stop_network_page(screen)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class StopStoragePoolConfigScreen(StorageListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is LIST_POOLS_PAGE:
|
||||
return self.get_storage_pool_list_page(screen, defined = False)
|
||||
return self.get_storage_pool_list_page(screen, defined=False)
|
||||
elif page is FINAL_PAGE:
|
||||
return self.get_final_page(screen)
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class StorageListConfigScreen(VmmTuiConfigScreen):
|
|||
self.__volumes_list = snack.Listbox(0)
|
||||
for volname in pool.listVolumes():
|
||||
volume = pool.storageVolLookupByName(volname)
|
||||
self.__volumes_list.append("%s (%0.2f GB)" % (volume.name(), volume.info()[2] / 1024**3), volume.name())
|
||||
self.__volumes_list.append("%s (%0.2f GB)" % (volume.name(), volume.info()[2] / (1024 ** 3)), volume.name())
|
||||
result = self.__volumes_list
|
||||
else:
|
||||
self.__has_volumes = False
|
||||
|
@ -77,4 +77,3 @@ class StorageListConfigScreen(VmmTuiConfigScreen):
|
|||
|
||||
def has_selectable_volumes(self):
|
||||
return self.__has_volumes
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class UndefineNetworkConfigScreen(NetworkListConfigScreen):
|
|||
|
||||
def get_elements_for_page(self, screen, page):
|
||||
if page is LIST_PAGE:
|
||||
return self.get_network_list_page(screen, started = False)
|
||||
return self.get_network_list_page(screen, started=False)
|
||||
elif page is CONFIRM_PAGE:
|
||||
return self.get_confirm_page(screen)
|
||||
elif page is UNDEFINE_PAGE:
|
||||
|
|
|
@ -42,4 +42,3 @@ class VmmTuiConfigScreen(configscreen.ConfigScreen):
|
|||
|
||||
def get_virt_manager_config(self):
|
||||
return self.__vm_config
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ class StorageVolumeConfig:
|
|||
return self.__pool
|
||||
|
||||
def create_volume(self):
|
||||
volume = self.__volume_class(name = self.__name + ".img",
|
||||
allocation = self.__allocation * 1024**2,
|
||||
capacity = self.__max_capacity * 1024**2,
|
||||
pool = self.__pool)
|
||||
volume = self.__volume_class(name=self.__name + ".img",
|
||||
allocation=self.__allocation * (1024 ** 2),
|
||||
capacity=self.__max_capacity * (1024 ** 2),
|
||||
pool=self.__pool)
|
||||
volume.pool = self.__pool
|
||||
if self.needs_format():
|
||||
volume.format = self.__format
|
||||
|
|
|
@ -147,7 +147,7 @@ skip_pep8 "E501" # Line too long
|
|||
|
||||
echo "Running pep8"
|
||||
pep8 -r --exclude=$IGNOREFILES --ignore $SKIP_PEP8 \
|
||||
virt-manager.py.in virtManager/*.py
|
||||
$PYLINT_FILES
|
||||
|
||||
cd - > /dev/null
|
||||
rm src/_virt-manager
|
||||
|
|
Loading…
Reference in New Issue