Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Citrix Hypervisor 8.0.0, VmBackup #94

Open
JW-wcad opened this issue Jul 4, 2019 · 18 comments
Open

Citrix Hypervisor 8.0.0, VmBackup #94

JW-wcad opened this issue Jul 4, 2019 · 18 comments

Comments

@JW-wcad
Copy link

JW-wcad commented Jul 4, 2019

Hello,
I use VmBackup.py last version to backup my VM:
Here some infos about my config:
Virtualization: xen
Operating System: Citrix Hypervisor 8.0.0
Kernel: Linux 4.19.0+1
Architecture: x86-64
And the Error:
2019-07-04-(16:33:50) - VmBackup.py running with these settings:
2019-07-04-(16:33:50) - backup_dir = /mnt/backup/vmbackup/WIN7
2019-07-04-(16:33:50) - status_log = /mnt/backup/vmbackup/logs/status.log
2019-07-04-(16:33:50) - compress = False
2019-07-04-(16:33:50) - max_backups = 2
2019-07-04-(16:33:50) - vdi_export_format = vhd
2019-07-04-(16:33:50) - pool_db_backup = 0
2019-07-04-(16:33:50) - exclude (cnt)= 0
2019-07-04-(16:33:50) - exclude:
2019-07-04-(16:33:50) - vdi-export (cnt)= 0
2019-07-04-(16:33:50) - vdi-export:
2019-07-04-(16:33:50) - vm-export (cnt)= 1
2019-07-04-(16:33:50) - vm-export: WIN7
Traceback (most recent call last):
File "./VmBackup.py", line 1457, in
session.xenapi.login_with_password(username, password)
File "/mnt/backup/vmbackup/XenAPI.py", line 264, in call
return self.__send(self.__name, args)
File "/mnt/backup/vmbackup/XenAPI.py", line 151, in xenapi_request
self._login(methodname, params)
File "/mnt/backup/vmbackup/XenAPI.py", line 188, in _login
raise e
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)
[root@xcp vmbackup]#
The same command on XCP-NG 7.6 works fine!
Regards
Jan

@sniperkitten
Copy link

sniperkitten commented Jul 11, 2019

Hi, seems like duplicate of #59

@NAUbackup
Copy link
Owner

Yes, please see #59 for a workaround.

@NAUbackup
Copy link
Owner

I have finally been able to attach an external storage device to my CH 8.0 tests pool and will hopefully start investigating this and other issues that occur under CH 8.0 soon. Sorry for the delay, as it's been very busy with many other things as of late.

@NAUbackup
Copy link
Owner

There are some fundamental differences between the earlier XenAPI.py and CH 8.0 release. Here are the differences (the CH 8.0 is < while the earlier version from XS 7.X is flagged as >):

58,59c58,59
< import six.moves.xmlrpc_client as xmlrpclib
< import six.moves.http_client as httplib
---
> import xmlrpclib
> import httplib
75,78c75,78
<         except Exception as exn:
<             msg = "Xen-API failure: %s" % exn
<             sys.stderr.write(msg)
<             return msg
---
>         except Exception, exn:
>             import sys
>             print >>sys.stderr, exn
>             return "Xen-API failure: %s" % str(self.details)
95c95
< class UDSHTTP(httplib.HTTPConnection):
---
> class UDSHTTP(httplib.HTTP):
102d101
<         self._connection = (None, None)
107c106
<         if sys.version_info[0] <= 2 and sys.version_info[1] < 7:
---
>         if sys.version_info[0] <= 2 and sys.version_info[1] < 6:
123c122
<     session.login_with_password('me', 'mypassword', '1.0', 'xen-api-scripts-xenapi.py')
---
>     session.login_with_password('me', 'mypassword')
129,141c128,130
<                  allow_none=1, ignore_ssl=False):
<
<         # Fix for CA-172901 (+ Python 2.4 compatibility)
<         # Fix for context=ctx ( < Python 2.7.9 compatibility)
<         if not (sys.version_info[0] <= 2 and sys.version_info[1] <= 7 and sys.version_info[2] <= 9 ) \
<                 and ignore_ssl:
<             import ssl
<             ctx = ssl._create_unverified_context()
<             xmlrpclib.ServerProxy.__init__(self, uri, transport, encoding,
<                                            verbose, allow_none, context=ctx)
<         else:
<             xmlrpclib.ServerProxy.__init__(self, uri, transport, encoding,
<                                            verbose, allow_none)
---
>                  allow_none=1):
>         xmlrpclib.ServerProxy.__init__(self, uri, transport, encoding,
>                                        verbose, allow_none)
172a162
>
174,188c164,171
<         try:
<             result = _parse_result(
<                 getattr(self, 'session.%s' % method)(*params))
<             if result is _RECONNECT_AND_RETRY:
<                 raise xmlrpclib.Fault(
<                     500, 'Received SESSION_INVALID when logging in')
<             self._session = result
<             self.last_login_method = method
<             self.last_login_params = params
<             self.API_version = self._get_api_version()
<         except socket.error as e:
<             if e.errno == socket.errno.ETIMEDOUT:
<                 raise xmlrpclib.Fault(504, 'The connection timed out')
<             else:
<                 raise e
---
>         result = _parse_result(getattr(self, 'session.%s' % method)(*params))
>         if result is _RECONNECT_AND_RETRY:
>             raise xmlrpclib.Fault(
>                 500, 'Received SESSION_INVALID when logging in')
>         self._session = result
>         self.last_login_method = method
>         self.last_login_params = params
>         self.API_version = self._get_api_version()
216,217d198
<         elif name == 'logout':
<             return _Dispatcher(self.API_version, self.xenapi_request, "logout")
222c203
<     return Session("http://_var_lib_xcp_xapi/", transport=UDSTransport())
---
>     return Session("http://_var_xapi_xapi/", transport=UDSTransport())

@NAUbackup
Copy link
Owner

NAUbackup commented Jul 26, 2019

Note the line:
def init(self, uri, transport=None, encoding=None, verbose=0,
allow_none=1, ignore_ssl=False):

which is probably why the https://localhost connection now fails without a valid certificate in place.

Looks like the https://localhost will have to be set to http://localhost by default as all sorts of errors get thrown otherwise.

@NAUbackup
Copy link
Owner

There are a number of changes in the latest API python library and I feel the easiest is to change the code to state http://localhost and be done with it. It's also then backwards-compatible. I will make a change a push out a minor release update soon.

@NAUbackup
Copy link
Owner

NAUbackup commented Aug 7, 2019

I have just released V3.25 which should address the http://localhost access issues and should work in all versions of XenServer/Citrix Hypervisor from 6.X through and including 8.0.

@sniperkitten
Copy link

Tested new version V3.25, it works fine for me in Xen 8.0

@JW-wcad
Copy link
Author

JW-wcad commented Aug 12, 2019

I have just tested the new version (V3.25), it works fine.
Thank You for your very nice work.
Regards
Jan

@txsastre
Copy link

txsastre commented Sep 4, 2019

hi there.
I've installed an XCP-ng 8.0 it tends to be 99% the same as the citrix hypervisor 8.0
I still have the same SSL error

Traceback (most recent call last):
  File "./VmBackup.py", line 1628, in <module>
    session.xenapi.login_with_password(username, password)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 264, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 151, in xenapi_request
    self._login(methodname, params)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 188, in _login
    raise e
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)

@NAUbackup
Copy link
Owner

@txsastre, this is with V3.25?

@txsastre
Copy link

txsastre commented Sep 4, 2019

Yes. Just downloaded today.
also checked the https / http roundabout

@txsastre
Copy link

txsastre commented Sep 5, 2019

hi, tried on a new server from scratch, same error
the servers are a XCP-NG 8.0

#!/usr/bin/python
#
#NAUVmBackup/VmBackup.py
# V3.25 August 2019

./VmBackup.py password plt-Debian9 preview

[08:52 h2 NAUbackup]# ./VmBackup.py  12341234  plt-Debian9 preview
2019-09-05-(08:52:48) - VmBackup config loaded from: plt-Debian9
2019-09-05-(08:52:48) - VmBackup.py running with these settings:
2019-09-05-(08:52:48) -   backup_dir        = /mnt/backup
2019-09-05-(08:52:48) -   status_log        = /mnt/backup/status.log
2019-09-05-(08:52:48) -   compress          = False
2019-09-05-(08:52:48) -   max_backups       = 2
2019-09-05-(08:52:48) -   vdi_export_format = raw
2019-09-05-(08:52:48) -   pool_db_backup    = 0
2019-09-05-(08:52:48) -   exclude (cnt)= 0
2019-09-05-(08:52:48) -   exclude: 
2019-09-05-(08:52:48) -   vdi-export (cnt)= 0
2019-09-05-(08:52:48) -   vdi-export: 
2019-09-05-(08:52:48) -   vm-export (cnt)= 1
2019-09-05-(08:52:48) -   vm-export: plt-Debian9
['HOST_IS_SLAVE', '192.168.222.73']
Traceback (most recent call last):
  File "./VmBackup.py", line 1628, in <module>
    session.xenapi.login_with_password(username, password)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 264, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 151, in xenapi_request
    self._login(methodname, params)
  File "/usr/lib/python2.7/site-packages/XenAPI.py", line 188, in _login
    raise e
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)

@txsastre
Copy link

txsastre commented Sep 5, 2019

hi again. I make it work

NAUVmBackup v3.25
in line
1628
replace
session = XenAPI.Session('https://' + e.details[1])
with
session = XenAPI.Session('http://' + e.details[1])

(remove the "s" in "httpS")

@NAUbackup
Copy link
Owner

Awesome, @txsastre thank you! I will fix and redistribute the code. Many thanks -- missed that one somehow.

@txsastre
Copy link

txsastre commented Sep 5, 2019

Glad to help :) . Thank to you for this priceless tool!

@NAUbackup
Copy link
Owner

Our pleasure!

@NAUbackup
Copy link
Owner

Code is updated in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants