Commit Graph
27 Commits
Author SHA1 Message Date
-bat 9bed39863b Fix for the issue on recent FreeBSD 11 with the resource disc (#743)
* Make sure the initial device is a valid disc, and fallback if not

    This is the same check the fallback code uses, and is necessary as on
    later FreeBSD 11 versions the disc are retruned in reverse order. Thus
    the original function returns 'pass1' instead of 'da1' which fails. This
    fixes the issue and allows the resource disc to be mounted again, though
    relying on the fallback is not the cleanest solution.

* Skip 'pass' devices when looking for the resource disk

This fixes the error introduced in FreeBSD 11 where the order of
outout from camcontrol changed from da1,pass1 to pass1,da1 and thus
waagent misidentified the disc as 'pass1'. Instead of taking the
first device, we now split the string at ',' and return the first
device which does not begin 'pass'.
2017-06-05 13:12:33 -07:00
Reyk Floeter aad62676a7 Add initial support for the OpenBSD operating system (#712)
* Add initial support for the OpenBSD operating system

There are some differences between FreeBSD, OpenBSD, and Linux.

Notes:

- OpenBSD ships LibreSSL, but WALinuxAgent needs OpenSSL for CMS, so
use the openssl port and the "eopenssl" binary instead.

- Don't run the custom DHCP client but parse /var/db/dhclient.leases.hvn0.
OpenBSD's lease file uses a modified syntax.

- OpenBSD does not have /proc.  WALinuxAgent should never assume that
the /proc filesystem is available.

- OpenBSD does not have sudo, but its replacement doas.  The OpenBSD
class implements support for modifying the doas.conf file.

- Unlike FreeBSD, OpenBSD supports and mounts UDF DVDs just fine.

- Create a swap partition instead of a swap file on the resource disk.

- Many other minor changes for OpenBSD

TODO:

- The /proc checks needs to be replaced with pgrep/ps etc. checks for
OpenBSD.  For now it just checks if /proc is available or returns
without error.
Make sure to install waagent with --register-service as setuptools
will not set the permissions of /etc/rc.d/waagent correctly (the file
has to be executable to be used by OpenBSD's rc system).

* Remove debug statement that was use to fix mount_dvd on OpenBSD.

* I accidentally replaced the FreeBSD resource disk handler.

The OpenBSD disk handler is an addition, not a replacement.

Found by jonathangray

* pylint

pylint found one bug in setting the password; other changes are just
for the style.

* strip newline from generated password hash.

Issue reported by Lili Deng.

* Keep AutoUpdate enabled, it was disabled for initial porting.

Pointed out by @hglkrijger

* Use a wildcard and delete all DHCP lease files on *BSD.

Requested by @hglkrijger
2017-05-30 15:27:22 -07:00
brendandixon 5c90636dd8 Added Provisioning telemetry duration (#702)
Correctly handle cleaning directories that include symlinks
Reduced polling interval #701
Enable selective agent testing
Improved FIPS configuration variable name
Reduced cloud-init files removed on deprovision #631

Signed-off-by: Brendan Dixon <brendandixon@me.com>
2017-05-08 16:27:56 -07:00
jgreat 5e64b3dfa4 change option order for mkfs. Alpine is being picky 2017-04-29 17:17:53 -05:00
Vitaly Kuznetsov 7537e51f00 Fix issues with resource disk mount (#600) (#629)
* Check mount output to detect already mounted resource disk (#600)

mount(8) returns '32' in a variety of cases, we need to check the output
to be sure the resource disk is already mounted.

* Pass '-n' to sfdisk when not writing

Some old versions of sfdisk(8) will open block device in O_RDWR mode regardless
of the face that we're actually just querying partition type and not changing
it and if device is opened in this mode it will trigger partition rescan when
it is closed. This creates a race as partitions (/dev/sd*) will be going away
and re-appear later. Specify '-n' to indicate no write is required, sfdisk(8)
always opens the device in O_RDONLY now.

* Re-read partition table after changing partition type

Some old sfdisk(8) versions don't do syncronious partition re-read after
making changes. The kernel will re-read it anyway in background but this
will cause races with further mkfs as partition devices will be
disappearing. Do explicit partition rescan after we change partition id.
2017-03-31 11:19:28 -07:00
Hans Krijger 39668a6620 wait for partition before mounting (#613)
* wait for partition before mounting

* correct error thrown when swap size is invalid
2017-03-08 16:01:58 -08:00
Hans Krijger de6866b8f4 ignore return code 32 (#577) 2017-01-26 17:18:35 -08:00
Hans Krijger b3288a9609 add more logging when mount fails 2017-01-26 17:00:15 -08:00
Hans Krijger 58baf8979a Unhandled errors (#564)
* ensure path exists before access

* handle read only filesystems

* check for swap file before getting size

* fix customdata decoding
2017-01-20 13:15:55 -08:00
Hans Krijger 446b6c7e16 correct mkfile size check (#562) 2017-01-19 13:59:45 -08:00
ccic cb9c20f6a1 fix the issues for mounting resourcedisk (#517) 2016-12-14 11:36:39 -08:00
Hans Krijger 515415a478 Update version to 2.2.2 (#511)
* logging update

* updating version for testing

* updating version to 2.2.2
2016-12-12 11:59:00 -08:00
Yoon Hong 84f41eb73c Add more logging to prevent unnecessary confusion in case of sfdisk --part-type failure (#478) (#509) 2016-12-08 11:26:02 -08:00
Yoon Hong ab717b5d7c Fix resource disk partition format detection (#478) (#501) 2016-12-06 14:30:15 -08:00
Yoon Hong 41af2e23c8 use dd right away without using fallocate when file system is xfs (#468) (#502) 2016-12-06 11:34:20 -08:00
William Douglas cd2ee7bbb7 Fix resource disk partition format detection (#478)
With recent versions of sfdisk the -c command is deprecated and
--part-type is recommended to be used instead. This use also requires
the output to be stripped instead of rstripped due to a leading space.
2016-11-18 16:06:42 -08:00
Hongjiang Zhang a737bfbf84 Fix the issue of failing to find resource disk for FreeBSD
FreeBSD VM gets a UUID from host which informs where resource
disk locates. But that UUID string was not exposed from VM kernel,
as a result, the agent used a hard code "2:1:0" as the location of
resource disk. That should be updated after FreeBSD VM kernel
exposed UUID through "sysctl dev.storvsc" command.

But considering compatible with previous FreeBSD VM, the hard code
logic cannot be removed, and they are left there as a fallback.
2016-09-08 14:23:49 +08:00
Hans Krijger b950ba1600 update the force option for mkfs.xfs 2016-08-31 13:18:49 -07:00
Hans Krijger 866c423e85 pep8 fixes and formatting cleanup; make get_mount_string static
port fix for #183; code cleanup
2016-08-29 17:22:17 -07:00
Steven Luther 8b53e8e4b8 Mount Options feature (#346)
* add testing for mountpoint, some refactoring

* fixed double space in mount string

* patch for ConfigProvider

* revert patch to original string.

* update documentation, add 'n' option for mountopts

* remove test argument

* More descriptive description in README, n to None

* minor var name changes for clarity

* spacing, missing self in get_mount_string

* mount_opts to mount_options

* add config option to writtet WaagentConf, minor style changes.

* mount options fix, is not Note

* add self to get_mount_string args

* self to function, not where it's called

* mount_options = output of function, not the function.

* get_mount_string returns with mount options/if not none

* forgot to remove part of the string

* instantiate resource disk handler, get_switch to get in conf.py

* Added config option to waagent.conf

* minor style fixes

* mountOpts is None change, and also added removed variable.

* revert changes to bin/waagent2.0

* reverted waagent2.0 to e8c641f

* config options added
2016-08-26 14:04:20 -07:00
Hans Krijger b4379817f9 fix dd command 2016-08-11 13:57:38 -07:00
Hans Krijger a936a7a439 correct logic for dd fallback 2016-08-08 12:19:55 -07:00
edneville e8c641f726 Set the umask prior to file creation (#315)
* Set the umask prior to file creation

* Set umask prior to file creation
2016-07-20 10:35:22 -07:00
Mingye Wang 3c5a9e73d9 fix for #127. try to use posix.fallocate and fallocate before falling back to dd; adds unit tests for basic functionality and shellutil.quote (#215) 2016-06-07 11:38:15 -07:00
Yue Zhang da9ebe0a3d Separate provision agent and guest agent
Ensured correct return
Temporarily disable autoupdate

Signed-off-by: Brendan Dixon <brendand@microsoft.com>
2016-06-01 15:27:32 -07:00
brendandixon e55d8dee0e Revert "Separate provision agent and guest agent" 2016-05-31 11:24:23 -07:00
Yue Zhang efff9d6e0e Separate provision agent and guest agent 2016-05-31 11:15:10 -07:00