1. 03 5月, 2016 9 次提交
    • E
      virt-admin: Introduce srv-clients-list command · de770391
      Erik Skultety 提交于
      Wire-up the public client listing API. Along with this change, a private time
      simple conversion method to interpret client's timestamp obtained from server
      has been added as well. Format used to for time output is as follows:
      YYYY-mm-DD HH:MM:SS+ZZZZ.
      
      Although libvirt exposes methods time-related methods through virtime.h
      internally, it utilizes millisecond precision which we don't need in this case,
      especially when connection timestamps use precision to seconds only.
      This is just a convenience int to string conversion method.
      
      To reflect the new API, man page has been adjusted accordingly.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      de770391
    • E
      admin: Introduce listing clients · ed978fa2
      Erik Skultety 提交于
      Finally add public method to retrieve the list of currently connected clients
      to a given server.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      ed978fa2
    • E
      rpc: virnetserverclient: Implement client connection transport retrieval · 42b06aa6
      Erik Skultety 提交于
      Although we document 6 types of transport that we support, internally we can
      only differentiate between TCP, TLS, and UNIX transports only, since both SSH
      and libssh2 transports, due to using netcat, behave in the exactly the same
      way as a UNIX socket.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      42b06aa6
    • E
      include: admin: export connection transport constants · 15500e92
      Erik Skultety 提交于
      We have to expose some constants, in order for the client object transport
      field to make sense.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      15500e92
    • E
      rpc: virnetserver: Support retrieval of a list of clients · 04bab54d
      Erik Skultety 提交于
      For now, the list copy is done simply by locking the whole server, walking the
      original and increasing the refcount on each object. We may want to change
      the list to a lockable object (like list of domains) later in the future if
      we discover some performance issues related to locking the whole server in
      order to walk the whole list of clients, possibly issuing some 'ForEach'
      callback.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      04bab54d
    • E
      rpc: gendispatch: Tune it to support client structure · 4bd43074
      Erik Skultety 提交于
      Now that libvirt-admin supports another client-side object and provided that
      we want to generate as many both client-side and server-side RPC dispatchers,
      support for this needs to be added to gendispatch.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      4bd43074
    • E
      admin: Introduce virAdmClient client-side object · 324945d9
      Erik Skultety 提交于
      Besides ID, the object also stores static data like connection transport and
      connection timestamp, since once obtained a list of all clients connected to a
      server, from user's perspective, it would be nice to know whether a given
      client is remote or local only and when did it connect to the daemon.
      Along with the object introduction, all necessary client-side methods necessary
      to work with the object are added as well.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      324945d9
    • E
      rpc: virnetserverclient: Introduce new attribute conn_time to client · a32135b3
      Erik Skultety 提交于
      Besides ID, libvirt should provide several parameters to help the user
      distinguish two clients from each other. One of them is the connection
      timestamp. This patch also adds a testcase for proper JSON formatting of the
      new attribute too (proper formatting of older clients that did not support
      this attribute yet is included in the existing tests) - in order to
      testGenerateJSON to work, a mock of time_t time(time_t *timer) needed to be
      created.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      a32135b3
    • E
      rpc: virnetserverclient: Identify clients by an integer ID · 5841d64d
      Erik Skultety 提交于
      Admin API needs a way of addressing specific clients. Unlike servers, which we
      are happy to address by names both because its name reflects its purpose (to
      some extent) and we only have two of them (so far), naming clients doesn't make
      any sense, since a) each client is an anonymous, i.e. not recognized after a
      disconnect followed by a reconnect, b) we can't predict what kind of requests
      it's going to send to daemon, and c) the are loads of them comming and going,
      so the only viable option is to use an ID which is of a reasonably wide data
      type.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      5841d64d
  2. 02 5月, 2016 31 次提交
    • A
      configure: Introduce LIBVIRT_{CHECK,RESULT}_INIT_SCRIPT · 6620cd1e
      Andrea Bolognani 提交于
      Move the code dealing with init scripts to a separate file
      so configure.ac itself can be a little bit smaller.
      6620cd1e
    • A
      configure: Add systemd detection to --with-init-script=check · cf72255e
      Andrea Bolognani 提交于
      Most distributions, including RHEL, have switched to systemd,
      so we should detect it and act accordingly. This also means
      that 'systemd+redhat' should be preferred to legacy 'redhat'.
      
      Our witness for the check is the availability of the systemctl
      command on the host.
      cf72255e
    • A
      configure: Improve --with-init-script=check · 6f916067
      Andrea Bolognani 提交于
      If we didn't find a match, either because we're cross compiling
      or because we're not building on RHEL, we won't install any
      init script.
      
      Make sure this is reported correctly in the configure summary.
      6f916067
    • B
      383c6f7f
    • B
      qemu: add default panic device to S390 guests · 73e4e10e
      Boris Fiuczynski 提交于
      This patch adds by default a panic device with model s390 to S390 guests.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      73e4e10e
    • B
      qemu: add panic device support for S390 · d8554654
      Boris Fiuczynski 提交于
      If a panic device is being defined without a model in a domain
      the default value is always overwritten with model ISA. An ISA
      bus does not exist on S390 and therefore specifying a panic device
      results in an unsupported configuration.
      Since the S390 architecture inherently provides a crash detection
      capability the panic device should be defined in the domain xml.
      
      This patch adds an s390 panic device model and prevents setting a
      device address on it.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      d8554654
    • B
    • B
      qemu: fix error message for default panic device · a1574e5c
      Boris Fiuczynski 提交于
      Adding the default bus type ISA to the message.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      a1574e5c
    • B
      docs: align spelling of S390 · f91403e0
      Boris Fiuczynski 提交于
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      f91403e0
    • C
      fdstream: don't raise error on SIGPIPE if abort requested · a5481546
      Cole Robinson 提交于
      The iohelper dies on SIGPIPE if the stream is closed before all data
      is processed. IMO this should be an error condition for virStreamFinish
      according to docs like:
      
        * This method is a synchronization point for all asynchronous
        * errors, so if this returns a success code the application can
        * be sure that all data has been successfully processed.
      
      However for virStreamAbort, not so much:
      
        * Request that the in progress data transfer be cancelled
        * abnormally before the end of the stream has been reached.
        * For output streams this can be used to inform the driver
        * that the stream is being terminated early. For input
        * streams this can be used to inform the driver that it
        * should stop sending data.
      
      Without this, virStreamAbort will realistically always error for
      active streams like domain console. So, treat the SIGPIPE case
      as non-fatal if abort is requested.
      
      Note, this will only affect an explicit user requested abort. An
      abnormal abort, like from a server error, always raises an error
      in the daemon.
      a5481546
    • C
      daemon: stream: Don't force error when client aborts · 66a03d0a
      Cole Robinson 提交于
      Every time a client aborts a stream via the virStreamAbort API,
      the daemon always logs an error like:
      
        error : daemonStreamHandleAbort:617 : stream aborted at client request
      
      and that same error is returned to the client. Meaning virStreamAbort
      always returns -1, which seems strange.
      
      This reworks the error handling to only raise an error on virStreamAbort
      if the actual server side abort call raises an error. This is similar
      to how virStreamFinish works.
      
      If the abort code path is triggered by an unexpected message type
      then we continue to raise an unconditional error. Also drop a redundant
      VIR_WARN call there, since virReportError will raise a VIR_ERROR anyways
      66a03d0a
    • C
      rpc: protocol: Clarify VIR_NET_ERROR usage with streams · 8958dde5
      Cole Robinson 提交于
      The described protocol semantics really only apply to server initiated
      stream messages. Document the semantics for client messages.
      8958dde5
    • C
      daemon: stream: set stream->closed on removal · 75e19990
      Cole Robinson 提交于
      These are the only places where we don't set stream->closed when
      aborting the stream. This leads to spurious errors when the client
      hangs up unexpectedly:
      
      error : virFDStreamUpdateCallback:127 : internal error: stream is not open
      75e19990
    • C
      daemon: stream: don't update events if stream->closed · a680dde6
      Cole Robinson 提交于
      Calling virStreamFinish prematurely seems to trigger this code path
      even after the stream is closed, which ends up hitting this error
      message later:
      
      error : virFDStreamUpdateCallback:127 : internal error: stream is not open
      
      Skip this function if stream->closed, which is used in many other places
      like read/write handlers
      a680dde6
    • C
      daemon: stream: Close stream on send failure · e7407872
      Cole Robinson 提交于
      This is the only place in daemon/stream.c that sets
      'stream->closed = true' but neglects to actually abort the stream
      and remove the callback, which seems wrong.
      e7407872
    • C
      fdstream: Raise explicit error when iohelper gets SIGPIPE · c48db92f
      Cole Robinson 提交于
      This happens when virStreamFinish/Abort are called, but iohelper
      still has data to process.
      c48db92f
    • C
      fdstream: Report error with virProcessTranslateStatus · 6b173cf5
      Cole Robinson 提交于
      Rather than poorly duplicate it
      6b173cf5
    • C
      fdstream: separate out virCommandPtr cleanup · c0e87037
      Cole Robinson 提交于
      Let's us de-nest some of the logic, and will simplify upcoming
      patches
      c0e87037
    • C
      nwfilter: Save config to disk if we generated a UUID · 441e881e
      Cole Robinson 提交于
      libvirt-daemon-config-nwfilter will put a bunch of xml configs
      into /etc/libvirt/nwfilter. These configs don't hardcode a UUID
      and depends on libvirt to generate one. However the generated UUID
      is never saved to disk, unless the user manually calls Define.
      
      This makes daemon reload quite noisy with many errors like:
      
      error : virNWFilterObjAssignDef:3101 : operation failed: filter 'allow-incoming-ipv4' already exists with uuid 50def3b5-48d6-46a3-b005-cc22df4e5c5c
      
      Because a new UUID is generated every time the config is read from
      disk, so libvirt constantly thinks it's finding a new nwfilter.
      
      Detect if we generated a UUID when the config file is loaded; if so,
      resave the new contents to disk to ensure the UUID is persisteny.
      
      This is similar to what was done in commit a47ae7c0 with virtual
      networks and generated MAC addresses
      441e881e
    • C
      nwfilter: Push configFile building into LoadConfig · 0feb1c6c
      Cole Robinson 提交于
      This matches the pattern used for network object APIs, and we want
      configDir in LoadConfig for upcoming patches
      0feb1c6c
    • C
      nwfilter: Fix potential locking problems on ObjLoad failure · ab05abdb
      Cole Robinson 提交于
      In virNWFilterObjLoad we can still fail after virNWFilterObjAssignDef,
      but we don't unlock and free the created virNWFilterObjPtr in the
      cleanup path.
      
      The bit we are trying to do after AssignDef is just STRDUP in the
      configFile path. However caching the configFile in the NWFilterObj
      is largely redundant and doesn't follow the same pattern we use
      for domain and network objects.
      
      So just remove all the configFile caching which fixes the latent
      bug as a side effect.
      ab05abdb
    • C
      network: Fix segfault on daemon reload · 26af7e4e
      Cole Robinson 提交于
      We will segfault of a daemon reload picks up a new network config
      that needs to be autostarted. We shouldn't be passing NULL for
      network_driver here. This seems like it was missed in the larger
      rework in commit 1009a61e
      26af7e4e
    • S
      send default USB controller in xml to destination during migration · 192a53e0
      Shivaprasad G Bhat 提交于
      The default USB controller is not sent to destination as the older versions
      of libvirt(0.9.4 or earlier as I see in commit log of 409b5f54) didn't
      support them. For some archs where the support started much later can
      safely send the USB controllers without this worry. So, send the controller
      to destination for all archs except x86. Moreover this is not very applicable
      to x86 as the USB controller has model ich9_ehci1 on q35 and for pc-i440fx,
      there cant be any slots before USB as it is fixed on slot 1.
      
      The patch fixes a bug that, if the USB controller happens to occupy
      a slot after disks/interfaces and one of them is hot-unplugged, then
      the default USB controller added on destination takes the smallest slot
      number and that would lead to savestate mismatch and migration
      failure. Seen and verified on PPC64.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      192a53e0
    • C
      conf: format runtime DAC seclabel, unless MIGRATABLE · 601531d6
      Cole Robinson 提交于
      We historically format runtime seclabel selinux/apparmor values,
      however we skip formatting runtime DAC values. This was added in
      
      commit 990e46c4
      Author: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
      Date:   Fri Aug 31 13:40:41 2012 +0200
      
          conf: Avoid formatting auto-generated DAC labels
      
      to maintain migration compatibility with libvirt < 0.10.0.
      
      However the formatting was skipped unconditionally. Instead only
      skip formatting in the VIR_DOMAIN_DEF_FORMAT_MIGRATABLE case.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1215833
      601531d6
    • C
      conf: storage: pool: reject name containing '/' · 20b52668
      Cole Robinson 提交于
      Trying to define a pool name containing an embedded '/'
      will immediately fail when trying to write the XML to disk.
      This patch explicitly rejects names containing a '/'
      
      Besides our stateful driver, there are two other storage impls:
      esx and phyp. esx doesn't support pool creation, so this should
      doesn't apply.
      
      phyp does support pool creation, and the name is passed to the
      'mksp' tool, which google doesn't reveal whether it accepts '/'
      or not. IMO the likeliness of this impacting any users is near zero
      20b52668
    • C
      conf: network: reject name containing '/' · 454f739f
      Cole Robinson 提交于
      Trying to define a network name containing an embedded '/'
      will immediately fail when trying to write the XML to disk.
      This patch explicitly rejects names containing a '/'
      
      Besides the network bridge driver, the only other network
      implementation is a very thin one for virtualbox, which seems to
      use the network name as a host interface name, which won't
      accept '/' anyways, so I think this is fine to do unconitionally.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=787604
      454f739f
    • C
      conf: domain: reject name containing '/' · b1fc6a7b
      Cole Robinson 提交于
      Trying to define a domain name containing an embedded '/'
      will immediately fail when trying to write the XML to disk for
      our stateful drivers. This patch explicitly rejects names
      containing a '/', and provides an xmlopt feature for drivers
      to avoid this validation check, which is enabled in every
      non-stateful driver that already has xmlopt handling wired up.
      
      (Technically this could reject a previously accepted vmname like
       '/foo', however at least for the qemu driver that falls over
       later when starting qemu)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=639923
      b1fc6a7b
    • M
      conf: Parse more of our nodedev XML · 541f21af
      Martin Kletzander 提交于
      We were lacking tests that are checking for the completeness of our
      nodedev XMLs and also whether we output properly formatted ones.  This
      patch adds parsing for the capability elements inside the <capability
      type='pci'> element.  Also bunch of tests are added to show everything
      works properly.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      541f21af
    • M
      schemas: Update nodedev schema to match reality · 9840761f
      Martin Kletzander 提交于
      There were few things done in the nodedev code but we were lacking tests
      for it.  And because of that we missed that the schema was not updated
      either.  Fix the schema and add various test files to show the schema
      is correct.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      9840761f
    • M
      Move capability formatting together · 88c8be67
      Martin Kletzander 提交于
      All sub-PCI capabilities should be next to each other for clarity.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      88c8be67
    • M
      Change virDevicePCIAddress to virPCIDeviceAddress · c36b1f7b
      Martin Kletzander 提交于
      We had both and the only difference was that the latter also included
      information about multifunction setting.  The problem with that was that
      we couldn't use functions made for only one of the structs (e.g.
      parsing).  To consolidate those two structs, use the one in virpci.h,
      include that in domain_conf.h and add the multifunction member in it.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c36b1f7b