On 07/29/2014 10:27 PM, Royce Lv wrote:
+1 for this one,
we have not tested add url link based cdrom,
could you also add a test case for this scenario in test_model.py so
that we can prevent regression?
Sure!
Just FYI: In order to hit this issue, you don't have to do an add of a
CD ROM. This was hit when editing (swapping?) the CD ROM that's there
because the VM was created using a remote-iso-based template. It's also
going to be hit with Manage Media.
I'll work on the tests, but I'm assuming it's okay to merge this fix
without them.
On 2014年07月30日 06:48, Christy Perez wrote:
> lxml only accepts strings as parameters when looking
> up xml elements. The port for remote ISO was being
> passed in as an int, and a KeyError was thrown.
>
> This patch just casts the ints to strings for the
> lookups.
>
> Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
> ---
> src/kimchi/model/vmstorages.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/vmstorages.py
> b/src/kimchi/model/vmstorages.py
> index cd985fa..5543f40 100644
> --- a/src/kimchi/model/vmstorages.py
> +++ b/src/kimchi/model/vmstorages.py
> @@ -68,7 +68,8 @@ def _get_storage_xml(params, ignore_source=False):
> if src_type == 'network':
> output = urlparse.urlparse(params.get('path'))
> host = E.host(name=output.hostname, port=
> - output.port or
> socket.getservbyname(output.scheme))
> + str(output.port) or
> + str(socket.getservbyname(output.scheme)))
> source = E.source(protocol=output.scheme, name=output.path)
> source.append(host)
> disk.append(source)
Regards,
- Christy