1. 23 5月, 2016 8 次提交
  2. 22 5月, 2016 1 次提交
  3. 21 5月, 2016 6 次提交
    • C
      tests: qemu: test <address type='pci'/> with aarch64 · f3d5e255
      Cole Robinson 提交于
      This is an interesting test case since PCI isn't the default for
      aarch64.
      f3d5e255
    • L
      qemu: auto-assign addresses when <address type='pci'/> is specified · c026f8f1
      Laine Stump 提交于
      Rather than only assigning a PCI address when no address is given at
      all, also do it when the config says that the address type is 'pci',
      but it gives no address (virDeviceInfoPCIAddressWanted()).
      
      There are also several places after parsing but prior to address
      assignment where code previously expected that any info with address
      type='pci' would have a *valid* PCI address, which isn't always the
      case - now we check not only for type='pci', but also for a valid
      address (virDeviceInfoPCIAddressPresent()).
      
      The test case added in this patch was directly copied from Cole's patch titled:
      
          qemu: Wire up address type=pci auto_allocate
      c026f8f1
    • L
      bhyve: auto-assign addresses when <address type='pci'/> is specified · d05da3fc
      Laine Stump 提交于
      Rather than only assigning a PCI address when no address is given at
      all, also do it when the config says that the address type is 'pci',
      but it gives no address.
      d05da3fc
    • L
      conf: allow type='pci' addresses with no address attributes specified · 8f578716
      Laine Stump 提交于
      Prior to this, <address type='pci'/> wasn't allowed when parsing
      (domain+bus+slot+function needed to be a "valid" PCI address, meaning
      that at least one of domain/bus/slot had to be non-0), the RNG
      required bus to be specified, and if type was set to PCI when
      formatting, domain+bus+slot+function would always be output.
      
      This makes all the address attributes optional during parse and RNG
      validation, and suppresses domain+bus+slot+function if domain+bus+slot
      are all 0 (NB: if d+b+s are all 0, any value for function is
      nonsensical as that will never happen in the real world, and after
      the next patch we will always assign a real working address to any
      empty PCI address before it is ever output to anywhere).
      
      Note that explicitly setting all attributes to 0 is equivalent to
      setting none of them, which is okay, since 0000:00:00 is reserved in
      any PCI bus setup, and can't be used anyway.
      8f578716
    • L
      conf: new functions to check if PCI address is wanted/present · 9a81a363
      Laine Stump 提交于
      In order to allow <address type='pci'/> with no other attributes to
      mean "I want a PCI address, but any PCI address will do" (just as
      having no <address> at all usually indicates), we will need to change
      several places in the code from a simple "info->type == (or !=)
      VIR_DOMAIN_DEVICE_ADDRESS_TYPE_(PCI|NONE)" into something slightly
      more complex, this patch adds to new functions that take a
      virDomainDeviceInfoPtr and return true/false depending on 1) whether
      the current state of the info indicates that we "want" a PCI address
      for this device (virDeviceInfoPCIAddressWanted()) and 2) whether this
      device already has a valid PCI address
      (virDeviceInfoPCIAddressPresent()).
      
      Both of these functions required the simpler check for whether a pci
      address is "empty" (i.e. all of its attributes are 0, which can never
      happen in a real PCI address, since slot 0 of bus 0 of domain 0 is
      always reserved), so that function is also added.
      9a81a363
    • L
      conf: move virDomainDeviceInfo definition from domain_conf.h to device_conf.h · ff89e9b9
      Laine Stump 提交于
      Also moves all the subordinate structs. This is necessary due to a new
      inline function that will be defined in device_conf.h, and also makes
      sense, because it is the *device* info that's in the struct. (Actually
      a lot more stuff from domain_conf.h could move to this newer file, but
      I didn't want to disturb any more than necessary).
      ff89e9b9
  4. 20 5月, 2016 25 次提交
    • M
      tests: Link virtestmock with probes · 997be5c2
      Michal Privoznik 提交于
      I've encountered this error while trying out this feature on some
      systems:
      
        $ VIR_TEST_FILE_ACCESS=1 ./virhashtest \
       libvirt.git/tests/.libs/lt-virhashtest: \
      symbol lookup error: libvirt.git/tests/.libs/virtestmock.so: \
      undefined symbol: libvirt_event_poll_purge_timeout_semaphore
      
      Problem is, linking just libvirt_utils to virmock.la is not
      enough. We might need to link libvirt_probes.lo too.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      997be5c2
    • M
      virtestmock: Mock stat() properly · 49c1a078
      Michal Privoznik 提交于
      There is a lot to explain, but I try to make it as short as
      possible. I'd start by pasting some parts of sys/stat.h:
      
      extern int stat (const char *__restrict __file,
      		 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
      
      extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
      				  struct stat *__restrict __buf), stat64)
           __nonnull ((1, 2));
      
      __extern_inline int
      __NTH (stat (const char *__path, struct stat *__statbuf))
      {
        return __xstat (_STAT_VER, __path, __statbuf);
      }
      
      Only one of these is effective at once, due to some usage of
      the mess we are dealing with in here. So, basically, while
      compiling or linking stat() in our code can be transformed into
      some other func. Or a dragon.
      Now, if you read stat(2) manpage, esp. "C library/kernel
      differences" section, you'll learn that glibc uses some tricks
      for older applications to work. I haven't gotten around actual
      code that does this, but based on my observations, if 'stat'
      symbol is found, glibc assumes it's dealing with ancient
      application. Unfortunately, it can be just ours stat coming from
      our mock. Therefore, calling stat() from a test will end up in
      our mock. But since glibc is not exposing the symbol anymore, our
      call of real_stat() will SIGSEGV immediately as the pointer to
      function is NULL. Therefore, we should expose only those symbols
      we know glibc has.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      49c1a078
    • M
      tests: Drop VIR_MOCK_CALL_STAT · 43639790
      Michal Privoznik 提交于
      It wasn't as great idea as I thought. Thing around stat() are
      more complicated than that. Therefore we need to revert
      86d1705a plus drop use of the macro as introduced in
      later patches.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      43639790
    • J
      qemu: Utilize qemu secret objects for RBD auth/secret · a1344f70
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1182074
      
      If they're available and we need to pass secrets to qemu, then use the
      qemu domain secret object in order to pass the secrets for RBD volumes
      instead of passing the base64 encoded secret on the command line.
      
      The goal is to make AES secrets the default and have no user interaction
      required in order to allow using the AES mechanism. If the mechanism
      is not available, then fall back to the current plain mechanism using
      a base64 encoded secret.
      
      New APIs:
      
      qemu_domain.c:
        qemuDomainGetSecretAESAlias:
          Generate/return the secret object alias for an AES Secret Info type.
          This will be called from qemuDomainSecretAESSetup.
      
        qemuDomainSecretAESSetup: (private)
          This API handles the details of the generation of the AES secret
          and saves the pieces that need to be passed to qemu in order for
          the secret to be decrypted. The encrypted secret based upon the
          domain master key, an initialization vector (16 byte random value),
          and the stored secret. Finally, the requirement from qemu is the IV
          and encrypted secret are to be base64 encoded.
      
      qemu_command.c:
        qemuBuildSecretInfoProps: (private)
          Generate/return a JSON properties object for the AES secret to
          be used by both the command building and eventually the hotplug
          code in order to add the secret object. Code was designed so that
          in the future perhaps hotplug could use it if it made sense.
      
        qemuBuildObjectSecretCommandLine (private)
          Generate and add to the command line the -object secret for the
          secret. This will be required for the subsequent RBD reference
          to the object.
      
        qemuBuildDiskSecinfoCommandLine (private)
          Handle adding the AES secret object.
      
      Adjustments:
      
      qemu_domain.c:
        The qemuDomainSecretSetup was altered to call either the AES or Plain
        Setup functions based upon whether AES secrets are possible (we have
        the encryption API) or not, we have secrets, and of course if the
        protocol source is RBD.
      
      qemu_command.c:
        Adjust the qemuBuildRBDSecinfoURI API's in order to generate the
        specific command options for an AES secret, such as:
      
          -object secret,id=$alias,keyid=$masterKey,data=$base64encodedencrypted,
                  format=base64
          -drive file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
                 mon_host=mon1.example.org\:6321,password-secret=$alias,...
      
        where the 'id=' value is the secret object alias generated by
        concatenating the disk alias and "-aesKey0". The 'keyid= $masterKey'
        is the master key shared with qemu, and the -drive syntax will
        reference that alias as the 'password-secret'. For the -drive
        syntax, the 'id=myname' is kept to define the username, while the
        'key=$base64 encoded secret' is removed.
      
        While according to the syntax described for qemu commit '60390a21'
        or as seen in the email archive:
      
          https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg04083.html
      
        it is possible to pass a plaintext password via a file, the qemu
        commit 'ac1d8878' describes the more feature rich 'keyid=' option
        based upon the shared masterKey.
      
      Add tests for checking/comparing output.
      
      NB: For hotplug, since the hotplug code doesn't add command line
          arguments, passing the encoded secret directly to the monitor
          will suffice.
      a1344f70
    • P
      tests: Allow multiple mock libraries · f0469c61
      Peter Krempa 提交于
      Make virtTestMain take variable number of libraries to mock.
      f0469c61
    • J
      qemu: Introduce qemuDomainSecretSetup · 97868a2b
      John Ferlan 提交于
      Currently just a shim to call qemuDomainSecretPlainSetup, but soon to be more
      97868a2b
    • J
      util: Introduce virCryptoGenerateRandom · 23803250
      John Ferlan 提交于
      Move the logic from qemuDomainGenerateRandomKey into this new
      function, altering the comments, variable names, and error messages
      to keep things more generic.
      
      NB: Although perhaps more reasonable to add soemthing to virrandom.c.
          The virrandom.c was included in the setuid_rpc_client, so I chose
          placement in vircrypto.
      23803250
    • J
      util: Introduce encryption APIs · 1ce9c08a
      John Ferlan 提交于
      Introduce virCryptoHaveCipher and virCryptoEncryptData to handle
      performing encryption.
      
       virCryptoHaveCipher:
         Boolean function to determine whether the requested cipher algorithm
         is available. It's expected this API will be called prior to
         virCryptoEncryptdata. It will return true/false.
      
       virCryptoEncryptData:
         Based on the requested cipher type, call the specific encryption
         API to encrypt the data.
      
      Currently the only algorithm support is the AES 256 CBC encryption.
      
      Adjust tests for the API's
      1ce9c08a
    • J
      tests: Add mock for virRandomBytes · 6a3f4121
      John Ferlan 提交于
      Create a mock for virRandomBytes to generate a not so random value.
      This should be usable by other tests that need a not so random number
      to be generated by including the virrandommock at preload.
      
      The "random number" generated is based upon the size of the expected
      stream of bytes being returned where each byte in the result gets
      the index of the array - hence a 4 byte array returns 0x00010203.
      6a3f4121
    • N
      qemu: parse: Handle suffixes for -m memory · 701b0f18
      Nishith Shah 提交于
      According to QEMU docs, the '-m' option for specifying RAM is by default
      in MiB, and a suffix of "M" or "G" may be passed for values in MiB and
      GiB respectively. This commit adds support and a test for the same.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=812295Signed-off-by: NNishith Shah <nishithshah.2211@gmail.com>
      701b0f18
    • N
      qemu: parse: Use qemuParseCommandLineMem for -m memory · 30677a78
      Nishith Shah 提交于
      Move the parsing of -m memory to a new function, qemuParseCommandLineMem
      Signed-off-by: NNishith Shah <nishithshah.2211@gmail.com>
      30677a78
    • P
      qemu_command: refactor spice channel code · 2c8e7555
      Pavel Hrdina 提交于
      This prepares the code for other listen types.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      2c8e7555
    • P
      0f6db3a4
    • P
      graphics: resolve address for listen type network in qemu_process · 78a09aa0
      Pavel Hrdina 提交于
      Both VNC and SPICE requires the same code to resolve address for listen
      type network.  Remove code duplication and create a new function that
      will be used in qemuProcessSetupGraphics().
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      78a09aa0
    • P
      qemu_command: move sasl parameter after port and addr definition · 858d7b6c
      Pavel Hrdina 提交于
      This is required for following patches where new listen types will be
      introduced.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      858d7b6c
    • P
      domain_conf: introduce virDomainGraphicsListenDefFormatAddr · 54820cc6
      Pavel Hrdina 提交于
      Move code that decide whether we print the 'listen' attribute or not
      into virDomainGraphicsListenDefFormatAddr() function.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      54820cc6
    • P
      graphics: rename gListen to glisten · 6bd0cd3b
      Pavel Hrdina 提交于
      We have both in the code.  Let's use only one format.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      6bd0cd3b
    • P
      tests: cleanup vnc auto socket test · 2faa1356
      Pavel Hrdina 提交于
      Commit 55320c23 introduced a new test for VNC to test if
      vnc_auto_unix_socket is set in qemu.conf, but forget to enable it in
      qemuxml2argvtest.c.
      
      This patch also moves the code in qemuxml2xmltest.c next to other VNC
      tests and refactor the test so we also check the case for parsing active
      XML.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      2faa1356
    • P
    • J
      cpu: Fix documentation of cpuGetModels · 5f29c531
      Jiri Denemark 提交于
      All callers of cpuGetModels expect @models to be NULL-terminated. Once
      both x86GetModels and ppc64GetModels were fixed to meet this
      expectation, we can explicitly document it.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      5f29c531
    • J
      cpu: Rework CPU map loading · 4b7c45ef
      Jiri Denemark 提交于
      The architecture specific loaders are now called with a list of all
      elements of a given type (rather than a single element at a time). This
      avoids the need to reallocate the arrays in CPU maps for each element.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4b7c45ef
    • J
      cpu_ppc64: Use array of models in CPU map · 82aca171
      Jiri Denemark 提交于
      There's no reason for keeping the models in a linked list. Especially
      when we know upfront the total number of models we are loading.
      
      As a nice side effect, this fixes ppc64GetModels to always return a
      NULL-terminated list of models.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      82aca171
    • J
      cpu_ppc64: Use array of vendors in CPU map · 1bf79d90
      Jiri Denemark 提交于
      There's no reason for keeping the vendors in a linked list. Especially
      when we know upfront the total number of models we are loading.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1bf79d90
    • J
      cpu_x86: Use array of features in CPU map · 3a7cd180
      Jiri Denemark 提交于
      There's no reason for keeping the features in a linked list. Especially
      when we know upfront the total number of features we are loading.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      3a7cd180
    • J
      cpu_x86: Use array of vendors in CPU map · 22137d39
      Jiri Denemark 提交于
      There's no reason for keeping the vendors in a linked list. Especially
      when we know upfront the total number of models we are loading.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      22137d39