File: Error.pm

package info (click to toggle)
libsys-virt-perl 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,084 kB
  • ctags: 170
  • sloc: perl: 1,769; makefile: 3
file content (835 lines) | stat: -rw-r--r-- 15,729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
# -*- perl -*-
#
# Copyright (C) 2006 Red Hat
# Copyright (C) 2006-2007 Daniel P. Berrange
#
# This program is free software; You can redistribute it and/or modify
# it under either:
#
# a) the GNU General Public License as published by the Free
#   Software Foundation; either version 2, or (at your option) any
#   later version,
#
# or
#
# b) the "Artistic License"
#
# The file "LICENSE" distributed along with this file provides full
# details of the terms and conditions of the two licenses.

=pod

=head1 NAME

Sys::Virt::Error - error object for libvirt APIs

=head1 DESCRIPTION

The C<Sys::Virt::Error> class provides an encoding of the
libvirt errors. Instances of this object can be thrown by
pretty much any of the Sys::Virt APIs.

=head1 METHODS

=over 4

=cut

package Sys::Virt::Error;

use strict;
use warnings;
use overload ('""' => 'stringify');

=item $err->stringify

Convert the object into string format suitable for printing on a
console to inform a user of the error.

=cut

sub stringify {
    my $self = shift;

    return "libvirt error code: " . $self->{code} . ", message: " . $self->{message} . ($self->{message} =~ /\n$/ ? "" : "\n");
}

=item my $code = $err->level

Return the raw error level represented by this error. One of the
ERROR LEVEL CONSTANTS

=cut

sub level {
    my $self = shift;
    return $self->{code}
}

=item my $code = $err->code

Return the raw error code represented by this error. One of the
ERROR CODE CONSTANTS

=cut

sub code {
    my $self = shift;
    return $self->{code}
}

=item my $from = $err->domain

Return the error domain raising this error. One of the ERROR
DOMAIN CONSTANTS

=cut

sub domain {
    my $self = shift;
    return $self->{domain}
}

=item my $msg = $err->message

Return an informative message describing the error condition.

=cut

sub message {
    my $self = shift;
    return $self->{message}
}


1;

=back

=head1 CONSTANTS

=head2 ERROR LEVEL CONSTANTS

=over 4

=item Sys::Virt::Error::LEVEL_NONE

Undefined error level

=item Sys::Virt::Error::LEVEL_WARNING

Warning error level

=item Sys::Virt::Error::LEVEL_ERROR

Fatal error level

=back

=head2 ERROR DOMAIN CONSTANTS

The error domain indicates which internal part of libvirt the error
report was raised from.

=over 4

=item Sys::Virt::Error::FROM_CONF

Configuration file handling

=item Sys::Virt::Error::FROM_DOM

Error while operating on a domain

=item Sys::Virt::Error::FROM_DOMAIN

Domain configuration handling

=item Sys::Virt::Error::FROM_LXC

LXC virtualization driver

=item Sys::Virt::Error::FROM_NET

Error while operating on a network

=item Sys::Virt::Error::FROM_NETWORK

Network configuration handling

=item Sys::Virt::Error::FROM_NODEDEV

Node device configuration handling

=item Sys::Virt::Error::FROM_NONE

No specific error domain.

=item Sys::Virt::Error::FROM_OPENVZ

OpenVZ virtualization driver

=item Sys::Virt::Error::FROM_PROXY

Xen proxy virtualization driver

=item Sys::Virt::Error::FROM_QEMU

QEMU virtualization driver

=item Sys::Virt::Error::FROM_REMOTE

Remote client virtualization driver

=item Sys::Virt::Error::FROM_RPC

XML-RPC handling code

=item Sys::Virt::Error::FROM_SECURITY

Security services driver

=item Sys::Virt::Error::FROM_SEXPR

SEXPR parsing code

=item Sys::Virt::Error::FROM_STATS_LINUX

Device statistics code

=item Sys::Virt::Error::FROM_STORAGE

Storage configuration handling

=item Sys::Virt::Error::FROM_TEST

Test virtualization driver

=item Sys::Virt::Error::FROM_UML

UML virtualization driver

=item Sys::Virt::Error::FROM_XEN

Xen hypervisor driver

=item Sys::Virt::Error::FROM_XEND

XenD daemon driver

=item Sys::Virt::Error::FROM_XENSTORE

XenStore driver

=item Sys::Virt::Error::FROM_XENXM

Xen XM configuration file driver

=item Sys::Virt::Error::FROM_XEN_INOTIFY

Xen Inotify events driver

=item Sys::Virt::Error::FROM_XML

Low level XML parser

=item Sys::Virt::Error::FROM_ESX

The VMWare ESX driver

=item Sys::Virt::Error::FROM_INTERFACE

The host network interface driver

=item Sys::Virt::Error::FROM_ONE

The Open Nebula driver. This constant is no longer
used and retained only for backwards compatibility

=item Sys::Virt::Error::FROM_PHYP

The IBM Power Hypervisor driver

=item Sys::Virt::Error::FROM_SECRET

The secret management driver

=item Sys::Virt::Error::FROM_VBOX

The VirtualBox driver

=item Sys::Virt::Error::FROM_AUDIT

The audit driver

=item Sys::Virt::Error::FROM_CPU

The CPU information driver

=item Sys::Virt::Error::FROM_DOMAIN_SNAPSHOT

The domain snapshot driver

=item Sys::Virt::Error::FROM_HOOK

The daemon hook driver

=item Sys::Virt::Error::FROM_NWFILTER

The network filter driver

=item Sys::Virt::Error::FROM_STREAMS

The data streams driver

=item Sys::Virt::Error::FROM_SYSINFO

The system information driver

=item Sys::Virt::Error::FROM_VMWARE

The VMWare driver

=item Sys::Virt::Error::FROM_XENAPI

The XenAPI driver

=item Sys::Virt::Error::FROM_EVENT

The event driver

=item Sys::Virt::Error::FROM_LIBXL

The libxl Xen driver

=item Sys::Virt::Error::FROM_LOCKING

The lock manager drivers

=item Sys::Virt::Error::FROM_HYPERV

The Hyper-V driver

=item Sys::Virt::Error::FROM_CAPABILITIES

The capabilities driver

=item Sys::Virt::Error::FROM_AUTH

The authentication handling code

=item Sys::Virt::Error::FROM_URI

The URI handling code

=item Sys::Virt::Error::FROM_DBUS

The DBus handling code

=item Sys::Virt::Error::FROM_DEVICE

The device handling code

=item Sys::Virt::Error::FROM_SSH

The libSSH2 socket client

=item Sys::Virt::Error::FROM_PARALLELS

The Parallels virtualization driver

=item Sys::Virt::Error::FROM_LOCKSPACE

The lockspace handling code

=item Sys::Virt::Error::FROM_INITCTL

The initctl client code

=item Sys::Virt::Error::FROM_CGROUP

The cgroups code

=item Sys::Virt::Error::FROM_IDENTITY

The identity management code

=item Sys::Virt::Error::FROM_ACCESS

The access control code

=item Sys::Virt::Error::FROM_SYSTEMD

The systemd init service

=item Sys::Virt::Error::FROM_BHYVE

The FreeBSD BHyve driver

=item Sys::Virt::Error::FROM_CRYPTO

The cryptographic helper APIs.

=item Sys::Virt::Error::FROM_FIREWALL

The firewall helper APIs.

=item Sys::Virt::Error::FROM_POLKIT

The polkit authentication / authorization APIs

=item Sys::Virt::Error::FROM_THREAD

The thread helper utils

=item Sys::Virt::Error::FROM_ADMIN

The administrative service

=item Sys::Virt::Error::FROM_LOGGING

The logging service

=item Sys::Virt::Error::FROM_XENXL

The Xen XL driver

=item Sys::Virt::Error::FROM_PERF

The performance events subsystem

=item Sys::Virt::Error::FROM_LIBSSH

The libSSH socket client

=back

=head2 ERROR CODE CONSTANTS

The error codes allow for specific problems to be identified and
handled separately from generic error handling.

=over 4

=item Sys::Virt::Error::ERR_AUTH_FAILED

Authentication falure when connecting to a driver

=item Sys::Virt::Error::ERR_CALL_FAILED

Operation not supported by driver (DEPRECATED & unused)

=item Sys::Virt::Error::ERR_CONF_SYNTAX

Configuration file syntax error

=item Sys::Virt::Error::ERR_DOM_EXIST

The domain already exists

=item Sys::Virt::Error::ERR_DRIVER_FULL

Too many hypervisor drivers have been registered

=item Sys::Virt::Error::ERR_GET_FAILED

HTTP GET command failed talking to XenD

=item Sys::Virt::Error::ERR_GNUTLS_ERROR

GNUTLS encryption error in RPC driver

=item Sys::Virt::Error::ERR_HTTP_ERROR

Unexpected HTTP error code from XenD

=item Sys::Virt::Error::ERR_INTERNAL_ERROR

Generic internal error

=item Sys::Virt::Error::ERR_INVALID_ARG

Invalid argument supplied to function

=item Sys::Virt::Error::ERR_INVALID_CONN

Invalid connection object

=item Sys::Virt::Error::ERR_INVALID_DOMAIN

Invalid domain object

=item Sys::Virt::Error::ERR_INVALID_MAC

Invalid MAC address string

=item Sys::Virt::Error::ERR_INVALID_NETWORK

Invalid network object

=item Sys::Virt::Error::ERR_INVALID_NODE_DEVICE

Invalid node device object

=item Sys::Virt::Error::ERR_INVALID_STORAGE_POOL

Invalid storage pool object

=item Sys::Virt::Error::ERR_INVALID_STORAGE_VOL

Invalid storage vol object

=item Sys::Virt::Error::ERR_NETWORK_EXIST

Network with this name/uuid already exists

=item Sys::Virt::Error::ERR_NO_CONNECT

Unable to connect to requested hypervisor driver

=item Sys::Virt::Error::ERR_NO_DEVICE

Missing device information

=item Sys::Virt::Error::ERR_NO_DOMAIN

No such domain with that name/uuid/id

=item Sys::Virt::Error::ERR_NO_KERNEL

Missing kernel information in domain configuration

=item Sys::Virt::Error::ERR_NO_MEMORY

Missing memory information in domain configuration

=item Sys::Virt::Error::ERR_NO_NAME

Missing name in object configuration

=item Sys::Virt::Error::ERR_NO_NETWORK

No such network with that name/uuid

=item Sys::Virt::Error::ERR_NO_NODE_DEVICE

No such node device with that name

=item Sys::Virt::Error::ERR_NO_OS

Missing OS information in domain configuration

=item Sys::Virt::Error::ERR_NO_ROOT

Missing root device information in domain configuration

=item Sys::Virt::Error::ERR_NO_SECURITY_MODEL

Missing security model information in domain configuratio

=item Sys::Virt::Error::ERR_NO_SOURCE

Missing source device information in domain configuration

=item Sys::Virt::Error::ERR_NO_STORAGE_POOL

No such storage pool with that name/uuid

=item Sys::Virt::Error::ERR_NO_STORAGE_VOL

No such storage volume with that name/path/key

=item Sys::Virt::Error::ERR_NO_SUPPORT

This operation is not supported by the active driver

=item Sys::Virt::Error::ERR_NO_TARGET

Missing target device information in domain configuration

=item Sys::Virt::Error::ERR_NO_XEN

Unable to connect to Xen hypervisor

=item Sys::Virt::Error::ERR_NO_XENSTORE

Unable to connect to XenStorage daemon

=item Sys::Virt::Error::ERR_OK

No error code. This should never be see

=item Sys::Virt::Error::ERR_OPEN_FAILED

Unable to open a configuration file

=item Sys::Virt::Error::ERR_OPERATIONED_DENIED

The operation is forbidden for the current connection

=item Sys::Virt::Error::ERR_OPERATION_FAILED

The operation failed to complete

=item Sys::Virt::Error::ERR_OS_TYPE

Missing/incorrect OS type in domain configuration

=item Sys::Virt::Error::ERR_PARSE_FAILED

Failed to parse configuration file

=item Sys::Virt::Error::ERR_POST_FAILED

HTTP POST failure talking to XenD

=item Sys::Virt::Error::ERR_READ_FAILED

Unable to read from configuration file

=item Sys::Virt::Error::ERR_RPC

Generic RPC error talking to XenD

=item Sys::Virt::Error::ERR_SEXPR_SERIAL

Failed to generic SEXPR for XenD

=item Sys::Virt::Error::ERR_SYSTEM_ERROR

Generic operating system error

=item Sys::Virt::Error::ERR_UNKNOWN_HOST

Unknown hostname

=item Sys::Virt::Error::ERR_WRITE_FAILED

Failed to write to configuration file

=item Sys::Virt::Error::ERR_XEN_CALL

Failure while talking to Xen hypervisor

=item Sys::Virt::Error::ERR_XML_DETAIL

Detailed XML parsing error

=item Sys::Virt::Error::ERR_XML_ERROR

Generic XML parsing error

=item Sys::Virt::Error::WAR_NO_NETWORK

Warning that no network driver is activated

=item Sys::Virt::Error::WAR_NO_NODE

Warning that no node device driver is activated

=item Sys::Virt::Error::WAR_NO_STORAGE

Warning that no storage driver is activated

=item Sys::Virt::Error::ERR_INVALID_INTERFACE

Invalid network interface object

=item Sys::Virt::Error::ERR_NO_INTERFACE

No interface with the matching name / mac address

=item Sys::Virt::Error::ERR_OPERATION_INVALID

The requested operation is not valid for the current object state

=item Sys::Virt::Error::WAR_NO_INTERFACE

The network interface driver is not available

=item Sys::Virt::Error::ERR_MULTIPLE_INTERFACES

There are multiple interfaces with the requested MAC address

=item Sys::Virt::Error::ERR_BUILD_FIREWALL

The firwall could not be constructed

=item Sys::Virt::Error::WAR_NO_NWFILTER

The network filter driver could not be activated

=item Sys::Virt::Error::ERR_NO_NWFILTER

There is no network filter driver available

=item Sys::Virt::Error::ERR_INVALID_NWFILTER

The network filter object was invalid

=item Sys::Virt::Error::WAR_NO_SECRET

There secret management driver is not available

=item Sys::Virt::Error::ERR_NO_SECRET

No secret with the matching uuid / usage ID

=item Sys::Virt::Error::ERR_INVALID_SECRET

Invalid secret object

=item Sys::Virt::Error::ERR_CONFIG_UNSUPPORTED

The requested XML configuration is not supported by the hypervisor

=item Sys::Virt::Error::ERR_OPERATION_TIMEOUT

The operation could not be completed in a satisfactory time

=item Sys::Virt::Error::ERR_MIGRATE_PERSIST_FAILED

Unable to persistent the domain configuration after migration
successfully completed

=item Sys::Virt::Error::ERR_HOOK_SCRIPT_FAILED

Execution of a daemon hook script failed

=item Sys::Virt::Error::ERR_INVALID_DOMAIN_SNAPSHOT

The domain snapshot object pointer was invalid

=item Sys::Virt::Error::ERR_NO_DOMAIN_SNAPSHOT

No matching domain snapshot was found

=item Sys::Virt::Error::ERR_INVALID_STREAM

The stream object pointer was invalid

=item Sys::Virt::Error::ERR_ARGUMENT_UNSUPPORTED

The argument value was not supported by the driver

=item Sys::Virt::Error::ERR_STORAGE_POOL_BUILT

The storage pool has already been built

=item Sys::Virt::Error::ERR_STORAGE_PROBE_FAILED

Probing the storage pool failed

=item Sys::Virt::Error::ERR_SNAPSHOT_REVERT_RISKY

Reverting the snapshot could cause data loss

=item Sys::Virt::Error::ERR_OPERATION_ABORTED

The asynchronous operation was aborted at admin request

=item Sys::Virt::Error::ERR_AUTH_CANCELLED

The user cancelled the authentication process

=item Sys::Virt::Error::ERR_NO_DOMAIN_METADATA

The requested metadata does not exist

=item Sys::Virt::Error::ERR_MIGRATE_UNSAFE

The migration operation would be unsafe to perform

=item Sys::Virt::Error::ERR_OVERFLOW

The calculation would overflow

=item Sys::Virt::Error::ERR_BLOCK_COPY_ACTIVE

Action prevented by block copy job

=item Sys::Virt::Error::ERR_AGENT_UNRESPONSIVE

The guest agent is not responding

=item Sys::Virt::Error::ERR_OPERATION_UNSUPPORTED

The operation is not supported on this host

=item Sys::Virt::Error::ERR_SSH

The SSH operation failed

=item Sys::Virt::Error::ERR_RESOURCE_BUSY

The resource requested is already in use

=item Sys::Virt::Error::ERR_ACCESS_DENIED

Not authorized to perform the operation

=item Sys::Virt::Error::ERR_DBUS_SERVICE

An error from a DBus service API

=item Sys::Virt::Error::ERR_STORAGE_VOL_EXIST

The storage volume already exists

=item Sys::Virt::Error::ERR_CPU_INCOMPATIBLE

The CPUs are not compatible

=item Sys::Virt::Error::ERR_INVALID_SCHEMA

The XML document does not comply with the XML schema

=item Sys::Virt::Error::ERR_MIGRATE_FINISH_OK

Migration finished but expected to return NULL domain.

=item Sys::Virt::Error::ERR_AUTH_UNAVAILABLE

Authentication services were not available

=item Sys::Virt::Error::ERR_NO_SERVER

Libvirt server was not found

=item Sys::Virt::Error::ERR_NO_CLIENT

Libvirt client was not found

=item Sys::Virt::Error::ERR_AGENT_UNSYNCED

Libvirt guest agent replies with wrong id to guest-sync command

=item Sys::Virt::Error::ERR_LIBSSH

The libSSH operation failed

=back

=head1 AUTHORS

Daniel P. Berrange <berrange@redhat.com>


=head1 COPYRIGHT

Copyright (C) 2006 Red Hat
Copyright (C) 2006-2007 Daniel P. Berrange

=head1 LICENSE

This program is free software; you can redistribute it and/or modify
it under the terms of either the GNU General Public License as published
by the Free Software Foundation (either version 2 of the License, or at
your option any later version), or, the Artistic License, as specified
in the Perl README file.

=head1 SEE ALSO

L<Sys::Virt::Domain>, L<Sys::Virt>, C<http://libvirt.org>

=cut