[Kimchi-devel] [PATCH 01/15] V3 Ginger Base : Taking off the host tab functionality from kimchi

Daniel Henrique Barboza dhbarboza82 at gmail.com
Wed Oct 7 12:52:37 UTC 2015


Code looks ok, but we have a few whitespace errors when applying this patch:

git am \[Kimchi-devel\]\ \[PATCH\ 01_15\]\ V3\ Ginger\ Base\ \:\ Taking\ 
off\ the\ host\ tab\ functionality\ from\ kimchi\ -\ 
chandra at linux.vnet.ibm.com\ -\ 2015-10-07\ 0735.eml
Applying: V3 Ginger Base : Taking off the host tab functionality from kimchi
/home/danielhb/kimchi/wok/kimchi/.git/rebase-apply/patch:432: trailing 
whitespace.

warning: 1 line adds whitespace errors.



On 10/07/2015 07:35 AM, chandra at linux.vnet.ibm.com wrote:
> From: chandrureddy <chandra at linux.vnet.ibm.com>
>
> ---
>   src/wok/plugins/kimchi/API.json                    | 134 ---------
>   src/wok/plugins/kimchi/Makefile.am                 |   3 +-
>   src/wok/plugins/kimchi/config.py.in                |   4 -
>   src/wok/plugins/kimchi/control/host.py             |  96 ------
>   src/wok/plugins/kimchi/docs/README.md              |   6 +-
>   src/wok/plugins/kimchi/i18n.py                     |  47 +--
>   src/wok/plugins/kimchi/kimchi.conf                 |   7 -
>   src/wok/plugins/kimchi/mockmodel.py                |  18 --
>   src/wok/plugins/kimchi/model/config.py             |  21 --
>   src/wok/plugins/kimchi/model/host.py               | 328 +--------------------
>   src/wok/plugins/kimchi/root.py                     |   1 -
>   src/wok/plugins/kimchi/tests/test_authorization.py |   6 -
>   src/wok/plugins/kimchi/tests/test_config.py.in     |   7 -
>   src/wok/plugins/kimchi/tests/test_host.py          |  96 +-----
>   src/wok/plugins/kimchi/tests/test_model.py         | 237 ---------------
>   src/wok/plugins/kimchi/tests/test_rest.py          |  54 ----
>   src/wok/plugins/kimchi/ui/config/tab-ext.xml       |   7 -
>   17 files changed, 8 insertions(+), 1064 deletions(-)
>
> diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json
> index fc1d2dd..6189207 100644
> --- a/src/wok/plugins/kimchi/API.json
> +++ b/src/wok/plugins/kimchi/API.json
> @@ -59,30 +59,6 @@
>           }
>       },
>       "properties": {
> -        "debugreports_create": {
> -            "type": "object",
> -            "error": "KCHDR0006E",
> -            "properties": {
> -                "name": {
> -                    "description": "The name for the debug report file.",
> -                    "type": "string",
> -                    "pattern": "^[_A-Za-z0-9-]*$",
> -                    "error": "KCHDR0007E"
> -                }
> -            }
> -        },
> -        "debugreport_update": {
> -            "type": "object",
> -            "properties": {
> -                "name": {
> -                    "description": "New name of debug report",
> -                    "type": "string",
> -                    "pattern": "^[_A-Za-z0-9-]*$",
> -                    "error": "KCHDR0007E"
> -                }
> -            },
> -            "additionalProperties": false
> -        },
>           "storagepools_create": {
>               "type": "object",
>               "error": "KCHPOOL0026E",
> @@ -684,116 +660,6 @@
>               "additionalProperties": false,
>               "error": "KCHAPI0001E"
>           },
> -        "repositories_create": {
> -            "type": "object",
> -            "properties": {
> -                "repo_id": {
> -                    "description": "Repository ID used for YUM repository.",
> -                    "type": "string",
> -                    "error": "KCHREPOS0001E"
> -                },
> -                "baseurl": {
> -                    "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file://  URL.",
> -                    "type": "string",
> -                    "error": "KCHREPOS0002E"
> -                },
> -                "config": {
> -                    "description": "Dictionary containing repository configuration",
> -                    "type": "object",
> -                    "error": "KCHREPOS0003E",
> -                    "properties": {
> -                        "dist": {
> -                            "description": "Distribution to DEB repository",
> -                            "type": "string",
> -                            "error": "KCHREPOS0004E"
> -                        },
> -                        "comps": {
> -                            "description": "List of components to DEB repository",
> -                            "type": "array",
> -                            "error": "KCHREPOS0005E",
> -                            "uniqueItems": true,
> -                            "items": {
> -                                "description": "Component name",
> -                                "type": "string",
> -                                "error": "KCHREPOS0006E"
> -                            }
> -                        },
> -                        "repo_name": {
> -                            "description": "YUM repository name",
> -                            "type": "string",
> -                            "error": "KCHREPOS0023E"
> -                        },
> -                        "mirrorlist": {
> -                            "description": "URL to a file containing a list of baseurls",
> -                            "type": "string",
> -                            "error": "KCHREPOS0007E"
> -                        },
> -                        "metalink": {
> -                            "description": "URL to a metalink file for the repomd.xml",
> -                            "type": "string",
> -                            "error": "KCHREPOS0029E"
> -                        }
> -                    }
> -                }
> -            },
> -            "additionalProperties": false,
> -            "error": "KCHAPI0001E"
> -        },
> -        "repository_update": {
> -            "type": "object",
> -            "properties": {
> -                "baseurl": {
> -                    "description": "URL to the directory where the repodata directory of a repository is located. Can be an http://, ftp:// or file://  URL.",
> -                    "type": "string",
> -                    "error": "KCHREPOS0002E"
> -                },
> -                "config": {
> -                    "description": "Dictionary containing repository configuration",
> -                    "type": "object",
> -                    "error": "KCHREPOS0003E",
> -                    "properties": {
> -                        "dist": {
> -                            "description": "Distribution to DEB repository",
> -                            "type": "string",
> -                            "error": "KCHREPOS0004E"
> -                        },
> -                        "comps": {
> -                            "description": "List of components to DEB repository",
> -                            "type": "array",
> -                            "error": "KCHREPOS0005E",
> -                            "uniqueItems": true,
> -                            "items": {
> -                                "description": "Component name",
> -                                "type": "string",
> -                                "error": "KCHREPOS0006E"
> -                            }
> -                        },
> -                        "repo_name": {
> -                            "description": "Human-readable string describing the YUM repository.",
> -                            "type": "string",
> -                            "error": "KCHREPOS0008E"
> -                        },
> -                        "mirrorlist": {
> -                            "description": "URL to a file containing a list of baseurls for YUM repository",
> -                            "type": "string",
> -                            "error": "KCHREPOS0007E"
> -                        },
> -                        "gpgcheck": {
> -                            "description": "Indicates if a GPG signature check on the packages gotten from repository should be performed.",
> -                            "type": "boolean",
> -                            "error": "KCHREPOS0009E"
> -                        },
> -                        "gpgkey": {
> -                            "description": "URL pointing to the ASCII-armored GPG key file for the repository.",
> -                            "type": "string",
> -                            "error": "KCHREPOS0010E"
> -                        }
> -                    }
> -                }
> -            },
> -            "additionalProperties": false,
> -            "error": "KCHAPI0001E"
> -        },
>           "devices_get_list": {
>               "type": "object",
>               "properties": {
> diff --git a/src/wok/plugins/kimchi/Makefile.am b/src/wok/plugins/kimchi/Makefile.am
> index 34ddef4..f2b05cd 100644
> --- a/src/wok/plugins/kimchi/Makefile.am
> +++ b/src/wok/plugins/kimchi/Makefile.am
> @@ -101,7 +101,6 @@ install-deb: install
>   	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/
>   	touch $(DESTDIR)/$(localstatedir)/lib/wok/objectstore
>   	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/vnc-tokens
> -	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/debugreports
>   	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/screenshots
>   	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/isos
>   
> @@ -144,7 +143,7 @@ install-data-local:
>   	$(MKDIR_P) $(DESTDIR)$(kimchidir)
>   	$(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json
>   	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/vnc-tokens
> -	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/{debugreports,isos,screenshots}
> +	mkdir -p $(DESTDIR)/$(localstatedir)/lib/wok/plugins/kimchi/{isos,screenshots}
>   
>   uninstall-local:
>   	$(RM) $(DESTDIR)$(kimchidir)/API.json
> diff --git a/src/wok/plugins/kimchi/config.py.in b/src/wok/plugins/kimchi/config.py.in
> index 6ae0ccd..43e7811 100644
> --- a/src/wok/plugins/kimchi/config.py.in
> +++ b/src/wok/plugins/kimchi/config.py.in
> @@ -38,10 +38,6 @@ def get_distros_store():
>       return os.path.join(PluginPaths('kimchi').conf_dir, 'distros.d')
>   
>   
> -def get_debugreports_path():
> -    return os.path.join(PluginPaths('kimchi').state_dir, 'debugreports')
> -
> -
>   def get_screenshot_path():
>       return os.path.join(PluginPaths('kimchi').state_dir, 'screenshots')
>   
> diff --git a/src/wok/plugins/kimchi/control/host.py b/src/wok/plugins/kimchi/control/host.py
> index 0a40f1b..c71c47b 100644
> --- a/src/wok/plugins/kimchi/control/host.py
> +++ b/src/wok/plugins/kimchi/control/host.py
> @@ -19,7 +19,6 @@
>   
>   from wok.control.base import Collection, Resource, SimpleCollection
>   from wok.control.utils import UrlSubNode
> -from wok.exception import NotFoundError
>   
>   from cpuinfo import CPUInfo
>   
> @@ -31,14 +30,7 @@ class Host(Resource):
>           self.role_key = 'host'
>           self.admin_methods = ['GET', 'POST']
>           self.uri_fmt = '/host/%s'
> -        self.reboot = self.generate_action_handler('reboot')
> -        self.shutdown = self.generate_action_handler('shutdown')
> -        self.stats = HostStats(self.model)
> -        self.partitions = Partitions(self.model)
>           self.devices = Devices(self.model)
> -        self.packagesupdate = PackagesUpdate(self.model)
> -        self.repositories = Repositories(self.model)
> -        self.swupdate = self.generate_action_handler_task('swupdate')
>           self.cpuinfo = CPUInfo(self.model)
>   
>       @property
> @@ -46,54 +38,6 @@ class Host(Resource):
>           return self.info
>   
>   
> -class HostStats(Resource):
> -    def __init__(self, model, id=None):
> -        super(HostStats, self).__init__(model, id)
> -        self.role_key = 'host'
> -        self.admin_methods = ['GET']
> -        self.history = HostStatsHistory(self.model)
> -
> -    @property
> -    def data(self):
> -        return self.info
> -
> -
> -class HostStatsHistory(Resource):
> -    @property
> -    def data(self):
> -        return self.info
> -
> -
> -class Partitions(Collection):
> -    def __init__(self, model):
> -        super(Partitions, self).__init__(model)
> -        self.role_key = 'storage'
> -        self.admin_methods = ['GET']
> -        self.resource = Partition
> -
> -    # Defining get_resources in order to return list of partitions in UI
> -    # sorted by their path
> -    def _get_resources(self, flag_filter):
> -        res_list = super(Partitions, self)._get_resources(flag_filter)
> -        res_list = filter(lambda x: x.info['available'], res_list)
> -        res_list.sort(key=lambda x: x.info['path'])
> -        return res_list
> -
> -
> -class Partition(Resource):
> -    def __init__(self, model, id):
> -        self.role_key = 'storage'
> -        self.admin_methods = ['GET']
> -        super(Partition, self).__init__(model, id)
> -
> -    @property
> -    def data(self):
> -        if not self.info['available']:
> -            raise NotFoundError("KCHPART0001E", {'name': self.info['name']})
> -
> -        return self.info
> -
> -
>   class Devices(Collection):
>       def __init__(self, model):
>           super(Devices, self).__init__(model)
> @@ -115,43 +59,3 @@ class Device(Resource):
>       def data(self):
>           return self.info
>   
> -
> -class PackagesUpdate(Collection):
> -    def __init__(self, model):
> -        super(PackagesUpdate, self).__init__(model)
> -        self.role_key = 'host'
> -        self.admin_methods = ['GET']
> -        self.resource = PackageUpdate
> -
> -
> -class PackageUpdate(Resource):
> -    def __init__(self, model, id=None):
> -        super(PackageUpdate, self).__init__(model, id)
> -        self.role_key = 'host'
> -        self.admin_methods = ['GET']
> -
> -    @property
> -    def data(self):
> -        return self.info
> -
> -
> -class Repositories(Collection):
> -    def __init__(self, model):
> -        super(Repositories, self).__init__(model)
> -        self.role_key = 'host'
> -        self.admin_methods = ['GET', 'POST']
> -        self.resource = Repository
> -
> -
> -class Repository(Resource):
> -    def __init__(self, model, id):
> -        super(Repository, self).__init__(model, id)
> -        self.role_key = 'host'
> -        self.admin_methods = ['GET', 'PUT', 'POST', 'DELETE']
> -        self.uri_fmt = "/host/repositories/%s"
> -        self.enable = self.generate_action_handler('enable')
> -        self.disable = self.generate_action_handler('disable')
> -
> -    @property
> -    def data(self):
> -        return self.info
> diff --git a/src/wok/plugins/kimchi/docs/README.md b/src/wok/plugins/kimchi/docs/README.md
> index fb0aef9..c838f0e 100644
> --- a/src/wok/plugins/kimchi/docs/README.md
> +++ b/src/wok/plugins/kimchi/docs/README.md
> @@ -177,13 +177,13 @@ Usage
>   
>   Connect your browser to https://localhost:8001.  You should see a screen like:
>   
> -![Wok Login Screen](/docs/kimchi-login.png)
> +![Wok Login Screen](docs/kimchi-login.png)
>   
>   Wok uses PAM to authenticate users so you can log in with the same username
>   and password that you would use to log in to the machine itself.  Once logged in
>   you will see a screen like:
>   
> -![Kimchi Guest View](/docs/kimchi-guest.png)
> +![Kimchi Guest View](docs/kimchi-guest.png)
>   
>   This shows you the list of running guests including a live screenshot of
>   the guest session.  You can use the action buttons to shutdown the guests
> @@ -197,7 +197,7 @@ top navigation bar.
>   
>   The template screen looks like:
>   
> -![Kimchi Template View](/docs/kimchi-templates.png)
> +![Kimchi Template View](docs/kimchi-templates.png)
>   
>   From this view, you can change the parameters of a template or create a
>   new template using the "+" button in the upper right corner.
> diff --git a/src/wok/plugins/kimchi/i18n.py b/src/wok/plugins/kimchi/i18n.py
> index ea325b8..ee996cd 100644
> --- a/src/wok/plugins/kimchi/i18n.py
> +++ b/src/wok/plugins/kimchi/i18n.py
> @@ -246,15 +246,6 @@ messages = {
>       "KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
>       "KCHNET0022E": _("Failed to start network %(name)s. Details: %(err)s"),
>   
> -    "KCHDR0001E": _("Debug report %(name)s does not exist"),
> -    "KCHDR0002E": _("Debug report tool not found in system"),
> -    "KCHDR0003E": _("Unable to create debug report %(name)s. Details: %(err)s."),
> -    "KCHDR0004E": _("Can not find any debug report with the given name %(name)s"),
> -    "KCHDR0005E": _("Unable to generate debug report %(name)s. Details: %(err)s"),
> -    "KCHDR0006E": _("You should give a name for the debug report file."),
> -    "KCHDR0007E": _("Debug report name must be a string. Only letters, digits, underscore ('_') and hyphen ('-') are allowed."),
> -    "KCHDR0008E": _("The debug report with specified name \"%(name)s\" already exists. Please use another one."),
> -
>       "KCHSR0001E": _("Storage server %(server)s was not used by Kimchi"),
>   
>       "KCHDISTRO0001E": _("Distro '%(name)s' does not exist"),
> @@ -266,11 +257,6 @@ messages = {
>       "KCHHOST0003E": _("Node device '%(name)s' not found"),
>       "KCHHOST0004E": _("Conflicting flag filters specified."),
>   
> -    "KCHPKGUPD0001E": _("No packages marked for update"),
> -    "KCHPKGUPD0002E": _("Package %(name)s is not marked to be updated."),
> -    "KCHPKGUPD0003E": _("Error while getting packages marked to be updated. Details: %(err)s"),
> -    "KCHPKGUPD0004E": _("There is no compatible package manager for this system."),
> -
>       "KCHUTILS0003E": _("Unable to choose a virtual machine name"),
>   
>       "KCHVMSTOR0002E": _("Invalid storage type. Types supported: 'cdrom', 'disk'"),
> @@ -288,38 +274,7 @@ messages = {
>       "KCHVMSTOR0016E": _("Volume already in use by other virtual machine."),
>       "KCHVMSTOR0017E": _("Only one of path or pool/volume can be specified to add a new virtual machine disk"),
>       "KCHVMSTOR0018E": _("Volume chosen with format %(format)s does not fit in the storage type %(type)s"),
> -
> -    "KCHREPOS0001E": _("YUM Repository ID must be one word only string."),
> -    "KCHREPOS0002E": _("Repository URL must be an http://, ftp:// or file:// URL."),
> -    "KCHREPOS0003E": _("Repository configuration is a dictionary with specific values according to repository type."),
> -    "KCHREPOS0004E": _("Distribution to DEB repository must be a string"),
> -    "KCHREPOS0005E": _("Components to DEB repository must be listed in a array"),
> -    "KCHREPOS0006E": _("Components to DEB repository must be a string"),
> -    "KCHREPOS0007E": _("Mirror list to repository must be a string"),
> -    "KCHREPOS0008E": _("YUM Repository name must be string."),
> -    "KCHREPOS0009E": _("GPG check must be a boolean value."),
> -    "KCHREPOS0010E": _("GPG key must be a URL pointing to the ASCII-armored file."),
> -    "KCHREPOS0011E": _("Could not update repository %(repo_id)s."),
> -    "KCHREPOS0012E": _("Repository %(repo_id)s does not exist."),
> -    "KCHREPOS0013E": _("Specify repository base URL,  mirror list or metalink in order to create or update a YUM repository."),
> -    "KCHREPOS0014E": _("Repository management tool was not recognized for your system."),
> -    "KCHREPOS0015E": _("Repository %(repo_id)s is already enabled."),
> -    "KCHREPOS0016E": _("Repository %(repo_id)s is already disabled."),
> -    "KCHREPOS0017E": _("Could not remove repository %(repo_id)s."),
> -    "KCHREPOS0018E": _("Could not write repository configuration file %(repo_file)s"),
> -    "KCHREPOS0019E": _("Specify repository distribution in order to create a DEB repository."),
> -    "KCHREPOS0020E": _("Could not enable repository %(repo_id)s."),
> -    "KCHREPOS0021E": _("Could not disable repository %(repo_id)s."),
> -    "KCHREPOS0022E": _("YUM Repository ID already exists"),
> -    "KCHREPOS0023E": _("YUM Repository name must be a string"),
> -    "KCHREPOS0024E": _("Unable to list repositories. Details: '%(err)s'"),
> -    "KCHREPOS0025E": _("Unable to retrieve repository information. Details: '%(err)s'"),
> -    "KCHREPOS0026E": _("Unable to add repository. Details: '%(err)s'"),
> -    "KCHREPOS0027E": _("Unable to remove repository. Details: '%(err)s'"),
> -    "KCHREPOS0028E": _("Configuration items: '%(items)s' are not supported by repository manager"),
> -    "KCHREPOS0029E": _("Repository metalink must be an http://, ftp:// or file:// URL."),
> -    "KCHREPOS0030E": _("Cannot specify mirrorlist and metalink at the same time."),
> -
> +
>       "KCHSNAP0001E": _("Virtual machine '%(vm)s' must be stopped before creating a snapshot of it."),
>       "KCHSNAP0002E": _("Unable to create snapshot '%(name)s' on virtual machine '%(vm)s'. Details: %(err)s"),
>       "KCHSNAP0003E": _("Snapshot '%(name)s' does not exist on virtual machine '%(vm)s'."),
> diff --git a/src/wok/plugins/kimchi/kimchi.conf b/src/wok/plugins/kimchi/kimchi.conf
> index 1bf78e4..ebf346f 100644
> --- a/src/wok/plugins/kimchi/kimchi.conf
> +++ b/src/wok/plugins/kimchi/kimchi.conf
> @@ -23,13 +23,6 @@ tools.staticdir.on = True
>   tools.staticdir.dir = wok.config.PluginPaths('kimchi').state_dir + '/screenshots'
>   tools.nocache.on = False
>   
> -[/data/debugreports]
> -tools.staticdir.on = True
> -tools.staticdir.dir = wok.config.PluginPaths('kimchi').state_dir + '/debugreports'
> -tools.nocache.on = False
> -tools.wokauth.on = True
> -tools.staticdir.content_types = {'xz': 'application/x-xz'}
> -
>   [/help]
>   tools.staticdir.on = True
>   tools.staticdir.dir = wok.config.PluginPaths('kimchi').ui_dir + '/pages/help'
> diff --git a/src/wok/plugins/kimchi/mockmodel.py b/src/wok/plugins/kimchi/mockmodel.py
> index 0832b20..288aae0 100644
> --- a/src/wok/plugins/kimchi/mockmodel.py
> +++ b/src/wok/plugins/kimchi/mockmodel.py
> @@ -35,7 +35,6 @@ import imageinfo
>   import osinfo
>   from model import cpuinfo
>   from model import vmifaces
> -from model.debugreports import DebugReportsModel
>   from model.host import DeviceModel
>   from model.libvirtstoragepool import IscsiPoolDef, NetfsPoolDef
>   from model.libvirtstoragepool import StoragePoolDef
> @@ -119,7 +118,6 @@ class MockModel(Model):
>           StoragePoolModel._update_lvm_disks = self._update_lvm_disks
>           StorageVolumesModel.get_list = self._mock_storagevolumes_get_list
>           StorageVolumeModel.doUpload = self._mock_storagevolume_doUpload
> -        DebugReportsModel._gen_debugreport_file = self._gen_debugreport_file
>           LibvirtVMTemplate._get_volume_path = self._get_volume_path
>           VMTemplate.get_iso_info = self._probe_image
>           imageinfo.probe_image = self._probe_image
> @@ -258,22 +256,6 @@ class MockModel(Model):
>   
>           return MockModel._libvirt_get_vol_path(pool, vol)
>   
> -    def _gen_debugreport_file(self, name):
> -        return add_task('/plugins/kimchi/debugreports/%s' % name,
> -                        self._create_log, self.objstore, name)
> -
> -    def _create_log(self, cb, name):
> -        path = config.get_debugreports_path()
> -        tmpf = os.path.join(path, name + '.tmp')
> -        realf = os.path.join(path, name + '.txt')
> -        length = random.randint(1000, 10000)
> -        with open(tmpf, 'w') as fd:
> -            while length:
> -                fd.write('I am logged')
> -                length = length - 1
> -        os.rename(tmpf, realf)
> -        cb("OK", True)
> -
>       def _update_lvm_disks(self, pool_name, disks):
>           conn = self.conn.get()
>           pool = conn.storagePoolLookupByName(pool_name.encode('utf-8'))
> diff --git a/src/wok/plugins/kimchi/model/config.py b/src/wok/plugins/kimchi/model/config.py
> index b6cc4d9..d00bb29 100644
> --- a/src/wok/plugins/kimchi/model/config.py
> +++ b/src/wok/plugins/kimchi/model/config.py
> @@ -28,10 +28,7 @@ from wok.utils import check_url_path, run_command, wok_log
>   
>   from ..config import find_qemu_binary
>   from ..distroloader import DistroLoader
> -from ..repositories import Repositories
>   from ..screenshot import VMScreenshot
> -from ..swupdate import SoftwareUpdate
> -from debugreports import DebugReportsModel
>   from featuretests import FeatureTests, FEATURETEST_POOL_NAME
>   from featuretests import FEATURETEST_VM_NAME
>   
> @@ -114,28 +111,10 @@ class CapabilitiesModel(object):
>           return False
>   
>       def lookup(self, *ident):
> -        report_tool = DebugReportsModel.get_system_report_tool()
> -        try:
> -            SoftwareUpdate()
> -        except Exception:
> -            update_tool = False
> -        else:
> -            update_tool = True
> -
> -        try:
> -            repo = Repositories()
> -        except Exception:
> -            repo_mngt_tool = None
> -        else:
> -            repo_mngt_tool = repo._pkg_mnger.TYPE
> -
>           return {'libvirt_stream_protocols': self.libvirt_stream_protocols,
>                   'qemu_spice': self._qemu_support_spice(),
>                   'qemu_stream': self.qemu_stream,
>                   'screenshot': VMScreenshot.get_stream_test_result(),
> -                'system_report_tool': bool(report_tool),
> -                'update_tool': update_tool,
> -                'repo_mngt_tool': repo_mngt_tool,
>                   'federation': kconfig.get("server", "federation"),
>                   'auth': kconfig.get("authentication", "method"),
>                   'kernel_vfio': self.kernel_vfio,
> diff --git a/src/wok/plugins/kimchi/model/host.py b/src/wok/plugins/kimchi/model/host.py
> index f32cf62..ec0822d 100644
> --- a/src/wok/plugins/kimchi/model/host.py
> +++ b/src/wok/plugins/kimchi/model/host.py
> @@ -18,28 +18,17 @@
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>   
>   import libvirt
> -import os
> -import platform
>   import psutil
> -import time
> -from cherrypy.process.plugins import BackgroundTask
> -from collections import defaultdict
>   from lxml import objectify
>   
> -from wok.basemodel import Singleton
>   from wok.exception import InvalidOperation, InvalidParameter
>   from wok.exception import NotFoundError, OperationFailed
> -from wok.utils import add_task, wok_log
>   from wok.xmlutils.utils import xpath_get_text
>   from wok.model.tasks import TaskModel
>   
>   import hostdev
> -from wok.plugins.kimchi import disks
> -from wok.plugins.kimchi import netinfo
> -from wok.plugins.kimchi.repositories import Repositories
> -from wok.plugins.kimchi.swupdate import SoftwareUpdate
>   from config import CapabilitiesModel
> -from vms import DOM_STATE_MAP, VMModel, VMsModel
> +from vms import VMModel, VMsModel
>   
>   
>   HOST_STATS_INTERVAL = 1
> @@ -50,60 +39,9 @@ class HostModel(object):
>           self.conn = kargs['conn']
>           self.objstore = kargs['objstore']
>           self.task = TaskModel(**kargs)
> -        self.host_info = self._get_host_info()
> -
> -    def _get_ppc_cpu_info(self):
> -        res = {}
> -        with open('/proc/cpuinfo') as f:
> -            for line in f.xreadlines():
> -                # Parse CPU, CPU's revision and CPU's clock information
> -                for key in ['cpu', 'revision', 'clock']:
> -                    if key in line:
> -                        info = line.split(':')[1].strip()
> -                        if key == 'clock':
> -                            value = float(info.split('MHz')[0].strip()) / 1000
> -                        else:
> -                            value = info.split('(')[0].strip()
> -                        res[key] = value
> -
> -                        # Power machines show, for each cpu/core, a block with
> -                        # all cpu information. Here we control the scan of the
> -                        # necessary information (1st block provides
> -                        # everything), skipping the function when find all
> -                        # information.
> -                        if len(res.keys()) == 3:
> -                            return "%(cpu)s (%(revision)s) @ %(clock)s GHz\
> -                                    " % res
> -
> -        return ""
> -
> -    def _get_host_info(self):
> -        res = {}
> -        if platform.machine().startswith('ppc'):
> -            res['cpu_model'] = self._get_ppc_cpu_info()
> -        else:
> -            with open('/proc/cpuinfo') as f:
> -                for line in f.xreadlines():
> -                    if "model name" in line:
> -                        res['cpu_model'] = line.split(':')[1].strip()
> -                        break
> -
> -        res['cpus'] = 0
> -        res['memory'] = 0L
> -
> -        # Include IBM PowerKVM name to supported distro names
> -        _sup_distros = platform._supported_dists + ('ibm_powerkvm',)
> -        # 'fedora' '17' 'Beefy Miracle'
> -        distro, version, codename = platform.linux_distribution(
> -            supported_dists=_sup_distros)
> -        res['os_distro'] = distro
> -        res['os_version'] = version
> -        res['os_codename'] = unicode(codename, "utf-8")
> -
> -        return res
>   
>       def lookup(self, *name):
> -        cpus = 0
> +        cpus = psutil.NUM_CPUS
>   
>           # psutil is unstable on how to get the number of
>           # cpus, different versions call it differently
> @@ -128,184 +66,6 @@ class HostModel(object):
>               self.host_info['memory'] = psutil.virtual_memory().total
>           return self.host_info
>   
> -    def swupdate(self, *name):
> -        try:
> -            swupdate = SoftwareUpdate()
> -        except:
> -            raise OperationFailed('KCHPKGUPD0004E')
> -
> -        pkgs = swupdate.getNumOfUpdates()
> -        if pkgs == 0:
> -            raise OperationFailed('KCHPKGUPD0001E')
> -
> -        wok_log.debug('Host is going to be updated.')
> -        taskid = add_task('/plugins/kimchi/host/swupdate', swupdate.doUpdate,
> -                          self.objstore, None)
> -        return self.task.lookup(taskid)
> -
> -    def shutdown(self, args=None):
> -        # Check for running vms before shutdown
> -        running_vms = self._get_vms_list_by_state('running')
> -        if len(running_vms) > 0:
> -            raise OperationFailed("KCHHOST0001E")
> -
> -        wok_log.info('Host is going to shutdown.')
> -        os.system('shutdown -h now')
> -
> -    def reboot(self, args=None):
> -        # Find running VMs
> -        running_vms = self._get_vms_list_by_state('running')
> -        if len(running_vms) > 0:
> -            raise OperationFailed("KCHHOST0002E")
> -
> -        wok_log.info('Host is going to reboot.')
> -        os.system('reboot')
> -
> -    def _get_vms_list_by_state(self, state):
> -        conn = self.conn.get()
> -        return [dom.name().decode('utf-8')
> -                for dom in conn.listAllDomains(0)
> -                if (DOM_STATE_MAP[dom.info()[0]]) == state]
> -
> -
> -class HostStatsModel(object):
> -    __metaclass__ = Singleton
> -
> -    def __init__(self, **kargs):
> -        self.host_stats = defaultdict(list)
> -        self.host_stats_thread = BackgroundTask(HOST_STATS_INTERVAL,
> -                                                self._update_host_stats)
> -        self.host_stats_thread.start()
> -
> -    def lookup(self, *name):
> -        return {'cpu_utilization': self.host_stats['cpu_utilization'][-1],
> -                'memory': self.host_stats['memory'][-1],
> -                'disk_read_rate': self.host_stats['disk_read_rate'][-1],
> -                'disk_write_rate': self.host_stats['disk_write_rate'][-1],
> -                'net_recv_rate': self.host_stats['net_recv_rate'][-1],
> -                'net_sent_rate': self.host_stats['net_sent_rate'][-1]}
> -
> -    def _update_host_stats(self):
> -        preTimeStamp = self.host_stats['timestamp']
> -        timestamp = time.time()
> -        # FIXME when we upgrade psutil, we can get uptime by psutil.uptime
> -        # we get uptime by float(open("/proc/uptime").readline().split()[0])
> -        # and calculate the first io_rate after the OS started.
> -        with open("/proc/uptime") as time_f:
> -            seconds = (timestamp - preTimeStamp if preTimeStamp else
> -                       float(time_f.readline().split()[0]))
> -
> -        self.host_stats['timestamp'] = timestamp
> -        self._get_host_disk_io_rate(seconds)
> -        self._get_host_network_io_rate(seconds)
> -
> -        self._get_percentage_host_cpu_usage()
> -        self._get_host_memory_stats()
> -
> -        # store only 60 stats (1 min)
> -        for key, value in self.host_stats.iteritems():
> -            if isinstance(value, list):
> -                if len(value) == 60:
> -                    self.host_stats[key] = value[10:]
> -
> -    def _get_percentage_host_cpu_usage(self):
> -        # This is cpu usage producer. This producer will calculate the usage
> -        # at an interval of HOST_STATS_INTERVAL.
> -        # The psutil.cpu_percent works as non blocking.
> -        # psutil.cpu_percent maintains a cpu time sample.
> -        # It will update the cpu time sample when it is called.
> -        # So only this producer can call psutil.cpu_percent in kimchi.
> -        self.host_stats['cpu_utilization'].append(psutil.cpu_percent(None))
> -
> -    def _get_host_memory_stats(self):
> -        virt_mem = psutil.virtual_memory()
> -        # available:
> -        #  the actual amount of available memory that can be given
> -        #  instantly to processes that request more memory in bytes; this
> -        #  is calculated by summing different memory values depending on
> -        #  the platform (e.g. free + buffers + cached on Linux)
> -        memory_stats = {'total': virt_mem.total,
> -                        'free': virt_mem.free,
> -                        'cached': virt_mem.cached,
> -                        'buffers': virt_mem.buffers,
> -                        'avail': virt_mem.available}
> -        self.host_stats['memory'].append(memory_stats)
> -
> -    def _get_host_disk_io_rate(self, seconds):
> -        disk_read_bytes = self.host_stats['disk_read_bytes']
> -        disk_write_bytes = self.host_stats['disk_write_bytes']
> -        prev_read_bytes = disk_read_bytes[-1] if disk_read_bytes else 0
> -        prev_write_bytes = disk_write_bytes[-1] if disk_write_bytes else 0
> -
> -        disk_io = psutil.disk_io_counters(False)
> -        read_bytes = disk_io.read_bytes
> -        write_bytes = disk_io.write_bytes
> -
> -        rd_rate = int(float(read_bytes - prev_read_bytes) / seconds + 0.5)
> -        wr_rate = int(float(write_bytes - prev_write_bytes) / seconds + 0.5)
> -
> -        self.host_stats['disk_read_rate'].append(rd_rate)
> -        self.host_stats['disk_write_rate'].append(wr_rate)
> -        self.host_stats['disk_read_bytes'].append(read_bytes)
> -        self.host_stats['disk_write_bytes'].append(write_bytes)
> -
> -    def _get_host_network_io_rate(self, seconds):
> -        net_recv_bytes = self.host_stats['net_recv_bytes']
> -        net_sent_bytes = self.host_stats['net_sent_bytes']
> -        prev_recv_bytes = net_recv_bytes[-1] if net_recv_bytes else 0
> -        prev_sent_bytes = net_sent_bytes[-1] if net_sent_bytes else 0
> -
> -        net_ios = None
> -        if hasattr(psutil, 'net_io_counters'):
> -            net_ios = psutil.net_io_counters(True)
> -        elif hasattr(psutil, 'network_io_counters'):
> -            net_ios = psutil.network_io_counters(True)
> -
> -        recv_bytes = 0
> -        sent_bytes = 0
> -        for key in set(netinfo.nics() +
> -                       netinfo.wlans()) & set(net_ios.iterkeys()):
> -            recv_bytes = recv_bytes + net_ios[key].bytes_recv
> -            sent_bytes = sent_bytes + net_ios[key].bytes_sent
> -
> -        rx_rate = int(float(recv_bytes - prev_recv_bytes) / seconds + 0.5)
> -        tx_rate = int(float(sent_bytes - prev_sent_bytes) / seconds + 0.5)
> -
> -        self.host_stats['net_recv_rate'].append(rx_rate)
> -        self.host_stats['net_sent_rate'].append(tx_rate)
> -        self.host_stats['net_recv_bytes'].append(recv_bytes)
> -        self.host_stats['net_sent_bytes'].append(sent_bytes)
> -
> -
> -class HostStatsHistoryModel(object):
> -    def __init__(self, **kargs):
> -        self.history = HostStatsModel(**kargs)
> -
> -    def lookup(self, *name):
> -        return {'cpu_utilization': self.history.host_stats['cpu_utilization'],
> -                'memory': self.history.host_stats['memory'],
> -                'disk_read_rate': self.history.host_stats['disk_read_rate'],
> -                'disk_write_rate': self.history.host_stats['disk_write_rate'],
> -                'net_recv_rate': self.history.host_stats['net_recv_rate'],
> -                'net_sent_rate': self.history.host_stats['net_sent_rate']}
> -
> -
> -class PartitionsModel(object):
> -    def __init__(self, **kargs):
> -        pass
> -
> -    def get_list(self):
> -        result = disks.get_partitions_names()
> -        return result
> -
> -
> -class PartitionModel(object):
> -    def __init__(self, **kargs):
> -        pass
> -
> -    def lookup(self, name):
> -        return disks.get_partition_details(name)
> -
>   
>   class DevicesModel(object):
>       def __init__(self, **kargs):
> @@ -502,87 +262,3 @@ class DeviceModel(object):
>                   return usb_info['name']
>           return unknown_dev
>   
> -
> -class PackagesUpdateModel(object):
> -    def __init__(self, **kargs):
> -        try:
> -            self.host_swupdate = SoftwareUpdate()
> -        except:
> -            self.host_swupdate = None
> -
> -    def get_list(self):
> -        if self.host_swupdate is None:
> -            raise OperationFailed('KCHPKGUPD0004E')
> -
> -        return self.host_swupdate.getUpdates()
> -
> -
> -class PackageUpdateModel(object):
> -    def __init__(self, **kargs):
> -        pass
> -
> -    def lookup(self, name):
> -        try:
> -            swupdate = SoftwareUpdate()
> -        except Exception:
> -            raise OperationFailed('KCHPKGUPD0004E')
> -
> -        return swupdate.getUpdate(name)
> -
> -
> -class RepositoriesModel(object):
> -    def __init__(self, **kargs):
> -        try:
> -            self.host_repositories = Repositories()
> -        except:
> -            self.host_repositories = None
> -
> -    def get_list(self):
> -        if self.host_repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return sorted(self.host_repositories.getRepositories())
> -
> -    def create(self, params):
> -        if self.host_repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self.host_repositories.addRepository(params)
> -
> -
> -class RepositoryModel(object):
> -    def __init__(self, **kargs):
> -        try:
> -            self._repositories = Repositories()
> -        except:
> -            self._repositories = None
> -
> -    def lookup(self, repo_id):
> -        if self._repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self._repositories.getRepository(repo_id)
> -
> -    def enable(self, repo_id):
> -        if self._repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self._repositories.enableRepository(repo_id)
> -
> -    def disable(self, repo_id):
> -        if self._repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self._repositories.disableRepository(repo_id)
> -
> -    def update(self, repo_id, params):
> -        if self._repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self._repositories.updateRepository(repo_id, params)
> -
> -    def delete(self, repo_id):
> -        if self._repositories is None:
> -            raise InvalidOperation('KCHREPOS0014E')
> -
> -        return self._repositories.removeRepository(repo_id)
> diff --git a/src/wok/plugins/kimchi/root.py b/src/wok/plugins/kimchi/root.py
> index 1e2bfc7..2c8ac5b 100644
> --- a/src/wok/plugins/kimchi/root.py
> +++ b/src/wok/plugins/kimchi/root.py
> @@ -58,7 +58,6 @@ class KimchiRoot(WokRoot):
>   
>           make_dirs = [
>               os.path.abspath(config.get_distros_store()),
> -            os.path.abspath(config.get_debugreports_path()),
>               os.path.abspath(config.get_screenshot_path())
>           ]
>           for directory in make_dirs:
> diff --git a/src/wok/plugins/kimchi/tests/test_authorization.py b/src/wok/plugins/kimchi/tests/test_authorization.py
> index 87d68ab..fda86a3 100644
> --- a/src/wok/plugins/kimchi/tests/test_authorization.py
> +++ b/src/wok/plugins/kimchi/tests/test_authorization.py
> @@ -77,12 +77,6 @@ class AuthorizationTests(unittest.TestCase):
>           resp = self.request('/plugins/kimchi/host/shutdown', '{}', 'POST')
>           self.assertEquals(403, resp.status)
>   
> -        # Non-root users can not get or debug reports
> -        resp = self.request('/plugins/kimchi/debugreports', '{}', 'GET')
> -        self.assertEquals(403, resp.status)
> -        resp = self.request('/plugins/kimchi/debugreports', '{}', 'POST')
> -        self.assertEquals(403, resp.status)
> -
>           # Non-root users can not create or delete network (only get)
>           resp = self.request('/plugins/kimchi/networks', '{}', 'GET')
>           self.assertEquals(200, resp.status)
> diff --git a/src/wok/plugins/kimchi/tests/test_config.py.in b/src/wok/plugins/kimchi/tests/test_config.py.in
> index e4db15a..8cb9b6a 100644
> --- a/src/wok/plugins/kimchi/tests/test_config.py.in
> +++ b/src/wok/plugins/kimchi/tests/test_config.py.in
> @@ -253,13 +253,6 @@ class ConfigTests(unittest.TestCase):
>                   'tools.staticdir.dir': get_screenshot_path(),
>                   'tools.nocache.on': False
>               },
> -            '/data/debugreports': {
> -                'tools.staticdir.on': True,
> -                'tools.staticdir.dir': get_debugreports_path(),
> -                'tools.nocache.on': False,
> -                'tools.wokauth.on': True,
> -                'tools.staticdir.content_types': {'xz': 'application/x-xz'}
> -            },
>               '/help': {
>                   'tools.staticdir.on': True,
>                   'tools.staticdir.dir': '%s/ui/pages/help' % pluginPrefix,
> diff --git a/src/wok/plugins/kimchi/tests/test_host.py b/src/wok/plugins/kimchi/tests/test_host.py
> index f3da49b..22a9a78 100644
> --- a/src/wok/plugins/kimchi/tests/test_host.py
> +++ b/src/wok/plugins/kimchi/tests/test_host.py
> @@ -20,8 +20,6 @@
>   
>   import json
>   import os
> -import platform
> -import psutil
>   import tempfile
>   import time
>   import unittest
> @@ -29,7 +27,7 @@ from functools import partial
>   
>   from wok.plugins.kimchi.mockmodel import MockModel
>   
> -from utils import get_free_port, patch_auth, request, run_server, wait_task
> +from utils import get_free_port, patch_auth, request, run_server
>   
>   
>   test_server = None
> @@ -62,98 +60,6 @@ class HostTests(unittest.TestCase):
>       def setUp(self):
>           self.request = partial(request, host, ssl_port)
>   
> -    def test_hostinfo(self):
> -        resp = self.request('/plugins/kimchi/host').read()
> -        info = json.loads(resp)
> -        keys = ['os_distro', 'os_version', 'os_codename', 'cpu_model',
> -                'memory', 'cpus']
> -        self.assertEquals(sorted(keys), sorted(info.keys()))
> -
> -        distro, version, codename = platform.linux_distribution()
> -        self.assertEquals(distro, info['os_distro'])
> -        self.assertEquals(version, info['os_version'])
> -        self.assertEquals(unicode(codename, "utf-8"), info['os_codename'])
> -        self.assertEquals(psutil.TOTAL_PHYMEM, info['memory'])
> -
> -    def test_hoststats(self):
> -        time.sleep(1)
> -        stats_keys = ['cpu_utilization', 'memory', 'disk_read_rate',
> -                      'disk_write_rate', 'net_recv_rate', 'net_sent_rate']
> -        resp = self.request('/plugins/kimchi/host/stats').read()
> -        stats = json.loads(resp)
> -        self.assertEquals(sorted(stats_keys), sorted(stats.keys()))
> -
> -        cpu_utilization = stats['cpu_utilization']
> -        self.assertIsInstance(cpu_utilization, float)
> -        self.assertGreaterEqual(cpu_utilization, 0.0)
> -        self.assertTrue(cpu_utilization <= 100.0)
> -
> -        memory_stats = stats['memory']
> -        self.assertIn('total', memory_stats)
> -        self.assertIn('free', memory_stats)
> -        self.assertIn('cached', memory_stats)
> -        self.assertIn('buffers', memory_stats)
> -        self.assertIn('avail', memory_stats)
> -
> -        resp = self.request('/plugins/kimchi/host/stats/history').read()
> -        history = json.loads(resp)
> -        self.assertEquals(sorted(stats_keys), sorted(history.keys()))
> -
> -    def test_host_actions(self):
> -        def _task_lookup(taskid):
> -            return json.loads(
> -                self.request('/plugins/kimchi/tasks/%s' % taskid).read()
> -            )
> -
> -        resp = self.request('/plugins/kimchi/host/shutdown', '{}', 'POST')
> -        self.assertEquals(200, resp.status)
> -        resp = self.request('/plugins/kimchi/host/reboot', '{}', 'POST')
> -        self.assertEquals(200, resp.status)
> -
> -        # Test system update
> -        resp = self.request('/plugins/kimchi/host/packagesupdate', None, 'GET')
> -        pkgs = json.loads(resp.read())
> -        self.assertEquals(3, len(pkgs))
> -
> -        pkg_keys = ['package_name', 'repository', 'arch', 'version']
> -        for p in pkgs:
> -            name = p['package_name']
> -            resp = self.request('/plugins/kimchi/host/packagesupdate/' + name,
> -                                None, 'GET')
> -            info = json.loads(resp.read())
> -            self.assertEquals(sorted(pkg_keys), sorted(info.keys()))
> -
> -        resp = self.request('/plugins/kimchi/host/swupdate', '{}', 'POST')
> -        task = json.loads(resp.read())
> -        task_params = [u'id', u'message', u'status', u'target_uri']
> -        self.assertEquals(sorted(task_params), sorted(task.keys()))
> -
> -        resp = self.request('/tasks/' + task[u'id'], None,
> -                            'GET')
> -        task_info = json.loads(resp.read())
> -        self.assertEquals(task_info['status'], 'running')
> -        wait_task(_task_lookup, task_info['id'])
> -        resp = self.request('/tasks/' + task[u'id'], None,
> -                            'GET')
> -        task_info = json.loads(resp.read())
> -        self.assertEquals(task_info['status'], 'finished')
> -        self.assertIn(u'All packages updated', task_info['message'])
> -        pkgs = model.packagesupdate_get_list()
> -        self.assertEquals(0, len(pkgs))
> -
> -    def test_host_partitions(self):
> -        resp = self.request('/plugins/kimchi/host/partitions')
> -        self.assertEquals(200, resp.status)
> -        partitions = json.loads(resp.read())
> -
> -        keys = ['name', 'path', 'type', 'fstype', 'size', 'mountpoint',
> -                'available']
> -        for item in partitions:
> -            resp = self.request('/plugins/kimchi/host/partitions/%s' %
> -                                item['name'])
> -            info = json.loads(resp.read())
> -            self.assertEquals(sorted(info.keys()), sorted(keys))
> -
>       def test_host_devices(self):
>           def asset_devices_type(devices, dev_type):
>               for dev in devices:
> diff --git a/src/wok/plugins/kimchi/tests/test_model.py b/src/wok/plugins/kimchi/tests/test_model.py
> index 55117cf..379c046 100644
> --- a/src/wok/plugins/kimchi/tests/test_model.py
> +++ b/src/wok/plugins/kimchi/tests/test_model.py
> @@ -1065,54 +1065,6 @@ class ModelTests(unittest.TestCase):
>   
>               self.assertTrue('kimchi-vm' in vms)
>   
> -    @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
> -    def test_debug_reports(self):
> -        inst = model.Model('test:///default',
> -                           objstore_loc=self.tmp_store)
> -
> -        if not inst.capabilities_lookup()['system_report_tool']:
> -            raise unittest.SkipTest("Without debug report tool")
> -
> -        try:
> -            timeout = int(os.environ['TEST_REPORT_TIMEOUT'])
> -        except (ValueError, KeyError):
> -            timeout = 120
> -
> -        namePrefix = 'unitTestReport'
> -        # sosreport always deletes unsual letters like '-' and '_' in the
> -        # generated report file name.
> -        uuidstr = str(uuid.uuid4()).translate(None, "-_")
> -        reportName = namePrefix + uuidstr
> -        try:
> -            inst.debugreport_delete(namePrefix + '*')
> -        except NotFoundError:
> -            pass
> -        with RollbackContext() as rollback:
> -            report_list = inst.debugreports_get_list()
> -            self.assertFalse(reportName in report_list)
> -            try:
> -                tmp_name = reportName + "_1"
> -                task = inst.debugreports_create({'name': reportName})
> -                rollback.prependDefer(inst.debugreport_delete, tmp_name)
> -                taskid = task['id']
> -                inst.task_wait(taskid, timeout)
> -                self.assertEquals('finished',
> -                                  inst.task_lookup(taskid)['status'],
> -                                  "It is not necessary an error.  "
> -                                  "You may need to increase the "
> -                                  "timeout number by "
> -                                  "TEST_REPORT_TIMEOUT=200 "
> -                                  "./run_tests.sh test_model")
> -                report_list = inst.debugreports_get_list()
> -                self.assertTrue(reportName in report_list)
> -                name = inst.debugreport_update(reportName, {'name': tmp_name})
> -                self.assertEquals(name, tmp_name)
> -                report_list = inst.debugreports_get_list()
> -                self.assertTrue(tmp_name in report_list)
> -            except OperationFailed, e:
> -                if 'debugreport tool not found' not in e.message:
> -                    raise e
> -
>       def test_get_distros(self):
>           inst = model.Model('test:///default',
>                              objstore_loc=self.tmp_store)
> @@ -1151,195 +1103,6 @@ class ModelTests(unittest.TestCase):
>               volumes = inst.storagevolumes_get_list(args['name'])
>               self.assertEquals(len(volumes), 2)
>   
> -    def test_repository_create(self):
> -        inst = model.Model('test:///default',
> -                           objstore_loc=self.tmp_store)
> -
> -        yum_repos = [{'repo_id': 'fedora-fake',
> -                      'baseurl': 'http://www.fedora.org'},
> -                     {'repo_id': 'fedora-updates-fake',
> -                      'config':
> -                      {'mirrorlist': 'http://www.fedoraproject.org'}}]
> -
> -        deb_repos = [{'baseurl': 'http://archive.ubuntu.com/ubuntu/',
> -                      'config': {'dist': 'quantal'}},
> -                     {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
> -                      'config': {'dist': 'quantal', 'comps': ['main']}}]
> -
> -        yum_invalid_repos = []
> -        deb_invalid_repos = []
> -
> -        for url in invalid_repository_urls:
> -            wrong_baseurl = {'repo_id': 'wrong-id', 'baseurl': url}
> -            wrong_mirrorlist = {'repo_id': 'wrong-id',
> -                                'baseurl': 'www.example.com',
> -                                'config': {'mirrorlist': url}}
> -            wrong_config_item = {
> -                'repo_id': 'wrong-id',
> -                'baseurl': 'www.example.com',
> -                'config': {
> -                    'gpgkey': 'file:///tmp/KEY-fedora-updates-fake-19'}}
> -
> -            yum_invalid_repos.append(wrong_baseurl)
> -            yum_invalid_repos.append(wrong_mirrorlist)
> -            yum_invalid_repos.append(wrong_config_item)
> -
> -            wrong_baseurl['config'] = {'dist': 'tasty'}
> -            wrong_config = {'baseurl': deb_repos[0]['baseurl'],
> -                            'config': {
> -                                'unsupported_item': "a_unsupported_item"}}
> -            deb_invalid_repos.append(wrong_baseurl)
> -            deb_invalid_repos.append(wrong_config)
> -
> -        repo_type = inst.capabilities_lookup()['repo_mngt_tool']
> -        if repo_type == 'yum':
> -            test_repos = yum_repos
> -            invalid_repos = yum_invalid_repos
> -        elif repo_type == 'deb':
> -            test_repos = deb_repos
> -            invalid_repos = deb_invalid_repos
> -        else:
> -            # repository management tool was not recognized by Kimchi
> -            # skip test case
> -            return
> -
> -        # create repositories with invalid data
> -        for repo in invalid_repos:
> -            self.assertRaises(InvalidParameter, inst.repositories_create, repo)
> -
> -        for repo in test_repos:
> -            system_host_repos = len(inst.repositories_get_list())
> -            repo_id = inst.repositories_create(repo)
> -            host_repos = inst.repositories_get_list()
> -            self.assertEquals(system_host_repos + 1, len(host_repos))
> -
> -            repo_info = inst.repository_lookup(repo_id)
> -            self.assertEquals(repo_id, repo_info['repo_id'])
> -            self.assertEquals(True, repo_info.get('enabled'))
> -            self.assertEquals(repo.get('baseurl', ''),
> -                              repo_info.get('baseurl'))
> -
> -            original_config = repo.get('config', {})
> -            config_info = repo_info.get('config', {})
> -
> -            if repo_type == 'yum':
> -                self.assertEquals(original_config.get('mirrorlist', ''),
> -                                  config_info.get('mirrorlist', ''))
> -                self.assertEquals(True, config_info['gpgcheck'])
> -            else:
> -                self.assertEquals(original_config['dist'], config_info['dist'])
> -                self.assertEquals(original_config.get('comps', []),
> -                                  config_info.get('comps', []))
> -
> -            inst.repository_delete(repo_id)
> -            self.assertRaises(NotFoundError, inst.repository_lookup, repo_id)
> -
> -        self.assertRaises(NotFoundError, inst.repository_lookup, 'google')
> -
> -    def test_repository_update(self):
> -        inst = model.Model('test:///default',
> -                           objstore_loc=self.tmp_store)
> -
> -        yum_repo = {'repo_id': 'fedora-fake',
> -                    'baseurl': 'http://www.fedora.org'}
> -        yum_new_repo = {'baseurl': 'http://www.fedoraproject.org'}
> -
> -        deb_repo = {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
> -                    'config': {'dist': 'quantal'}}
> -        deb_new_repo = {'baseurl': 'http://br.archive.canonical.com/ubuntu/',
> -                        'config': {'dist': 'utopic'}}
> -
> -        yum_invalid_repos = []
> -        deb_invalid_repos = []
> -
> -        for url in invalid_repository_urls:
> -            wrong_baseurl = {'baseurl': url}
> -            wrong_mirrorlist = {'baseurl': 'www.example.com',
> -                                'config': {'mirrorlist': url}}
> -
> -            yum_invalid_repos.append(wrong_baseurl)
> -            yum_invalid_repos.append(wrong_mirrorlist)
> -
> -            wrong_baseurl['config'] = {'dist': 'tasty'}
> -            deb_invalid_repos.append(wrong_baseurl)
> -
> -        repo_type = inst.capabilities_lookup()['repo_mngt_tool']
> -        if repo_type == 'yum':
> -            repo = yum_repo
> -            new_repo = yum_new_repo
> -            invalid_repos = yum_invalid_repos
> -        elif repo_type == 'deb':
> -            repo = deb_repo
> -            new_repo = deb_new_repo
> -            invalid_repos = deb_invalid_repos
> -        else:
> -            # repository management tool was not recognized by Kimchi
> -            # skip test case
> -            return
> -
> -        system_host_repos = len(inst.repositories_get_list())
> -
> -        with RollbackContext() as rollback:
> -            repo_id = inst.repositories_create(repo)
> -            rollback.prependDefer(inst.repository_delete, repo_id)
> -
> -            host_repos = inst.repositories_get_list()
> -            self.assertEquals(system_host_repos + 1, len(host_repos))
> -
> -            # update repositories with invalid data
> -            for tmp_repo in invalid_repos:
> -                self.assertRaises(InvalidParameter, inst.repository_update,
> -                                  repo_id, tmp_repo)
> -
> -            new_repo_id = inst.repository_update(repo_id, new_repo)
> -            repo_info = inst.repository_lookup(new_repo_id)
> -
> -            self.assertEquals(new_repo_id, repo_info['repo_id'])
> -            self.assertEquals(new_repo['baseurl'], repo_info['baseurl'])
> -            self.assertEquals(True, repo_info['enabled'])
> -            inst.repository_update(new_repo_id, repo)
> -
> -    def test_repository_disable_enable(self):
> -        inst = model.Model('test:///default',
> -                           objstore_loc=self.tmp_store)
> -
> -        yum_repo = {'repo_id': 'fedora-fake',
> -                    'baseurl': 'http://www.fedora.org'}
> -        deb_repo = {'baseurl': 'http://archive.ubuntu.com/ubuntu/',
> -                    'config': {'dist': 'quantal'}}
> -
> -        repo_type = inst.capabilities_lookup()['repo_mngt_tool']
> -        if repo_type == 'yum':
> -            repo = yum_repo
> -        elif repo_type == 'deb':
> -            repo = deb_repo
> -        else:
> -            # repository management tool was not recognized by Kimchi
> -            # skip test case
> -            return
> -
> -        system_host_repos = len(inst.repositories_get_list())
> -
> -        repo_id = inst.repositories_create(repo)
> -
> -        host_repos = inst.repositories_get_list()
> -        self.assertEquals(system_host_repos + 1, len(host_repos))
> -
> -        repo_info = inst.repository_lookup(repo_id)
> -        self.assertEquals(True, repo_info['enabled'])
> -
> -        inst.repository_disable(repo_id)
> -        repo_info = inst.repository_lookup(repo_id)
> -        self.assertEquals(False, repo_info['enabled'])
> -
> -        inst.repository_enable(repo_id)
> -        repo_info = inst.repository_lookup(repo_id)
> -        self.assertEquals(True, repo_info['enabled'])
> -
> -        # remove files creates
> -        inst.repository_delete(repo_id)
> -
> -
>   class BaseModelTests(unittest.TestCase):
>       class FoosModel(object):
>           def __init__(self):
> diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py
> index 8cf4bd3..8f12920 100644
> --- a/src/wok/plugins/kimchi/tests/test_rest.py
> +++ b/src/wok/plugins/kimchi/tests/test_rest.py
> @@ -1266,60 +1266,6 @@ class RestTests(unittest.TestCase):
>               # Distro not found error
>               self.assertIn('KCHDISTRO0001E', distro.get('reason'))
>   
> -    def test_debugreports(self):
> -        resp = request(host, ssl_port, '/plugins/kimchi/debugreports')
> -        self.assertEquals(200, resp.status)
> -
> -    def _report_delete(self, name):
> -        request(host, ssl_port, '/plugins/kimchi/debugreports/%s' % name, '{}',
> -                'DELETE')
> -
> -    def test_create_debugreport(self):
> -        req = json.dumps({'name': 'report1'})
> -        with RollbackContext() as rollback:
> -            resp = request(host, ssl_port, '/plugins/kimchi/debugreports', req,
> -                           'POST')
> -            self.assertEquals(202, resp.status)
> -            task = json.loads(resp.read())
> -            # make sure the debugreport doesn't exist until the
> -            # the task is finished
> -            wait_task(self._task_lookup, task['id'])
> -            rollback.prependDefer(self._report_delete, 'report2')
> -            resp = request(host, ssl_port,
> -                           '/plugins/kimchi/debugreports/report1')
> -            debugreport = json.loads(resp.read())
> -            self.assertEquals("report1", debugreport['name'])
> -            self.assertEquals(200, resp.status)
> -            req = json.dumps({'name': 'report2'})
> -            resp = request(host, ssl_port,
> -                           '/plugins/kimchi/debugreports/report1', req, 'PUT')
> -            self.assertEquals(303, resp.status)
> -
> -    def test_debugreport_download(self):
> -        req = json.dumps({'name': 'report1'})
> -        with RollbackContext() as rollback:
> -            resp = request(host, ssl_port, '/plugins/kimchi/debugreports', req,
> -                           'POST')
> -            self.assertEquals(202, resp.status)
> -            task = json.loads(resp.read())
> -            # make sure the debugreport doesn't exist until the
> -            # the task is finished
> -            wait_task(self._task_lookup, task['id'], 20)
> -            rollback.prependDefer(self._report_delete, 'report1')
> -            resp = request(host, ssl_port,
> -                           '/plugins/kimchi/debugreports/report1')
> -            debugreport = json.loads(resp.read())
> -            self.assertEquals("report1", debugreport['name'])
> -            self.assertEquals(200, resp.status)
> -            resp = request(host, ssl_port,
> -                           '/plugins/kimchi/debugreports/report1/content')
> -            self.assertEquals(200, resp.status)
> -            resp = request(host, ssl_port,
> -                           '/plugins/kimchi/debugreports/report1')
> -            debugre = json.loads(resp.read())
> -            resp = request(host, ssl_port, debugre['uri'])
> -            self.assertEquals(200, resp.status)
> -
>       def test_repositories(self):
>           def verify_repo(t, res):
>               for field in ('repo_id', 'enabled', 'baseurl', 'config'):
> diff --git a/src/wok/plugins/kimchi/ui/config/tab-ext.xml b/src/wok/plugins/kimchi/ui/config/tab-ext.xml
> index ee88c88..48ec9ec 100644
> --- a/src/wok/plugins/kimchi/ui/config/tab-ext.xml
> +++ b/src/wok/plugins/kimchi/ui/config/tab-ext.xml
> @@ -2,13 +2,6 @@
>   <tabs-ext>
>       <tab>
>           <access role="admin" mode="admin"/>
> -        <access role="user" mode="none"/>
> -
> -        <title>Host</title>
> -        <path>plugins/kimchi/host.html</path>
> -    </tab>
> -    <tab>
> -        <access role="admin" mode="admin"/>
>           <access role="user" mode="byInstance"/>
>   
>           <title>Guests</title>




More information about the Kimchi-devel mailing list